When 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.
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
The code is now in e:\GitHub\Xamarin Forms
Step 3: With notepad, create this batch file e:\GitHub\Build Xamarin NuGet.bat
PowerShell.exe -Command “& ‘Build XF By Batch file.ps1′”
Step 4: With notepad, create this ps1 file e:\GitHub\Build XF By Batch file.ps1
Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
./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….
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.
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.