[Mono-bugs] [Bug 353536] New: CompileFromFileBatch with "-t:module" option throws BadImageFormatException

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sun Jan 13 10:27:42 EST 2008


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: mono-bugs at lists.ximian.com
        ReportedBy: Moritz.Kroll at gmx.de
         QAContact: mono-bugs at lists.ximian.com
          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.


More information about the mono-bugs mailing list