Xamarin IOS debug, app crashes with no error

Viewed 1318

When I run app with debug from Visual Studio in IOS Emulator, app launches, shows splash screen and then crashes. Visual Studio continue showing normal behavior like it is still attached to debug process and everything go according to plan.

When I launch that same app on emulator manually, it works perfectly.

Debug log always as this:

Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/40C63365-3924-44EA-9145-AAF5F59D170F/data/Containers/Bundle/Application/FED2C1CB-FD8E-441A-856C-66981DB384B5/WebtutorMobileX.iOS.app/Xamarin.iOS.dll [External] Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/40C63365-3924-44EA-9145-AAF5F59D170F/data/Containers/Bundle/Application/FED2C1CB-FD8E-441A-856C-66981DB384B5/WebtutorMobileX.iOS.app/System.dll [External] Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/40C63365-3924-44EA-9145-AAF5F59D170F/data/Containers/Bundle/Application/FED2C1CB-FD8E-441A-856C-66981DB384B5/WebtutorMobileX.iOS.app/Mono.Security.dll [External]

After that app crashes and nothing happens. Visual Studio stays in blessed ignorance.

No errors whatsoever.

This began after I upgraded to 4.7.0.1179 and XCode 11.6. Visual Studio 2019 16.6.5.

2 Answers

Put a try/catch block in the Main.cs file in the xamarin.ios project and a breakpoint in the catch block, it usually tells you what wrong in this kind of crash.

    public class Application
{
    // This is the main entry point of the application.
    static void Main(string[] args)
    {
        try
        {
            // if you want to use a different Application Delegate class from "AppDelegate"
            // you can specify it here.
            UIApplication.Main(args, null, "AppDelegate");
        }
        catch (Exception ex)
        {
            //Breakpoint here
        }
 
    }
}

Visual Studio Version 16.7.4 + Xamarin IOS 14.0, debug working again.

Related