[Mono-bugs] [Bug 65722][Wis] New - CompilerOptions isn't used in the CSharpCodeCompiler

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Fri, 10 Sep 2004 16:36:31 -0400 (EDT)


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 spigaz@hotmail.com.

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

--- shadow/65722	2004-09-10 16:36:31.000000000 -0400
+++ shadow/65722.tmp.15321	2004-09-10 16:36:31.000000000 -0400
@@ -0,0 +1,105 @@
+Bug#: 65722
+Product: Mono: Class Libraries
+Version: unspecified
+OS: 
+OS Details: Gentoo 2.6.7
+Status: NEW   
+Resolution: 
+Severity: Unknown
+Priority: Wishlist
+Component: System
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: spigaz@hotmail.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: CompilerOptions isn't used in the CSharpCodeCompiler
+
+Description of Problem:
+In the implementation of the method
+private static string BuildArgs(CompilerParameters options, 
+                                string[]fileNames)
+in 
+mcs/class/System/Microsoft.CSharp/CSharpCodeCompiler.cs
+the parameter from the option, CompilerOptions isn't used.
+
+The solution is just to place 
+if(options.CompilerOptions!=null)
+  args.AppendFormat("{0} ", options.CompilerOptions);
+
+before 
+
+args.Append (" -- ");
+
+Before is a sample using of the CompilerOptions that makes the bug appear.
+any other usage of the option makes the bug obvious.
+
+Steps to reproduce the problem:
+1. Compile Test.cs
+2. Execute it
+3. 
+
+Actual Results:
+/tmp/87984.0.cs(1,0) : error CS0246: The namespace `Gtk' can not be found
+(missing assembly reference?)
+(0,0) : error failed: 1 error(s), 0 warnings
+Failure!
+
+
+Expected Results:
+Sucess!
+
+How often does this happen? 
+always
+
+Additional Information:
+Test.cs:
+
+using Microsoft.CSharp;
+using System.CodeDom.Compiler;
+
+public class Test
+{
+	public static void Main(string[] args)
+	{
+		
+
+		ICodeCompiler compiler = (new CSharpCodeProvider()).CreateCompiler();
+
+		//ICodeCompiler compiler = new Mono.CSharp.CSharpCodeCompiler();
+				
+
+		CompilerParameters parameters = new CompilerParameters();
+
+		parameters.GenerateExecutable = true;		
+		parameters.OutputAssembly = "sample.exe";
+				
+		parameters.CompilerOptions = "-pkg:gtk-sharp ";
+		
+		string source = "using Gtk; class MainClass { public static void
+Main(string[] args) 	{ Application.Init (); new Window(\"Test\"); 
+Application.Run (); } }";
+
+
+		CompilerResults results = compiler.CompileAssemblyFromSource(parameters,
+source);
+
+				
+
+		foreach(object obj in results.Output)
+
+			System.Console.WriteLine(obj);
+
+				
+
+		foreach(object obj in results.Errors)
+
+			System.Console.WriteLine(obj);				
+				
+		if(results.CompiledAssembly!=null)
+			System.Console.WriteLine("Sucess!");
+		else
+			System.Console.WriteLine("Failure!");
+	}
+}