[Mono-bugs] [Bug 463568] New: Dynamic method stacks don't unwind properly

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Jan 5 10:07:02 EST 2009


https://bugzilla.novell.com/show_bug.cgi?id=463568


           Summary: Dynamic method stacks don't unwind properly
           Product: Mono: Runtime
           Version: SVN
          Platform: x86-64
        OS/Version: Linux
            Status: NEW
          Severity: Minor
          Priority: P5 - None
         Component: JIT
        AssignedTo: lupus at novell.com
        ReportedBy: Dax at daxxfiles.net
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


Description of Problem:
When throwing exceptions in dynamic method, the callstack does not unwind
properly: only one dynamic method is unwound, more specifically the one method
used to enter the dm-stack.

Steps to reproduce the problem:
compile and run:

using System.Reflection;
using System.Reflection.Emit;
using System;

class test
{
  static void Main()
  {
    var dm = new DynamicMethod("foo.a", typeof(void), Type.EmptyTypes,
                               typeof(test));
    var il = dm.GetILGenerator();
    il.ThrowException(typeof(Exception));

    var dm3 = new DynamicMethod("foo.b", typeof(void), Type.EmptyTypes,
                                typeof(test));
    il = dm3.GetILGenerator();
    il.Emit(OpCodes.Call, dm);
    il.Emit(OpCodes.Ret);

    var dm2 = new DynamicMethod("foo.c", typeof(void), Type.EmptyTypes,
                                typeof(test));
    il = dm2.GetILGenerator();
    il.Emit(OpCodes.Call, dm3);
    il.Emit(OpCodes.Ret);

    var action = (Action)dm2.CreateDelegate(typeof(Action));
    try {
      action();
    } catch(Exception e) {
      Console.WriteLine(e);
    }
  }
}


Actual Results:

System.Exception: Exception of type 'System.Exception' was thrown.
at (wrapper dynamic-method) test.foo.c () <0x00014>
at test.Main () <0x00213>


Expected Results:


System.Exception: Exception of type 'System.Exception' was thrown.
at (wrapper dynamic-method) test.foo.a () <0x00029>
at (wrapper dynamic-method) test.foo.b () <0x00014>
at (wrapper dynamic-method) test.foo.c () <0x00014>
at test.Main () <0x00213>


How often does this happen? 

Every time.


Additional Information:

Oddly, wrapping the code of each an every dynamic method in try { } (no
catch/finally) produces the expected output. Is this by design or rather a
minor bug, as regular method work just fine?


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list