[Mono-bugs] [Bug 42521][Wis] New - mcs 0.24 compile exception relating to foreach loop

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Wed, 7 May 2003 14:17:59 -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 bryan@alphora.com.

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

--- shadow/42521	Wed May  7 14:17:59 2003
+++ shadow/42521.tmp.16397	Wed May  7 14:17:59 2003
@@ -0,0 +1,84 @@
+Bug#: 42521
+Product: Mono/MCS
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: Misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: bryan@alphora.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: mcs 0.24 compile exception relating to foreach loop
+
+Trying out the .24 build I got an error tring to compile a file that 
+worked fine in .23.
+
+Here is the exception seen:
+
+C:\src\Dataphor\Base>mcs *.cs
+Exception caught by the compiler while compiling:
+   Block that caused the problem begin at: .\Base.cs: (339)
+                     Block being compiled: [Internal: (1),Internal: (1)]
+
+Unhandled Exception: System.NotSupportedException: The invoked member is 
+not supported in a dynamic module.
+   at System.Reflection.Emit.TypeBuilder.GetMethods(BindingFlags 
+bindingAttr)
+   at System.Type.FindMembers(MemberTypes memberType, BindingFlags 
+bindingAttr, MemberFilter filter, Object filterCriter
+ia)
+   at Mono.CSharp.Foreach.TryType(Type t, ForeachHelperMethods hm)
+   at Mono.CSharp.Foreach.ProbeCollectionType(EmitContext ec, Type t)
+   at Mono.CSharp.Foreach.Resolve(EmitContext ec)
+   at Mono.CSharp.Block.Resolve(EmitContext ec)
+   at Mono.CSharp.Block.Resolve(EmitContext ec)
+   at Mono.CSharp.EmitContext.EmitTopBlock(Block block, InternalParameters 
+ip, Location loc)
+   at Mono.CSharp.MethodData.Emit(TypeContainer container, Block block, 
+Object kind)
+   at Mono.CSharp.TypeContainer.Emit()
+   at Mono.CSharp.RootContext.EmitCode()
+   at Mono.CSharp.Driver.MainDriver(String[] args)
+   at Mono.CSharp.Driver.Main(String[] args)
+
+I'll attach the base.cs but you won't be able to compile it without the 
+rest of the project.  Hopefully you will be able to diagnose the problem 
+from the call stack above and by looking at the specific lines of code 
+that are tring to be compiled.  If you can give me an idea of what the 
+problem might be I can spend the time to try to create a simple test case.
+
+I'm guessing it's releated to the iterator changes that went in.
+
+Here is the code that is causing the error.
+
+        protected object RecurseChildren(IParent AParent, ref int AIndex)
+        {
+            object LReturnObject = null;
+            foreach (object LChild in AParent.Children)
+            {
+                if (FType.IsInstanceOfType(LChild) || LChild.GetType
+().IsSubclassOf(FType))
+                {
+                    AIndex--;
+                    if (AIndex < 0)
+                    {
+                        LReturnObject = (LChild);
+                        break;
+                    }
+                }
+                if (LChild is IParent)
+                {
+                    LReturnObject = RecurseChildren((IParent)LChild, ref 
+AIndex);
+                    if (LReturnObject != null)
+                        break;
+                }
+            }
+            return LReturnObject;
+        }