Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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 30692 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
In special cases on GitHub you might also want the comments:
GitHub Markdown with public comments
Since the upgrade from mono 3.12 to mono 4.0, using CSharpCodeCompiler.CompileAssemblyFromFile yields an "empty" error (location is (0, 0) and it has empty text) although the compilation is successful. My calling code:
var result = new CSharpCodeProvider().CompileAssemblyFromFile(
As I debugged into the mono code, I identified the problem: The compiler executable is called from the code and its error output starts with a byte order mark (BOM). This can be observed in the hex representation of the output string containing the two bytes FE and FF (method: CompileFromFileBatch, variable mscOutput). One quick fix, which worked in my case, was declaring a constant containg the BOM string and stripping it in CreateErrorFromString:
private readonly static string ByteOrderMark = Encoding.UTF8.GetString(Encoding.UTF8.GetPreamble());
private static CompilerError CreateErrorFromString(string error_string)
if (error_string.StartsWith(ByteOrderMark, StringComparison.Ordinal))
error_string = error_string.Substring(ByteOrderMark.Length);
if (error_string.StartsWith ("BETA"))
if (error_string == null || error_string == "")
Pleace notice that the error string only containing the BOM looks like an empty string on first sight in the debugger, but of course is not caught by 'if (error_string == null || error_string == "")'.
However, maybe my fix is wrong and the problem is where the BOM is emitted. However, in the current version on my machine, CSharpCodeCompiler.CompileAssemblyFromFile does not work.
I just entered bug 33896 and I think, that both have the same root cause, related to the locate (de_DE.utf8) which makes the streams generate the BOM.