[Mono-bugs] [Bug 76440][Nor] New - incorrect generation of error
CS0122:
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Fri Oct 14 13:47:07 EDT 2005
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 awaddell at fnfr.com.
http://bugzilla.ximian.com/show_bug.cgi?id=76440
--- shadow/76440 2005-10-14 13:47:07.000000000 -0400
+++ shadow/76440.tmp.22936 2005-10-14 13:47:07.000000000 -0400
@@ -0,0 +1,112 @@
+Bug#: 76440
+Product: Mono: Compilers
+Version: 1.1
+OS: All
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: C#
+AssignedTo: rharinath at novell.com
+ReportedBy: awaddell at fnfr.com
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: incorrect generation of error CS0122:
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+I get:
+error CS0122: `GenericsBugLib.MyClass<System.Int32>.ListChanged' is
+inaccessible due to its protection level
+
+on lines like
+ list.ListChanged += new ListChangedEventHandler(list_ListChanged);
+
+even thought the event in question is publicly declared. This only seems
+to happen if the event is declared in a different assembly.
+
+Steps to reproduce the problem:
+1. Compile the following as a dll
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.ComponentModel;
+
+
+namespace GenericsBugLib
+{
+ public class MyClass<TItem>
+ {
+ public MyClass() { }
+
+ public event ListChangedEventHandler ListChanged;
+ public void AddListChangedEventHandler(ListChangedEventHandler handler)
+ {
+ ListChanged += handler;
+ }
+ protected void OnListChanged(ListChangedEventArgs e) {}
+
+ }
+}
+"C:\Program Files\Mono-1.1.9.2\bin\gmcs" /noconfig /nowarn:1691,67 /warn:4
+/define:DEBUG;TRACE /define:MONO;HEADLESS;FIXME
+/reference:System;System.Data;System.Xml /out:mono\Debug\GenericsBugLib.dll
+ /target:library Class1.cs Properties\AssemblyInfo.cs
+
+2. Compile the following as an exe:
+//#define WORKAROUND
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.ComponentModel;
+using GenericsBugLib;
+
+
+namespace GenericsBug
+{
+ class Program
+ {
+ static void Main(string[] args)
+ {
+ MyClass<int> list = new MyClass<int>();
+
+#if ! WORKAROUND
+ list.ListChanged += new ListChangedEventHandler(list_ListChanged);
+#else
+ list.AddListChangedEventHandler(new
+ListChangedEventHandler(list_ListChanged));
+#endif
+ }
+
+ static void list_ListChanged(object sender, ListChangedEventArgs e) { }
+ }
+}
+
+"C:\Program Files\Mono-1.1.9.2\bin\gmcs" /noconfig /nowarn:1691,67 /warn:4
+/define:DEBUG;TRACE /define:MONO;HEADLESS;FIXME
+/reference:..\GenericsBugLib\mono\Debug\GenericsBugLib.dll
+/reference:System;System.Data;System.Xml /out:mono\Debug\GenericsBug.exe
+ /target:exe Program.cs Properties\AssemblyInfo.cs
+
+3. experiment with #define WORKAROUND
+
+Actual Results:
+w/o WORKAROUND
+Program.cs(19,18): error CS0122:
+`GenericsBugLib.MyClass<System.Int32>.ListChanged' is inaccessible due to
+its protection level
+
+
+Expected Results:
+clean compile
+
+How often does this happen?
+always
+
+Additional Information:
+compiles cleanly with MS compiler
More information about the mono-bugs
mailing list