调用MonoTouch.UIKit.UIDevice.CurrentDevice.SystemVersion时发生崩溃 - c#

调用MonoTouch.UIKit.UIDevice.CurrentDevice.SystemVersion时发生崩溃。它发生在模拟器上。我无法轻松地重现它。

用法上下文:
目的是显示正在播放的视频的进度。因为iOS 4.X不支持SetProgress(v,false)。 MonoTouch 5.X中不再提供旧的SetProgress(v)API,目前我们不显示缓冲进度。

欢呼声,中国人民银行

Stacktrace:

at (wrapper managed-to-native) MonoTouch.ObjCRuntime.Messaging.IntPtr_objc_msgSend (intptr,intptr) <IL 0x00026, 0xffffffff>
at MonoTouch.UIKit.UIDevice.get_SystemVersion () [0x0000b] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIDevice.g.cs:189
at Dartfish.ControlsX.DFScrubBar.SetDownloadProgressValue (single) [0x00000] in /Users/patrick/Work/Dartfish/Dartfish Mobile/Source/SDKs/SystemSDK/Source/ControlsX/MonoTouch/DFScrubBar.cs:118
at MonoTouchPresenter.Common.PlaybackControlBar.UpdateBufferingProgress () [0x00017] in /Users/patrick/Work/Dartfish/Dartfish Mobile/Source/Application/Dartfish.tv/iOS/MonoTouch/Common/Views/PlaybackControlBar.cs:461
at MonoTouchPresenter.Common.PlaybackControlBar.OnVideoPlayerViewModelPropertyChanged (object,System.ComponentModel.PropertyChangedEventArgs) [0x00065] in /Users/patrick/Work/Dartfish/Dartfish Mobile/Source/Application/Dartfish.tv/iOS/MonoTouch/Common/Views/PlaybackControlBar.cs:383
at (wrapper delegate-invoke) <Module>.invoke_void__this___object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs) <IL 0x00027, 0x000a8>
at (wrapper delegate-invoke) <Module>.invoke_void__this___object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs) <IL 0x00027, 0x000a8>
at (wrapper delegate-invoke) <Module>.invoke_void__this___object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs) <IL 0x00059, 0xffffffff>
at Dartfish.Common.BindableObject.RaisePropertyChanged (string) [0x0002b] in /Users/patrick/Work/Dartfish/Dartfish Mobile/Source/SDKs/CommonSDK/Source/Common/BindableObject.cs:40
at Dartfish.ViewModel.Player.VideoPlayerViewModel.videoPlayer_BufferingProgressChanged (object,Dartfish.Component.Media.VideoEventArgs) [0x00000] in /Users/patrick/Work/Dartfish/Dartfish Mobile/Source/ViewModel/PlayerViewModel/Implementations/VideoPlayer/VideoPlayerViewModel.cs:2386
at Dartfish.Component.MediaCommon.GenericMatchPlayer.RaiseEvent (Dartfish.Component.Media.VideoEventHandler,object,Dartfish.Component.Media.VideoEventArgs) [0x00006] in /Users/patrick/Work/Dartfish/Dartfish Mobile/Source/SDKs/MediaComponentSDK/Source/MediaComponentCommon/Implementations/VideoPlayer/VideoPlayer.cs:2434
at Dartfish.Component.MediaCommon.GenericMatchPlayer.OnBufferingProgressChanged (object,Dartfish.Component.Media.VideoEventArgs) [0x00000] in /Users/patrick/Work/Dartfish/Dartfish Mobile/Source/SDKs/MediaComponentSDK/Source/MediaComponentCommon/Implementations/VideoPlayer/VideoPlayer.cs:2406
at Dartfish.Component.MediaCommon.VideoControl.OnBufferingProgressChanged (object,Dartfish.Component.Media.VideoEventArgs) [0x00096] in /Users/patrick/Work/Dartfish/Dartfish Mobile/Source/SDKs/MediaComponentSDK/Source/MediaComponentCommon/Implementations/VideoPlayer/VideoControl.cs:2621
at Dartfish.Component.MediaCommon.VideoControl.TimerCallback2 () [0x00366] in /Users/patrick/Work/Dartfish/Dartfish Mobile/Source/SDKs/MediaComponentSDK/Source/MediaComponentCommon/Implementations/VideoPlayer/VideoControl.cs:2459
at Dartfish.Component.MediaCommon.VideoControl.m_timer_Tick (object,System.EventArgs) [0x00000] in /Users/patrick/Work/Dartfish/Dartfish Mobile/Source/SDKs/MediaComponentSDK/Source/MediaComponentCommon/Implementations/VideoPlayer/VideoControl.cs:2166
at System.Windows.Threading.DispatcherTimer.InternalTick () [0x00019] in /Users/patrick/Work/Dartfish/Dartfish Mobile/Source/SDKs/CommonSDK/Source/Common/DispatcherTimer.cs:203
at MonoTouch.Foundation.NSActionDispatcher.Apply () [0x00000] in /Developer/MonoTouch/Source/monotouch/src/shared/Foundation/NSAction.cs:48
at (wrapper runtime-invoke) object.runtime_invoke_void__this__ (object,intptr,intptr,intptr) <IL 0x0004e, 0xffffffff>
at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication.UIApplicationMain (int,string[],intptr,intptr) <IL 0x0009f, 0xffffffff>
at MonoTouch.UIKit.UIApplication.Main (string[],string,string) [0x00042] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:29
at MonoTouchPresenter.Application.Main (string[]) [0x00000] in /Users/patrick/Work/Dartfish/Dartfish Mobile/Source/Application/Dartfish.tv/iOS/MonoTouch/Main.cs:16
at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <IL 0x00050, 0xffffffff>

