I have some complex functions that run in the async Task , spawned via TPL, which can sometimes occur unexpectedly. If such a malfunction occurs, this indicates a programming error that could lead to damage to the state of the program. Therefore, I do not want my program to detect an exception, handle it and "limp"; I want my process to crash and terminate.
I also want the thing to die in such a way that the Windows error reporting system detects it as a failure and does all the useful debugging things like grabbing a mini-disk, sending it to Microsoft, etc.
I understand that this may contradict your opinions about what programs should be done in the face of errors, but that is not the issue.
The problem that I have is that an exception arises from the task, this does not immediately lead to a process failure. After some time, it crashes when the garbage collector in his wisdom decides to collect an "unobserved" exception.
I want the process to work immediately because ...
- The call column and the stream dump from the actual error is what I want to collect in the crash dump
- The process of "chrome plating" and the failure of some indefinite time later can lead to further damage, since it will work with a possible damaged software state
- Users are confused about which operation actually caused the failure.
So, in short, the question is:
How can I crash my process from async Task created using TPL so that Windows Error Reporting can create a useful mini-drive?
Thanks in advance!
source share