[MonoTouch] Weird exception

Jeff Stedfast jeff at xamarin.com
Thu Oct 6 18:31:36 EDT 2011


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 <
dean.cleaver at xceptionsoftware.com> 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
> MonoTouch at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/monotouch
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/monotouch/attachments/20111006/bd129fe3/attachment.html 


More information about the MonoTouch mailing list