Bug 18603 - [STAThread] don't seem to work.
Summary: [STAThread] don't seem to work.
Alias: None
Product: Runtime
Classification: Mono
Component: JIT ()
Version: 3.2.x
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2014-03-27 02:28 UTC by Mikkel Kruse Johnsen
Modified: 2014-09-10 03:38 UTC (History)
3 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 Mikkel Kruse Johnsen 2014-03-27 02:28:58 UTC
After updating to Mono 3.2.8 printing under Windows (7) with Gtk# is not working. It worked before, with Mono 3.0.2 (I only updated Mono, not Gtk#)

The last time I had this error (many years ago, I had to add the [STAThread] to my main funtion.

The program just hangs, no exception or any information.
Comment 1 Mikkel Kruse Johnsen 2014-03-28 07:16:22 UTC
I have testet with the official Mono installer 3.2.3 aswell and it breaks printing with Gtk#

The official Mono installer 3.0.10 works fine.

(Could not find any installers in between)
Comment 2 Zoltan Varga 2014-03-28 17:00:22 UTC
-> gtk#
Comment 3 Mikkel Kruse Johnsen 2014-03-31 03:36:35 UTC
Zoltan, this has nothing to do with Gtk#. 

This is a Mono problem.
Comment 4 Andres G. Aragoneses 2014-03-31 09:41:53 UTC
If you're sure this is a mono bug and regression, you could try bisect the commit that caused it, given that you know a working version and a non-working one.
Comment 5 Mikkel Kruse Johnsen 2014-03-31 09:57:05 UTC
I am pretty sure it is a Mono problem.

If I use the "mono.exe", "mono-2.0.dll" and "mscorlib.dll" from the Mono 3.0.10 installer. Everything works fine.

If I use the "mono.exe", "libmonoboehm-2.0.dll" and "mscorlib.dll" from the Mono 3.2.3 installer. The print dialog is not shown.

It makes it hard to bisect, since there is no release between 3.0.10 and 3.2.3. So it's a big commit stack to run through.
Comment 6 Andres G. Aragoneses 2014-03-31 09:59:08 UTC
>It makes it hard to bisect, since there is no release between 3.0.10 and 3.2.3.
>So it's a big commit stack to run through.

There are some releases between 3.0.10 and 3.2.3. However, I don't mean bisecting through releases but through each commit. You would need to build mono yourself.
Comment 7 Andres G. Aragoneses 2014-03-31 10:15:58 UTC
Also, probably the biggest change between 3.0.10 and 3.2.3 is the default garbage collector used. So, to rule out the GC as a cause, you would need to test with 3.2.3 using the boehm collector instead of sgen (like 3.0.10's default).
Comment 8 Mikkel Kruse Johnsen 2014-03-31 10:20:24 UTC
As I understand it, windows build has been broken for a while. I'm am unable to compile mono for windows between 3.0.10 and 3.2.3 my self.

There are no windows build between 3.0.10 and 3.2.3 on http://download.mono-project.com/archive/

I have testet with both Boehm and SGen and they both fail.
Comment 9 Mikkel Kruse Johnsen 2014-04-02 03:21:13 UTC
Just testet with Mono 3.4.0 and it has the same bug.

Gtk# print dialog is not shown and the program hangs.

(working with Mono 3.0.10)
Comment 10 Mikkel Kruse Johnsen 2014-04-03 01:53:16 UTC
diff -Nur mono-3.0.10/mono/metadata/threads.c mono-3.4.0/mono/metadata/threads.c

Is a 2500 line patch. So I guess a lot has changed with threads.

Could this be changed back to a Mono problem, since it works fine with mono 3.0.10, I don't see how it can be a Gtk# problem ?
Comment 11 Andres G. Aragoneses 2014-04-03 15:19:50 UTC
Can you obtain a log of all the traces of all the threads when it hangs? See http://stackoverflow.com/questions/2067359/how-do-i-make-a-thread-dump-with-mono for more info.
Comment 12 Andres G. Aragoneses 2014-04-03 15:21:00 UTC
Oh, just realised you are in Windows, not Linux... so I'm not sure if you can kill mono with msysgit?
Comment 13 Mikkel Kruse Johnsen 2014-04-23 07:38:09 UTC
I have changed to Runtime again.

This is not a Gtk# bug.
Comment 14 Mikkel Kruse Johnsen 2014-08-25 07:29:40 UTC
Just tested with Mono 3.6.0 on Windows. Printing still hangs Gtk.

gtk-demo.exe is working, so it is a problem with either Gtk# or Mono. But since it works fine with Mono 3.0.12, I assume it is a Mono problem.
Comment 15 Mikkel Kruse Johnsen 2014-09-10 03:38:23 UTC
Seems to have been resolved with Mono 3.8