I am developing a thin managed C++ wrapper over a large unmanaged C++ library, and a large C# library. I need to catch errors originating in that large unmanaged C++ library, an
The only reliable way I've come up with to catch most unmanaged exceptions is catch (...) which won't give you any information to rethrow, but will prevent most crashes. There are still some exceptions that even catch (...) won't catch and will crash your application, even without a crash indicator (the app just disappears), like if a badly written 3rd party app uses SetJump/LongJump with the wrong error handling or thread protocols.
You could write a long series of catch blocks if you wanted to try to type many C++ exceptions, like:
catch (int i)
{
// Rethrow managed with int data
}
catch (double d)
{
// Rethrow managed with double data
}
... etc
catch (...)
{
// Rethrow managed "I got a general exception" error
}