1
votes

I'm trying to debug a program which crashes. In normal circumstances, when the program crashes, I can attach a debugger from an "Application has stopped working" dialog, where you can check online for a solution, close the program or debug.

When I click debug, another dialog pops up asking me to choose a debugger - I pick a new or existing instance of Visual Studio 2010. Debugger launches, then I get another appcrash dialog asking me for debugger, which says "Exception is being thrown from .NET 4.0 code, current debugger is configured to debug .NET 1.0, 1.1 and 2.0 code". Another instance of VS2010 launches, which says "unable to attach to crashing process. A debugger is already attached". (the 1st one).

What other things can I try to debug the program?

2

2 Answers

0
votes

Why don't you simply run your program with the VS Debugger attached until it crashes?

Alternatively when your program crashes you can right click your process in the task manager and generate a dump file (this is available starting with Windows Vista I think but you can also use ProcessExplorer for this - this will work for all versions of Windows). You can then load this dump file in VS 2010, it should point you directly to the source of the crash.

0
votes

What I eventually did was to write location to "devenv.exe" - Visual Studio 2010 shell to

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\xxx.exe" - "Debugger=...\devenv.exe"

That forced the app to start in the debugger.