xamarin.ios - 来自崩溃日志Xamarin.iOS的更多详细信息

标签 xamarin.ios crash

我的试飞用户之一在每次加载应用程序时都遇到崩溃。我无法在我的测试设备或模拟器上重现此内容。

我有崩溃报告,并相信我已在blog之后对其进行了充分的符号化。

但是我无法将错误映射回我的代码:

Date/Time:           2017-09-04 20:37:34.8879 +0100
Launch Time:         2017-09-04 20:36:50.5258 +0100
OS Version:          iPhone OS 10.2.1 (14D27)
Report Version:      104

Exception Type:  EXC_BAD_ACCESS (SIGABRT)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000000
Triggered by Thread:  0

Thread 0 name:
Thread 0 Crashed:
0   libsystem_kernel.dylib          0x0000000185433014 __pthread_kill + 8
1   libsystem_pthread.dylib         0x00000001854fb450 pthread_kill + 112 (pthread.c:1366)
2   libsystem_c.dylib               0x00000001853a7400 abort + 140 (abort.c:91)
3   planit                          0x0000000101235da8 mono_handle_native_crash (mini-exceptions.c:2548)
4   libsystem_platform.dylib        0x00000001854f5348 _sigtramp + 52 (sigtramp.c:115)
5   libsystem_pthread.dylib         0x00000001854fb450 pthread_kill + 112 (pthread.c:1366)
6   libsystem_c.dylib               0x00000001853a7400 abort + 140 (abort.c:91)
7   planit                          0x0000000101333414 xamarin_printf (runtime.m:2218)
8   planit                          0x0000000101271a9c mono_invoke_unhandled_exception_hook (exception.c:1084)
9   planit                          0x00000001012359e4 mono_handle_exception_internal (mini-exceptions.c:1886)
10  planit                          0x0000000101234a84 mono_handle_exception (mini-exceptions.c:2117)
11  planit                          0x000000010122d458 mono_arm_throw_exception (exceptions-arm64.c:411)
12  planit                          0x000000010041c278 throw_exception + 168
13  planit                          0x000000010032289c System_Runtime_ExceptionServices_ExceptionDispatchInfo_Throw + 44
14  planit                          0x00000001003252e4 System_Runtime_CompilerServices_AsyncMethodBuilderCore__c__ThrowAsyncb__6_0_object + 84
15  planit                          0x0000000100c2f808 UIKit_UIKitSynchronizationContext__Postc__AnonStorey0__m__0 (UIKitSynchronizationContext.cs:24)
16  planit                          0x0000000100c1be34 Foundation_NSAsyncActionDispatcher_Apply (NSAction.cs:163)
17  planit                          0x00000001003ecc24 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 244
18  planit                          0x0000000101243010 mono_jit_runtime_invoke (mini-runtime.c:2526)
19  planit                          0x00000001012a7df0 do_runtime_invoke (object.c:2829)
20  planit                          0x00000001012a7d50 mono_runtime_invoke (object.c:2983)
21  planit                          0x00000001000a8204 native_to_managed_trampoline_1(objc_object*, objc_selector*, _MonoMethod**, unsigned int) (registrar.m:25)
22  planit                          0x00000001000a853c -[__MonoMac_NSAsyncActionDispatcher xamarinApplySelector] (registrar.m:4355)
23  Foundation                      0x0000000186f79048 __NSThreadPerformPerform + 340 (NSThread.m:1247)
24  CoreFoundation                  0x0000000186412b5c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24 (CFRunLoop.c:1943)
25  CoreFoundation                  0x00000001864124a4 __CFRunLoopDoSources0 + 524 (CFRunLoop.c:1989)
26  CoreFoundation                  0x00000001864100a4 __CFRunLoopRun + 804 (CFRunLoop.c:2821)
27  CoreFoundation                  0x000000018633e2b8 CFRunLoopRunSpecific + 444 (CFRunLoop.c:3113)
28  GraphicsServices                0x0000000187df2198 GSEventRunModal + 180 (GSEvent.c:2245)
29  UIKit                           0x000000018c3857fc -[UIApplication _run] + 684 (UIApplication.m:2650)
30  UIKit                           0x000000018c380534 UIApplicationMain + 208 (UIApplication.m:4092)
31  planit                          0x0000000100c6fc10 wrapper_managed_to_native_UIKit_UIApplication_UIApplicationMain_int_string___intptr_intptr (/<unknown>:1)
32  planit                          0x0000000100c2de8c UIKit_UIApplication_Main_string___intptr_intptr (UIApplication.cs:79)
33  planit                          0x0000000100c2de4c UIKit_UIApplication_Main_string___string_string (UIApplication.cs:63)
34  planit                          0x00000001000cbef4 planit_Application_Main_string__ (Main.cs:13)
35  planit                          0x00000001003ecc24 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 244
36  planit                          0x0000000101243010 mono_jit_runtime_invoke (mini-runtime.c:2526)
37  planit                          0x00000001012a7df0 do_runtime_invoke (object.c:2829)
38  planit                          0x00000001012aa7bc do_exec_main_checked (object.c:4624)
39  planit                          0x000000010122cc68 mono_jit_exec (driver.g.c:1040)
40  planit                          0x0000000101337168 xamarin_main (monotouch-main.m:482)
41  planit                          0x00000001000c75bc main (main.m:79)
42  libdyld.dylib                   0x00000001853215b8 start + 4

谁能指出我正确的方向?

最佳答案

我们跟踪使要求测试人员浏览的应用程序崩溃的异常的方法是,挂接到iOS的全局异常处理程序,并使用我们编写的类将信息记录到IO。

类:

using System;
using System.IO;
using UIKit;

namespace namespace.TestingLogs
{
    public static class ApplicationLog
    {
        private static string _filename = "LogFile-";

        public static void CreateFile(string SessionFilename)
        {
            _filename += SessionFilename;

            var docs = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            var filename = Path.Combine(docs, _filename);
            var Device = UIDevice.CurrentDevice;
            File.AppendAllText(filename, ("======Device Information======" + Environment.NewLine));
            File.AppendAllText(filename, ("Battery Level: " + Device.BatteryLevel + Environment.NewLine));
            File.AppendAllText(filename, ("Model: " + Device.Model + Environment.NewLine));
            File.AppendAllText(filename, ("System Version: " + Device.SystemVersion + Environment.NewLine));
            File.AppendAllText(filename, ("[" + DateTime.UtcNow.ToString() + "]" + "======Start Log======" + Environment.NewLine + Environment.NewLine));
            Console.WriteLine("[] = " + filename);
        }

        public static void AppendFile(string appendText)
        {
            var txt = Environment.NewLine + appendText;

            var docs = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            var filename = Path.Combine(docs, _filename);
            File.AppendAllText(filename, txt);
        }
    }

    public class ExitAppException : Exception
    {
        public ExitAppException() { }
        public ExitAppException(string message) : base(message) { }
        public ExitAppException(string message, Exception inner) :
        base(message, inner)
        { }
    }
}

通过在“FinishedLaunching”方法中执行以下操作,挂接到AppDelegate.cs中的全局未处理事件:
        AppDomain.CurrentDomain.UnhandledException += (object sender, UnhandledExceptionEventArgs e) =>
        {
            try
            {
                //Record the error in our application logs

                ApplicationLog.AppendFile(
                    DateTime.Now.ToString() + "  :  " + "[CRITICAL GLOBALLY HANDLED EXCEPTION] - Critical exception has been hit! - Message: " + e.ExceptionObject +
                        Environment.NewLine + Environment.NewLine +
                            "========= Critcal Error has been hit, application closed =========" +
                                Environment.NewLine + Environment.NewLine
                    );
            }
            catch (Exception genEx)
            {
                var Error = genEx.Message;
            }
        };

显然,请使用最适合您的措辞。可以随意使用字符串构建器来代替我们使用它的方式,但是总体概念是相同的。然后,您的用户可以下载“macgo iphone资源管理器”(免费)之类的内容并访问应用程序文档文件夹,该日志文件位于其中,因此他们仅通过电子邮件将其发送给您。希望这有所帮助。

关于xamarin.ios - 来自崩溃日志Xamarin.iOS的更多详细信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46049526/

相关文章:

ios - 无法弄清楚如何在 Visual Studio 2019 上使用 Xamarin 将 iOS Apps Ad Hoc 发送到某些 iPhone

xamarin.ios - 自定义 Xamarin.Forms 布局

xamarin.ios - 为 IOS 创建 AOT list (ExecutionEngineException)

c# - MonoTouch 中的按钮问题

c# - Xamarin.iOS 具有等效标识错误的多个程序集

crash - vo,ao指令崩溃

visual-studio-2015 - Visual Studio 2015 社区在启动时崩溃

excel - 避免多次运行IE Web抓取时崩溃VBA

asp.net - 导致应用程序崩溃的未处理异常,日志中显示 "EventType clr20r3, P1 w3wp.exe",但没有详细信息

ipad - iPad使崩溃报告有意义