[Mono-bugs] [Bug 80972][Nor] New - Compiler throws Exception with anonymous Delegates

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue Feb 27 05:36:39 EST 2007


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 egon.rath at gespag.at.

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

--- shadow/80972	2007-02-27 05:36:39.000000000 -0500
+++ shadow/80972.tmp.23369	2007-02-27 05:36:39.000000000 -0500
@@ -0,0 +1,61 @@
+Bug#: 80972
+Product: Mono: Compilers
+Version: 1.2
+OS: other
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: Unknown
+Priority: Normal
+Component: C#
+AssignedTo: rharinath at novell.com                            
+ReportedBy: Egon.Rath at gespag.at               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Compiler throws Exception with anonymous Delegates
+
+If a anonymous delegate is assigned to a non-existing Event, the compiler
+throws an exception.
+
+Example code:
+
+            stepButton.Clicked += delegate( object sender, EventArgs e )
+            {
+                m_Model.Step();
+            };
+
+stepButton is of Type Button (which does not contain an Event Named
+"Clicked"). When compiling the following exception is thrown:
+
+---- snip ----
+controller.cs(35,15): error CS0117: `System.Windows.Forms.Button' does not
+contain a definition for `Clicked'
+controller.cs(18,3): error CS0143: The type
+`egrath.test.Controller.<>c__CompilerGenerated1' has no constructors defined
+
+Unhandled Exception: Mono.CSharp.InternalErrorException: Internal error
+  at Mono.CSharp.ScopeInfo+ScopeInitializer.DoResolveInternal
+(Mono.CSharp.EmitContext ec) [0x00000] 
+  at Mono.CSharp.RootScopeInfo+RootScopeInitializer.DoResolveInternal
+(Mono.CSharp.EmitContext ec) [0x00000] 
+  at Mono.CSharp.ScopeInfo+ScopeInitializer.DoResolve
+(Mono.CSharp.EmitContext ec) [0x00000] 
+  at Mono.CSharp.Expression.Resolve (Mono.CSharp.EmitContext ec,
+ResolveFlags flags) [0x00000] 
+  at Mono.CSharp.Expression.Resolve (Mono.CSharp.EmitContext ec) [0x00000] 
+  at Mono.CSharp.ScopeInfo.GetScopeInitializer (Mono.CSharp.EmitContext ec)
+[0x00000] 
+  at Mono.CSharp.Block.EmitMeta (Mono.CSharp.EmitContext ec) [0x00000] 
+  at Mono.CSharp.ToplevelBlock.EmitMeta (Mono.CSharp.EmitContext ec) [0x00000] 
+  at Mono.CSharp.EmitContext.EmitMeta (Mono.CSharp.ToplevelBlock b) [0x00000] 
+  at Mono.CSharp.Constructor.Emit () [0x00000] 
+  at Mono.CSharp.TypeContainer.EmitConstructors () [0x00000] 
+  at Mono.CSharp.TypeContainer.EmitType () [0x00000] 
+  at Mono.CSharp.RootContext.EmitCode () [0x00000] 
+  at Mono.CSharp.Driver.MainDriver (System.String[] args) [0x00000] 
+  at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] 
+---- snip ----
+
+The expected resoult would be a error message without a compiler crash.


More information about the mono-bugs mailing list