[Mono-bugs] [Bug 78692][Maj] New - MS.NET's foreach loop over an array of Controls crashes JIT

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Thu Jun 22 09:42:49 EDT 2006


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 kuba.brecka at gmail.com.

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

--- shadow/78692	2006-06-22 09:42:49.000000000 -0400
+++ shadow/78692.tmp.5629	2006-06-22 09:42:49.000000000 -0400
@@ -0,0 +1,90 @@
+Bug#: 78692
+Product: Mono: Runtime
+Version: 1.1
+OS: GNU/Linux [Other]
+OS Details: Linux Slackware, Windows XP
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Major
+Component: JIT
+AssignedTo: lupus at ximian.com                            
+ReportedBy: kuba.brecka at gmail.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: MS.NET's foreach loop over an array of Controls crashes JIT
+
+Description of Problem:
+I have the following code to reproduce the problem:
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Windows.Forms;
+namespace MonoTest2
+{
+    class Program
+    {
+        static void Main(string[] args)
+        {
+            Panel P = new Panel();
+
+            Button B1 = new Button();
+            Button B2 = new Button();
+
+            B1.Text = "hello world";
+            B2.Text = "hello world2";
+
+            P.Controls.Add(B1);
+            P.Controls.Add(B2);
+
+            foreach(Control C in P.Controls) {
+                MessageBox.Show(C.Text);
+            }
+        }
+    }
+}
+
+This code runs perfectly when:
+1) compiled with mono and run under mono
+2) compiled with mono and run under Microsoft .NET Framework
+3) compiled with Microsoft .NET Framework and run under Microsoft .NET
+Framework
+
+But it breaks the JIT compiler when it is:
+* compiled with Microsoft .NET Framework and run under mono (tried both
+stable 1.1.13.8 and devel 1.1.15 version)
+
+I tried figuring out why this happens and here is the MSIL instruction
+where the two .exe files differ. The difference is on a single line, at the
+foreach loop:
+
+Mono's code:
+callvirt instance [mscorlib]System.Collections.IEnumerator
+[System.Windows.Forms]System.Windows.Forms.Control/ControlCollection::GetEnumerator()
+
+MS.NET's code:
+callvirt instance [mscorlib]System.Collections.IEnumerator
+[System.Windows.Forms]System.Windows.Forms.Layout.ArrangedElementCollection::GetEnumerator()
+
+
+Actual Results:
+When run, the program shows a messagebox with this error (mono devel. 1.1.15):
+
+** ERROR **: file mini.c: line 9995 (mono_jit_compile_method_inner): should
+not be reached
+aborting...
+
+It also produces this warning to the stdout:
+
+** (program-vs.exe:3636): WARNING **: Missing method GetEnumerator in
+assembly C:\Kuba\Programming\MonoTest2\MonoTest2\program-vs.exe, type
+System.Windows.Forms.Layout.ArrangedElementCollection
+
+This application has requested the Runtime to terminate it in an unusual
+way. Please contact the application's support team for more information.
+
+Expected Results:
+Two messageboxes, one with "helloworld1", second with "helloworld2"


More information about the mono-bugs mailing list