Bug 322311 (MONO79605) - [MCS] Iterators produce invalid IL code.
Summary: [MCS] Iterators produce invalid IL code.
Status: RESOLVED FIXED
Alias: MONO79605
Product: Mono: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: 1.0
Hardware: Other Other
: P3 - Medium : Major
Target Milestone: ---
Assignee: Martin Baulig
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-10-07 00:03 UTC by Marek Safar
Modified: 2007-09-15 21:24 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 20:12:18 UTC


---- Reported by marek.safar@seznam.cz 2006-10-06 17:03:42 MST ----

Please fill in this template when reporting a bug, unless you know what you
are doing.
Description of Problem:

Probably because of Martin anonymous method rewrite, iterators stop working.

Steps to reproduce the problem:
1. Take any of test/test-iter*.*
2. compile
3. run under MS.NET environment

Actual Results:

Unhandled Exception: System.InvalidCastException: Specified cast is not valid.
   at X.Main()

Expected Results:

No exception

How often does this happen? 


Additional Information:



---- Additional Comments From miguel@ximian.com 2006-10-08 13:13:51 MST ----

Also sebastien reported:

<spouliot> 1) MonoTests.System.ArrayTest.ReadOnly_Enumerator :
System.InvalidProgramException : Invalid IL code in
<>c__CompilerGenerated1:System.Collections.Generic.IEnumerator<T>.get_Current
(): IL_0010: newobj    0x060006bc
<spouliot> when running unit tests for 2.0 profile



---- Additional Comments From martin@ximian.com 2006-10-09 08:14:42 MST ----

Can you please provide a test case for that ?



---- Additional Comments From marek.safar@seznam.cz 2006-10-09 13:50:59 MST ----

As I said take any test file from test/test-iter*.*

I have no testcase for Sebastian's problem.



---- Additional Comments From martin@ximian.com 2006-10-09 14:16:17 MST ----

... and closing it again.



---- Additional Comments From martin@ximian.com 2006-10-09 14:17:24 MST ----

Hmm, where's my last comment gone ... ?  Looks like it got eaten by
Bugzilla.

I tried 5 random test/test-iter-*.cs tests, compiled them with gmcs
and run them on .NET.  They all worked and also PEVerify'ed.

Martin



---- Additional Comments From marek.safar@seznam.cz 2006-10-09 17:08:28 MST ----

Sorry for misinformation but for some strange reasons GMCS is OK and
the problem occurs with MCS only.
The output is OK in terms of Peverify but cannot run it at all.



---- Additional Comments From miguel@ximian.com 2006-10-09 20:32:53 MST ----

The problem is easy to reproduce:

cd mcs/class/corlib
make run-test-local PROFILE=net_2_0

Let it run, at some point it will hang, you can control-c it at that
point;  It hangs because of something else now (strtod.c is broken
with O2).  Anyways, then type this from that directory:

MONO_PATH="../../class/lib/net_2_0::$MONO_PATH"
/cvs/mono/runtime/mono-wrapper --debug
../../class/lib/net_2_0/nunit-console.exe 
/exclude:NotWorking,ValueAdd,CAS,InetAccess
/fixture:MonoTests.System.ArrayTest corlib_test_net_2_0.dll

It will produce this:

Failures:
1) MonoTests.System.ArrayTest.ReadOnly_Enumerator :
System.InvalidProgramException : Invalid IL code in
<>c__CompilerGenerated1:System.Collections.Generic.IEnumerator<T>.get_Current
(): IL_0010: newobj    0x060006bc


  at <0x00000> <unknown method>
  at MonoTests.System.ArrayTest.ReadOnly_Enumerator () [0x00033] in
/home/cvs/mcs/class/corlib/Test/System/ArrayTest.cs:2747
  at <0x00000> <unknown method>
  at (wrapper managed-to-native)
System.Reflection.MonoMethod:InternalInvoke (object,object[])
  at System.Reflection.MonoMethod.Invoke (System.Object obj,
BindingFlags invokeAttr, System.Reflection.Binder binder,
System.Object[] parameters, System.Globalization.CultureInfo culture)
[0x00056] in
/home/cvs/mcs/class/corlib/System.Reflection/MonoMethod.cs:143



Unknown operating system unknown. Setting to default OS "Other".