[Mono-dev] C->C#, exceptions ...
Jan Vavra
vavra at software602.cz
Tue Mar 21 10:00:35 EST 2006
Hello,
I modified your /mono/samples/embed/test-invoke.c
I call a C# method, that throws an exception.
1) Can I obtain a Message (C#: exception.Message) ?
2) Can I obtain a type of exception. Smthg like get_type_name( MonObject
*) ?
MonoObject *exception = NULL;
mono_runtime_invoke (fail, NULL, NULL, &exception);
if (exception) {
//I tried this, but no success:
MonoClass *eklass = mono_object_get_class(exception);
if (!eklass) {
printf("eklass==NULL\n");
}
MonoClassField *Message =
mono_class_get_field_from_name(klass, "Message");
if (!Message) {
printf("Message==NULL\n");
}
MonoString *msg;
mono_field_get_value(exception, Message, &msg);
}
JV
More information about the Mono-devel-list
mailing list