Bug 5938 - CSharp compiler freeze
Summary: CSharp compiler freeze
Alias: None
Product: Runtime
Classification: Mono
Component: General ()
Version: unspecified
Hardware: PC Windows
: High normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2012-07-01 07:53 UTC by Filip Lundgren
Modified: 2015-01-21 22:45 UTC (History)
7 users (show)

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

Test case for the issue, using CompileAssemblyFromSource. (Bug originally found with CompileAssemblyFromFile) (1.51 KB, application/octet-stream)
2012-07-01 07:53 UTC, Filip Lundgren
testcase (3.23 KB, application/x-gzip)
2012-09-16 10:40 UTC, Zoltan Varga

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 Filip Lundgren 2012-07-01 07:53:37 UTC
Created attachment 2138 [details]
Test case for the issue, using CompileAssemblyFromSource. (Bug originally found with CompileAssemblyFromFile)

Description of Problem:
The CSharpCodeProvider shipped with Mono 2.11.2 currently freezes for unknown reasons upon parsing a specific struct.

Steps to reproduce the problem:
1. Run the attached test case.

Actual Results:
Compiler freezes and leaves the user having to shut down the program.

Expected Results:
Compiler produces the assembly as expected.

How often does this happen? 
Every time.

Additional Information:
Test case was produced after the test having been discovered in a embedded mono build.
Comment 1 Filip Lundgren 2012-07-01 09:28:46 UTC
It's worth mentioning that we are having another issue with JIT compiled scripts (using CSharpCodeProvider.CompileAssemblyFromFile) where we can only contain 21 events in the generated assembly, any more will lead to the application freezing at compilation.
Comment 2 Marek Safar 2012-07-02 06:30:40 UTC
I cannot reproduce it using mono 2.11.3 or master
Comment 3 Filip Lundgren 2012-07-02 07:00:56 UTC
I'll try and get this reproduced in a sample embed project (minimal) when I can.
Comment 4 Filip Lundgren 2012-07-02 08:56:03 UTC
I have created a embedded sample which JIT compiles the test case I provided here. This results in the same compiler freezing issue.

The sample can be found here: https://github.com/inkdev/Embedded-Mono-Sample

(See https://github.com/inkdev/Embedded-Mono-Sample/blob/master/Managed%20Source/ClassLibrary/EntryPoint.cs)
Comment 5 Filip Lundgren 2012-07-19 09:46:02 UTC
I have updated the sample mentioned above with improved tests, along with the latest Mono dev build. (2.11.3)

Has anyone looked into this yet?
Comment 6 Miguel de Icaza [MSFT] 2012-09-02 13:42:58 UTC
Reopening, I did not see that we had a sample test case.
Comment 7 Zoltan Varga 2012-09-16 10:39:44 UTC
I can reproduce this somewhat on windows using mono 2.10.8 using the attached testcase. It has nothing to do with embedding.

To reproduce:
Go to 'tmp' and run:
mono bug.exe
Comment 8 Zoltan Varga 2012-09-16 10:40:20 UTC
Created attachment 2544 [details]
Comment 9 Zoltan Varga 2012-09-16 10:41:55 UTC
This works fine on osx. Also, commenting out the
		compilerParameters.GenerateInMemory = true;
line makes this work on windows too.
Comment 10 João Matos 2014-02-14 12:16:27 UTC
I cannot reproduce this here on Windows.

>mono --version
Mono JIT compiler version 3.0.3 (master/39c48d5)

Filip, can you still reproduce this with a recent version of Mono?
Comment 11 Zoltan Varga 2015-01-21 22:45:18 UTC
This works fine with the mono 2.12 packages.