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 [EMAIL PROTECTED] http://bugzilla.ximian.com/show_bug.cgi?id=81466 --- shadow/81466 2007-04-26 17:53:44.000000000 -0400 +++ shadow/81466.tmp.20343 2007-04-26 17:53:44.000000000 -0400 @@ -0,0 +1,153 @@ +Bug#: 81466 +Product: Mono: Runtime +Version: 1.2 +OS: All +OS Details: Windows XP/SUSE Linux 10.1 +Status: NEW +Resolution: +Severity: +Priority: Critical +Component: JIT +AssignedTo: [EMAIL PROTECTED] +ReportedBy: [EMAIL PROTECTED] +QAContact: [EMAIL PROTECTED] +TargetMilestone: --- +URL: +Cc: +Summary: Mono fails to run binaries produced with .NET C# compiler. + +Description of Problem: + +I am experiencing a problem when I try to run the code compiled using the +.NET Framework on the mono runtime. The same code runs fine when executed on +.NET Framework. However when I compile the code using mono compiler mcs.exe +it runs fine on any runtime. When I started to examine the IL code emitted +by the csc.exe and mcs.exe I noticed the difference that leads to unbounded +recursion and then a StackOverflowException. + +To reproduce the problem the following steps required: +1. The library. Contains code: + +using System; + +namespace MainSpace +{ + public interface IA + {} + public interface IB + { bool Test(); } + public interface IC : IA, IB + {} + public interface ID : IC + {} + public class A : IA + {} + public class AC : A, IC + { + public virtual bool Test() + { + Console.WriteLine("AC.Test()"); return true; + } + } + public class CD : AC, ID + {} +} + + +2. The executable. Contains code: + +using System; + +namespace ImplSpace +{ + internal class TestImpl : MainSpace.CD + { + public override bool Test() + { Console.WriteLine("TestImpl.Test()"); return base.Test(); } + } + public class TestClass + { + public static void Main() + { + TestImpl ti = new TestImpl(); + ti.Test(); + } + } +} + +3. The library and the executable now should be compiled using the +Microsoft csc.exe C# compiler. + +4. When executed using the .NET Framework the output is expected: +TestImpl.Test() +AC.Test() + +5. When executed using the Mono-1.2.3/4 for Win32 the output is unexpected: +TestImpl.Test() +... +TestImpl.Test() +Unhandled Exception: System.StackOverflowException: The requested operation +caus ed a stack overflow. + at ImplSpace.TestImpl.Test () [0x00000] + ... + at ImplSpace.TestImpl.Test () [0x00000] + +6. If the library and the executable are compiled using the Mono compiler +then no any unexpected behaviour occurs. + +Actual Results: +Unhandled Exception: System.StackOverflowException + +Expected Results: +TestImpl.Test() +AC.Test() + +How often does this happen? +Always + +Additional Information: +Disassembly information obtained with .NET IL DASM(ildasm.exe) utility +follows. +The following IL code is generated using the csc.exe for the method +TestImpl.Test: +.method public hidebysig virtual instance bool + Test() cil managed +{ + // Code size 21 (0x15) + .maxstack 1 + .locals init ([0] bool CS$00000003$00000000) + IL_0000: ldstr "TestImpl.Test()" + IL_0005: call void [mscorlib]System.Console::WriteLine(string) + IL_000a: ldarg.0 + IL_000b: call instance bool [FaultTestLib]MainSpace.CD::Test() + IL_0010: stloc.0 + IL_0011: br.s IL_0013 + IL_0013: ldloc.0 + IL_0014: ret +} // end of method TestImpl::Test + +The following IL code is generated using the mcs.exe for the method +TestImpl.Test: +.method public hidebysig virtual instance bool + Test() cil managed +{ + // Code size 17 (0x11) + .maxstack 8 + IL_0000: ldstr "TestImpl.Test()" + IL_0005: call void [mscorlib]System.Console::WriteLine(string) + IL_000a: ldarg.0 + IL_000b: call instance bool [FaultTestLib]MainSpace.AC::Test() + IL_0010: ret +} // end of method TestImpl::Test + +Now I can see that the the code produced by the csc.exe calls +MainSpace.CD::Test() +whereas code produced by the mcs.exe directly calls MainSpace.AC::Test(). + +My environment +OS: Windows/Linux +.NET: .NET Framework v1.1.4322 +Mono: Mono-1.2.3 for Linux, Mono-1.2.3/4 for Win32 + +Thanks, +Alex Makhotin _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
