My Mac application crashes randomly with "GCHandle value belongs to a different domain"

Here is the complete call stack

System.ArgumentException: GCHandle value belongs to a different domain
at System.Runtime.InteropServices.GCHandle.op_Explicit (intptr) [0x0002b] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr5/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.5/mcs/class/corlib/System.Runtime.InteropServices/GCHandle.cs:125
at System.Runtime.InteropServices.GCHandle.FromIntPtr (intptr) [0x00000] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr5/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.5/mcs/class/corlib/System.Runtime.InteropServices/GCHandle.cs:166
at MonoMac.Foundation.NSObject.SwitchGCHandle (bool)
at MonoMac.Foundation.NSObject.RetainTrampoline (intptr,intptr)
at (wrapper native-to-managed) MonoMac.Foundation.NSObject.RetainTrampoline (intptr,intptr)
at (wrapper managed-to-native) MonoMac.ObjCRuntime.Messaging.IntPtr_objc_msgSendSuper_UInt32_IntPtr_IntPtr_bool (intptr,intptr,uint,intptr,intptr,bool) <0x00012>
at MonoMac.AppKit.NSApplication.NextEvent (uint,MonoMac.Foundation.NSDate,string,bool)
at Awesomium.Mono.Mac.OSMApplication.NextEvent (uint,MonoMac.Foundation.NSDate,string,bool)
at (wrapper dynamic-method) object.[Awesomium.Mono.Mac.OSMApplication.MonoMac.AppKit.NSEvent NextEvent(UInt32, MonoMac.Foundation.NSDate, System.String, Boolean)] (MonoMac.Foundation.NSObject,MonoMac.ObjCRuntime.Selector,uint,MonoMac.Foundation.NSDate,MonoMac.Foundation.NSString,bool)
at (wrapper native-to-managed) object.[Awesomium.Mono.Mac.OSMApplication.MonoMac.AppKit.NSEvent NextEvent(UInt32, MonoMac.Foundation.NSDate, System.String, Boolean)] (MonoMac.Foundation.NSObject,MonoMac.ObjCRuntime.Selector,uint,MonoMac.Foundation.NSDate,MonoMac.Foundation.NSString,int)
at (wrapper managed-to-native) MonoMac.AppKit.NSApplication.NSApplicationMain (int,string[]) <0x00012>
at MonoMac.AppKit.NSApplication.Main (string[])
at GameContainer.Program.Main (string[]) [0x0042e] in /Users/poker/tatevik/Container/GameContainer/Program.cs:214

System.ArgumentException: GCHandle value belongs to a different domain
at System.Runtime.InteropServices.GCHandle.op_Explicit (intptr) [0x0002b] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr5/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.5/mcs/class/corlib/System.Runtime.InteropServices/GCHandle.cs:125
at System.Runtime.InteropServices.GCHandle.FromIntPtr (intptr) [0x00000] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr5/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.5/mcs/class/corlib/System.Runtime.InteropServices/GCHandle.cs:166
at MonoMac.Foundation.NSObject.SwitchGCHandle (bool)
at MonoMac.Foundation.NSObject.RetainTrampoline (intptr,intptr)
at (wrapper native-to-managed) MonoMac.Foundation.NSObject.RetainTrampoline (intptr,intptr)
at (wrapper managed-to-native) MonoMac.ObjCRuntime.Messaging.IntPtr_objc_msgSendSuper_UInt32_IntPtr_IntPtr_bool (intptr,intptr,uint,intptr,intptr,bool) <0x00012>
at MonoMac.AppKit.NSApplication.NextEvent (uint,MonoMac.Foundation.NSDate,string,bool)
at Awesomium.Mono.Mac.OSMApplication.NextEvent (uint,MonoMac.Foundation.NSDate,string,bool)
at (wrapper dynamic-method) object.[Awesomium.Mono.Mac.OSMApplication.MonoMac.AppKit.NSEvent NextEvent(UInt32, MonoMac.Foundation.NSDate, System.String, Boolean)] (MonoMac.Foundation.NSObject,MonoMac.ObjCRuntime.Selector,uint,MonoMac.Foundation.NSDate,MonoMac.Foundation.NSString,bool)
at (wrapper native-to-managed) object.[Awesomium.Mono.Mac.OSMApplication.MonoMac.AppKit.NSEvent NextEvent(UInt32, MonoMac.Foundation.NSDate, System.String, Boolean)] (MonoMac.Foundation.NSObject,MonoMac.ObjCRuntime.Selector,uint,MonoMac.Foundation.NSDate,MonoMac.Foundation.NSString,int)
at (wrapper managed-to-native) MonoMac.AppKit.NSApplication.NSApplicationMain (int,string[]) <0x00012>
at MonoMac.AppKit.NSApplication.Main (string[])
at GameContainer.Program.Main (string[]) [0x0042e] in /Users/poker/tatevik/Container/GameContainer/Program.cs:214

Sign In or Register to comment.