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]
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to