And that's exactly my point. The code I have shared does nothing, yet the 
exception handler in my Main() function traps errors like this, and then the 
app crashes completely:

MonoTouch.Foundation.MonoTouchException: Objective-C exception thrown. Name: 
NSInvalidArgumentException Reason: -[OS_dispatch_semaphore 
UIApplicationWillEnterForeground:]: unrecognized selector sent to instance 
0x81b27e0
at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain 
(int,string[],intptr,intptr)
at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String 
principalClassName, System.String delegateClassName) [0x0004c] in 
/Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:38
at KleverLogic.FlashValet.iPhone.Valet.Application.Main (System.String[] args) 
[0x00048] in /xsl-home/kleverlogic/FlashValet/Mobile/iPhone/Valet/Main.cs:40

I am confused by this:

Reason: -[OS_dispatch_semaphore UIApplicationWillEnterForeground:]: 
unrecognized selector sent to instance 0x81b27e0

When my code does nothing in the WillEnterForeground call. So what is passing 
an unrecognized selector in that call if it's not my code? Can you see now why 
I'm rather stressed about this?

Code somewhere else? I have about 90 to 100 view controllers, plus their 
respective DataSource classes. Starting to look at that with the view that 
"something might be wrong somewhere" is not an enthralling task. I don't have a 
single thing to go on - not even a hint as to what class, nothing. It's like 
looking for a needle in a haystack.

Dino

From: James Darbyshire [mailto:[email protected]]
Sent: Friday, October 12, 2012 20:02
To: Dean Cleaver
Cc: James Darbyshire; [email protected]
Subject: Re: [MonoTouch] Any idea what this could be?

My point is that the code you have shared does nothing, hence I would be 
surprised if it is that code which causes the problem.

The try block is empty. Therefore it can't be that catch block catching the 
exception.

Is it possible that some code elsewhere is not disposing of a reference?

Regards,

James

On 13/10/2012, at 11:40 AM, Dean Cleaver 
<[email protected]<mailto:[email protected]>> 
wrote:
James,

I did share the code. That's it:


public override void WillEnterForeground(UIApplication application)

{

                    try

                    {

                                         
//ThreadPool.QueueUserWorkItem(this.EnterForeground);

                    }

                    catch (Exception ex)

                    {

                                         Application.SendError(ex);

                    }

}

I can't publish my entire app code in here. But why am I getting exceptions 
that simply crash my app in a method that I have no real code in? Even if I 
comment out the entire "WillEnterForeground" I still get explosions that just 
kill the app completely.

It will not break in code - always just blows up. Never blew up before, just 
after I made the mistake of upgrading to MonoTouch 6.0.3. This code has been 
working for over 12 months, and now I'm in deep shit where I can't publish a 
new version because I cannot get any help on some severe crashes.

Hell - I've even got one crash on an iPad where it actually manages to disable 
the Home button until you reboot the device - any ideas what API I might be 
using incorrectly to achieve that?

Dino

From: James Darbyshire [mailto:[email protected]]
Sent: Friday, October 12, 2012 19:35
To: Dean Cleaver
Cc: [email protected]<mailto:[email protected]>
Subject: Re: [MonoTouch] Any idea what this could be?

To be blunt, we can't help without having code to look through.

MonoTouch doesn't just add method calls, and throw exceptions on its own.

My guess is that your problem is probably an incorrect use of an API or object 
somewhere.

iOS application development is a lot more accessible now, thanks to MT, but if 
you don't do the basics, just as with ObjC or PhoneGap (et. al.) your 
foundations will be shaky.

Share the code, or at least somewhere we can reproduce the problem, and we can 
help you diagnose the problem.

Regards,

James

On 13/10/2012, at 11:23 AM, Dean Cleaver 
<[email protected]<mailto:[email protected]>> 
wrote:
Anyone able to help before I ditch MonoTouch and try something that works? We 
are seriously in a position where we cannot release code because of this 
problem, and the CEO is discussing ditching MonoTouch completely because we 
can't rely on it to work.

Dino

From: Dean Cleaver
Sent: Friday, October 12, 2012 17:16
To: Dean Cleaver; [email protected]<mailto:[email protected]>
Subject: RE: Any idea what this could be?

It's now seemingly not Linea - just random:

MonoTouch.Foundation.MonoTouchException: Objective-C exception thrown. Name: 
NSInvalidArgumentException Reason: -[OS_dispatch_semaphore 
UIApplicationWillEnterForeground:]: unrecognized selector sent to instance 
0x81b27e0
at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain 
(int,string[],intptr,intptr)
at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String 
principalClassName, System.String delegateClassName) [0x0004c] in 
/Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:38
at KleverLogic.FlashValet.iPhone.Valet.Application.Main (System.String[] args) 
[0x00048] in /xsl-home/kleverlogic/FlashValet/Mobile/iPhone/Valet/Main.cs:40

And here's my WillEnterForeground:


public override void WillEnterForeground(UIApplication application)

{

                    try

                    {

                                         
//ThreadPool.QueueUserWorkItem(this.EnterForeground);

                    }

                    catch (Exception ex)

                    {

                                         Application.SendError(ex);

                    }

}

Yeah - basically empty, yet it still crashes in the 
UIApplicationWillEnterForeground - any ideas?

Dino

From: 
[email protected]<mailto:[email protected]> 
[mailto:[email protected]] On Behalf Of Dean Cleaver
Sent: Thursday, October 11, 2012 15:00
To: [email protected]<mailto:[email protected]>
Subject: [MonoTouch] Any idea what this could be?

I got this error report recently:

MonoTouch.Foundation.MonoTouchException: Objective-C exception thrown. Name: 
NSInvalidArgumentException Reason: -[Linea UIApplicationDidEnterBackground:]: 
unrecognized selector sent to instance 0x21a2a80
at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String 
principalClassName, System.String delegateClassName) [0x0004c] in 
/Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:38
at KleverLogic.FlashValet.iPhone.Valet.Application.Main (System.String[] args) 
[0x00027] in /xsl-home/kleverlogic/FlashValet/Mobile/iPhone/Valet/Main.cs:40

I'm intrigued by the "Reason: -[Linea UIApplicationDidEnterBackground:]" 
because I make no calls to the linea in this, so wondered if there was even 
anything I could do?

Dino
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to