[Mono-dev] Exception catching in C...
robertj at gmx.net
Thu Jan 4 15:05:20 EST 2007
Thomas Wiest wrote:
> On a related note, in my example project if I throw an exception that
> isn't handled (on purpose), the program prints the "Unhandled Exception"
> information but doesn't exit as expected. It just sits there. I've
> attached the example project. Sorry for the size, I tried to pare it
> down as much as possible. I also tried rewriting it in a more basic
> form, but then it didn't seem to have this problem. I've tried this on
> 184.108.40.206 (sled) and 220.127.116.11 (vmware image).
> Is this a bug, or am I doing something wrong?
The link in your previous mail was about p/invoke, where exceptions
can't be caught, but since you're embedding Mono, there is an easy and
documented way to handle exceptions:
mono_runtime_invoke's last argument is actually a MonoException**:
void call_person_ThrowException(person_class *person)
person->object, NULL, &exception);
if (exception) do_something ();
I didn't look why your sample hangs, though.
More information about the Mono-devel-list