[MonoTouch] Weird exception

Dean Cleaver dean.cleaver at xceptionsoftware.com
Thu Oct 6 20:25:18 EDT 2011


Any ideas on this? Anything higher 4.0.6 is completely unusable to me because of this - as soon as any sound finishes playing my app just crashes.

Dino

From: monotouch-bounces at lists.ximian.com [mailto:monotouch-bounces at lists.ximian.com] On Behalf Of Dean Cleaver
Sent: Wednesday, September 28, 2011 10:47 PM
To: Forums, MonoTouch (monotouch at lists.ximian.com)
Subject: [MonoTouch] Weird exception

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/monotouch/attachments/20111007/1d95ab96/attachment-0001.html 


More information about the MonoTouch mailing list