Xamarin IOS 调试,应用程序崩溃,没有错误

Ser*_*cat 5 debugging visual-studio ios xamarin

当我在 IOS 模拟器中从 Visual Studio 运行带有调试功能的应用程序时,应用程序启动,显示启动屏幕,然后崩溃。Visual Studio 继续显示正常行为,就像它仍然附加到调试过程一样,一切都按计划进行。

当我在模拟器上手动启动相同的应用程序时,它运行得很好。

调试日志总是这样:

加载的程序集:/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 [外部] 加载程序集:/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 [外部] 加载的程序集:/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 [外部]

之后应用程序崩溃并且没有任何反应。Visual Studio 仍然处于幸运的无知状态。

没有任何错误。

这是在我升级到 4.7.0.1179 和 XCode 11.6 后开始的。Visual Studio 2019 16.6.5。

Vis*_*arp 0

在 xamarin.ios 项目的文件中放置一个 try/catch 块Main.cs,并在 catch 块中放置一个断点,它通常会告诉您这种崩溃中出了什么问题。

    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
        }
 
    }
}
Run Code Online (Sandbox Code Playgroud)