Native stacktrace:

0   MonoTouchPresenter                  0x0007e5cc mono_handle_native_sigsegv + 284
1   MonoTouchPresenter                  0x00009af8 mono_sigsegv_signal_handler + 248
2   libsystem_c.dylib                   0x94b5159b _sigtramp + 43
3   ???                                 0xffffffff 0x0 + 4294967295
4   libsystem_c.dylib                   0x94b17903 szone_malloc_should_clear + 899
5   libsystem_c.dylib                   0x94b1866b szone_malloc + 24
6   libsystem_c.dylib                   0x94b4e962 malloc_zone_malloc + 77
7   CoreFoundation                      0x0175ca88 __CFAllocatorSystemAllocate + 24
8   CoreFoundation                      0x0175ca63 CFAllocatorAllocate + 147
9   CoreFoundation                      0x0175c8de _CFRuntimeCreateInstance + 270
10  CoreFoundation                      0x0175ed13 __CFStringCreateImmutableFunnel3 + 1955
11  CoreFoundation                      0x017664be CFStringCreateWithBytes + 94
12  CoreFoundation                      0x01783b56 _CFPropertyListCreateWithData + 822
13  CoreFoundation                      0x0178381a CFPropertyListCreateWithData + 58
14  libMobileGestalt.dylib              0x0537a069 load_dict + 433
15  libMobileGestalt.dylib              0x0537a351 copySystemVersionDictionary + 204
16  libMobileGestalt.dylib              0x0537be70 copyProductVersion + 20
17  libMobileGestalt.dylib              0x0537abd2 copyRealAnswer + 132
18  UIKit                               0x00b87a65 -[UIDevice deviceInfoForKey:] + 32
19  UIKit                               0x00b87c53 -[UIDevice systemVersion] + 44
20  ???                                 0x0bb60763 0x0 + 196478819
21  ???                                 0x111c9d04 0x0 + 287087876
22  ???                                 0x111c9bc5 0x0 + 287087557
23  ???                                 0x111c9a0c 0x0 + 287087116
24  ???                                 0x111c64c0 0x0 + 287073472
25  ???                                 0x0d09caaa 0x0 + 218745514
26  ???                                 0x0d09ca41 0x0 + 218745409
27  ???                                 0x0d09ca41 0x0 + 218745409
28  ???                                 0x0d09b9b8 0x0 + 218741176
29  ???                                 0x112aa45c 0x0 + 288007260
30  ???                                 0x11210990 0x0 + 287377808
31  ???                                 0x112aa414 0x0 + 288007188
32  ???                                 0x112ab2f3 0x0 + 288010995
33  ???                                 0x112a60ac 0x0 + 287989932
34  ???                                 0x112a536c 0x0 + 287986540
35  ???                                 0x112a34a2 0x0 + 287978658
36  ???                                 0x101885b8 0x0 + 270042552
37  ???                                 0x09ddbd48 0x0 + 165526856
38  MonoTouchPresenter                  0x0000dde2 mono_jit_runtime_invoke + 722
39  MonoTouchPresenter                  0x00153b4e mono_runtime_invoke + 126
40  MonoTouchPresenter                  0x001fbde8 monotouch_trampoline + 3416
41  Foundation                          0x005c4eb6 __NSFireTimer + 113
42  CoreFoundation                      0x0182c936 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 22
43  CoreFoundation                      0x0182c3d7 __CFRunLoopDoTimer + 551
44  CoreFoundation                      0x0178f790 __CFRunLoopRun + 1888
45  CoreFoundation                      0x0178ed84 CFRunLoopRunSpecific + 212
46  CoreFoundation                      0x0178ec9b CFRunLoopRunInMode + 123
47  GraphicsServices                    0x0286c7d8 GSEventRunModal + 190
48  GraphicsServices                    0x0286c88a GSEventRun + 103
49  UIKit                               0x009b1626 UIApplicationMain + 1163
50  ???                                 0x0bb5b005 0x0 + 196456453
51  ???                                 0x0bb5a0e0 0x0 + 196452576
52  ???                                 0x0bb59db8 0x0 + 196451768
53  ???                                 0x0bb59f2e 0x0 + 196452142
54  MonoTouchPresenter                  0x0000dde2 mono_jit_runtime_invoke + 722
55  MonoTouchPresenter                  0x00153b4e mono_runtime_invoke + 126
56  MonoTouchPresenter                  0x00157d44 mono_runtime_exec_main + 420
57  MonoTouchPresenter                  0x001580b5 mono_runtime_run_main + 725
58  MonoTouchPresenter                  0x00068165 mono_jit_exec + 149
59  MonoTouchPresenter                  0x0000762c main + 3052
60  MonoTouchPresenter                  0x00002825 start + 53

 =================================================================
 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.
 =================================================================

参考方案

这是内存损坏。某物(在调用CurrentDevice.SystemVersion之前)损坏了内存,然后在一段时间后崩溃(在这种情况下,当分配内存时)。

由于分配内存非常普遍,因此很可能在调用CurrentDevice.SystemVersion之前不久就发生了损坏。

我建议您尝试制作尽可能小的样本,这也可能会告诉您确切的问题所在。