Debugging Xamarin Forms 3.6 and up

download.jpgWhen your app fails, is it your app, or is there a bug in Xamarin Forms? How to know? In this post I’ll show you how to run Xamarin Forms in debug mode so that exceptions are caught and displayed deep inside Xamarin Forms.

In my previous post I showed you how to debug Xamarin Forms 3.5 and below. 3.6 and above are very different (and easier).

Let’s get to it!

GOTCHA: Make sure you have all the UWP components from the Visual Studio installer or you’ll get errors building. When in doubt, just add it all.

2019-04-02 09_08_19-Window.png

GOTCHA: Delete any Xamarin Forms github repro you have.

Step 1: Create a folder to contain the GitHub source code. I use e:\GitHub

Step 2: Open the GitHub Windows Client and clone  Xamarin Forms Git Hub Repro . Switch to version 3.6

2019-04-02 09_06_16-Window.png

The code is now in e:\GitHub\Xamarin Forms

Step 3: With notepad, create this batch file  e:\GitHub\Build Xamarin NuGet.bat

e:\
cd E:\GitHub\Xamarin.Forms

PowerShell.exe -Command “& ‘Build XF By Batch file.ps1′”
PAUSE

Step 4: With notepad, create this ps1 file e:\GitHub\Build XF By Batch file.ps1

Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force

cd E:\GitHub\Xamarin.Forms
./Build.ps1 -Target NugetPack

Step 5: Double click Build Xamarin NuGet.bat to build

GOTCHA: It can take 6-10 minutes to build. Really. Coffee time….

2019-04-02 09_12_32-Window.png

Now we have the NuGet packages for Xamarin Forms on our machine.

In Visual Studio, add this Nuget repository , then upgrade your projects to the new Xamarin Forms build (Prerelease Nuget)

GOTCHA: Don’t forget to check the “Include Prerelease” checkbox.

2019-04-02 09_15_42-Window.png

GOTCHA: Update project by project, not the whole solution at once. I often get NuGet errors on the solution.

GOTCHA: Delete all bin/obj folder, restart Visual Studio then rebuild.

All done! Now you can debug into Xamarin Forms.

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s