Bug 30669 - Winforms: GCHandle value cannot be zero
Summary: Winforms: GCHandle value cannot be zero
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: Windows.Forms ()
Version: 4.0.0
Hardware: PC Windows
: Low normal
Target Milestone: Community
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-06-02 09:41 UTC by Juergen Bockhorn
Modified: 2017-09-01 11:56 UTC (History)
3 users (show)

Tags:
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 for Bug 30669 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
NEW

Description Juergen Bockhorn 2015-06-02 09:41:34 UTC
Hi,

I've tried to port a C#-Project to Mono. Compiling etc. went fine using XamarinStudio 5.9 but when I try to start the project using the mono runtime I got the following exception.

System.Runtime.InteropServices.GCHandle.op_Explicit (value=0x0) in C:\buildroot\release\repos\mono\mcs\class\corlib\System.Runtime.InteropServices\GCHandle.cs:123
System.Windows.Forms.XplatUIWin32.GetMessage (msg=, hWnd=, wFilterMin=, wFilterMax=, blocking=) in C:\buildroot\release\repos\mono\mcs\class\Managed.Windows.Forms\System.Windows.Forms\XplatUIWin32.cs:2080
System.Windows.Forms.XplatUIWin32.GetMessage (Parameters=) in C:\buildroot\release\repos\mono\mcs\class\Managed.Windows.Forms\System.Windows.Forms\XplatUIWin32.cs:2027
System.Windows.Forms.XplatUI.GetMessage (Parameters=) in C:\buildroot\release\repos\mono\mcs\class\Managed.Windows.Forms\System.Windows.Forms\XplatUI.cs:716
System.Windows.Forms.Application.RunLoop (Parameters=) in C:\buildroot\release\repos\mono\mcs\class\Managed.Windows.Forms\System.Windows.Forms\Application.cs:852
System.Windows.Forms.Application.Run (Parameters=) in C:\buildroot\release\repos\mono\mcs\class\Managed.Windows.Forms\System.Windows.Forms\Application.cs:724
System.Windows.Forms.Application.Run (Parameters=) in C:\buildroot\release\repos\mono\mcs\class\Managed.Windows.Forms\System.Windows.Forms\Application.cs:707
PlatoController.Program.Main (Parameters=) in D:\Entwicklung\Mono\Plato\PlatoController\App\Program.cs:79

An internet search only found similar questions but now answer. 

Any hint what went wrong ?

Thx Jürgen
Comment 1 Zoltan Varga 2015-06-02 18:36:19 UTC
System.Windows.Forms is no longer supported by mono.

-> winforms.
Comment 2 Juergen Bockhorn 2015-06-03 03:28:20 UTC
Does that mean I should use winforms ? An if, how do I use it.
Comment 3 Juergen Bockhorn 2015-06-03 03:31:54 UTC
I'm using Xamarin Studio and the reference to System.Windows.Forms is checked. Do I have to exchange the standard lib through something else ?
Comment 4 Miguel de Icaza [MSFT] 2015-12-24 15:44:02 UTC
You would need to use a new toolkit, something like Gtk# or Xwt.

This is likely a case of WM_ASYNC_MESSAGE being sent by the OS, and we just assume that we are the only senders of this message.   The right fix is probably to ignore this message and pass it along to the OS, and use a different message code internal to Mono's Winforms to send async requests.