The ability for a process to detect handled exceptions is very dangerous. The concept is called the Vectored Exception Handler on windows. You can do this in unmanaged code with kernel32!AddVectoredExceptionHandler, but it is not supported for managed code. See explanation here for details. Basically, it's too dangerous in managed. (My understanding is that you're asking what your options are with the current design; we can have a whole separate discussion about the design )
There's no easy way to detect all handled exceptions. If you want this, options include: 1. Use debugging interfaces, which must operate from a 2nd process. Example here. 2. Use profiler interfaces, which have callbacks for managed exceptions. This is hard too (profilers must be written in unmanaged code), but very powerful. 3. The rocket scientist approach is to use kernel32!AddVectoredExceptionHandler, but that's very dangerous and limited, and can't call back into managed code.
|