Bug 8239 - Fail to compile C# with CSharpProvider code on mono-sgen
Summary: Fail to compile C# with CSharpProvider code on mono-sgen
Status: NEEDINFO
Alias: None
Product: Class Libraries
Classification: Mono
Component: System (show other bugs)
Version: unspecified
Hardware: All All
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-11-06 04:01 UTC by Roope Kangas
Modified: 2012-11-20 02:57 UTC (History)
1 user (show)

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


Attachments

Description Roope Kangas 2012-11-06 04:01:22 UTC
Sorry, this might be under the wrong product but.

If I use Microsoft.CSharp.CSharpCodeProvider class on mono-sgen and configure GC with MONO_GC_PARAMS. I will the following error when trying to compile C# code:

MONO_GC_PARAMS must be a comma-delimited list of one or more of the following:
  max-heap-size=N (where N is an integer, possibly with a k, m or a g suffix)

So is mono-sgen using mono with Boehm under the hood that does not accept the environment variable?

It seems to go away when I add this code to my main method:

Environment.SetEnvironmentVariable("MONO_GC_PARAMS", "");
Comment 1 Marek Safar 2012-11-11 09:09:52 UTC
I am not sure I understand the issue. Could you add exact code which initialises your CSharpCodeProvider
Comment 2 Roope Kangas 2012-11-20 02:57:08 UTC
The code looks about like this:

public Assembly compile(string code, out CompilerErrorCollection errors)
{
var csProvider = new Microsoft.CSharp.CSharpCodeProvider (new Dictionary<String, String>{{ "CompilerVersion","v3.5" }});
var options = new CompilerParameters ();
options.GenerateExecutable = false; 
options.GenerateInMemory = true;
options.ReferencedAssemblies.Add (Assembly.GetExecutingAssembly ().Location);
CompilerResults result;
result = csProvider.CompileAssemblyFromSource (options, code);
}

If I run this with mono-sgen and have MONO_GC_PARAMS defined I get compile error (in CompilerResults.Errors) that contains the message:

MONO_GC_PARAMS must be a comma-delimited list of one or more of the following:
  max-heap-size=N (where N is an integer, possibly with a k, m or a g suffix)

But it does not appear if I add Environment.SetEnvironmentVariable("MONO_GC_PARAMS", ""); to the program.

Note You need to log in before you can comment on or make changes to this bug.