Managed exception filter

  • Thread starter Thread starter szilvaa
  • Start date Start date
S

szilvaa

Hi there,

The .NET Framework developer's guide claims that one can filter
managed exceptions in C++.
http://msdn.microsoft.com/library/d...de/html/cpconusinguser-filteredexceptions.asp

However, I don't see how I get access to the managed exception object.
The unmanaged EXCEPTION_POINTERS* is completely useless since I want
to get to the InnerException property of the System::Exception.

BTW, I don't see that this feature in C++/CLI either. Did I miss it?

Thanks,
Albert
 
szilvaa said:
The .NET Framework developer's guide claims that one can filter
managed exceptions in C++.

Unfortunately, that document is wrong. C++ only has support to filter SEH
exceptions with the __try/__except construct. This isn't using the CLR's
exception filter capability (although the CLR's filtering is built on top of
SEH).

I've filed a bug to have this document fixed.
BTW, I don't see that this feature in C++/CLI either. Did I miss it?

We do plan to do this in C++ and support it for all exception types;
however, the Whidbey product already has enough features to keep us very
busy. This is on the list for an upcoming product after Whidbey.

Cheerio!
 
Thanks Brandon! I've added a bit of VB.NET code to do the exception
filtering for now. Cross language interop comes to the rescue.

The funny thing is that when you use __except under /clr the generated IL
code comes so close to what VB.NET generates: except for one nasty "pop"
that removes the managed exception from the stack before the filter gets
executed.

Oh well,
Albert
 
Back
Top