We would like to implement custom data collection/reporting when a crash occurs in a .NET application, but right now it doesn't look like there is a good way to do that.
It would be nice to have something similar to -XX:OnError in Java, which allows to set a custom command that will be executed in case of a crash (before the process is teared down).
For instance, it could be a DOTNET_DbgCrashHandler environment variable that takes the path to the custom crash handler. Just like -XX:OnError, it would replace %p with the pid. It could make sense to also support the other arguments that are currently given to createdump (such as the minidump type or the path) but I don't see that as a requirement.
From a CLR perspective, most of the code would be identical, the main difference being that PROCBuildCreateDumpCommandLine would initialize the command-line for the custom tool instead of createdump (it has also some impacts in PROCCreateCrashDumpIfEnabled).
We would like to implement custom data collection/reporting when a crash occurs in a .NET application, but right now it doesn't look like there is a good way to do that.
It would be nice to have something similar to
-XX:OnErrorin Java, which allows to set a custom command that will be executed in case of a crash (before the process is teared down).For instance, it could be a
DOTNET_DbgCrashHandlerenvironment variable that takes the path to the custom crash handler. Just like-XX:OnError, it would replace%pwith the pid. It could make sense to also support the other arguments that are currently given to createdump (such as the minidump type or the path) but I don't see that as a requirement.From a CLR perspective, most of the code would be identical, the main difference being that
PROCBuildCreateDumpCommandLinewould initialize the command-line for the custom tool instead of createdump (it has also some impacts inPROCCreateCrashDumpIfEnabled).