Xamarin.iOS application freezes on iOS 13 - ios

I have Xamarin Native (iOS/Android) application. The application works without problems on iOS 12 and below. If you run the application on the device with iOS 13, then it starts to freeze for unknown reasons and this bug doesn't have clear steps to reproduce, it occurs on different screens.
This is stacktrace from Visual Studio for Mac
=================================================================
Native Crash Reporting
=================================================================
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.
=================================================================
=================================================================
Native stacktrace:
=================================================================
0x1003ea775 - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : mono_dump_native_crash_info
0x1003de6b5 - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : mono_handle_native_crash
0x1003f19f1 - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : mono_sigsegv_signal_handler_debug
0x10790bb1d - /usr/lib/system/libsystem_platform.dylib : _sigtramp
0x111ab5e38 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : OBJC_CLASS_$_UIView
0x122711c6b - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/VectorKit.framework/VectorKit : _ZNSt3__110shared_ptrIN3ggl6BufferEED2Ev
0x1227397f3 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/VectorKit.framework/VectorKit : _ZNSt3__110shared_ptrIN3ggl12ConstantDataEED2Ev
0x122c98778 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/VectorKit.framework/VectorKit : _ZNSt3__113__vector_baseIN3ggl19ConstantDataElementEN3geo12StdAllocatorIS2_NS1_9AllocatorEEEED2Ev
0x122c9850c - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/VectorKit.framework/VectorKit : _ZN3ggl13PipelineSetupD2Ev
0x1227b3d24 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/VectorKit.framework/VectorKit : _ZN3ggl6Circle17FillPipelineSetupD0Ev
0x122b3059d - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/VectorKit.framework/VectorKit : _ZNSt3__120__shared_ptr_emplaceIN2md23CircleOverlayRenderableENS_9allocatorIS2_EEE16__on_zero_sharedEv
0x12281c40b - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/VectorKit.framework/VectorKit : _ZNSt3__110shared_ptrIN2md23CircleOverlayRenderableEED2Ev
0x1068eff02 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libobjc.A.dylib : _ZL27object_cxxDestructFromClassP11objc_objectP10objc_class
0x1068ff3c9 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libobjc.A.dylib : objc_destructInstance
0x10690598f - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libobjc.A.dylib : -[NSObject dealloc]
0x122b2eb22 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/VectorKit.framework/VectorKit : -[VKVectorOverlayCircle dealloc]
0x106906116 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libobjc.A.dylib : _ZN11objc_object17sidetable_releaseEb
0x1068eff02 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libobjc.A.dylib : _ZL27object_cxxDestructFromClassP11objc_objectP10objc_class
0x1068ff3c9 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libobjc.A.dylib : objc_destructInstance
0x10690598f - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libobjc.A.dylib : -[NSObject dealloc]
0x101d63e52 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/MapKit.framework/MapKit : -[MKOverlayRenderer dealloc]
0x101d63d9b - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/MapKit.framework/MapKit : -[MKOverlayPathRenderer dealloc]
0x106906116 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libobjc.A.dylib : _ZN11objc_object17sidetable_releaseEb
0x100640abd - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : xamarin_release_managed_ref
0x12a596bbc - Unknown
0x132b427b9 - Unknown
0x1003f4dd5 - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : mono_jit_runtime_invoke
0x1005210e7 - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : mono_runtime_invoke_checked
0x100524a6e - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : mono_runtime_invoke
0x10064a822 - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : xamarin_invoke_trampoline
0x10065257b - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : xamarin_arch_trampoline
0x100653782 - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : xamarin_x86_64_common_trampoline
0x100dd0d10 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Foundation.framework/Foundation : __NSThreadPerformPerform
0x105b2e271 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation : _CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION_
0x105b2e19c - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation : __CFRunLoopDoSource0
0x105b2d974 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation : __CFRunLoopDoSources0
0x105b2867f - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation : __CFRunLoopRun
0x105b27e66 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation : CFRunLoopRunSpecific
0x10ca74bb0 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices : GSEventRunModal
0x110d41dd0 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : UIApplicationMain
0x12a4abae2 - Unknown
0x12a4ab833 - Unknown
0x12940fae3 - Unknown
0x12940ffb9 - Unknown
0x1003f4dd5 - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : mono_jit_runtime_invoke
0x1005210e7 - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : mono_runtime_invoke_checked
0x10052756c - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : mono_runtime_exec_main_checked
0x100354a22 - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : mono_jit_exec
0x100651a1e - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : xamarin_main
0x10030f4a7 - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : main
0x107528d29 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libdyld.dylib : start
0x3 - Unknown
=================================================================
Basic Fault Address Reporting
=================================================================
Memory around native instruction pointer (0x122cb448d):0x122cb447d 48 8b 7f 08 48 85 ff 74 13 48 8b 73 10 48 8b 07 H...H..t.H.s.H..
0x122cb448d ff 50 10 b8 ad ba ad de 48 89 43 10 48 83 c4 08 .P......H.C.H...
0x122cb449d 5b 5d c3 55 48 89 e5 53 50 48 89 fb 48 8d 05 90 [].UH..SPH..H...
0x122cb44ad f2 29 00 48 89 07 48 8b 7f 08 48 85 ff 74 0a 48 .).H..H...H..t.H
=================================================================
Managed Stacktrace:
=================================================================
at <unknown> <0xffffffff>
at Foundation.NSObject:xamarin_release_managed_ref <0x000cb>
at Foundation.NSObject:ReleaseManagedRef <0x0007a>
at NSObject_Disposer:Drain <0x00392>
at <Module>:runtime_invoke_void_object <0x001a8>
at <unknown> <0xffffffff>
at UIKit.UIApplication:UIApplicationMain <0x00251>
at UIKit.UIApplication:Main <0x000b2>
at UIKit.UIApplication:Main <0x00132>
at MyApp.iOS.Application:Main <0x00202>
at <Module>:runtime_invoke_void_object <0x001a8>
=================================================================
The first thing that comes to mind is problems with disposing of some NSObject (possible some memory leak), but it is very strange that this problem doesn't reproduce on slower devices with a lower version of iOS.
Please tell me if anyone else has encountered a similar problem. Are there any assumptions about the source of the problem?

