简体   繁体   English

应用程序已停止工作 - 无法附加 VS2010 调试器

[英]Application has stopped working - cannot attach VS2010 debugger

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".当我单击调试时,会弹出另一个对话框,要求我选择一个调试器 - 我选择一个新的或现有的 Visual Studio 2010 实例。调试器启动,然后我得到另一个appcrash 对话框,询问我调试器,它说“正在抛出异常.NET 4.0 代码,当前调试器配置为调试 .NET 1.0、1.1 和 2.0 代码”。 Another instance of VS2010 launches, which says "unable to attach to crashing process. A debugger is already attached".另一个 VS2010 实例启动,显示“无法附加到崩溃进程。已附加调试器”。 (the 1st one). (第一个)。

What other things can I try to debug the program?我还可以尝试调试程序的哪些其他内容?

Why don't you simply run your program with the VS Debugger attached until it crashes?为什么不简单地运行带有 VS 调试器的程序,直到它崩溃?

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).或者,当您的程序崩溃时,您可以在任务管理器中右键单击您的进程并生成转储文件(我认为从 Windows Vista 开始可用,但您也可以为此使用 ProcessExplorer - 这适用于所有版本的 Windows)。 You can then load this dump file in VS 2010, it should point you directly to the source of the crash.然后你可以在 VS 2010 中加载这个转储文件,它应该直接指向崩溃的源头。

What I eventually did was to write location to "devenv.exe" - Visual Studio 2010 shell to我最终所做的是将位置写入“devenv.exe”-Visual Studio 2010 shell 到

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.这迫使应用程序在调试器中启动。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM