如何排除故障和调试Visual Studio的设计模式中的错误?故障、错误、模式、Studio

2023-09-02 10:29:07 作者:若只如初见

使用Windows 7和Visual Studio 2010中,我写了一个C#的自定义用户控件。我被编码code查看了几个星期,最近,当我试图切换到设计模式,Visual Studio中上吊,没有响应。我可以等一个小时,仍然没有任何反应。点击关闭按钮就给出了你要等待,关闭,重新启动,将信息发送到微软对话框。

Using Windows 7 and Visual Studio 2010, I am writing a C# custom UserControl. I was coding in code view for weeks and recently when I tried to switch to design mode, Visual Studio hanged, "NOT RESPONDING". I can wait for an hour, and still nothing happens. Clicking on the close button it gives the "Do you want to wait, close, restart and send information to Microsoft" dialog.

有没有一种办法(堆栈)跟踪code,设计师正在试图执行?也许设计时跟踪消息或转折点?

Is there a way to (stack)trace the code that the designer is trying to execute? Maybe design-time trace messages or breakpoints?

推荐答案

您可以调试Visual Studio设计本身! 打开Visual Studio的第二个实例,使用工具 - >附加到进程并附着在第一的Visual Studio(即 devenv.exe的)。

For Visual Studio 2010/2013

You can debug the Visual Studio designer itself! Open a second instance of Visual Studio, use the Tools -> Attach To Process and attach to the first Visual Studio (i.e. devenv.exe).

在Visual Studio实例#2 (你没有附加到进程中的一个)的:把一个断点在你的用户控件的构造

In Visual Studio instance #2 (the one that you did the Attach To Process in): Put a breakpoint on your usercontrol's constructor

在Visual Studio实例#1 (原单,这将卡住)的: 打开设计,您的用户控件中,断点在VS#2将被打到。

In Visual Studio instance #1 (the original one, that will get stuck): Open the designer which your usercontrol is in, the breakpoint in VS#2 will get hit.

您要调试的过程是 XDesProc.exe - 见博士ABT的回答。否则,程序是作为Visual Studio的二千○十三分之二千○一十。

The process you want to debug is XDesProc.exe - see Dr. ABT's answer. Otherwise the procedure is as for Visual Studio 2010/2013.