[Mono-bugs] [Bug 608073] New: exception in cctor is not caught by mono_runtime_invoke

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sat May 22 08:30:09 EDT 2010


http://bugzilla.novell.com/show_bug.cgi?id=608073

http://bugzilla.novell.com/show_bug.cgi?id=608073#c0


           Summary: exception in cctor is not caught by
                    mono_runtime_invoke
    Classification: Mono
           Product: Mono: Runtime
           Version: 2.6.x
          Platform: Other
        OS/Version: Mac OS X 10.6
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: JIT
        AssignedTo: lupus at novell.com
        ReportedBy: lucas.meijer at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-US)
AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.38 Safari/533.4

Run this reproprogram:

#include <glib.h>
#include <mono/jit/jit.h>
#include <mono/metadata/assembly.h>
#include <mono/metadata/debug-helpers.h>
#include <mono/metadata/mono-gc.h>
#include <mono/metadata/class.h>

int main()
{
        MonoDomain* domain = mono_jit_init_version ("Unity Root Domain",
"v2.0.50727");
        MonoMethodDesc* desc = mono_method_desc_new("Lucas:.ctor()",1);

        MonoAssembly* ass = mono_domain_assembly_open (mono_domain_get (),
"lucas.dll");
        MonoImage* img = mono_assembly_get_image(ass);
        printf("image %d\n",img);
        MonoMethod* m = mono_method_desc_search_in_image(desc,img);
        printf("method %d\n",m);
        MonoObject* exc;
        MonoObject* newinst = mono_object_new(mono_domain_get(),
mono_method_get_class(m));
        MonoObject* ret = mono_runtime_invoke(m,newinst,0,&exc);
        printf ("Exception: %d\n",exc);
        if (exc)
        {
                MonoException* exc2 = (MonoException*) exc;
                printf ("exc msg:
%s\n",mono_class_get_name(mono_object_get_class(exc)));
        }
        printf ("ret: %d\n",ret);
        return 0;
}




against this lucas.dll:

public class Lucas
{
    static Lucas()
    {
        throw new System.Exception("bookaya");
    }
}


Reproducible: Always

Steps to Reproduce:
Run the program in the details section on the mono 2.6.x branch
Actual Results:  
Unhandled exception

Expected Results:  
mono_runtime_invoke catching the exception, and neatly reporting it trough the
printf();

happens on windows7 & macosx 10.5 & 10.6,  on mono 2.6.x branch

-- 
Configure bugmail: http://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