Bug 8072 - System.InvalidOperationException: Handle is not allocated
Summary: System.InvalidOperationException: Handle is not allocated
Alias: None
Product: Runtime
Classification: Mono
Component: GC ()
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2012-10-30 15:38 UTC by Dominique Louis
Modified: 2012-11-01 11:19 UTC (History)
5 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Dominique Louis 2012-10-30 15:38:16 UTC
Taken from https://xamarin.desk.com/agent/case/19109...

I receive the following exception when the finalizer of one of my classes is called:

{System.InvalidOperationException: Handle is not allocated
at System.Runtime.InteropServices.GCHandle.get_Target () [0x0001b] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Runtime.InteropServices/GCHandle.cs:80
at System.WeakReference.get_Target () [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System/WeakReference.cs:95
at System.WeakReference.get_IsAlive () [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System/WeakReference.cs:88
at Microsoft.Xna.Framework.Graphics.GraphicsResource.get_GraphicsDevice () [0x00000] in /Users/turtlegames/Documents/Development/MonoDevelop/ui/MonoGame/MonoGame.Framework/Graphics/GraphicsResource.cs:157
at Microsoft.Xna.Framework.Graphics.RenderTarget2D.Dispose (Boolean disposing) [0x0000b] in /Users/turtlegames/Documents/Development/MonoDevelop/ui/MonoGame/MonoGame.Framework/Graphics/RenderTarget2D.cs:184
at Microsoft.Xna.Framework.Graphics.GraphicsResource.Finalize () [0x00000] in /Users/turtlegames/Documents/Development/MonoDevelop/ui/MonoGame/MonoGame.Framework/Graphics/GraphicsResource.cs:74 }

According to this article:

It should not throw an exception anymore. Could you look at it please?

Adam Kapos
Comment 1 Zoltan Varga 2012-11-01 11:19:19 UTC
Fixed in master/2.10/mobile-master/monotouch-6.0-series.