[Mono-bugs] [Bug 37108][Nor] New - MCS can't handle the internal access scope

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Thu, 23 Jan 2003 02:01:18 -0500 (EST)


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 daniel@solin.org.

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

--- shadow/37108	Thu Jan 23 02:01:18 2003
+++ shadow/37108.tmp.10211	Thu Jan 23 02:01:18 2003
@@ -0,0 +1,79 @@
+Bug#: 37108
+Product: Mono/MCS
+Version: unspecified
+OS: Red Hat 8.0
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: daniel@solin.org               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: MCS can't handle the internal access scope
+
+Description of Problem:
+MCS does not generate a compile error when trying to use an internal class 
+from a different assembly.
+
+Steps to reproduce the problem:
+1. Create this file:
+[myclass.cs]
+namespace MyNamespace
+{
+        internal class MyClass
+        {
+        }
+
+        public class MyOtherClass
+        {
+                public static void Main(string[] args)
+                {
+                        MyClass mc = new MyClass();
+                }
+        }
+}
+
+2. Compile myclass.cs into a dll:
+daniel@localhost:~$ mcs /t:library myclass.cs
+Compilation succeeded
+ 
+3. Create this file:
+[usingmynamespace.cs]
+using MyNamespace;
+
+class UsingMyClass
+{
+    public static void Main(string[] args)
+    {
+            MyClass mc = new MyClass();
+            //do something with mc
+    }
+}
+
+4. Compile usingmynamespace.cs:
+daniel@localhost:~$ mcs /r:./myclass.dll usingmyclass.cs
+Compilation succeeded
+
+Actual Results:
+The compilation succeeds.
+
+Expected Results:
+MCS should generate en error. The MS compiler generates the following:
+C:\temp>csc /r:./myclass.dll usingmyclass.cs
+Microsoft (R) Visual C# .NET Compiler version 7.00.9466
+for Microsoft (R) .NET Framework version 1.0.3705
+Copyright (C) Microsoft Corporation 2001. All rights reserved.
+
+usingmyclass.cs(7,13): error CS0122: 'MyNamespace.MyClass' is inaccessible 
+due to its protection level
+
+How often does this happen? 
+Always.
+
+Additional Information:
+Thanks for your hard work!