Skip to content

Register a custom crash handler #95461

Description

@kevingosse

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-Diagnostics-coreclrenhancementProduct code improvement that does NOT require public API changes/additionsin-prThere is an active PR which will close this issue when it is merged

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions