[MonoTouch] Any idea what could cause this crash?
René Ruppert
rene.ruppert at googlemail.com
Thu Mar 22 12:13:39 UTC 2012
Rolf,
while composing a reply with some code fragments, I realized that I was
missing an InvokeOnMainThread() while changing my UI.
Chances are high that this caused the problem. Ill keep an eye on it.
Thanks for asking for the code! J
In the world of Windows Forms, an application throws if you try to execute
UI related code on anything but the main thread.
In iOS it often seems to work and randomly crashes with obscure unhandled
exceptions. Would it be possible for MT to throw immediately like Windows
Forms does?
René
Von: Rolf Bjarne Kvinge [mailto:rolf at xamarin.com]
Gesendet: Donnerstag, 22. März 2012 10:56
An: René Ruppert
Cc: monotouch at lists.ximian.com
Betreff: Re: [MonoTouch] Any idea what could cause this crash?
Hi,
On Thu, Mar 22, 2012 at 9:35 AM, René Ruppert <rene.ruppert at googlemail.com>
wrote:
Hi,
>From one out of hundred taps on a UIButton, I get the following crash. There
is no managed crash.
Hitting the button starts a new thread and that thread updates the UI by
using InvokeOnMainThread(). I was able to verify that it never crashes if I
do not use a separate thread.
What line is the key line here? What is nil/null? As I can see table view
cells showing up in the crash, I assume it has to do with those.
I posted this stacktrace on SO a while ago and Rolf answered that the key is
at (4) but I've been unable to fix the problem.
Giving code is hard because I don't know what part of is causing the
problem.
Can I assume that something was setting a background color (8) and then it
crashed at (4)?
Then I would be able to limit it to places where the
background color gets changed by me.
Native stacktrace:
0 BrainloopBrowser 0x00094fbc
mono_handle_native_sigsegv + 284
1 BrainloopBrowser 0x0000be72
mono_sigsegv_signal_handler + 178
2 libsystem_c.dylib 0x9401859b _sigtramp + 43
3 ??? 0xffffffff 0x0 + 4294967295
4 QuartzCore 0x04176891 -[CALayer
actionForKey:] + 89
5 QuartzCore 0x0417982d
_ZL12actionForKeyP7CALayerPN2CA11TransactionEP8NSString + 82
6 QuartzCore 0x0417c9c3
_ZN2CA5Layer12begin_changeEPNS_11TransactionEjRP11objc_object + 131
7 QuartzCore 0x04182ac1
_ZN2CA5Layer6setterEj12_CAValueTypePKv + 141
8 QuartzCore 0x04172ca4 -[CALayer
setBackgroundColor:] + 62
9 UIKit 0x021e2992
-[UIView(Internal) _setBackgroundCGColor:withSystemColorName:] + 1516
10 UIKit 0x021dbca5
-[UIView(Hierarchy) _setBackgroundColor:] + 145
11 UIKit 0x021dda06
-[UIView(Rendering) setBackgroundColor:] + 40
12 CoreFoundation 0x0113b51d __invoking___ +
29
13 CoreFoundation 0x0113b437 -[NSInvocation
invoke] + 167
14 UIKit 0x025c53a5
TaggingAppearanceGeneralSetterIMP + 1137
15 UIKit 0x02388523 -[UITableViewCell
_updateSeparatorContent] + 478
16 UIKit 0x02390e53 -[UITableViewCell
layoutSubviews] + 2681
17 UIKit 0x021e3322
-[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 178
18 CoreFoundation 0x011d6e72 -[NSObject
performSelector:withObject:] + 66
19 QuartzCore 0x0417392d -[CALayer
layoutSublayers] + 266
20 QuartzCore 0x0417d827
_ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 231
21 QuartzCore 0x04103fa7
_ZN2CA7Context18commit_transactionEPNS_11TransactionE + 377
22 QuartzCore 0x04105ea6
_ZN2CA11Transaction6commitEv + 374
23 QuartzCore 0x041059d3
_ZN2CA11Transaction14release_threadEPv + 65
24 libsystem_c.dylib 0x94009e0c
_pthread_tsd_cleanup + 85
25 libsystem_c.dylib 0x93fc264c _pthread_exit +
146
26 libsystem_c.dylib 0x93fc29a0 pthread_exit + 33
27 BrainloopBrowser 0x0020434e thread_exit + 30
28 BrainloopBrowser 0x00203d03
thread_start_routine + 163
29 BrainloopBrowser 0x001aeb20 gc_start_thread +
80
30 libsystem_c.dylib 0x93fc0ed9 _pthread_start +
335
31 libsystem_c.dylib 0x93fc46de thread_start + 34
This isn't the main thread. This code shouldn't be executing on any thread
but the main one, but this isn't directly executed from your code, so it's
not obvious what's going on.
Can you post the code you execute on the new thread? It's hopefully
something suspicious there.
Rolf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/monotouch/attachments/20120322/df022c04/attachment.html>
More information about the MonoTouch
mailing list