Diagnostics: Allow dump generation based on CPU, Memory, EventCounter/EventSource, 1st/2nd Chance Exception

Created on 1 Oct 2019  路  10Comments  路  Source: dotnet/diagnostics

dotnet-dump enhancement

Most helpful comment

Sure :)
I was thinking about the scenarios we usually see at the customers. And collecting the right data is the most important step to troubleshooting.

Many times we need to collect dumps on production environment, and we don't know how frequently, or how to simulate the problem. In Windows we have ProcDump (the Linux version still have some issues with .NET Core and doesn't have all the flags) and DebugDiag.

In order to have a complete and uniform debug experience, we would need more advanced trigger for dotnet-dump, like:

CPU is above/below X
Private committed memory usage is above X
Event Counter threshold is above X
Crash Dump (2nd chance Exception)
1st chance exception (and optionally filter by type/message)
When a specific Event happen (similar to ETW)

All 10 comments

@felipepessoto Could you please provide a little bit more detail about what this feature request is about? :-)

Sure :)
I was thinking about the scenarios we usually see at the customers. And collecting the right data is the most important step to troubleshooting.

Many times we need to collect dumps on production environment, and we don't know how frequently, or how to simulate the problem. In Windows we have ProcDump (the Linux version still have some issues with .NET Core and doesn't have all the flags) and DebugDiag.

In order to have a complete and uniform debug experience, we would need more advanced trigger for dotnet-dump, like:

CPU is above/below X
Private committed memory usage is above X
Event Counter threshold is above X
Crash Dump (2nd chance Exception)
1st chance exception (and optionally filter by type/message)
When a specific Event happen (similar to ETW)

Totally agree. At least _Crash Dump_ (2nd chance Exception) is must have feature.

This is now possible with the diagnostics client library. There is a code sample in the docs as well, so you should be able to easily do this by writing your own tool.

https://github.com/dotnet/diagnostics/blob/master/documentation/design-docs/diagnostics-client-library.md

This is now possible with the diagnostics client library. There is a code sample in the docs as well, so you should be able to easily do this by writing your own tool.

https://github.com/dotnet/diagnostics/blob/master/documentation/design-docs/diagnostics-client-library.md

Sorry, may be I am looking wrong way, but I can't find how I can to do a crash dump with this tool :(
Other triggers like (cpu-usage, working-set...) - yes, but _Crash Dump (2nd chance Exception)_?

If you turn on the COMPlus environment variables detailed here, you will get dumps on process tear down due to 2nd chance exceptions.

CC - @mikem8361

If you turn on the COMPlus environment variables detailed here, you will get dumps on process tear down due to 2nd chance exceptions.

And what about windows? If we want generate crash dumps ourselves, for example in watch dog process?

There is the dbghelp's MiniDumpWriteDump that you could call on the target process in your watch dog. The other way it to setup "WER" which I don't know a lot about the configuration on Windows.

An C# example is here.

There is the dbghelp's MiniDumpWriteDump that you could call on the target process in your watch dog. The other way it to setup "WER" which I don't know a lot about the configuration on Windows.

An C# example is here.

Of course I can create dump with MiniDumpWriteDump , dose it have crash trigger? - No :(
ProcDump mentioned by @felipepessoto not working with .net core even on windows. At least for tested WinForm app (work fine with same app but net472 target). So on windows for now WER is the only option...
Back to subject of this issue:

In order to have a complete and uniform debug experience, we would need more advanced trigger for dotnet-dump, like:

CPU is above/below X
Private committed memory usage is above X
Event Counter threshold is above X
Crash Dump (2nd chance Exception)
1st chance exception (and optionally filter by type/message)
When a specific Event happen (similar to ETW)

For now, we can workaround some of this triggers (CPU, memory...), but not all (Crash Dump (2nd chance Exception)...)

Your right; I didn't answer your question about unhandled (2nd chance) exceptions on Windows. We will look into adding the 2nd chance exception event/trigger.

Was this page helpful?
0 / 5 - 0 ratings