【问题标题】:Xamarin iOS app SIGSEGVXamarin iOS 应用程序 SIGSEGV
【发布时间】:2015-04-14 18:18:31
【问题描述】:

我的应用中偶尔会出现如下 SIGSEGV 错误(c# Xamarin iOS 应用,最新版本的 Xamarin Studio=5.8.3,Xamarin.iOS=8.9.1.3

它看起来像是在 UIKit 中崩溃了,而在我自己的应用程序“ObymobiMobileAppiOS”中它只是在“main”中。

这是什么问题? 如何获取更多信息或进行调试?

我可以通过使用该应用程序大约 5 分钟来重现它。

堆栈跟踪:

at <unknown> <0xffffffff>
at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain (int,string[],intptr,intptr) <0xffffffff>
at UIKit.UIApplication.Main (string[],intptr,intptr) [0x00005] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:62
at UIKit.UIApplication.Main (string[],string,string) [0x0001c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:45
at Obymobi.Mobile.App.iOS.Application.Main (string[]) [0x000b9] in /Users/billbatchelor/Documents/Mobile Development/AllInOne/Obymobi.Xamarin/Obymobi.Mobile.App.iOS/Main.cs:52
at (wrapper runtime-invoke) object.runtime_invoke_dynamic (intptr,intptr,intptr,intptr) <0xffffffff>

本机堆栈跟踪:

0   ObymobiMobileAppiOS                 0x00000001024ef9ac mono_handle_native_sigsegv + 264
1   ObymobiMobileAppiOS                 0x00000001024f97cc mono_sigsegv_signal_handler + 316
2   libsystem_platform.dylib            0x000000019890895c _sigtramp + 68
3   UIKit                               0x000000018b535540 <redacted> + 216
4   UIKit                               0x000000018b535030 <redacted> + 452
5   UIKit                               0x000000018b534e38 <redacted> + 216
6   UIKit                               0x000000018b534d4c <redacted> + 468
7   UIKit                               0x000000018b48fd8c <redacted> + 264
8   UIKit                               0x000000018b32ca2c <redacted> + 700
9   UIKit                               0x000000018b325f68 <redacted> + 684
10  UIKit                               0x000000018b2f918c <redacted> + 264
11  UIKit                               0x000000018b59a324 <redacted> + 15424
12  UIKit                               0x000000018b2f76a0 <redacted> + 1716
13  CoreFoundation                      0x0000000186870240 <redacted> + 24
14  CoreFoundation                      0x000000018686f4e4 <redacted> + 264
15  CoreFoundation                      0x000000018686d594 <redacted> + 712
16  CoreFoundation                      0x00000001867992d4 CFRunLoopRunSpecific + 396
17  GraphicsServices                    0x000000018ffaf6fc GSEventRunModal + 168
18  UIKit                               0x000000018b35efac UIApplicationMain + 1488
19  ObymobiMobileAppiOS                 0x0000000100b61f28 wrapper_managed_to_native_UIKit_UIApplication_UIApplicationMain_int_string___intptr_intptr + 344
20  ObymobiMobileAppiOS                 0x00000001005387c0 UIKit_UIApplication_Main_string___intptr_intptr + 48
21  ObymobiMobileAppiOS                 0x000000010053865c UIKit_UIApplication_Main_string___string_string + 188
22  ObymobiMobileAppiOS                 0x000000010009c654 Obymobi_Mobile_App_iOS_Application_Main_string__ + 1508
23  ObymobiMobileAppiOS                 0x0000000101007130 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 160
24  ObymobiMobileAppiOS                 0x00000001024fb88c mono_jit_runtime_invoke + 1260
25  ObymobiMobileAppiOS                 0x00000001025511e0 mono_runtime_invoke + 128
26  ObymobiMobileAppiOS                 0x00000001025553c4 mono_runtime_exec_main + 404
27  ObymobiMobileAppiOS                 0x00000001025c6a50 xamarin_main + 1812
28  ObymobiMobileAppiOS                 0x00000001024b9688 main + 96
29  libdyld.dylib                       0x000000019875aa08 <redacted> + 4


=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries used by your application.

更新 这是我得到的另一个没有“编辑”的 SIGSEGV 示例(这是在模拟器上):-

关于如何找到问题的更多想法?还是 Xamarin 中可能存在的错误?

本机堆栈跟踪:

0   ObymobiMobileAppiOS                 0x0011d4f7 mono_handle_native_sigsegv + 311
1   ObymobiMobileAppiOS                 0x0014c505 mono_sigsegv_signal_handler + 213
2   libsystem_platform.dylib            0x08c8003b _sigtramp + 43
3   ???                                 0xffffffff 0x0 + 4294967295
4   VectorKit                           0x10663fe9 -[VKTileProvider tileSource:didFetchTile:forKey:] + 105
5   VectorKit                           0x1067140e -[VKTileSource fetchedTile:forKey:] + 62
6   VectorKit                           0x106c2617 -[VKTileSetBackedTileSource fetchedTile:forKey:] + 247
7   VectorKit                           0x106705b5 -[VKTileSource _fetchedTile:] + 309
8   VectorKit                           0x10671985 __49-[VKTileSource decodeData:downloadKey:sourceKey:]_block_invoke_2 + 181
9   libdispatch.dylib                   0x08930d8a _dispatch_call_block_and_release + 15
10  libdispatch.dylib                   0x0894decf _dispatch_client_callout + 14
11  libdispatch.dylib                   0x0893602e _dispatch_queue_drain + 411
12  libdispatch.dylib                   0x08935d33 _dispatch_queue_invoke + 197
13  libdispatch.dylib                   0x0893820b _dispatch_root_queue_drain + 428
14  libdispatch.dylib                   0x089393e7 _dispatch_worker_thread3 + 108
15  libsystem_pthread.dylib             0x08c8d1da _pthread_wqthread + 724
16  libsystem_pthread.dylib             0x08c8ae2e start_wqthread + 30

【问题讨论】:

  • 你必须从 Xcode 得到一个符号化的日志,看这个:possiblemobile.com/2015/03/symbolicating-your-ios-crash-reports
  • 我在问题中添加了另一个没有编辑行的示例。知道问题出在哪里吗?
  • 这是两个完全不同的堆栈跟踪,可能有两个不同的原因。我以前从未见过像第二次 (VectorKit) 崩溃这样的事情,但它似乎与 Xamarin.iOS 无关,因为它似乎也发生在 Objective-C 应用程序中(例如stackoverflow.com/q/20142726/183422),而且看起来与 MapKit 相关(您在使用 MapKit 吗?)。我会开始尝试追踪第一次崩溃(在 UIKit 中),因为这可能是最容易弄清楚的(第一步总是得到一个完全符号化的崩溃报告)。
  • Rolf,你是对的,第二个堆栈跟踪与导致问题的 MKMapSnapshotter Cancel 方法有关,所以我已经发布了对该链接的答案。第一次崩溃目前没有发生,但如果我再次看到它会进行更多调查......

标签: ios xamarin segmentation-fault


【解决方案1】:

我遇到了同样的问题。就我而言,我找到了一些解决方案:

  1. 如果项目引用了本机库之上的包装器。检查包装器和您的项目是否具有相同的架构 - 经典 API 或统一 API。 1.1 尝试重建原生项目。 1.2 从解决方案中删除项目包装器并仅添加对输出库的引用。

  2. 有时,本机对象比 .NET 更早被销毁。在这种情况下,.NET 对象内部有异常,并且此错误无法通过 try-catch 捕获。 需要正确处理对象。

  3. 尝试在 xcode 中查看崩溃报告以获取更多详细信息。

【讨论】:

    【解决方案2】:

    我在使用 UIDocumentInteractionController 时遇到了这个问题。我将此类的实例用作本地参数,并且垃圾收集器甚至在函数执行完成之前就刷新了该实例。将该实例应用于全局范围解决了我的问题。

    【讨论】:

      【解决方案3】:

      Xamarin 在 OS X 和 Windows 上的版本是否相同?我有类似的错误。当我更新 Xamarin 时,一切都很好。

      【讨论】:

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