About SEHException

C

Chris

Hi
As I understand things, when my unmanaged C++ code throws
an exception it is wrapped into a SEHException when it reaches
managed code. Now is there a way from the managed catch clause
to get the original unmanaged exception class that was wrapped
in the SEHException ?

Chris.
 
O

Oleg Starodumov

As I understand things, when my unmanaged C++ code throws
an exception it is wrapped into a SEHException when it reaches
managed code. Now is there a way from the managed catch clause
to get the original unmanaged exception class that was wrapped
in the SEHException ?

You can use the unmanaged exception class in the catch clause
(and use it before the catch clause for SEHException if it is also present).

Regards,
Oleg
 
C

Chris

Oleg said:
You can use the unmanaged exception class in the catch clause
(and use it before the catch clause for SEHException if it is also present).

Yes, I know that, but what I'd like to do, for example, is catch the
SEHException from C# code and call some managed C++ conversion function
I would have written, extracting useful information from my internal
exception class. I don't want to put a C++ try / catch around each call
to my unmanaged C++ functions, catching my unmanaged C++ exception class
and throwing my own managed wrapper exception class (SEHException would
be of no use then).

Chris.
 
O

Oleg Starodumov

Yes, I know that, but what I'd like to do, for example, is catch the
SEHException from C# code and call some managed C++ conversion function
I would have written, extracting useful information from my internal
exception class. I don't want to put a C++ try / catch around each call
to my unmanaged C++ functions, catching my unmanaged C++ exception class
and throwing my own managed wrapper exception class (SEHException would
be of no use then).

AFAIK this information is not directly exposed (since it is actually
specific to CRT library and not documented).

Regards,
Oleg
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top