https://bugzilla.novell.com/show_bug.cgi?id=353536
Summary: CompileFromFileBatch with "-t:module" option throws
BadImageFormatException
Product: Mono: Class Libraries
Version: 1.2.6
Platform: x86-64
OS/Version: Windows Vista
Status: NEW
Severity: Normal
Priority: P5 - None
Component: System
AssignedTo: [email protected]
ReportedBy: [EMAIL PROTECTED]
QAContact: [email protected]
Found By: ---
Created an attachment (id=190372)
--> (https://bugzilla.novell.com/attachment.cgi?id=190372)
Test case
Compiling a module with e.g.
Microsoft.CSharp.CSharpCodeProvider.CompileAssemblyFromSource (using the
"-t:module" compiler option) crashes with a BadImageFormatException, because
Mono.CSharp.CSharpCodeCompiler.CompileFromFileBatch tries to open the resulting
module file using Assembly.LoadFrom.
NET does not crash in the same situation.
It only crashes with the same exception, if the CompiledAssembly property of
the returned CompilerResults instance is read.
The attached test case produces the following output:
Unhandled Exception: System.BadImageFormatException: Could not load file or
assembly 'test-416-mod.netmodule' or one of its dependencies. An attempt was
made to load a program with an incorrect format.
File name: 'test-416-mod.netmodule'
at (wrapper managed-to-native) System.Reflection.Assembly:LoadFrom
(string,bool)
at System.Reflection.Assembly.LoadFrom (System.String assemblyFile) [0x00000]
in
C:\cygwin\tmp\monobuild\build\BUILD\mono-1.2.6\mcs\class\corlib\System.Reflection\Assembly.cs:437
at Mono.CSharp.CSharpCodeCompiler.CompileFromFileBatch
(System.CodeDom.Compiler.CompilerParameters options, System.String[] fileNames)
[0x00227] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-1.2.6\mcs\class\System\Microsoft.CSharp\CSharpCodeCompiler.cs:227
at Mono.CSharp.CSharpCodeCompiler.CompileFromSourceBatch
(System.CodeDom.Compiler.CompilerParameters options, System.String[] sources)
[0x0009b] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-1.2.6\mcs\class\System\Microsoft.CSharp\CSharpCodeCompiler.cs:395
at Mono.CSharp.CSharpCodeCompiler.CompileAssemblyFromSourceBatch
(System.CodeDom.Compiler.CompilerParameters options, System.String[] sources)
[0x00011] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-1.2.6\mcs\class\System\Microsoft.CSharp\CSharpCodeCompiler.cs:156
at System.CodeDom.Compiler.CodeDomProvider.CompileAssemblyFromSource
(System.CodeDom.Compiler.CompilerParameters options, System.String[] fileNames)
[0x00014] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-1.2.6\mcs\class\System\System.CodeDom.Compiler\CodeDomProvider.cs:135
at CompileModuleBug.Main (System.String[] args) [0x00000]
Expected result:
No output on the console and a module "test-416-mod.netmodule" in the current
directory.
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
_______________________________________________
mono-bugs maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs