[Mono-bugs] [Bug 75669][Nor] New - ArgumentNullException when referencing private field of base class in switch

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sat Jul 30 13:22:26 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 gert.driesen at pandora.be.

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

--- shadow/75669	2005-07-30 13:22:26.000000000 -0400
+++ shadow/75669.tmp.24523	2005-07-30 13:22:26.000000000 -0400
@@ -0,0 +1,94 @@
+Bug#: 75669
+Product: Mono: Compilers
+Version: 1.0
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: C#
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: gert.driesen at pandora.be               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: ArgumentNullException when referencing private field of base class in switch
+
+When referencing a private field of a base class in a switch statement, an
+ArgumentNullException is thrown in mcs.
+
+To reproduce, compile the following code snippet:
+
+public class A {
+        private string output;
+}
+
+public class B : A {
+        public void Test() {
+                switch ("a") {
+                        case "1":
+                                output.Replace("a", "b");
+                                break;
+                }
+        }
+}
+
+Actual result:
+
+Unhandled Exception: System.ArgumentNullException: null key
+Parameter name: key
+in <0x00158> System.Collections.Hashtable:get_Item (System.Object key)
+in <0x0004a> Mono.CSharp.TypeManager:FindMembers (System.Type t,
+MemberTypes mt, BindingFlags bf, System.Reflection.MemberFilter filter,
+System.Object criteria)in <0x00392>
+Mono.CSharp.Expression:MemberLookupFailed (Mono.CSharp.EmitContext ec,
+System.Type qualifier_type, System.Type queried_type, System.String name,
+System.String class_name, Boolean complain_if_none_found, Location loc)
+in <0x0030f> Mono.CSharp.SimpleName:DoSimpleNameResolve
+(Mono.CSharp.EmitContext ec, Mono.CSharp.Expression right_side, Boolean
+intermediate)
+in <0x00030> Mono.CSharp.SimpleName:SimpleNameResolve
+(Mono.CSharp.EmitContext ec, Mono.CSharp.Expression right_side, Boolean
+intermediate)
+in <0x00014> Mono.CSharp.SimpleName:DoResolve (Mono.CSharp.EmitContext ec,
+Boolean intermediate)
+in <0x000b3> Mono.CSharp.Expression:Resolve (Mono.CSharp.EmitContext ec,
+ResolveFlags flags)
+in <0x000ac> Mono.CSharp.MemberAccess:DoResolve (Mono.CSharp.EmitContext
+ec, Mono.CSharp.Expression right_side)
+in <0x0000f> Mono.CSharp.MemberAccess:DoResolve (Mono.CSharp.EmitContext ec)
+in <0x000c4> Mono.CSharp.Expression:Resolve (Mono.CSharp.EmitContext ec,
+ResolveFlags flags)
+in <0x00049> Mono.CSharp.Invocation:DoResolve (Mono.CSharp.EmitContext ec)
+in <0x000c4> Mono.CSharp.Expression:Resolve (Mono.CSharp.EmitContext ec,
+ResolveFlags flags)
+in <0x00012> Mono.CSharp.Expression:Resolve (Mono.CSharp.EmitContext ec)
+in <0x00013> Mono.CSharp.ExpressionStatement:ResolveStatement
+(Mono.CSharp.EmitContext ec)
+in <0x0001f> Mono.CSharp.StatementExpression:Resolve
+(Mono.CSharp.EmitContext ec)
+in <0x0014b> Mono.CSharp.Block:Resolve (Mono.CSharp.EmitContext ec)
+in <0x00072> Mono.CSharp.Block:ResolveUnreachable (Mono.CSharp.EmitContext
+ec, Boolean warn)
+in <0x0027e> Mono.CSharp.Switch:Resolve (Mono.CSharp.EmitContext ec)
+in <0x0014b> Mono.CSharp.Block:Resolve (Mono.CSharp.EmitContext ec)
+in <0x000f8> Mono.CSharp.EmitContext:ResolveTopBlock
+(Mono.CSharp.EmitContext anonymous_method_host, Mono.CSharp.ToplevelBlock
+block, Mono.CSharp.InternalParameters ip, IMethodData md, System.Boolean
+unreachable)
+in <0x0002a> Mono.CSharp.EmitContext:EmitTopBlock (IMethodData md,
+Mono.CSharp.ToplevelBlock block, Mono.CSharp.InternalParameters ip)
+in <0x001f0> Mono.CSharp.MethodData:Emit (Mono.CSharp.TypeContainer
+container, Mono.CSharp.Attributable kind)
+in <0x00022> Mono.CSharp.Method:Emit ()
+in <0x0063d> Mono.CSharp.TypeContainer:EmitType ()
+in <0x00215> Mono.CSharp.RootContext:EmitCode ()
+in <0x00be5> Mono.CSharp.Driver:MainDriver (System.String[] args)
+in <0x0000f> Mono.CSharp.Driver:Main (System.String[] args)
+
+Expected result:
+
+test.cs (9,5): error CS0122: 'A.output' is inaccessible due to its
+protection level


More information about the mono-bugs mailing list