<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>DevFish on MSDN ...&gt;««(o&gt;...</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/devfish/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/devfish/feed.xml</link>
    <description>Joe Healy - Premier Services for Developers (PSfD)</description>
    <lastBuildDate>Mon, 11 Jun 2018 16:08:26 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>AdalException : authentication_ui_failed with ADAL and Xamarin Forms Android</title>
      <link>https://docs.microsoft.com/archive/blogs/devfish/adalexception-authentication_ui_failed-with-adal-and-xamarin-forms-android</link>
      <pubDate>Sun, 31 Dec 2017 18:44:38 GMT</pubDate>
      <dc:creator><![CDATA[jhealy]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/devfish/?p=2945</guid>
      <description><![CDATA[Recently I was helping a client with an Azure Active Directory integrated project ( ADAL not MSAL...]]></description>
      <content:encoded><![CDATA[Recently I was helping a client with an Azure Active Directory integrated project ( ADAL not MSAL for some various reasons ) . All was going well and good as I plugged away with the various integration pieces.   We are targeting Xamarin Forms on this project.   Luckily there was a great blog post by Mayur at <a href="https://blog.xamarin.com/put-adal-xamarin-forms/">https://blog.xamarin.com/put-adal-xamarin-forms/</a> .

Typically I will start with UWP as a 'sanity check' to make sure things are working right. I provisioned up my Xamarin UWP project and had it running smoothly, no problems. My IOS project also also worked smoothly, authenticating against my test O365 environment like a champ.

<a href="https://msdnshared.blob.core.windows.net/media/2017/12/ios.adalforforms1.png"><img width="150" height="300" class="alignnone size-medium wp-image-2965" alt="" src="https://msdnshared.blob.core.windows.net/media/2017/12/ios.adalforforms1-150x300.png" border="1" /></a><a href="https://msdnshared.blob.core.windows.net/media/2017/12/uwp.adalforforms.png"><img width="275" height="300" class="alignnone size-medium wp-image-2975" alt="" src="https://msdnshared.blob.core.windows.net/media/2017/12/uwp.adalforforms-275x300.png" border="1" /></a><a href="https://msdnshared.blob.core.windows.net/media/2017/12/ios.adalforforms1.png"></a>

Next up was my Android project.  I followed the steps Mayur suggested and gave the program a run. Oooo. Nasty messages! Yuk.

<a href="https://msdnshared.blob.core.windows.net/media/2017/12/authentication_ui_failed.png"><img width="182" height="300" class="alignnone size-medium wp-image-2985" alt="" src="https://msdnshared.blob.core.windows.net/media/2017/12/authentication_ui_failed-182x300.png" border="1" /></a>

If we peek hard you can see the error message <strong>"Authentication_ui_failed: The browser based authentication dialog failed to complete"</strong> show up.

Various activities were tried including adjusting manifest capability request and other such things. No luck.

Turns out the fix was the adjust the<strong> TLS</strong> from Default to a specific TLS Implementation.  You can adjust this by navigating into your Android project properties and navigating  <b>Android Options &gt; Advanced &gt; SSL/TLS Implementation from "Default" to Managed TLS 1.1 OR Native TLS 1.2+</b>

<a href="https://msdnshared.blob.core.windows.net/media/2017/12/TLS-settings.png"><img width="300" height="228" class="alignnone size-medium wp-image-2995" alt="" src="https://msdnshared.blob.core.windows.net/media/2017/12/TLS-settings-300x228.png" border="1" /></a>

Who knew? I sure didn't. And after a mere, well, quite a number of hours digging this out, I'm sharing it with you. Hopefully the SEO gods will bless you and you find this post when hunting for the error.

<a href="https://msdnshared.blob.core.windows.net/media/2017/12/android.adalforms.png"><img width="181" height="300" class="alignnone size-medium wp-image-3005" alt="" src="https://msdnshared.blob.core.windows.net/media/2017/12/android.adalforms-181x300.png" border="1" /></a>

Interesting to note, and I'll try and find out why, <strong>this only occurs before the value of SSL/TLS Implementation is changed for the first time</strong>. Once you change from "Default" to one of the other values, even if you go back to Default, the error will not occur.  Time to dig out some of the deep Xamarin brains out for an answer.

Tested on physical hardware and HAXM Android 7.1 Emulator image several times. To test it you need to build the Android Xamarin Forms project up from scratch. Mayur's instructions are great for this at [ <a href="https://blog.xamarin.com/put-adal-xamarin-forms/">https://blog.xamarin.com/put-adal-xamarin-forms/</a> ].

In the spirit of sharing I've posted a new ADALForForms sample until Mayur gets his repository updated. My sample can be found at [ <a href="https://github.com/jhealy/xammutts/tree/master/ADALForForms">https://github.com/jhealy/xammutts/tree/master/ADALForForms</a> ]. The xammutts repo I posted is .NET Standard with Android, IOS, and UWP support. Mayur had WP, IOS, and Android. Note since we are targeting .NET Standard with the UWP, the UWP run is limited to Fall Creator's Update ( build 16299 ) and later. FCU introduces .NET Standard to UWP.   Windows Phone is left as an exercise to the coder.

Partial exception dump for SEO purposes below.

<hr />

<pre>AcquireTokenHandlerBase.cs: === Token Acquisition started:
12-31 12:19:55.341 I/        ( 4651): 	Authority: https://login.microsoftonline.com/M365x947151.onmicrosoft.com/
12-31 12:19:55.341 I/        ( 4651): 	Resource: https://graph.windows.net
12-31 12:19:55.341 I/        ( 4651): 	ClientId: 8f580ff3-2ab3-469b-bd43-158c581757da
12-31 12:19:55.341 I/        ( 4651): 	CacheType: null
12-31 12:19:55.341 I/        ( 4651): 	Authentication Target: User
12-31 12:19:55.341 I/        ( 4651): 	
12-31 12:19:55.463 V/        ( 4651): 2017-12-31T17:19:55.4308620Z: 1663fe86-17e1-4842-b23e-ca25a43dde8d - AcquireTokenHandlerBase.cs: Loading from cache.
12-31 12:19:55.481 V/        ( 4651): 2017-12-31T17:19:55.4809390Z: 1663fe86-17e1-4842-b23e-ca25a43dde8d - TokenCache.cs: Looking up cache for a token...
12-31 12:19:55.537 I/        ( 4651): 2017-12-31T17:19:55.5378480Z: 1663fe86-17e1-4842-b23e-ca25a43dde8d - TokenCache.cs: No matching token was found in the cache
12-31 12:19:55.729 D/Mono    ( 4651): DllImport attempting to load: '/system/lib64/liblog.so'.
12-31 12:19:55.730 D/Mono    ( 4651): DllImport loaded library '/system/lib64/liblog.so'.
12-31 12:19:55.730 D/Mono    ( 4651): DllImport searching in: '/system/lib64/liblog.so' ('/system/lib64/liblog.so').
12-31 12:19:55.730 D/Mono    ( 4651): Searching for '__android_log_print'.
12-31 12:19:55.730 D/Mono    ( 4651): Probing '__android_log_print'.
12-31 12:19:55.730 D/Mono    ( 4651): Found as '__android_log_print'.
12-31 12:19:55.736 W/monodroid( 4651): JNIEnv.FindClass(Type) caught unexpected exception: Java.Lang.ClassNotFoundException: md5673452a39546f0a71deda1ad064ecc65.AuthenticationAgentActivity ---&gt; Java.Lang.ClassNotFoundException: Didn't find class "md5673452a39546f0a71deda1ad064ecc65.AuthenticationAgentActivity" on path: DexPathList[[zip file "/data/app/com.devfish.xamarin.ADALForForms-1/base.apk"],nativeLibraryDirectories=[/data/app/com.devfish.xamarin.ADALForForms-1/lib/x86_64, /system/fake-libs64, /data/app/com.devfish.xamarin.ADALForForms-1/base.apk!/lib/x86_64, /system/lib64, /vendor/lib64]]
12-31 12:19:55.736 W/monodroid( 4651):    --- End of inner exception stack trace ---
12-31 12:19:55.736 W/monodroid( 4651):   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in :0 
12-31 12:19:55.736 W/monodroid( 4651):   at Java.Interop.JniEnvironment+StaticMethods.CallStaticObjectMethod (Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00069] in :0 
12-31 12:19:55.736 W/monodroid( 4651):   at Android.Runtime.JNIEnv.CallStaticObjectMethod (System.IntPtr jclass, System.IntPtr jmethod, Android.Runtime.JValue* parms) [0x0000e] in :0 
12-31 12:19:55.736 W/monodroid( 4651):   at Android.Runtime.JNIEnv.CallStaticObjectMethod (System.IntPtr jclass, System.IntPtr jmethod, Android.Runtime.JValue[] parms) [0x00017] in :0 
12-31 12:19:55.736 W/monodroid( 4651):   at Android.Runtime.JNIEnv.FindClass (System.String classname) [0x0003d] in :0 
12-31 12:19:55.736 W/monodroid( 4651):   at Android.Runtime.JNIEnv.FindClass (System.Type type) [0x00015] in :0 
12-31 12:19:55.736 W/monodroid( 4651):   --- End of managed Java.Lang.ClassNotFoundException stack trace ---
12-31 12:19:55.736 W/monodroid( 4651): java.lang.ClassNotFoundException: md5673452a39546f0a71deda1ad064ecc65.AuthenticationAgentActivity
12-31 12:19:55.736 W/monodroid( 4651): 	at java.lang.Class.classForName(Native Method)
12-31 12:19:55.736 W/monodroid( 4651): 	at java.lang.Class.forName(Class.java:400)
12-31 12:19:55.736 W/monodroid( 4651): 	at md5270abb39e60627f0f200893b490a1ade.ButtonRenderer_ButtonClickListener.n_onClick(Native Method)
12-31 12:19:55.737 W/monodroid( 4651): 	at md5270abb39e60627f0f200893b490a1ade.ButtonRenderer_ButtonClickListener.onClick(ButtonRenderer_ButtonClickListener.java:30)
12-31 12:19:55.737 W/monodroid( 4651): 	at android.view.View.performClick(View.java:5637)
12-31 12:19:55.737 W/monodroid( 4651): 	at android.view.View$PerformClick.run(View.java:22429)
12-31 12:19:55.737 W/monodroid( 4651): 	at android.os.Handler.handleCallback(Handler.java:751)
12-31 12:19:55.737 W/monodroid( 4651): 	at android.os.Handler.dispatchMessage(Handler.java:95)
12-31 12:19:55.737 W/monodroid( 4651): 	at android.os.Looper.loop(Looper.java:154)
12-31 12:19:55.737 W/monodroid( 4651): 	at android.app.ActivityThread.main(ActivityThread.java:6119)
12-31 12:19:55.737 W/monodroid( 4651): 	at java.lang.reflect.Method.invoke(Native Method)
12-31 12:19:55.737 W/monodroid( 4651): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
12-31 12:19:55.737 W/monodroid( 4651): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
12-31 12:19:55.737 W/monodroid( 4651): Caused by: java.lang.ClassNotFoundException: Didn't find class "md5673452a39546f0a71deda1ad064ecc65.AuthenticationAgentActivity" on path: DexPathList[[zip file "/data/app/com.devfish.xamarin.ADALForForms-1/base.apk"],nativeLibraryDirectories=[/data/app/com.devfish.xamarin.ADALForForms-1/lib/x86_64, /system/fake-libs64, /data/app/com.devfish.xamarin.ADALForForms-1/base.apk!/lib/x86_64, /system/lib64, /vendor/lib64]]
12-31 12:19:55.737 W/monodroid( 4651): 	at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
12-31 12:19:55.737 W/monodroid( 4651): 	at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
12-31 12:19:55.737 W/monodroid( 4651): 	at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
12-31 12:19:55.737 W/monodroid( 4651): 	... 13 more
12-31 12:19:55.737 W/monodroid( 4651): 
12-31 12:19:55.859 E/        ( 4651): 2017-12-31T17:19:55.8588900Z: 1663fe86-17e1-4842-b23e-ca25a43dde8d - AcquireTokenHandlerBase.cs: Microsoft.IdentityModel.Clients.ActiveDirectory.AdalException: <span style="color: #ff0000"><strong>authentication_ui_failed: The browser based authentication dialog failed to complete</strong></span> ---&gt; Java.Lang.ClassNotFoundException: md5673452a39546f0a71deda1ad064ecc65.AuthenticationAgentActivity ---&gt; Java.Lang.ClassNotFoundException: Didn't find class "md5673452a39546f0a71deda1ad064ecc65.AuthenticationAgentActivity" on path: DexPathList[[zip file "/data/app/com.devfish.xamarin.ADALForForms-1/base.apk"],nativeLibraryDirectories=[/data/app/com.devfish.xamarin.ADALForForms-1/lib/x86_64, /system/fake-libs64, /data/app/com.devfish.xamarin.ADALForForms-1/base.apk!/lib/x86_64, /system/lib64, /vendor/lib64]]
12-31 12:19:55.859 E/        ( 4651):    --- End of inner exception stack trace ---
</pre>]]></content:encoded>
    </item>
    <item>
      <title>Rigging up Roslyn Analyzers in .NET Core</title>
      <link>https://docs.microsoft.com/archive/blogs/devfish/rigging-up-roslyn-analyzers-in-net-core</link>
      <pubDate>Thu, 09 Nov 2017 19:33:39 GMT</pubDate>
      <dc:creator><![CDATA[jhealy]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/devfish/?p=2877</guid>
      <description><![CDATA[&gt;&gt; Update 06/11/2018.  Damiano Curia has pushed out a "more definitive" post on this topic....]]></description>
      <content:encoded><![CDATA[<strong><span style="color: #ff0000">&gt;&gt; Update 06/11/2018.  Damiano Curia has pushed out a "more definitive" post on this topic.  Please check it out at <a href="https://curia.me/how-to-configure-code-analysis-in-net-core-projects">https://curia.me/how-to-configure-code-analysis-in-net-core-projects</a> …</span></strong>

I love Live Code Analyzers in VS2017. The analyzers help identify bad coding patterns, resource leaks and just generally aid one be a better developer by alerting when things are not done optimally.

Fun story - for reals. I was engaged by "big ole firm" to do code analysis on .NET 4.6 system that's "not running so good". About 87000 lines of code. Got code compiling, then had them turn on live analyzers in VS2017. Run an optimized ruleset which includes all the Dispose checks ( which are not included in the "recommended" rule set btw, look for <a href="https://msdn.microsoft.com/en-us/library/ms182289.aspx">CA2000</a>, not turned on in recommended rules ).

Hmm. <strong>800</strong> lines with potential memory leaks around <strong>dispose</strong>.

<strong>Me to client person - </strong>Did you try building the system with the analyzers on?
<strong>Client -</strong> Yes, we turned them off. There were too many errors.
<strong>Me -</strong> Sigh. Ok lets start here. Turns on live code analysis.

[caption id="attachment_2885" align="alignright" width="135"]<a href="https://msdnshared.blob.core.windows.net/media/2017/11/solution-explorer.png"><img width="135" height="300" class="size-medium wp-image-2885" alt="dotnet core project" src="https://msdnshared.blob.core.windows.net/media/2017/11/solution-explorer-135x300.png" /></a> .NET Core Console[/caption]

Today I work in .NET Core more than .NET Framework. But my trusty analyzers are not there. And the Analyzer tools are not yet integrated into the VS2017 IDE as they are for .NET Framework projects.   So let's explore how to put the analyzers into .NET Core projects.

For this exercise I'm starting with a basic .NET Core 2.0 Console project. Tons of improper things that are targets for the Analyzers to find live in the code. Dispose, try/catch, globalization, exceptions and more loom for the unsuspecting developer.  The source for the demo projects may be obtained at <a href="https://github.com/jhealy/RoslynAnalyzerProofs">https://github.com/jhealy/RoslynAnalyzerProofs</a> .

Rebuild the project and four warnings appear in my Error List in Visual Studio (View-&gt;Error List). Notably, these are things I need to fix. But I know there are more errors.

<a href="https://msdnshared.blob.core.windows.net/media/2017/11/error-list-00-before-analyzers.png"><img width="990" height="247" class="alignnone wp-image-2895 size-full" alt="Errors List - 4 errors" src="https://msdnshared.blob.core.windows.net/media/2017/11/error-list-00-before-analyzers.png" /></a>

The product group who owns the analyzers recommends people use the publicly released beta analyzers for .NET Core. FxCop is a great starting analyzer library so let's pull in the .NET Core compatible FxCop analyzers from <a href="https://www.nuget.org/packages/Microsoft.CodeAnalysis.FxCopAnalyzers/2.3.0-beta1">https://www.nuget.org/packages/Microsoft.CodeAnalysis.FxCopAnalyzers/2.3.0-beta1</a> .

I add the FxCop analyzer to my project using the Manage Nuget Packages window.

<a href="https://msdnshared.blob.core.windows.net/media/2017/11/install-fxcop.png"><img width="1024" height="360" class="aligncenter wp-image-2897 size-large" alt="" src="https://msdnshared.blob.core.windows.net/media/2017/11/install-fxcop-1024x360.png" /></a>

Rebuild the project and open the errors window.  There are a TON of errors about "<strong>IOperation is disabled"</strong>.

<a href="https://msdnshared.blob.core.windows.net/media/2017/11/ioperation-is-disabled.png"><img width="1024" height="165" class="aligncenter wp-image-2905 size-large" alt="" src="https://msdnshared.blob.core.windows.net/media/2017/11/ioperation-is-disabled-1024x165.png" /></a>

To  resolve IOperation is disabled, open your <strong>.csproj</strong> file.

Then add <strong>&lt;Features&gt;IOperation&lt;/Features&gt;</strong> to the <strong>&lt;PropertyGroup&gt;</strong>. Screenshot of the .csproj below.

<a href="https://msdnshared.blob.core.windows.net/media/2017/11/csproj.png"><img width="958" height="363" class="aligncenter wp-image-2907 size-full" alt="" src="https://msdnshared.blob.core.windows.net/media/2017/11/csproj.png" /></a>

Rebuild the project and we now have 76 warnings in the Error List.  Items such as globalization, public fields, classes that are never instantiated, bad exception practices and more.

<a href="https://msdnshared.blob.core.windows.net/media/2017/11/errros-list-01-fxcop.png"><img width="1024" height="371" class="aligncenter wp-image-2916 size-large" alt="" src="https://msdnshared.blob.core.windows.net/media/2017/11/errros-list-01-fxcop-1024x371.png" /></a>

Now I'm ready to have some fun.  I add a number of other analyzers to my project.  By opening up Manage Nuget Packages and put Microsoft.CodeAnalysis into the search box, a number of new toys show up.  Below are the results after I add various new analzyers.:

Microsoft.CodeAnalysis - v2.4 - 77 total warnings
Microsoft.CodeAnalysis.Csharp - v2.4 - 77 total warnings
Roslynator.Analyzers - v1.5.0 - 87 total warnings
SonarAnalyzer.Csharp - v6.6.0.3 - 131 total warnings, 9 messages
Microsoft.CodeAnalysis.Analyzers - v2.3.0-beta1 - 131 total warnings

<a href="https://msdnshared.blob.core.windows.net/media/2017/11/errors-list-02-131warnings.png"><img width="1024" height="277" class="aligncenter size-large wp-image-2935" alt="" src="https://msdnshared.blob.core.windows.net/media/2017/11/errors-list-02-131warnings-1024x277.png" /></a>

Note the Core Analyzers have not caught up with the .NET analyzers - yet. Running the full set of analyzers in .NET Core with just FxCop yields five warnings on the current document. Running the stock analyzers on .NET yields 13 warnings. One if these is a CA2000 Dispose warning, which always concern me. Unfortunately I can't get Dispose warnings to surface in the .NET Core analyzers yet.

[caption id="attachment_2917" align="aligncenter" width="1024"]<a href="https://msdnshared.blob.core.windows.net/media/2017/11/feline-core.png"><img width="1024" height="218" class="wp-image-2917 size-large" alt="" src="https://msdnshared.blob.core.windows.net/media/2017/11/feline-core-1024x218.png" /></a> Core Analyzer Results[/caption]

[caption id="attachment_2925" align="aligncenter" width="1024"]<a href="https://msdnshared.blob.core.windows.net/media/2017/11/feline-dotnet.png"><img width="1024" height="158" class="wp-image-2925 size-large" alt="" src="https://msdnshared.blob.core.windows.net/media/2017/11/feline-dotnet-1024x158.png" /></a> .NET Analyzer Result[/caption]

Preview analyzers are available at [ <a href="https://dotnet.myget.org/gallery/roslyn-analyzers">https://dotnet.myget.org/gallery/roslyn-analyzers</a> ]. These will be available with Visual Studio2017 version 15.5. I tried to get them working with Visual Studio 2017 v15.3 and v15.4 to no avail. Posted an issue and was advised to the PG to sit a bit and wait, good stuff is coming soon. So I’m in a hurry up and wait scenario. See the thread here for the fun of trying to get the preview working [ <a href="https://github.com/dotnet/roslyn/issues/23083">https://github.com/dotnet/roslyn/issues/23083</a> ]. I'll post a revised article once version 15.5 releases.

The source for the demo projects may be obtained at <a href="https://github.com/jhealy/RoslynAnalyzerProofs">https://github.com/jhealy/RoslynAnalyzerProofs</a> .

The information in this blog post is current as of November 10, 2017 and is subject to change with new VS and Analyzer releases. Visual Studio 2017 Version 15.4.4, .NET Core 2.0.2.

Happy coding and carpe diem...]]></content:encoded>
    </item>
    <item>
      <title>Exploring DataTable and SqlDBAdapter in ASP.NET Core 2.0</title>
      <link>https://docs.microsoft.com/archive/blogs/devfish/exploring-datatable-and-sqldbadapter-in-asp-net-core-2-0</link>
      <pubDate>Mon, 15 May 2017 02:37:05 GMT</pubDate>
      <dc:creator><![CDATA[jhealy]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/devfish/?p=2865</guid>
      <description><![CDATA[.NET Core 2.0 Preview was released May 2017.  Great timing as one of my customer was inquiring re...]]></description>
      <content:encoded><![CDATA[.NET Core 2.0 Preview was released May 2017.  Great timing as one of my customer was inquiring re DataTable and SqlDBADapter support in ASP.NET Core.  Instructions to wire it up are below.

First, pull down my ASP .NET Core 1.1 SqlClientPlay11 project from <a href="https://github.com/jhealy/aspdotnetcore">https://github.com/jhealy/aspdotnetcore</a>.  Instructions for building up this project are also at the previous post in this loosely strung together series at https://blogs.msdn.microsoft.com/devfish/?p=2846 .

We are going to upgrade this project to .NET Core 2.0 and use a DataTable and SqlDBAdapter to access Sql Server from ASP .NET Core.

To use a DataTable and SqlDBAdapter we must be on .NET Standard 2.0. Note .NET Standard 2.0 is in a preview state (warning) but is at a good place to start using it for development. If you take a peek at <a href="https://apisof.net/catalog/System.Data.DataSet">https://apisof.net/catalog/System.Data.DataSet</a> you'll see the inclusion in this great api reference site.

VS2017 15.2 (aka release) does not support .NET Standard 2.0. We must use VS2017 Preview 15.3 to target DataTable - see 5/11 comment here - <a href="https://github.com/dotnet/core/issues/640">https://github.com/dotnet/core/issues/640</a> .

VS2017 Preview will run side by side with VS2017 15.2, so can keep our regular dev tools in 'release state'. You will wind up with a side by side install that looks like the following in the VS2017 Installer, as well as two separate icons to work with.

<a href="https://msdnshared.blob.core.windows.net/media/2017/05/vs2017-sxs.jpg"><img width="300" height="160" class="aligncenter size-medium wp-image-2866" alt="Visual Studio 2017 SxS" src="https://msdnshared.blob.core.windows.net/media/2017/05/vs2017-sxs-300x160.jpg" /></a>

Once VS Preview 15.3 is installed your projects will have .NET CORE 2.0 available as a target platform in the Target Framework drop down of the Application tab under the project's Properties dialog.

<a href="https://msdnshared.blob.core.windows.net/media/2017/05/vs2017-target-framework.jpg"><img width="300" height="138" class="aligncenter size-medium wp-image-2867" alt="Target Frameworks" src="https://msdnshared.blob.core.windows.net/media/2017/05/vs2017-target-framework-300x138.jpg" /></a>

We need to migrate our 1.1 project to .NET Core 2.0. Perform the following steps to migrate our previous 1.1 project to 2.0.

Set our Target Framework to 2.0 via the Target Framework drop down in Project Properties

Manage Nuget packaged, click on updates.  Take them all.
Turn on "include prerelease"
Take the updates.

<a href="https://msdnshared.blob.core.windows.net/media/2017/05/nuget-update.jpg"><img width="300" height="128" class="aligncenter size-medium wp-image-2875" alt="nuget-update" src="https://msdnshared.blob.core.windows.net/media/2017/05/nuget-update-300x128.jpg" /></a>

Build the project, give it a run and a blank web project is good to go, and should work as it did before.

Note Intellisense for newly added methods is probably a bit messed up at this point. You may see things like DataTable not being highlighted as a keyword,  or missing types on compilation. Close Visual Studio and reopen it. Intellisense should be restored.

At this point I add a method to my SqlHelper to fetch customers via SqlDataAdapter, wire it into my CustomerRepository, and then call from my UI.   Below you can see my SqlDataAdapter and DataTabe functions.
<pre>public static DataTable ExecuteDataTable(SqlConnection conn, CommandType cmdType, string cmdText, SqlParameter[] cmdParms)
 {
 DataTable dt = new DataTable();
 // just doing this cause dr.load fails
 dt.Columns.Add("CustomerID");
 dt.Columns.Add("CustomerName");
 SqlDataReader dr = ExecuteReader(conn, cmdType, cmdText, cmdParms);
 // as of now dr.Load throws a big nasty exception saying its not supported. wip.
 // dt.Load(dr);
 while (dr.Read())
 {
 dt.Rows.Add(dr[0], dr[1]);
 }
 return dt;
 }

public static DataTable ExecuteDataTableSqlDA(SqlConnection conn, CommandType cmdType, string cmdText, SqlParameter[] cmdParms)
 {
 System.Data.DataTable dt = new DataTable();
 System.Data.SqlClient.SqlDataAdapter da = new SqlDataAdapter(cmdText, conn);
 da.Fill(dt);
 return dt;
 }</pre>
Again, code is available for download at <a href="https://github.com/jhealy/aspdotnetcore">https://github.com/jhealy/aspdotnetcore</a> . Pull the samples down, and carpe diem.

Have fun!]]></content:encoded>
    </item>
    <item>
      <title>Data access via SqlDataReader in ASP.NET Core 1.1 and 2.0</title>
      <link>https://docs.microsoft.com/archive/blogs/devfish/data-access-via-sqldatareader-in-asp-net-core-1-1-and-2-0</link>
      <pubDate>Mon, 15 May 2017 02:17:05 GMT</pubDate>
      <dc:creator><![CDATA[jhealy]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/devfish/?p=2846</guid>
      <description><![CDATA[I'd been working with a client who wanted to access SqlServer directly from an
ASP.NET Core...]]></description>
      <content:encoded><![CDATA[I'd been working with a client who wanted to access SqlServer directly from an
ASP.NET Core application. I'd been using Entity Framework for my ASP.NET Core access so I had to
dig in a bit on this one, especially for his DataTable, DataSet, and SqlDbAdapter questions ( see part2 of this article ).  Good news, if you know ADO, you know how to access SQL Server from ASP.NET Core.  Let's explore wiring this up below.

For the first challenge I simply wanted to execute a direct SQL against the database. SqlServer access is inASP.NET Core 1.1 via the System.Data.SqlClient nuget package.   Let's walk the process to spin up an ASP.NET Core app using SqlClient.

Code to access Sql Server form ASP.NET Core is fairly straight up. To access a SqlDbReader, for example, is the stock ADO statement, as shown below.
<pre>public static SqlDataReader ExecuteReader(SqlConnection conn, CommandType cmdType, string cmdText, SqlParameter[] cmdParms)
 {
 SqlCommand cmd = conn.CreateCommand();
 PrepareCommand(cmd, conn, null, cmdType, cmdText, cmdParms);
 var rdr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
 return rdr;
 }</pre>
Full code for this is at <a href="https://github.com/jhealy/aspdotnetcore">https://github.com/jhealy/aspdotnetcore</a>  . ASP.NET Core 1.1 and 2.0 versions are available.

<strong>STEP BY STEP</strong>
<ul>
 	<li><strong>Build up a Sql Server and install Northwind</strong>. Yes, Northwind. Sql Server
install steps, and configuring Northwind are a bit beyond the scope of this article. Old school!  But
Northwind download is at <a href="https://www.microsoft.com/en-us/download/details.aspx?id=23654">https://www.microsoft.com/en-us/download/details.aspx?id=23654</a> .
The .mdb didn't like Sql Express 2016, but the scripts to create Northwind ran fine via Sql Management Studio.</li>
 	<li><strong>Create a connection string to your Sql Server</strong>.
<a href="https://www.connectionstrings.com/sql-server">https://www.connectionstrings.com/sql-server</a>/  is a great resource to figure this out.
My connection string is
<strong>"Server=DESKTOP-PPD5M0F\SQLEXPRESS;Database=northwind;User Id=donald_reader;Password=yessurethisismypassword;"</strong>.</li>
 	<li><strong>Visual Studio 2017 Access</strong> - Open up Visual Studio 2017 15.2 or later. I strongly recommend you have all the updates
installed. My version of VS2017 for this exercise is 15.2 (26430.6) release.</li>
 	<li><strong>Create a new ASP.NET Core Project</strong>
File &gt; New &gt; Templates &gt; Visual C# &gt; .NET Core &gt; ASP.NET Core Web Application (.NET Core)
I named mine <strong>sqlclientplay11</strong>, and the solution <strong>sqlclientplay11SLN</strong>. The "11" referencing framwwork 1.1.</li>
 	<li>Select "Empty" web project.</li>
 	<li>Leave docker support unchecked, and auth to "no authenticate".</li>
 	<li>Open <strong>Startup.cs</strong>, change "Hello World!" to "Hello devfish".</li>
 	<li>Give it a run via F5 (debug&gt;go). You should see output with "hello devfish".  Woohoo.  We've got ASP.NET Core 1.1 up and running.</li>
 	<li>Add <strong>System.Data.Common</strong> and <strong>System.Data.SqlClient</strong> to the project's nuget packages. This add's direct Sql Server access to our project.</li>
 	<li>Add a file called <strong>SqlHelper.cs</strong> to your project. Direct file link : <a href="https://github.com/jhealy/aspdotnetcore/blob/master/SqlClientPlay11/SqlClientPlay11/SQLHelper.cs">https://github.com/jhealy/aspdotnetcore/blob/master/SqlClientPlay11/SqlClientPlay11/SQLHelper.cs</a></li>
 	<li>Add <strong>Customer.cs</strong> to your project. Direct file link:  <a href="https://github.com/jhealy/aspdotnetcore/blob/master/SqlClientPlay11/SqlClientPlay11/Customer.cs">https://github.com/jhealy/aspdotnetcore/blob/master/SqlClientPlay11/SqlClientPlay11/Customer.cs</a></li>
 	<li>Add <strong>CustomersRepository.cs</strong> to your project.  Direct file link: <a href="https://github.com/jhealy/aspdotnetcore/blob/master/SqlClientPlay11/SqlClientPlay11/CustomersRepository.cs">https://github.com/jhealy/aspdotnetcore/blob/master/SqlClientPlay11/SqlClientPlay11/CustomersRepository.cs</a></li>
 	<li>Modify <strong>startup.cs</strong> as follows in the snippet at the end of this document.</li>
 	<li>Give the project a run and you should hopefully see ASP.NET Core using SqlClient.</li>
</ul>
<a href="https://msdnshared.blob.core.windows.net/media/2017/05/aspdnc11-output.png"><img width="300" height="272" class="aligncenter wp-image-2855 size-medium" alt="aspdnc11-output" src="https://msdnshared.blob.core.windows.net/media/2017/05/aspdnc11-output-300x272.png" /></a>

I'll show DataTables and SqlDbAdapter inside ASP.NET Core in my next post on this topic. Feedback welcome...

<strong>Startup.cs</strong>
<div style="font: consolas;border: 2;border-color: black">
<pre>public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
 {
 loggerFactory.AddConsole();
if (env.IsDevelopment())
 {
 app.UseDeveloperExceptionPage();
 }

app.Run(async (context) =&gt;
 {
 await context.Response.WriteAsync("Hello devfish!");
<span style="color: #ff0000"> await context.Response.WriteAsync("SQLCLIENT DIRECT SQL");</span>
<span style="color: #ff0000"> await context.Response.WriteAsync(CustomerTable());</span>
 });
 }

<span style="color: #ff0000">public string CustomerTable()</span>
<span style="color: #ff0000"> {</span>
<span style="color: #ff0000"> string retval;</span>
<span style="color: #ff0000"> string header = @"SqlDbReader Fetch";</span>
<span style="color: #ff0000"> string footer = @"done...";</span>

<span style="color: #ff0000">StringBuilder sbBody = new StringBuilder(1024);</span>
<span style="color: #ff0000"> List list = CustomersRepository.GetAllCustomers();</span>
<span style="color: #ff0000"> foreach (Customer c in list)</span>
<span style="color: #ff0000"> {</span>
<span style="color: #ff0000"> sbBody.AppendFormat(@"{0}::{1}</span>
<span style="color: #ff0000"> ", c.CustomerId, c.CompanyName);</span>
<span style="color: #ff0000"> }</span>
<span style="color: #ff0000"> retval = $@"{header}</span>
<span style="color: #ff0000"> {sbBody}</span>
<span style="color: #ff0000"> {footer}";</span>
<span style="color: #ff0000"> return retval;</span>
<span style="color: #ff0000"> }</span></pre>
</div>]]></content:encoded>
    </item>
    <item>
      <title>On passing the Xamarin Mobile Developer Certification Exam</title>
      <link>https://docs.microsoft.com/archive/blogs/devfish/on-passing-the-xamarin-mobile-developer-certification-exam</link>
      <pubDate>Mon, 17 Apr 2017 15:19:01 GMT</pubDate>
      <dc:creator><![CDATA[jhealy]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/devfish/?p=2825</guid>
      <description><![CDATA[Microsoft likes us to have some technical certifications.  Personally I enjoy the challenges of the...]]></description>
      <content:encoded><![CDATA[Microsoft likes us to have some technical certifications.  Personally I enjoy the challenges of the tests.  This year my goals were the Windows 10 UWP Developer exam ( Developing Mobile Apps 70-357 - <a href="https://www.microsoft.com/en-us/learning/exam-70-357.aspx">https://www.microsoft.com/en-us/learning/exam-70-357.aspx</a> )and the Xamarin Certified Developer accreditation ( <a href="https://university.xamarin.com/certification">https://university.xamarin.com/certification</a> ).  Earlier in the year I passed the UWP exam, so up next was the Xamarin Cert.

Cutting it short, I passed the Xamarin exam Saturday.  Good to go.  Check it at the Xamarin site <a href="https://university.xamarin.com/certification">https://university.xamarin.com/certification</a>.  You can search for me by name - Joe Healy.

<a href="https://university.xamarin.com/certification"><img width="300" height="124" class="aligncenter wp-image-2845 size-medium" alt="xam-cert" src="https://msdnshared.blob.core.windows.net/media/2017/04/xam-cert1-300x124.png" /></a>

My background – pretty significant UWP and Xamarin Forms. Quite a number of engagements on Xamarin, ALL WERE XAMARIN FORMS, so my native-fu was weak. I knew I had to refresh there.

The Xamarin exam long.  Very long.  My ADHD doesn't hold up very well in the long exams.  This was going to be a challenge. They give you a big chunk of time. Didn’t double check my answers as I tend to hurt myself by double guessing my answers.

I had a down week and spent Tues/Wed/Thurs working through all 16 of the required certification classes. I reviewed the slides and anything I was vague on went into my OneNote, manually typed and keyed in.  I also pasted in code samples from the slides, which helped a lot of some of the things I don’t use too much (effects, renderers). Friday = machine crash and setup backup machine ( see gotchas below). Saturday – review materials, review native stuff again, take exam.

Best tip – you have to have the counselling thing before taking the exam, listen to what they say. My counselor, Kym Philpotts ( <a href="https://www.kymphillpotts.com/">https://www.kymphillpotts.com/</a> ), pointed out extra study guides on the bottom of the cert page ( <a href="https://university.xamarin.com/content/certification">https://university.xamarin.com/content/certification</a> ). Each one listed out specific items to know and links to find detailed info. Work through these. Make sure you understand, well, everything. Quite a number of questions from them, especially things like publishing on iOS.

Question topics – Rumed - "Hey the cert track is mostly xam forms ( 12/16 courses ) so that’s the ratio forms to native on exam".  Don't count on it. Lots of native still. Be ready. Review all materials thoroughly.

The test is open book.  Given you have to have 80% to pass, this was refreshing.   In hindsight I realized you can save yourself hassle before starting the test by configuring your work area properly. One side monitor at home, so test open on side monitor, with research helpers on main for when I got stuck.  If I had done it properly I would have had open:
<ul>
 	<li>My OneNote with my study notes and some pasted code samples</li>
 	<li>Visual Studio 2017 with Android and IOS PCL project</li>
 	<li>Visual Studio 2017 with Android Native Project - base</li>
 	<li>Visual Studio 2017 with iOS Native Project - base</li>
 	<li>Mac crossover connected to PC with VS Mac on latest update</li>
 	<li>Browser on "bing" ready to search when I got vague</li>
</ul>
Gotchas – before my final my HPZbook battery and charger went boom. All my downloaded exercises were on that machine. I was planning on using those for reference on some of the projects I hadn’t played with that much. Wound up just pulling down AND101-2 and IOS1-2 to my machine. Too burned out at that point after provisioning up my backup box and 3 days pre-study to pull the rest. Ugh.

Drained today but travelling. Going for some 3 mile walks and having red wine or scotch for dinner this evening. Cya!]]></content:encoded>
    </item>
    <item>
      <title>Roslyn Analyzer Deltas for VS2017 RC3</title>
      <link>https://docs.microsoft.com/archive/blogs/devfish/roslyn-analyzer-deltas-for-vs2017-rc3</link>
      <pubDate>Thu, 02 Feb 2017 02:44:19 GMT</pubDate>
      <dc:creator><![CDATA[jhealy]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/devfish/?p=2805</guid>
      <description><![CDATA[One of my favorite features in VS2015 is the Roslyn based live static code analyzers   Interactive...]]></description>
      <content:encoded><![CDATA[<a href="https://msdnshared.blob.core.windows.net/media/2017/02/rules.png"><img width="299" height="167" class="alignright  wp-image-2815" alt="Analyzer Rules" src="https://msdnshared.blob.core.windows.net/media/2017/02/rules.png" /></a>One of my favorite features in VS2015 is the Roslyn based live static code analyzers   Interactive IDE feedback on my code gives me  'opportunities for improvement' to my code.  Think FxCop++ without having to build your project.  I like to say "in your face" developer education.  See "bad things" and fix them before some other developer makes fun of you!   For those not familiar with Roslyn Analyzers I will suggest you view Falafel's blog post on the topic at <a href="https://blog.falafel.com/live-code-analysis-day-20-visual-studio-2015/">https://blog.falafel.com/live-code-analysis-day-20-visual-studio-2015/</a> .  He gives a great overview with examples of the toolset inside VS2015.

Well now VS2017 RC3 is out on the wire.  I setup an Azure VM and install VS2017R3 into it.  Futzing around, I noticed working with VS2017RC3 that there were a number of new analyzers.  I attempted to find a comprehensive list of analyzers added to or removed from the stock set that VS ships with.  Unable to find a list of deltas, I manually perused the "all rules" list, and noted the following changes below.  I share them with you for reference.

**** Warning - This is a very unscientific and manual analysis and may change from time to time ****

If you find any omissions or extra additions, please let me know!

<strong>Microsoft.CodeAnalysis.CSharp</strong>
[-] CS0028 Method has the wrong signature to be an entry point
[-] CS0402 An entry point cannot be generic or in a generic type
[-] CS7022 The entry point of the program is global script code
[+] CS8123 The tuple element name is ignored because a different name is specified by the assignment target

<strong>Microsoft.CodeAnalysis.CSharp.EditorFeatures</strong>
[+] IDE0007 Use implicit type
[+] IDE0008 Use explicit type
[+] IDE0009 Member access should be qualified
[+] IDE0011 Add braces
[+] IDE0012 Simplify Names
[+] IDE0013 Simplify Names
[+] IDE0014 Use framework type
[+] IDE0015 Use framework type
[+] IDE0016 Use 'throw' expression
[+] IDE0017 Simplify object initialization
[+] IDE0018 Inline variable declaration
[+] IDE0019 Use pattern matching
[+] IDE0020 Use pattern matching
[+] IDE0021 Use expression body for methods
[+] IDE0022 Use expression body for operators
[+] IDE0023 Use expression body for operators
[+] IDE0024 Use expression body for properties
[+] IDE0025 Use expression body for indexers
[+] IDE0026 Use expression body for accessors
[+] IDE0027 Simplify colection initialization
[+] IDE0028 Use coalesce expression
[+] IDE0029 Use coalesce expression
[+] IDE0030 Use null propogation
[+] IDE1005 Delegate invocation can be simplified
[+] IDE1006 Naming Styles

<strong>Microsoft.CodeAnalysis.Features</strong>
[+] IDE0010 Add missing cases
[+] IDE0032 Use explicity provided tuple name

<strong>Microsoft.Rules.Managed</strong>
[-] CA2123 Override link demands should be identical to base
[-] CA2130: Security critical constants should be transparent
[-] CA2131: Security critical types may not participate in type equivalence
[-] CA2132: Default constructors must be at least as critical as base type default constructors
[-] CA2133: Delegates must bind to methods with consistent transparency
[-] CA2134: Methods must keep consistent transparency when overriding base methods
[-] CA2135: Level 2 assemblies should not contain LinkDemands
[-] CA2136: Members should not have conflicting transparency annotations
[-] CA2137: Transparent methods must contain only verifiable IL
[-] CA2138: Transparent methods must not call methods with the SuppressUnmanagedCodeSecurity attribute
[-] CA2139: Transparent methods may not use the HandleProcessCorruptingExceptions attribute
[-] CA2140: Transparent code must not reference security critical items
[-] CA2141:Transparent methods must not satisfy LinkDemands
[-] CA2142: Transparent code should not be protected with LinkDemands
[-] CA2143: Transparent methods should not use security demands
[-] CA2144: Transparent code should not load assemblies from byte arrays
[-] CA2145: Transparent methods should not be decorated with the SuppressUnmanagedCodeSecurityAttribute
[-] CA2146: Types must be at least as critical as their base types and interfaces
[-] CA2147: Transparent methods may not use security asserts
[-] CA2149: Transparent methods must not call into native code
[-] CA2151: Fields with critical types should be security critical.
[-] CA5122: P/Invoke declarations should not be safe-critical

<strong>Microsoft.VisualStudio.Azure.Fabric.DiagnosticAnalyzers</strong>
[+] SF1001 The name of a service type has not been consistently applied in all places
[+] SF1002 Assembly name and serviceentry point are inconsistent across project and manifest

&nbsp;

Enjoy!]]></content:encoded>
    </item>
    <item>
      <title>New project type has XAML forms by default</title>
      <link>https://docs.microsoft.com/archive/blogs/devfish/new-project-type-has-xaml-forms-by-default</link>
      <pubDate>Fri, 23 Sep 2016 20:08:40 GMT</pubDate>
      <dc:creator><![CDATA[jhealy]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/devfish/?p=2765</guid>
      <description><![CDATA[Xamarin has some great documentation. The article at [...]]></description>
      <content:encoded><![CDATA[Xamarin has some great documentation. The article at [ <a href="https://developer.xamarin.com/guides/xamarin-forms/xaml/xaml-basics/getting_started_with_xaml/">https://developer.xamarin.com/guides/xamarin-forms/xaml/xaml-basics/getting_started_with_xaml/</a> ] shows how to get started with Xaml by using the <strong>Blank Xaml App ( Xamarin.Forms Portable )</strong> template.

[caption id="attachment_2775" align="aligncenter" width="512"]<a href="https://msdnshared.blob.core.windows.net/media/2016/09/blank-app-portable.png"><img width="512" class="size-full wp-image-2775" alt="Xamarin New Forms Portable" src="https://msdnshared.blob.core.windows.net/media/2016/09/blank-app-portable.png" /></a> Xamarin New Forms Portable[/caption]

The Blank Xaml App template sets up a project without any Xaml, just C# classes for creating a Xamarin Forms project. You must manually add a Xaml Page to this template, as this article shows [ <a href="https://developer.xamarin.com/guides/xamarin-forms/xaml/xaml-basics/getting_started_with_xaml/">https://developer.xamarin.com/guides/xamarin-forms/xaml/xaml-basics/getting_started_with_xaml/</a>].

In my article at [ <a href="https://blogs.msdn.microsoft.com/devfish/2016/06/24/global-resources-in-xamarin-forms-no-app-xaml-create-one/">https://blogs.msdn.microsoft.com/devfish/2016/06/24/global-resources-in-xamarin-forms-no-app-xaml-create-one/</a>] I show how to add an App.Xaml to the Blank Xaml App template as well.  App.xaml using xml gives a developer Xaml based resources and style definitions, imho a much cleaner and manageable approach than C# based repositories.

[caption id="attachment_2785" align="aligncenter" width="512"]<a href="https://msdnshared.blob.core.windows.net/media/2016/09/blank-xaml-app.png"><img width="512" class="size-large wp-image-2785" alt="Xamarin New Forms PCL App" src="https://msdnshared.blob.core.windows.net/media/2016/09/blank-xaml-app-1024x716.png" /></a> Xamarin New Forms PCL App[/caption]

Manually adding in XAML pages works very well.  Functional? Yes! Tedious, absolutely.Wish there was an easier way?  Of course.

Good news. XAML templates are here.

Update your Xamarin to at least Xamarin 4.1, and new  templates are available. My very favorit-est is the <strong>Blank Xaml App ( Xamarin.Forms Portable ).</strong> <strong>Blank Xaml App</strong> versus <strong>Blank App</strong>? <strong>Blank Xaml App</strong> gives us <strong>App.Xaml</strong> and <strong>App.Xaml.cs</strong>, as well as <strong>MainPage.xaml</strong> and <strong>MainPage.Xaml.cs</strong> files.

Developers no longer have to have to manually add in the Xaml page, or an App.Xaml . Great news for those of us who prefer the pointy thing approach &lt; xaml /&gt; to form layout versus C# driven.

Prior to Xamarin 4.1 we were forced to use the Xaml App template with manually added XAML forms if we wanted to use XAML instead of code.

Note this is also available in <strong>Xamarin Studio on the Mac</strong>, via the<strong> File &gt; New &gt; Solution &gt; Xamarin.Forms &gt; Forms App</strong>.   Keep a sharp watch, as the default page in Xamarin STudio for Mac will match the name of the project instead of being "MainPage.xaml".

Xamarin Forms keeps getting better. I can't wait to see where it goes. But in the meantime, the new default layout with Xaml based pages gives us pointy types a much better launchpad for our projects than the previous C# only options.

Happy coding and tight lines!]]></content:encoded>
    </item>
    <item>
      <title>Global resources in Xamarin Forms! No App.xaml?  Create one!</title>
      <link>https://docs.microsoft.com/archive/blogs/devfish/global-resources-in-xamarin-forms-no-app-xaml-create-one</link>
      <pubDate>Fri, 24 Jun 2016 01:03:31 GMT</pubDate>
      <dc:creator><![CDATA[jhealy]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/devfish/?p=2725</guid>
      <description><![CDATA[Xaml developers moving to Xamarin Forms are hoping to take some of their good habits from the...]]></description>
      <content:encoded><![CDATA[Xaml developers moving to Xamarin Forms are hoping to take some of their good habits from the Windows (WPF/Silverlight/UWP) dev world with them. And probably a few of their bad ones as well but we don't want to talk about those. But sometimes the constructs the devs hope to find in Xamarin Forms are not there waiting for them by default. Such <del>is</del> was the case with App.Xaml.

<a href="https://msdnshared.blob.core.windows.net/media/2016/06/little-bo-peep.jpg"><img class="alignright size-thumbnail wp-image-2735" style="float: right" src="https://msdnshared.blob.core.windows.net/media/2016/06/little-bo-peep-150x150.jpg" alt="little bo peep" width="150" height="150" />
</a>

Declaring resources such as strings and styles (Resource Dictionaries) at an application level is a good thing.  App.xaml is a construct that enables us to declare global styles, strings, and resources in a declarative fashion, aka using XML and not C#. In fact, the only thing that can be put into the body of the App.xaml declaration is Application.Resources declarations ( see <a href="https://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.application.resources.aspx">https://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.application.resources.aspx</a>  ) for details on Application level resources.

App.xaml was not a default item in a Xamarin Forms PCL Template before version 4.1.  In lieu of App.xaml, Xamarin Forms would put an App.cs into the project for application level code and resource declarations. Even in Xamarin 4.1, the Blank Xamarin Forms ( Portable Class Library ) template still gives us an App.cs file, and not an App.Xaml file.  A blog post by Falafel gives us a great example of using code (C#) inside App.cs to create global level resources( <a href="https://blog.falafel.com/creating-global-resources-for-xamarin-forms-apps/">https://blog.falafel.com/creating-global-resources-for-xamarin-forms-apps/</a> ).
Read the post to get an idea of what I mean.  Definitely not XML declarations.

But... Xaml devs often want to define resources using declarative layouts (XML)  and not code ( C# ).

I'm going to show you how to add an App.xaml to an <strong>existing Xamarin Forms</strong> project using a Xaml based approach. If you want a non-declarative, code-driven approach, Falafel's approach is great. Please stop reading this blog post immediately and surf to Falafel's page.
<blockquote>
<p style="padding-left: 30px"><strong>NOTE</strong>: If you are using Xamarin Forms 4.1 or later, and creating a new project, you should start new Xamarin Forms projects with the <strong>Blank Xaml App ( Xamarin.Forms Portable )</strong> instead of the <strong>Blank App ( Xamarin.Forms Portable )</strong>. I'll detail the differences in a future post, but suffice it to say that the <strong>Blank Xaml App</strong> template in Xamarin 4.1 uses a full App.xaml as a default file in the template, versus pre 4.1 App.cs.</p>
</blockquote>
Follow the steps below to <strong>add App.xaml to an existing Xamarin Forms project</strong>.
<h3>SETUP OUR APP.XAML</h3>
<ul>
	<li>Create a <strong>Blank App ( Xamarin.Forms Portable )</strong> in Visual Studio and name it <strong><i>"HelloXamarinForms"</i></strong></li>
	<li>Rename <strong>App.cs</strong> to <strong>App.cs.saveme</strong> - this is a precautionary measure for us "just in case"</li>
	<li>Add a new <strong>Xaml</strong> form to the page and name it <strong>"App.xaml"</strong></li>
	<li>Modify <strong>App.xaml.cs</strong> so that the class <strong>App</strong> inherits from <strong>Application</strong></li>
	<li>Add a call to <strong>InitializeComponent()</strong> to the constructor</li>
	<li>Modify the App.MainPage initialization line to point to a new startup page we will created named <strong>UseGlobalResourceDictPage.xaml</strong> .</li>
</ul>
<h3>App.xaml.cs</h3>
<pre style="border-width: thin;background: black;color: lime;font-family: Consolas,Arial, Helvetica, sans-serif;width: 7000px">public partial class App : Application
{
    public App()
    {
        InitializeComponent();
        MainPage = new UseGlobalResourceDictPage(); 
    }
...
}
</pre>
<h3>ADD GLOBAL RESOURCES</h3>
<ul>
	<li>Modify App.xaml to resemble the following. This is our application level resource dictionary.</li>
</ul>
<h3>App.xaml</h3>
<pre style="border-width: thin;background: black;color: lime;font-family: Consolas,Arial, Helvetica, sans-serif;width: 1000px">&lt;Application xmlns="https://xamarin.com/schemas/2014/forms"
            xmlns:x="https://schemas.microsoft.com/winfx/2009/xaml"
            x:Class="HelloXamarinForms.App"&gt;
&lt;Application.Resources&gt;
&lt;ResourceDictionary&gt;
    &lt;Color x:Key="PageBackgroundColor"&gt;Yellow&lt;/Color&gt;
    &lt;Color x:Key="HeadingTextColor"&gt;Black&lt;/Color&gt;
    &lt;Color x:Key="NormalTextColor"&gt;Blue&lt;/Color&gt;
    &lt;Style x:Key="LabelPageHeadingStyle" TargetType="Label"&gt;
        &lt;Setter Property="FontAttributes" Value="Bold" /&gt;
        &lt;Setter Property="HorizontalOptions" Value="Center" /&gt;
        &lt;Setter Property="TextColor" Value="{StaticResource HeadingTextColor}" /&gt;
    &lt;/Style&gt;
&lt;/ResourceDictionary&gt;
&lt;/Application.Resources&gt;
&lt;/Application&gt;
</pre>
<h3>USE GLOBAL RESOURCES</h3>
<ul>
	<li>Add a new Xaml form called <strong>"UseGlobalResourceDictPage"</strong> to our project</li>
	<li>Modify the Xaml of UseGlobalResourceDictPage to match the following. Note the use of StaticResources applying
styles to our Buttons and Labels.</li>
</ul>
<h4>UseGlobalResourceDictPage.xaml</h4>
<pre style="border-width: thin;background: black;color: lime;font-family: Consolas,Arial, Helvetica, sans-serif;width: 1000px">&lt;?xml version="1.0" encoding="utf-8" ?&gt;
&lt;ContentPage xmlns="https://xamarin.com/schemas/2014/forms"
             xmlns:x="https://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="HelloXamarinForms.ResDictUseApplicationLevelPage"&gt;
    &lt;StackLayout&gt;
    &lt;StackLayout.Resources&gt;
      &lt;ResourceDictionary&gt;
        &lt;Style x:Key="LabelNormalStyle" TargetType="Label"&gt;
          &lt;Setter Property="TextColor" Value="{StaticResource NormalTextColor}" /&gt;
        &lt;/Style&gt;
        &lt;Style x:Key="MediumBoldText" TargetType="Button"&gt;
          &lt;Setter Property="FontSize" Value="Medium" /&gt;
          &lt;Setter Property="FontAttributes" Value="Bold" /&gt;
        &lt;/Style&gt;
      &lt;/ResourceDictionary&gt;
    &lt;/StackLayout.Resources&gt;
    &lt;Label Text="ResourceDictionary Demo" Style="{StaticResource LabelPageHeadingStyle}" /&gt;
    &lt;Label Text="This app demonstrates consuming resources that have been defined in resource dictionaries."
           Style="{StaticResource LabelNormalStyle}" /&gt;
    &lt;Button Text="Navigate" 
            TextColor="{StaticResource NormalTextColor}"
            HorizontalOptions="Center"
            Style="{StaticResource MediumBoldText}" /&gt;
  &lt;/StackLayout&gt;
&lt;/ContentPage&gt;
</pre>
<h3>ENJOY</h3>
Give the page a run. We will see the styles and resources we have defined globally applied to
our Xaml form layout. Screenshots shown below for UWP and Android. Too lazy to get my Mac out of my backpack (yes, I'm on the road).
<a href="https://msdnshared.blob.core.windows.net/media/2016/06/combo.png"><img class="alignnone size-full wp-image-2756" src="https://msdnshared.blob.core.windows.net/media/2016/06/combo.png" alt="screen shots" width="521" height="294" /></a>
Have fun and enjoy. Feedback is welcome. This is blogged cause I couldn't find a public blog on how to do this anywhere. Feel free to post more links to aid in the App.xaml quest for Xamarin forms.
<h3>RESOURCES</h3>
<ul>
	<li>Falafel on Creating Global Resources for Xamarin Forms - <a href="https://blog.falafel.com/creating-global-resources-for-xamarin-forms-apps">https://blog.falafel.com/creating-global-resources-for-xamarin-forms-apps/</a></li>
	<li>Application Resources documentation - <a href="https://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.application.resources.aspx">https://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.application.resources.aspx</a></li>
</ul>]]></content:encoded>
    </item>
    <item>
      <title>xam.plugins.connectivity - all APIs Sample</title>
      <link>https://docs.microsoft.com/archive/blogs/devfish/xam-plugins-connectivity-all-apis-sample</link>
      <pubDate>Wed, 22 Jun 2016 16:59:31 GMT</pubDate>
      <dc:creator><![CDATA[jhealy]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/devfish/?p=2705</guid>
      <description><![CDATA[Esteemed Xamarin evangelist James Montemagno ( https://twitter.com/JamesMontemagno ) has a...]]></description>
      <content:encoded><![CDATA[<a href="https://msdnshared.blob.core.windows.net/media/2016/06/transmit.jpg"><img class="size-medium wp-image-2715" src="https://msdnshared.blob.core.windows.net/media/2016/06/transmit-300x188.jpg" alt="transmit" width="300" height="188" /></a>
<p class="wp-caption-dd">Esteemed Xamarin evangelist James Montemagno ( <a href="https://twitter.com/JamesMontemagno" target="_blank">https://twitter.com/JamesMontemagno</a> ) has a fantastic cross  platform plugin for working with connectivity scenarios in Xamarin. The plugin works with iOS, Windows UWP,
Android, using Forms as well as native targets. The repository has full source code
for the plugin. The repo also has some lightweight samples as well.</p>
As an exploration of the component I've written and shared a sample that takes advantage of
all the APIs in the component I could find.  The sample is available at <a href="https://github.com/jhealy/Connectivity-Plugin-Sample" target="_blank">https://github.com/jhealy/Connectivity-Plugin-Sample</a>  .

Why did I bother building a new sample when James already gave us a sample in his plugins repository?
James's sample is a "IsConnected" detection snippet, but no other APIs are explored. And
there was no Android version. Thus my full on Connectivity Plugin API explorer was conceived.

The sample I've published reacts to status changes. I've supplied iOS, Android, and UWP implementations. Inside we have an enumeration of the following APIs from the Connectivity plugin.
<ul>
	<li>IsConnected - Is there an active Internet connection</li>
	<li>ConnectionStatus changes - React when bandwidth or connection status changes</li>
	<li>ConnectionTypes - Enumerate available connection types</li>
	<li>Bandwidths - Enumerate available bandwidths</li>
	<li>IsReachable - Is machine or URL reachable</li>
	<li>IsRemoteReachable - Is host by IP or URL reachable</li>
</ul>
Have fun and enjoy. Feedback is welcome. Tip of the fish to Michael Stonis ( <a href="https://www.twitter.com/MichaelStonis">@MichaelStonis</a> ) for
pointing out this component to me.
<h3>RESOURCES</h3>
<ul>
	<li>Connectivity Plugin for Xamarin - <a href="https://github.com/jamesmontemagno/Xamarin.Plugins/tree/master/Connectivity">https://github.com/jamesmontemagno/Xamarin.Plugins/tree/master/Connectivity</a></li>
	<li>Connecity Plugin All APIs Sample - <a href="https://github.com/jhealy/Connectivity-Plugin-Sample">https://github.com/jhealy/Connectivity-Plugin-Sample</a></li>
</ul>]]></content:encoded>
    </item>
    <item>
      <title>Easy Blog with WordPress, Azure Web Apps and the Azure Gallery</title>
      <link>https://docs.microsoft.com/archive/blogs/devfish/easy-blog-with-wordpress-azure-web-apps-and-the-azure-gallery</link>
      <pubDate>Thu, 03 Sep 2015 13:31:21 GMT</pubDate>
      <dc:creator><![CDATA[jhealy]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/devfish/2015/09/03/easy-blog-with-wordpress-azure-web-apps-and-the-azure-gallery/</guid>
      <description><![CDATA[WordPress is a very popular platform. Using Azure plus Web Apps plus the Azure Marketplace you...]]></description>
      <content:encoded><![CDATA[<div style="margin: 20px; padding: 20px;"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/40/83/2015/4604.wordpress.PNG" original-url="https://blogs.msdn.com/cfs-filesystemfile.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-40-83-2015/4604.wordpress.PNG"> <img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/40/83/2015/4604.wordpress.PNG" original-url="https://blogs.msdn.com/cfs-filesystemfile.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-40-83-2015/4604.wordpress.PNG" alt="" width="400" /> </a></div>
<p>WordPress is a very popular platform. Using Azure plus Web Apps plus the Azure Marketplace you can easily spin up a WordPress site without having to touch any code. The provisioning process takes care of code installation, Web App initialization, and even creating a MySQL database for you.</p>
<p>For one of my engagements I was asked to come up ways to spin up online properties like blogs with little or no code. Accordingly, I've recorded a video of provisioning WordPress into a Web App in Azure. WordPress is an easy to work with, PHP driven blogging platform.</p>
<p>Watch the video below for a walk through using a Stop and Go tutorial format. After completing the video tutorial you will have stood up a complete blog in the cloud with no coding required.</p>
<p><iframe src="https://channel9.msdn.com/Blogs/devfish/WordPress-in-Azure-Up-and-Running-in-Ten-Minutes-Stop-and-Go-Tutorial/player" frameborder="0" width="640" height="360"></iframe></p>]]></content:encoded>
    </item>
  </channel>
</rss>