.NET Application crashes silent only when a debugger is attached. How do I locate the faulting code?

0

I have an .NET application which crashes when I attach a debugger. Without an attached debugger it runs as expected.

When the application crashes it just vanishes and no error message is displayed anywhere. Visual studio which I used to start the application and attach the debugger is still running but it did recognize that the debugger isn't running anymore.

The behavior doesn't happen every time but it is quite reliable.


How can I analyze this error?


This is what the Event Viewer tells me:

Faulting module name: KERNELBASE.dll, version: 10.0.18362.86, time stamp: 0x3fee4d7f
Exception code: 0xc000041d
Fault offset: 0x001133d2
Faulting process id: 0xf7f8
Faulting application start time: 0x01d59df4ddb019b5
Faulting module path: C:\WINDOWS\System32\KERNELBASE.dll
Report Id: a24c3846-a339-43ae-a3fb-04665b1b76a4

What have I tried:

  • I've eddited the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps registry key to automaticly create a crash dump but nothing is beeing created
  • I've set the following debugg options to true
    • "Break all processes when one process breaks"
    • "Break when exceptions cross AppDomain or managed/native boundaries (Managed only)
    • "Use the new Exception Helper"
  • As it is an WPF Application I subscribe to the DispatcherUnhandledException event but it isn't published
  • A simple try catch in the static void Main() method but the code in the catch isn't hit
  • Under Debug > Windows > Exception Settings I've enabled all C++ Exceptions, Managed Debugging Assistants and Win32 Exceptions

I'm using the following products:

  • Visual Studio 2019 Version 16.0.3
  • Visual Studio 2017 Version 15.9.16
  • .NET 4.6.1
  • Windows 10 Version 1903

Project specialties:

  • I have some special STA theads extra for COM and they can be blocking for a while which shouldn't be bad as they are background threads.

Basicly my question isn't why is this code not working but how can I find the code which is not working.

.net
wpf
visual-studio
debugging
asked on Stack Overflow Nov 18, 2019 by NtFreX • edited Nov 19, 2019 by NtFreX

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0