如何排查和调试 Visual Studio 设计模式错误? [英] How to troubleshoot and debug Visual Studio design mode errors?

查看:37
本文介绍了如何排查和调试 Visual Studio 设计模式错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 Windows 7 和 Visual Studio 2010,我正在编写 C# 自定义用户控件.我在代码视图中编码了几个星期,最近当我尝试切换到设计模式时,Visual Studio 挂起,没有响应".我可以等一个小时,但仍然没有任何反应.单击关闭按钮会显示是否要等待、关闭、重新启动并向 Microsoft 发送信息"对话框.

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.

有没有办法(堆栈)跟踪设计者试图执行的代码?也许是设计时跟踪消息或断点?

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 2010/2013

您可以调试 Visual Studio 设计器本身!打开 Visual Studio 的第二个实例,使用 Tools ->附加到进程 并附加到第一个 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 - 参见 Dr.ABT 的回答.否则,程序与 Visual Studio 2010/2013 相同.

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

这篇关于如何排查和调试 Visual Studio 设计模式错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