[Mono-bugs] [Bug 57703][Nor] Changed - MCS emits invalid IL for events on an interface

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Wed, 28 Apr 2004 01:44:47 -0400 (EDT)


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@pandora.be.

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

--- shadow/57703	2004-04-27 18:43:19.000000000 -0400
+++ shadow/57703.tmp.31302	2004-04-28 01:44:47.000000000 -0400
@@ -38,6 +38,58 @@
 ------- Additional Comments From bmaurer@users.sf.net  2004-04-27 18:43 -------
 what kind of file is this, i cant tell from bugzilla.
 
 Can you attach the file as plain text?
 
 Also, it is more like a normal, not a blocker.
+
+------- Additional Comments From gert.driesen@pandora.be  2004-04-28 01:44 -------
+Sorry about that, it was a tar ...
+
+But I guess you don't really need the MS generated assembly to 
+reproduce this issue, so I'll just include the "offending" code here:
+
+using System;
+
+namespace InterfaceEventIssue {
+	public interface ITest {
+		event EventHandler DocBuildingStep;
+	}
+}
+
+MCS emits the following IL for the event :
+
+.field private class [mscorlib]System.EventHandler DocBuildingStep
+.event specialname rtspecialname [mscorlib]System.EventHandler 
+DocBuildingStep
+{
+  .addon instance void InterfaceEventIssue.ITest::add_DocBuildingStep
+(class [mscorlib]System.EventHandler)
+  .removeon instance void 
+InterfaceEventIssue.ITest::remove_DocBuildingStep(class [mscorlib]
+System.EventHandler)
+}
+
+while CSC emits 
+
+.event [mscorlib]System.EventHandler DocBuildingStep
+{
+  .addon instance void InterfaceEventIssue.ITest::add_DocBuildingStep
+(class [mscorlib]System.EventHandler)
+  .removeon instance void 
+InterfaceEventIssue.ITest::remove_DocBuildingStep(class [mscorlib]
+System.EventHandler)
+} // end of event ITest::DocBuildingStep
+
+Note that MS does not emit the field, and does not tag the event with 
+specialname and rtspecialname attributes.
+
+PE Verifier reports the following errors on the assembly built by 
+MCS :
+
+[MD]: .NET Framework Internal error: 0x801312a0  [token:0x04000001]
+[MD]: .NET Framework Internal error: 0x8013126b  [token:0x04000001]
+[MD]: .NET Framework Internal error: 0x8013126c  [token:0x04000001]
+
+In my opinion, a bug which causes MCS to emit invalid IL is critical 
+as it would allow assemblies to be built on Mono (that even work fine 
+on Mono), but fail at runtime on MS.NET.