[Mono-bugs] [Bug 69462][Nor] New - Compiler crash on interface with event attribute [field:NonSerialized()]

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sat, 13 Nov 2004 19:46:01 -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 jhill@arcfocus.com.

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

--- shadow/69462	2004-11-13 19:46:01.000000000 -0500
+++ shadow/69462.tmp.19979	2004-11-13 19:46:01.000000000 -0500
@@ -0,0 +1,68 @@
+Bug#: 69462
+Product: Mono: Compilers
+Version: 1.1
+OS: other
+OS Details: FC1 and FC2
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: C#
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: jhill@arcfocus.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Compiler crash on interface with event attribute [field:NonSerialized()]
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+The following test case will compile fine on csc, but mcs will fail with a
+NullReferenceException from ApplyAttributeBuilder.  If you comment out the
+attribute, or change the interface to a class, the compilation will succeed.
+
+Steps to reproduce the problem:
+1.  Create X.cs file with the following code:
+
+using System;
+interface X {
+  [field:NonSerialized()]
+  event EventHandler XEvent;
+}
+
+2. Attempt to compile:
+mcs x.cs -t:library
+
+Actual Results:
+Unhandled Exception: System.NullReferenceException: Object reference not
+set to an instance of an object
+in <0x0001c> Mono.CSharp.EventField:ApplyAttributeBuilder
+(Mono.CSharp.Attribute,System.Reflection.Emit.CustomAttributeBuilder)
+in <0x0010c> Mono.CSharp.Attribute:Emit
+(Mono.CSharp.EmitContext,Mono.CSharp.Attributable,System.Collections.Specialized.ListDictionary)
+in <0x000ba> Mono.CSharp.Attributes:Emit
+(Mono.CSharp.EmitContext,Mono.CSharp.Attributable)
+in <0x00064> Mono.CSharp.Event:Emit ()
+in <0x00d62> Mono.CSharp.TypeContainer:EmitType ()
+in <0x004a4> Mono.CSharp.RootContext:EmitCode ()
+in <0x00cff> Mono.CSharp.Driver:MainDriver (string[])
+in <0x00019> Mono.CSharp.Driver:Main (string[])
+
+Expected Results:
+Compilation succeeded
+
+How often does this happen? 
+Always.
+
+Additional Information:
+When mcs fails, it will not output a file name or line number, making this
+issue difficult to track in larger projects.
+
+On Mono 1.0.4, this attribute does not appear to be supported at all.  When
+it fails to compile, though, it does give a different error which actually
+outputs the file name and line number:
+x.cs(3) error CS0592: Attribute 'NonSerialized' is not valid on this
+declaration type. It is valid on 'field' 'property'  declarations only.
+Compilation failed: 1 error(s), 0 warnings