[Mono-bugs] [Bug 82845][Maj] New - In the constructor of a partial class, only the using directives from the first translation unit are observed.
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Thu Sep 13 22:40:02 EDT 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 nathan_baum at btinternet.com.
http://bugzilla.ximian.com/show_bug.cgi?id=82845
--- shadow/82845 2007-09-13 22:40:02.000000000 -0400
+++ shadow/82845.tmp.27987 2007-09-13 22:40:02.000000000 -0400
@@ -0,0 +1,75 @@
+Bug#: 82845
+Product: Mono: Compilers
+Version: 1.2
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Major
+Component: C#
+AssignedTo: rharinath at novell.com
+ReportedBy: nathan_baum at btinternet.com
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: In the constructor of a partial class, only the using directives from the first translation unit are observed.
+
+Description of Problem:
+
+In the constructor of a partial class, only the using directives from the
+first translation unit are observed.
+
+Steps to reproduce the problem:
+1. Install Mono from CVS.
+2. Create Foo1.cs
+
+ partial class Foo
+ {
+ }
+
+3. Create Foo2.cs
+
+ using System;
+
+ partial class Foo
+ {
+ public Foo () {
+ Console.Write("Hello, world.\n");
+ }
+ public static void Main ()
+ {
+ }
+ }
+
+4. Compile
+
+ mcs Foo1.cs Foo2.cs
+
+Actual Results:
+
+ Foo2.cs(7,5): error CS0103: The name `Console' does not exist in the
+current context
+ Compilation failed: 1 error(s), 0 warnings
+
+Expected Results:
+
+ Successful compilation.
+
+How often does this happen?
+
+ Every time.
+
+Additional Information:
+
+ If Foo2.cs is compiled alone, it works as expected. If Foo2.cs is
+compiled _before_ Foo1.cs -- i.e. mcs Foo2.cs Foo1.cs -- it works as
+expected. (But, any using directives in Foo1.cs would also be ignored in
+the constructor.)
+
+ The using directives are _only_ ignored in the constructor. All other
+methods appear work as expected.
+
+ ATM my solution is to put all needed using directives where every partial
+declaration of a class can see it. This is tedious.
More information about the mono-bugs
mailing list