【问题标题】:Xamarin IOS debug, app crashes with no errorXamarin IOS 调试,应用程序崩溃,没有错误
【发布时间】:2020-11-15 06:11:35
【问题描述】:

当我在 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。

【问题讨论】:

  • 删除 obj/debug 文件夹并清理/重建您的项目。
  • 希望它这么简单...(
  • 重新安装 Xamarin.forms 怎么样?
  • 还是什么都没有……
  • 降级 Xamarin.forms 版本是否有效?如果不是,可能是由于visual-studio造成的。

标签: ios visual-studio debugging xamarin


【解决方案1】:

在 xamarin.ios 项目的 Main.cs 文件中放置一个 try/catch 块,并在 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
        }
 
    }
}

【讨论】:

  • 不,仍然没有。我相信它与调试器链接有关,因为复制的调试实例无需调试即可顺利运行。
【解决方案2】:

Visual Studio 版本 16.7.4 + Xamarin IOS 14.0,再次调试。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多