About SEHException

  • Thread starter Thread starter Chris
  • Start date Start date
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.
 
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
 
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.
 
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
 
Back
Top