mail-archives/mono-bugs/2004-November/022578.html

132 строки
5.1 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [Mono-bugs] [Bug 69462][Nor] New - Compiler crash on interface with event attribute [field:NonSerialized()]
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:bugzilla-daemon%40bugzilla.ximian.com">
<META NAME="robots" CONTENT="index,nofollow">
<LINK REL="Previous" HREF="022577.html">
<LINK REL="Next" HREF="022579.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[Mono-bugs] [Bug 69462][Nor] New - Compiler crash on interface with event attribute [field:NonSerialized()]
</H1>
<B>bugzilla-daemon@bugzilla.ximian.com
</B>
<A HREF="mailto:bugzilla-daemon%40bugzilla.ximian.com"
TITLE="[Mono-bugs] [Bug 69462][Nor] New - Compiler crash on interface with event attribute [field:NonSerialized()]">bugzilla-daemon@bugzilla.ximian.com
</A><BR>
<I>Sat, 13 Nov 2004 19:46:01 -0500 (EST)</I>
<P><UL>
<LI> Previous message: <A HREF="022577.html">[Mono-bugs] [Bug 69258][Wis] Changed - mod_mono package should require libapr &gt;= 0.9.4
</A></li>
<LI> Next message: <A HREF="022579.html">[Mono-bugs] [Bug 69466][Wis] New - undefined reference to `mono_main' in main.c
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#22578">[ date ]</a>
<a href="thread.html#22578">[ thread ]</a>
<a href="subject.html#22578">[ subject ]</a>
<a href="author.html#22578">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>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 <A HREF="mailto:jhill@arcfocus.com.">jhill@arcfocus.com.</A>
<A HREF="http://bugzilla.ximian.com/show_bug.cgi?id=69462">http://bugzilla.ximian.com/show_bug.cgi?id=69462</A>
--- 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: <A HREF="mailto:mono-bugs@ximian.com">mono-bugs@ximian.com</A>
+ReportedBy: <A HREF="mailto:jhill@arcfocus.com">jhill@arcfocus.com</A>
+QAContact: <A HREF="mailto:mono-bugs@ximian.com">mono-bugs@ximian.com</A>
+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 &lt;0x0001c&gt; Mono.CSharp.EventField:ApplyAttributeBuilder
+(Mono.CSharp.Attribute,System.Reflection.Emit.CustomAttributeBuilder)
+in &lt;0x0010c&gt; Mono.CSharp.Attribute:Emit
+(Mono.CSharp.EmitContext,Mono.CSharp.Attributable,System.Collections.Specialized.ListDictionary)
+in &lt;0x000ba&gt; Mono.CSharp.Attributes:Emit
+(Mono.CSharp.EmitContext,Mono.CSharp.Attributable)
+in &lt;0x00064&gt; Mono.CSharp.Event:Emit ()
+in &lt;0x00d62&gt; Mono.CSharp.TypeContainer:EmitType ()
+in &lt;0x004a4&gt; Mono.CSharp.RootContext:EmitCode ()
+in &lt;0x00cff&gt; Mono.CSharp.Driver:MainDriver (string[])
+in &lt;0x00019&gt; 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
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI> Previous message: <A HREF="022577.html">[Mono-bugs] [Bug 69258][Wis] Changed - mod_mono package should require libapr &gt;= 0.9.4
</A></li>
<LI> Next message: <A HREF="022579.html">[Mono-bugs] [Bug 69466][Wis] New - undefined reference to `mono_main' in main.c
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#22578">[ date ]</a>
<a href="thread.html#22578">[ thread ]</a>
<a href="subject.html#22578">[ subject ]</a>
<a href="author.html#22578">[ author ]</a>
</LI>
</UL>
</body></html>