I found the reason of this bug and it related to disposing of MKMapView. On few screens where I display map I added Overlays (MKCircle) and OverlayRenderers (MKCircleRenderer) to the map and references to those Overlays and OverlayRenderers contains in private variables. So the main problem was is that during of screen disposing was disposed only map (MKMapView) object but not private variables with references to map Overlay and OverlayRenderer. After adding explicit disposing of this variables this bug has disappeared.

Related

Unable to convert [UInt8] to String. Error: EXC_BAD_ACCESS

I am trying to convert a UInt8 array to string but it is returning me nil.
func send(data: [UInt8]?) {
if(data == nil || data?.count == 0) { return }
let dataString = String(data: Data(bytes: data!, count: data!.count), encoding : String.Encoding.utf8)
print("DataString: \(dataString ?? "J[]")")
if(self.webSocket != nil) {
self.webSocket!.send(text: dataString ?? "J[]" )
}
}
when this function is called it has the input as
Optional<Array<UInt8>>
▿ some : 471 elements
- 0 : 68
- 1 : 31
- 2 : 139
- 3 : 8
- 4 : 0
- 5 : 0
- 6 : 0
- 7 : 0
- 8 : 0
- 9 : 0
- 10 : 19
- 11 : 117
- 12 : 148
- 13 : 201
- 14 : 82
- 15 : 228
- 16 : 48
- 17 : 12
- 18 : 134
- 19 : 223
- 20 : 197
- 21 : 103
- 22 : 29
- 23 : 108
- 24 : 45
- 25 : 142
- 26 : 211
- 27 : 199
- 28 : 169
- 29 : 225
- 30 : 1
- 31 : 88
- 32 : 102
- 33 : 46
- 34 : 20
- 35 : 135
- 36 : 0
- 37 : 125
- 38 : 27
- 39 : 104
- 40 : 10
- 41 : 194
- 42 : 129
- 43 : 162
- 44 : 120
- 45 : 119
- 46 : 36
- 47 : 47
- 48 : 77
- 49 : 22
- 50 : 79
- 51 : 37
- 52 : 94
- 53 : 218
- 54 : 95
- 55 : 44
- 56 : 75
- 57 : 191
- 58 : 228
- 59 : 190
- 60 : 253
- 61 : 116
- 62 : 243
- 63 : 155
- 64 : 59
- 65 : 4
- 66 : 225
- 67 : 68
- 68 : 126
- 69 : 148
- 70 : 72
- 71 : 41
- 72 : 50
- 73 : 184
- 74 : 199
- 75 : 105
- 76 : 158
- 77 : 220
- 78 : 225
- 79 : 211
- 80 : 221
- 81 : 127
- 82 : 204
- 83 : 71
- 84 : 165
- 85 : 183
- 86 : 40
- 87 : 2
- 88 : 24
- 89 : 34
- 90 : 228
- 91 : 17
- 92 : 5
- 93 : 136
- 94 : 64
- 95 : 16
- 96 : 226
- 97 : 8
- 98 : 1
- 99 : 61
- 100 : 4
- 101 : 47
- 102 : 218
- 103 : 16
- 104 : 188
- 105 : 62
- 106 : 195
- 107 : 96
- 108 : 175
- 109 : 7
- 110 : 46
- 111 : 63
- 112 : 61
- 113 : 36
- 114 : 109
- 115 : 33
- 116 : 128
- 117 : 62
- 118 : 162
- 119 : 179
- 120 : 182
- 121 : 26
- 122 : 235
- 123 : 24
- 124 : 56
- 125 : 26
- 126 : 138
- 127 : 11
- 128 : 52
- 129 : 54
- 130 : 164
- 131 : 7
- 132 : 40
- 133 : 178
- 134 : 253
- 135 : 212
- 136 : 150
- 137 : 106
- 138 : 179
- 139 : 30
- 140 : 109
- 141 : 143
- 142 : 44
- 143 : 64
- 144 : 30
- 145 : 163
- 146 : 237
- 147 : 193
- 148 : 161
- 149 : 135
- 150 : 6
- 151 : 155
- 152 : 179
- 153 : 223
- 154 : 152
- 155 : 195
- 156 : 58
- 157 : 227
- 158 : 113
- 159 : 225
- 160 : 194
- 161 : 112
- 162 : 222
- 163 : 147
- 164 : 20
- 165 : 137
- 166 : 95
- 167 : 32
- 168 : 244
- 169 : 141
- 170 : 37
- 171 : 85
- 172 : 3
- 173 : 194
- 174 : 216
- 175 : 119
- 176 : 143
- 177 : 36
- 178 : 171
- 179 : 162
- 180 : 58
- 181 : 108
- 182 : 220
- 183 : 64
- 184 : 175
- 185 : 1
- 186 : 83
- 187 : 4
- 188 : 26
- 189 : 118
- 190 : 144
- 191 : 33
- 192 : 22
- 193 : 89
- 194 : 36
- 195 : 171
- 196 : 26
- 197 : 117
- 198 : 8
- 199 : 88
- 200 : 154
- 201 : 87
- 202 : 63
- 203 : 124
- 204 : 54
- 205 : 175
- 206 : 70
- 207 : 147
- 208 : 13
- 209 : 172
- 210 : 64
- 211 : 213
- 212 : 9
- 213 : 62
- 214 : 3
- 215 : 66
- 216 : 144
- 217 : 102
- 218 : 44
- 219 : 7
- 220 : 128
- 221 : 155
- 222 : 99
- 223 : 23
- 224 : 11
- 225 : 26
- 226 : 169
- 227 : 70
- 228 : 164
- 229 : 186
- 230 : 115
- 231 : 202
- 232 : 125
- 233 : 209
- 234 : 219
- 235 : 150
- 236 : 82
- 237 : 102
- 238 : 17
- 239 : 36
- 240 : 213
- 241 : 143
- 242 : 116
- 243 : 98
- 244 : 235
- 245 : 163
- 246 : 217
- 247 : 95
- 248 : 33
- 249 : 201
- 250 : 8
- 251 : 219
- 252 : 102
- 253 : 82
- 254 : 79
- 255 : 200
- 256 : 50
- 257 : 198
- 258 : 59
- 259 : 225
- 260 : 209
- 261 : 142
- 262 : 46
- 263 : 112
- 264 : 159
- 265 : 21
- 266 : 204
- 267 : 177
- 268 : 152
- 269 : 26
- 270 : 220
- 271 : 79
- 272 : 139
- 273 : 161
- 274 : 181
- 275 : 194
- 276 : 1
- 277 : 34
- 278 : 215
- 279 : 202
- 280 : 225
- 281 : 85
- 282 : 174
- 283 : 216
- 284 : 252
- 285 : 23
- 286 : 95
- 287 : 29
- 288 : 54
- 289 : 74
- 290 : 251
- 291 : 180
- 292 : 233
- 293 : 129
- 294 : 41
- 295 : 51
- 296 : 238
- 297 : 177
- 298 : 44
- 299 : 51
- 300 : 75
- 301 : 118
- 302 : 224
- 303 : 199
- 304 : 172
- 305 : 214
- 306 : 83
- 307 : 54
- 308 : 85
- 309 : 74
- 310 : 213
- 311 : 244
- 312 : 222
- 313 : 196
- 314 : 16
- 315 : 48
- 316 : 101
- 317 : 136
- 318 : 157
- 319 : 248
- 320 : 44
- 321 : 2
- 322 : 99
- 323 : 212
- 324 : 221
- 325 : 168
- 326 : 142
- 327 : 24
- 328 : 228
- 329 : 46
- 330 : 180
- 331 : 242
- 332 : 87
- 333 : 56
- 334 : 108
- 335 : 148
- 336 : 17
- 337 : 104
- 338 : 247
- 339 : 102
- 340 : 91
- 341 : 122
- 342 : 132
- 343 : 103
- 344 : 20
- 345 : 124
- 346 : 207
- 347 : 151
- 348 : 88
- 349 : 33
- 350 : 242
- 351 : 57
- 352 : 192
- 353 : 96
- 354 : 25
- 355 : 104
- 356 : 184
- 357 : 132
- 358 : 97
- 359 : 10
- 360 : 252
- 361 : 136
- 362 : 195
- 363 : 160
- 364 : 121
- 365 : 211
- 366 : 151
- 367 : 83
- 368 : 51
- 369 : 205
- 370 : 241
- 371 : 191
- 372 : 56
- 373 : 174
- 374 : 175
- 375 : 15
- 376 : 215
- 377 : 146
- 378 : 178
- 379 : 62
- 380 : 149
- 381 : 227
- 382 : 161
- 383 : 123
- 384 : 91
- 385 : 98
- 386 : 49
- 387 : 184
- 388 : 190
- 389 : 14
- 390 : 82
- 391 : 9
- 392 : 237
- 393 : 8
- 394 : 233
- 395 : 181
- 396 : 195
- 397 : 124
- 398 : 215
- 399 : 145
- 400 : 250
- 401 : 117
- 402 : 19
- 403 : 169
- 404 : 36
- 405 : 241
- 406 : 14
- 407 : 220
- 408 : 243
- 409 : 244
- 410 : 116
- 411 : 116
- 412 : 7
- 413 : 247
- 414 : 247
- 415 : 52
- 416 : 31
- 417 : 95
- 418 : 29
- 419 : 184
- 420 : 183
- 421 : 121
- 422 : 122
- 423 : 157
- 424 : 127
- 425 : 233
- 426 : 191
- 427 : 154
- 428 : 59
- 429 : 248
- 430 : 175
- 431 : 51
- 432 : 125
- 433 : 127
- 434 : 249
- 435 : 119
- 436 : 154
- 437 : 30
- 438 : 127
- 439 : 159
- 440 : 30
- 441 : 222
- 442 : 159
- 443 : 142
- 444 : 207
- 445 : 179
- 446 : 126
- 447 : 54
- 448 : 127
- 449 : 188
- 450 : 216
- 451 : 250
- 452 : 213
- 453 : 197
- 454 : 229
- 455 : 159
- 456 : 139
- 457 : 235
- 458 : 27
- 459 : 247
- 460 : 117
- 461 : 247
- 462 : 13
- 463 : 251
- 464 : 171
- 465 : 44
- 466 : 100
- 467 : 39
- 468 : 5
- 469 : 0
- 470 : 0
And when this data is converted to string I am getting dataString as nil . And when I tried to debug I found this log
expression produced error: error: Execution was interrupted, reason:
EXC_BAD_ACCESS (code=2, address=0x16f174000). The process has been
returned to the state before expression evaluation.
My code is using this methods several times before and was working fine.
The reason for the failure is most likely the \0 bytes in the array and the data seems not to be an UTF8 string.
This is a more straightforward syntax. The parameter data is non-optional since when you call this method you want to send data.
if(self.webSocket != nil) { self.webSocket!... is pretty objective-c-ish. In Swift there is Optional chanining
func send(data: [UInt8]) {
guard !data.isEmpty, let dataString = String(data: Data(data), encoding: .utf8) else { return }
print("DataString:", dataString)
self.webSocket?.send(text: dataString)
}

Firebase App configuration crash

I have a custom keyboard for iOS that uses Firebase for analytics. The Firebase app configuration is done at the initializer with a dispatch_once clause with the token as a global variable.
var token: dispatch_once_t = 0
class KeyboardViewController: UIInputViewController {
// ..
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
dispatch_once(&token) {
FIRApp.configure()
} // line 90
}
// ..
}
This is working fine but I am receiving many crash reports that indicate crashes on many devices when the app is configured. I am stuck for days trying to figure out the cause. Here is a part of one of the crash reports stack trace:
Exception Type: EXC_CRASH (SIGQUIT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Termination Signal: Quit: 3
Termination Reason: Namespace SIGNAL, Code 0x3
Terminating Process: launchd [1]
Triggered by Thread: 0
Thread 0 name:
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x000000018fab6338 __semwait_signal_nocancel + 8
1 libsystem_c.dylib 0x000000018f9e20dc nanosleep$NOCANCEL + 200 (nanosleep.c:104)
2 libsystem_c.dylib 0x000000018fa0568c sleep$NOCANCEL + 44 (sleep.c:62)
3 libsystem_dnssd.dylib 0x000000018fa6e7d4 ConnectToServer + 832 (dnssd_clientstub.c:607)
4 libsystem_dnssd.dylib 0x000000018fa6ff44 DNSServiceCreateConnection + 76 (dnssd_clientstub.c:1785)
5 libsystem_network.dylib 0x000000018fb2d318 __nw_resolver_set_update_handler_block_invoke + 872 (resolver.m:1031)
6 libdispatch.dylib 0x000000018f9711c0 _dispatch_client_callout + 16 (object.m:455)
7 libdispatch.dylib 0x000000018f97e860 _dispatch_barrier_sync_f_invoke + 84 (queue.c:3457)
8 libsystem_network.dylib 0x000000018fb2ce78 nw_resolver_set_update_handler + 208 (resolver.m:1275)
9 SystemConfiguration 0x0000000190f8a16c __SCNetworkReachabilityRestartResolver + 260 (SCNetworkReachability.c:1711)
10 SystemConfiguration 0x0000000190f891c8 __SCNetworkReachabilitySetDispatchQueue + 764 (SCNetworkReachability.c:1823)
11 SystemConfiguration 0x0000000190f88ccc SCNetworkReachabilityScheduleWithRunLoop + 504 (SCNetworkReachability.c:1586)
12 CustomKeyboard 0x000000010013f630 -[FIRReachabilityChecker start] + 196
13 CustomKeyboard 0x000000010013abac -[FIRNetwork init] + 156
14 CustomKeyboard 0x0000000100132e28 -[FIRClearcutLogger init] + 416
15 CustomKeyboard 0x0000000100132c68 __35+[FIRClearcutLogger sharedInstance]_block_invoke + 36
16 libdispatch.dylib 0x000000018f9711c0 _dispatch_client_callout + 16 (object.m:455)
17 libdispatch.dylib 0x000000018f971fb4 dispatch_once_f + 56 (once.c:57)
18 CustomKeyboard 0x0000000100132c40 +[FIRClearcutLogger sharedInstance] + 108
19 CustomKeyboard 0x0000000100137214 +[FIRApp initClearcut] + 60
20 CustomKeyboard 0x0000000100136688 +[FIRApp configureDefaultAppWithOptions:sendingNotifications:] + 132
21 CustomKeyboard 0x000000010013643c +[FIRApp configure] + 316
22 libdispatch.dylib 0x000000018f9711c0 _dispatch_client_callout + 16 (object.m:455)
23 libdispatch.dylib 0x000000018f971fb4 dispatch_once_f + 56 (once.c:57)
24 CustomKeyboard 0x00000001000e314c _TFC19CustomKeyboard22KeyboardViewControllercfT7nibNameGSqSS_6bundleGSqCSo8NSBundle__S0_ + 1500 (KeyboardViewController.swift:90)
25 CustomKeyboard 0x00000001000e3270 _TToFC19CustomKeyboard22KeyboardViewControllercfT7nibNameGSqSS_6bundleGSqCSo8NSBundle__S0_ + 112 (KeyboardViewController.swift:0)
26 UIKit 0x00000001971f7688 -[_UIViewServiceViewControllerOperator __createViewController:withContextToken:fbsDisplays:appearanceSerializedRepresentations:legacyAppearance:traitCollection:initialInterfaceOrientation:hostAccessibilityServerPort:canShowTextServices:replyHandler:] + 2216 (UIViewServiceViewControllerOperator.m:1732)
27 CoreFoundation 0x0000000190aee160 __invoking___ + 144
28 CoreFoundation 0x00000001909e1c3c -[NSInvocation invoke] + 284 (NSForwarding.m:2948)
29 CoreFoundation 0x00000001909e66ec -[NSInvocation invokeWithTarget:] + 60 (NSForwarding.m:3019)
Apparently, the call trace after calling FIRApp.configure() is going through system libraries.
One observation from the stack trace is that the crash has something to do with checking the reachability of the device. However, I tried to reproduce a scenario where there is no internet connection but it's working fine.
Please note that all the crashes are happening on iOS 10 and most of them on iPhone 6.
Any help to figure out the cause of the crashes would be appreciated.
It is not recommended to use Firebase Analytics in an extension as the SDK does not support extension well. App extensions have limited functionalities compared to a full app so Firebase Analytics may not work well under some conditions, like the network in this case. The team is looking into supporting extensions better later.
It seems like the network is not available on custom keyboard as stated by Apple
"By default, a keyboard has no network access and cannot share a
container with its containing app. To enable these things, set the
value of the RequestsOpenAccess Boolean key in the Info.plist file to
YES. Doing this expands the keyboard’s sandbox, as described in
Designing for User Trust."
https://developer.apple.com/library/content/documentation/General/Conceptual/ExtensibilityPG/CustomKeyboard.html#//apple_ref/doc/uid/TP40014214-CH16-SW1

Xamarin iOS app SIGSEGV

I am getting occasional SIGSEGV errors like below in my app (c# Xamarin iOS app with latest version of Xamarin Studio=5.8.3, Xamarin.iOS=8.9.1.3
It looks like in crashed in UIKit and from my own app "ObymobiMobileAppiOS" it's just in "main".
What kind of problem it is?
How can I get more info or debug it?
I can reproduce it by using the app for about 5 mins.
Stacktrace:
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>
Native stacktrace:
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.
Update
Here is another example of SIGSEGVs I get (this was on simulator) which doesn't have "redacted":-
Any more ideas how to find the problem? Or is it a possible bug in Xamarin?
Native stacktrace:
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
I came across the same problem. In my case I found some solutions:
If project referenced to wrapper above native library. Check that wrapper and your project have the same architecture - Classic API or Unified API.
1.1 Try to rebuild native project.
1.2 Remove project wrapper from solution and add reference only to output library.
Sometimes, native object are destroyed earlier than .NET. In this case, .NET object have exceptions inside and this error cannot catch with try-catch.
Need to dispose objects correctly.
Try to look crash report inside xcode to get more detailed information.
I faced this problem while using UIDocumentInteractionController. I was using instance of this class as a local parameter and garbage collector was flushing that instance even before the function execution completes. Taking that instance to Global scope solved my problem.
Are the version of Xamarin equal on OS X and Windows? I had similar error. When I updated Xamarin, everything was fine.

OCMock - accessing weak properties of a partially mocked object causes sporadic crash

I'm using OCMock to test UIViewControllers that are instantiated from a storyboard. Following best practice, all IBOutlets of subviews of the view controller's view are weak properties. When I'm writing tests for these view controllers in which the tests call methods that rely on the weak properties, I'm seeing sporadic EXC_BAD_ACCESS crashes like the one I attached.
The crash does not happen every unit test run. There does not seem to be a pattern, it's totally random whether the crash surfaces or not. This design technique of partially mocking the view controller is used in many places in the app as well.
What could be going on? Is there a conflict in what I'm trying to do here?
#interface CustomUIViewControllerTests : XCTestCase
#property (nonatomic, strong) CustomUIViewController *vc;
#property (nonatomic, strong) UIStoryboard *mainStoryboard;
#end
#implementation CustomUIViewControllerTests
- (void)setUp
{
[super setUp];
// In order to test data on the Storyboard - need to instantiate the Storyboard
self.mainStoryboard = [UIStoryboard storyboardWithName:[[NSBundle mainBundle].infoDictionary
objectForKey:#"UIMainStoryboardFile"]
bundle:[NSBundle mainBundle]];
self.vc = [_mainStoryboard instantiateViewControllerWithIdentifier:kStoryboardVCID];
[self.vc loadView];
}
- (void)testSomething
{
id mockController = [OCMockObject partialMockForObject:self.vc];
[mockController doSomethingThatUsesAWeakProperty];
//other verification/assertions here
}
The Crash:
Process: XXXX [33756]
Path: /Users/USER/Library/Application Support/iPhone Simulator/*/XXXX.app/XXXX
Identifier: XXXX
Version: 0
Code Type: X86-64 (Native)
Parent Process: launchd_sim [33727]
Responsible: launchd_sim [33727]
User ID: 501
Date/Time: 2014-07-10 11:51:51.692 -0400
OS Version: Mac OS X 10.9.3 (13D65)
Report Version: 11
Anonymous UUID: 8B81673C-B92D-28D3-9940-47C83C140C8E
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x000000011ab0e360
External Modification Warnings:
Debugger attached to process.
VM Regions Near 0x11ab0e360:
MALLOC_TINY 0000000114700000-0000000114800000 [ 1024K] rw-/rwx SM=PRV
-->
JS JIT generated code 0000056193e99000-0000056193e9a000 [ 4K] ---/rwx SM=NUL
Application Specific Information:
iPhone Simulator 463.9.41, iPhone OS 7.1 (iPhone Retina (4-inch 64-bit)/11D167)
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x0000000103156292 __kill + 10
1 XXXX 0x000000010010f565 CLSSignalHandler + 218 (CLSSignal.m:305)
2 libsystem_platform.dylib 0x00000001030295aa _sigtramp + 26
3 Foundation 0x0000000102174225 -[NSConcreteValue getValue:] + 29
4 Foundation 0x00000001021af5be -[NSValue nonretainedObjectValue] + 25
5 XXXX 0x0000000100153e00 +[OCPartialMockObject existingPartialMockForObject:] + 160 (OCPartialMockObject.m:50)
6 XXXX 0x00000001001546e1 -[OCPartialMockObject forwardingTargetForSelectorForRealObject:] + 65 (OCPartialMockObject.m:170)
7 CoreFoundation 0x0000000102a8ba5c ___forwarding___ + 156
8 CoreFoundation 0x0000000102a8b938 _CF_forwarding_prep_0 + 120
9 XXXX 0x0000000100028ea6 -[CustomUIViewController doSomethingThatUsesAWeakProperty] + 454 (CustomUIViewControllerTests.m:121)
10 CoreFoundation 0x0000000102a8ff1c __invoking___ + 140
11 CoreFoundation 0x0000000102a8fdc4 -[NSInvocation invoke] + 308
12 CoreFoundation 0x0000000102a8ff86 -[NSInvocation invokeWithTarget:] + 54
13 XXXX 0x0000000100154999 -[OCPartialMockObject handleUnRecordedInvocation:] + 73 (OCPartialMockObject.m:217)
14 XXXX 0x0000000100151fe6 -[OCMockObject forwardInvocation:] + 102 (OCMockObject.m:190)
15 CoreFoundation 0x0000000102a8bb85 ___forwarding___ + 453
16 CoreFoundation 0x0000000102a8b938 _CF_forwarding_prep_0 + 120
17 XXXXTests 0x000000010c0d289d -[CustomUIViewControllerTests testSomething] + 573 (CustomUIViewControllerTests.m:996)
18 CoreFoundation 0x0000000102a8ff1c __invoking___ + 140
19 CoreFoundation 0x0000000102a8fdc4 -[NSInvocation invoke] + 308
20 XCTest 0x0000000109ba4c40 -[XCTestCase invokeTest] + 161
21 XCTest 0x0000000109ba4d2c -[XCTestCase performTest:] + 91
22 XCTest 0x0000000109ba5a75 -[XCTest run] + 65
23 XCTest 0x0000000109ba44df -[XCTestSuite performTest:] + 125
24 XCTest 0x0000000109ba5a75 -[XCTest run] + 65
25 XCTest 0x0000000109ba44df -[XCTestSuite performTest:] + 125
26 XCTest 0x0000000109ba5a75 -[XCTest run] + 65
27 XCTest 0x0000000109ba44df -[XCTestSuite performTest:] + 125
28 XCTest 0x0000000109ba5a75 -[XCTest run] + 65
29 XCTest 0x0000000109ba71b4 +[XCTestProbe runTests:] + 138
30 Foundation 0x00000001021846dc __NSFireDelayedPerform + 354
31 CoreFoundation 0x0000000102a5cc34 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20
32 CoreFoundation 0x0000000102a5c7b2 __CFRunLoopDoTimer + 962
33 CoreFoundation 0x0000000102a457be __CFRunLoopRun + 1614
34 CoreFoundation 0x0000000102a44d83 CFRunLoopRunSpecific + 467
35 GraphicsServices 0x00000001039dcf04 GSEventRunModal + 161
36 UIKit 0x00000001010cce33 UIApplicationMain + 1010
37 XXXX 0x000000010007b889 main + 169 (main.m:16)
38 libdyld.dylib 0x000000010301f5fd start + 1
The problem here has to be associated with what OCMock does when creating a partialMock. You can check the source code here.
It's likely that your ViewController's view is being nilled out, and with it, all of it's subviews (which are set as outlets)
But this is important: normally you mock other objects, not your system under test. If you're mocking your SUT, it may be be a sign that you need to refactor your code.
Having said that, I mock the SUT using partial mock for things like returning a mock object from a lazy-instantiated property for example and that has worked perfectly fine.

Mono Boehm vs SGen GC

I have an application developed (renamed in my error as MyApplication for privacy) on the following enviroment:
Monotouch 2.1
MonoDevelop 2.4.2
MacOS 10.6.8
iOS SDK 4.3
that work fine.
Now i'm try to migrate to iOS 5.0/5.1 and Monotouch 5.2.5 with MonoDevelop 2.8.8.4.
My application crashes immediately with the following error:
Stacktrace:
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 MonoTouch.UIKit.UIApplication.Main (string[]) [0x00000] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:34
at MyApplication.Application.Main (string[]) [0x00000] in /Users/MyPC/Projects/Test/MyApplication/Main.cs:19
at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <IL 0x00050, 0xffffffff>
Native stacktrace:
0 MyApplication 0x000908fc mono_handle_native_sigsegv + 284
1 MyApplication 0x00005c98 mono_sigsegv_signal_handler + 248
2 libSystem.B.dylib 0x9138145b _sigtramp + 43
3 ??? 0xffffffff 0x0 + 4294967295
4 libobjc.A.dylib 0x02958753 prepareForMethodLookup + 93
5 libobjc.A.dylib 0x0294f069 lookUpMethod + 86
6 libobjc.A.dylib 0x0294f1d6 _class_lookupMethodAndLoadCache + 40
7 libobjc.A.dylib 0x029620e3 objc_msgSend + 87
8 UIKit 0x01cba799 -[UIControl sendAction:to:forEvent:] + 67
9 UIKit 0x01cbcc2b -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
10 UIKit 0x01cbba1c -[UIControl touchesBegan:withEvent:] + 277
11 UIKit 0x01c4ed41 -[UIWindow _sendTouchesForEvent:] + 395
12 UIKit 0x01c2fc37 -[UIApplication sendEvent:] + 447
13 UIKit 0x01c34f2e _UIApplicationHandleEvent + 7576
14 GraphicsServices 0x03fa5992 PurpleEventCallback + 1550
15 CoreFoundation 0x00df8944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
16 CoreFoundation 0x00d58cf7 __CFRunLoopDoSource1 + 215
17 CoreFoundation 0x00d55f83 __CFRunLoopRun + 979
18 CoreFoundation 0x00d55840 CFRunLoopRunSpecific + 208
19 CoreFoundation 0x00d55761 CFRunLoopRunInMode + 97
20 GraphicsServices 0x03fa41c4 GSEventRunModal + 217
21 GraphicsServices 0x03fa4289 GSEventRun + 115
22 UIKit 0x01c38c93 UIApplicationMain + 1160
23 ??? 0x090a61fc 0x0 + 151675388
24 ??? 0x090a60c8 0x0 + 151675080
25 ??? 0x090a59c0 0x0 + 151673280
26 ??? 0x090a590c 0x0 + 151673100
27 ??? 0x090a5997 0x0 + 151673239
28 MyApplication 0x0000a002 mono_jit_runtime_invoke + 722
29 MyApplication 0x00169efe mono_runtime_invoke + 126
30 MyApplication 0x0016dfe4 mono_runtime_exec_main + 420
31 MyApplication 0x00173405 mono_runtime_run_main + 725
32 MyApplication 0x00067205 mono_jit_exec + 149
33 MyApplication 0x002116d5 main + 2837
34 MyApplication 0x00003055 start + 53
35 ??? 0x00000004 0x0 + 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.
It is the same if i deploy it to iOS SDK 4.3. I'm thinking it might be a problem with the new GC SGen as mentioned here http://www.infoq.com/news/2012/02/MonoTouch-SGen
UPDATE: In fact error is showed on a Alert show as lv.Message = "Copy...";
Class Handle: the requested operation cannot be completed because the
object has been garbage collected
How could i solve it?
In MonoTouch 4 the GC is executed more aggressively to catch as early as possible a certain type of programming errors: ensuring that native objects aren't freed to early by the GC.
The most common pattern is to declare variables in a method:
void Method ()
{
var view = new UIView ();
otherNativeObject.NativeProperty = view;
}
What happens here is that the managed GC does not see that the otherNativeObject has a reference to the view, so when the method finishes executing, the GC will free the view. At a later point otherNativeObject will try to use the view, and you will end up with a crash similar to the one you reported (the exact stack trace and messages will vary a bit depending on where the freed native object is accessed).
The fix for the above example is easy, just make the view a class variable:
UIView view;
void Method ()
{
view = new UIView ();
otherNativeObject.NativeProperty = view;
}
now the GC will not be able to free the view when the method exits.
Note that this crash isn't new in MonoTouch 4, the effect of making the GC more aggressive is that you'll see the problem when debugging, as opposed to hearing it from your clients when they (very randomly) crash.

Resources