Creating Mini Dumps for _caught_ SEH Exceptions in a Mixed DLL

I am trying to use code similar to clrdump to create mini dumps in my managed process.

This managed process calls C ++ / CLI code, which calls some native static C ++ lib code in which SEH exceptions can be thrown (for example, random access violation).

  C# WinForms
  -> 
    C++/CLI DLL
    ->
      Static C++ Lib
      ->
        ACCESS VIOLATION

Our policy is to create mini-dumps for all SEH exceptions (caught and not displayed), and then translate them into C ++ exceptions, which will be processed by the application code. This works great for purely native processes; but when the application is a C # application - not so much.

The only thing I see for dumping from SEH exceptions in the C # process is not to catch them, and then, like unhandled exceptions, use a handler Application.ThreadExceptionto create a mini dump. An alternative is to allow the CLR to throw the SEH exception into the .Net exception and catch it (for example System.AccessViolationException) - but this means that no dump is created, but information is lost (information about the stack trace in is Exceptionnot as rich as a mini dump).

So how can I handle SEH exceptions by creating a minidump and translating the exception into an exception. Net so my application can try to recover?

Edit

By "not catching exceptions" I also mean a trap, and then rethrowing, which preserves rich information about the exception.

, System.Exception -, System.SystemException. , AccessViolation ( ) , , , (ApplicationException?).

+3

Source: https://habr.com/ru/post/1742776/


All Articles