Sorry Jeff - didn't see this. I'll see if I can put together a sample, but I'm 
just swamped at the moment.

Dino

From: Jeff Stedfast [mailto:[email protected]]
Sent: Thursday, October 06, 2011 5:32 PM
To: Dean Cleaver
Cc: Forums, MonoTouch ([email protected])
Subject: Re: [MonoTouch] Weird exception

Hi Dean,

Did you ever get this resolved? If not, could you submit a bug report to 
http://bugzilla.xamarin.com (preferably with a sample test case) so that 
someone can look deeper into this issue? Unfortunately, like you, I'm not 
seeing anything obviously wrong in the code snippet you provided.

Thanks!

Jeff
On Wed, Sep 28, 2011 at 11:47 PM, Dean Cleaver 
<[email protected]<mailto:[email protected]>> 
wrote:
Hi,

I'm getting this exception reported to me:


System.ObjectDisposedException: The object was used after being disposed.

  at MonoTouch.AVFoundation.InternalAVAudioPlayerDelegate.FinishedPlaying 
(MonoTouch.AVFoundation.AVAudioPlayer player, Boolean flag) [0x00000] in 
<filename unknown>:0

  at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String 
principalClassName, System.String delegateClassName) [0x00000] in <filename 
unknown>:0

  at KleverLogic.FlashValet.iPhone.Valet.Application.Main (System.String[] 
args) [0x000ed] in 
/xsl-home/kleverlogic/FlashValet20110906/Mobile/iPhone/Valet/Main.cs:62

No - only lines of code that are mine is the "Main" function in the Application.

I've searched the entire solution for "FinishedPlaying" and every reference to 
that event has error handling, and specifically handles 
ObjectDisposedException. For example:

private static void HandlePlayerhandleFinishedPlaying (object sender, 
AVStatusEventArgs e)
{
                try
                {
                                if (player != null)
                                                player.Dispose();

                                player = null;
                }
                catch (ObjectDisposedException)
                {
                                player = null;
                }
                catch (Exception ex)
                {
                                AppDelegate.CurrentAppDelegate.SendError(ex);
                }
}

How is this possible? There's only 2 effectively identical functions in my 
code. The other one checks a static Boolean, and if set calls Play() again - 
but has the same ObjectDisposedException trap, yet somehow I am still getting 
error reports back from the SendError function.

Looks to me like the exception is actually something in the 
MonoTouch.AVFoundation.InternalAVAudioPlayerDelegate.FinishedPlaying 
(MonoTouch.AVFoundation.AVAudioPlayer player, Boolean flag) function, and not 
in my code?

This is all new with MonoTouch 4.2 - this exact code (actually, without the 
ObjectDisposedExceptions) has been working perfectly for a while now on 4.0.6.

Dino

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

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

Reply via email to