[Mono-bugs] [Bug 60418][Nor] New - MCS bug with 'using' statement and unreferenced assemblies.

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Fri, 18 Jun 2004 08:46:41 -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 davidandrewtaylor@hotmail.com.

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

--- shadow/60418	2004-06-18 08:46:40.000000000 -0400
+++ shadow/60418.tmp.15324	2004-06-18 08:46:40.000000000 -0400
@@ -0,0 +1,57 @@
+Bug#: 60418
+Product: Mono: Compilers
+Version: unspecified
+OS: Red Hat 9.0
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: C#
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: davidandrewtaylor@hotmail.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: MCS bug with 'using' statement and unreferenced assemblies.
+
+Description of Problem:
+The MONO C# compiler produces a fatal error message if a "using" 
+statement appears in the C# file specifying a namespace that is not 
+referenced by the compiler at the command line, 
+ie "/r:System.Web.Services".  MS.NET's C# compiler does not require an 
+assembly be referenced unless a class from that assembly is actually used 
+(and the 'using' statement is simply helping the compiler resolve class 
+names).  This is a problem because there are many files produced by 
+Visual Studio that include a reference to "using System.Drawing" 
+or "using System.Web.Services" (etc) that never actually use those 
+assemblies.  Developers will write simple scripts (or instructions for 
+the command line options, which will break when run on MONO because extra 
+namespaces were included in the "using" statements but the corresonding 
+assemblies were not referenced by the compiler at the command line.
+
+Obviously this would be easy to fix for any experienced MS.NET developers 
+moving to MONO; but this will be a real headache for beginners trying 
+MONO if we cannot fix it easily?
+
+Steps to reproduce the problem:
+Compile this class on both MONO and MS.NET
+-------
+using System.Web.Services;
+public class test
+{
+}
+--------
+mcs /t:library test.cs (on MS.NET)
+csc /t:library test.cs (on MONO)
+
+Actual Results:
+test.cs(1) error CS0246: The namespace 'System.Web.Services' can not be 
+found....
+
+Expected Results:
+It should compile as it does on Microsoft's CSC.
+
+How often does this happen? 
+All the time (tested on MONO beta 3).