[Mono-bugs] [Bug 80920][Nor] New - CodeCompiler.CompileAssemblyFromSource fails with GenerateInMemory == true

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Wed Feb 21 07:11:28 EST 2007


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by joergr at voelcker.com.

http://bugzilla.ximian.com/show_bug.cgi?id=80920

--- shadow/80920	2007-02-21 07:11:28.000000000 -0500
+++ shadow/80920.tmp.10909	2007-02-21 07:11:28.000000000 -0500
@@ -0,0 +1,86 @@
+Bug#: 80920
+Product: Mono: Class Libraries
+Version: 1.2
+OS: GNU/Linux [Other]
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: System
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: JoergR at voelcker.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: CodeCompiler.CompileAssemblyFromSource fails with GenerateInMemory == true
+
+Description of Problem:
+If you are compiling C# source code using new
+CSharpCodeProvider().CreateCompiler().CompileAssemblyFromSource(...) and
+you set the parameter GenerateInMemory to true and OutputAssembly parameter
+is empty the compiler will fail.
+
+
+Steps to reproduce the problem:
+1. Compile attached sample
+2. Run
+
+Actual Results:
+using System; namespace MyNamespace {
+        class Message
+        {
+                public void MSGOutput()
+                {
+                        Console.WriteLine("Hello world");
+                }
+        }
+}
+With file as output assembly
+Hello world
+Without file as output assembly
+
+Unhandled Exception: System.ArgumentException: Name is empty 
+in <0x004d7> System.IO.FileStream:.ctor (System.String name, FileMode mode,
+FileAccess access, FileShare share, Int32 bufferSize, Boolean isAsync,
+Boolean anonymous) 
+in <0x0001f> System.IO.FileStream:.ctor (System.String name, FileMode mode,
+FileAccess access, FileShare share) 
+in (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor
+(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
+in <0x00021> System.IO.File:OpenRead (System.String path) 
+in <0x002f8> Mono.CSharp.CSharpCodeCompiler:CompileFromFileBatch
+(System.CodeDom.Compiler.CompilerParameters options, System.String[]
+fileNames) 
+in <0x00181> Mono.CSharp.CSharpCodeCompiler:CompileFromSourceBatch
+(System.CodeDom.Compiler.CompilerParameters options, System.String[] sources) 
+in <0x00022> Mono.CSharp.CSharpCodeCompiler:CompileAssemblyFromSourceBatch
+(System.CodeDom.Compiler.CompilerParameters options, System.String[] sources) 
+in <0x0003c> Mono.CSharp.CSharpCodeCompiler:CompileAssemblyFromSource
+(System.CodeDom.Compiler.CompilerParameters options, System.String source) 
+in <0x0035f> CompilerTestEx.CompilerTest:Main (System.String[] args) 
+
+Expected Results:
+using System;
+namespace MyNamespace
+{
+        class Message
+        {
+                public void MSGOutput()
+                {
+                        Console.WriteLine("Hello world");
+                }
+        }
+}
+With file as output assembly
+Hello world
+Without file as output assembly
+Hello world
+
+
+How often does this happen? 
+Always
+
+Additional Information:
+There should be created a temporary assembly file internally for this case.


More information about the mono-bugs mailing list