We have been working on a project for over a year now and finally ready to get it in the store and the store requires it to be compiled with NET Native toolchain. Changing to that and compiling works fine, but it crashes on launch and no way that we can tell what the problem is since breakpoints aren't hit and call stack is useless; it just shows some interop dll's, etc.
I read Andrew Hall's blog on debugging .NET Native toolchain apps but his suggestions of un-checking the 'optimized' option still hits no breakpoints or gives any useful information.
So I figured I would do a 'Hello World' app and slowly start adding new code until it breaks. I created a new Xamarin PCL app; updated all the Nuget packages, and get the 'Welcome' screen just fine. Then I check the .NET Native toolchain option in the project and it crashes on launch and the exception is in Helpers.g.cs on the InternalInitialize statement:
public static void Initialize()
{
if (s_initialized != 2)
if (global::System.Threading.Interlocked.CompareExchange(
ref s_initialized,
1,
0
) == 0)
{
InternalInitialize();
global::System.Threading.Volatile.Write(
ref s_initialized,
2
);
}
else
while (global::System.Threading.Volatile.Read(ref s_initialized) != 2)
{
global::System.Runtime.InteropServices.SpinWaitExtensions.Yield();
}
}
The only thing it tells me is
"Unhandled exception at 0x0F38DB1B (mrt100_app.dll) in MobileApp.UWP.exe: 0xC0000602: A fail fast exception occurred."
One post suggested that in the watch window there will be some symbols that you can manually load, but the app is so simple there are no variables, nor anything in locals.
I really must be missing something basic but everything I read seems to imply that it should at least hit breakpoints, etc., as long as it is not optimized. So I really don't know where to start if I can't even get hello world to run. I am using visual studio 2017.
So, how can I get it to run with .Net Native Toolchain, or at least give me a clue as to what it is having a problem with?
User contributions licensed under CC BY-SA 3.0