【问题标题】:Visual studio 2005 freezes/hangs when switching to design view切换到设计视图时,Visual Studio 2005 冻结/挂起
【发布时间】:2011-07-18 17:55:22
【问题描述】:

我创建了一个新的空白表单并尝试切换到设计模式,但 ide 锁定并使用了我的一个 CPU 的 100%。我必须强行杀死它才能回到可行的 ide。查看源代码时,一切似乎都很好。我在现有项目(在别人的机器上工作)和全新的解决方案中都尝试了这个,两者都具有相同的结果。我正在开发安装了所有更新的 WinXP pro box。

执行下面推荐的操作(附加调试器并暂停执行)表明它卡在这里:

[Managed to Native Transition]  

System.Drawing.dll!System.Drawing.Graphics.DrawRectangle(System.Drawing.Pen pen, int x, int y, int width, int height) + 0x3d 字节
System.Drawing.dll!System.Drawing.Graphics.DrawRectangle(System.Drawing.Pen pen, System.Drawing.Rectangle rect) + 0x14 bytes
System.Design.dll!System.Windows.Forms.Design.PanelDesigner.DrawBorder(System.Drawing.Graphics 图形) + 0x97 字节
System.Design.dll!System.Windows.Forms.Design.PanelDesigner.OnPaintAdornments(System.Windows.Forms.PaintEventArgs pe = {ClipRectangle = {System.Drawing.Rectangle}}) + 0x50 字节
System.Design.dll!System.Windows.Forms.Design.ControlDesigner.WndProc(参考 System.Windows.Forms.Message m) + 0xd1e 字节 System.Design.dll!System.Windows.Forms.Design.ScrollableControlDesigner.WndProc(ref System.Windows.Forms.Message m = {System.Windows.Forms.Message}) + 0x12 字节
System.Design.dll!System.Windows.Forms.Design.ControlDesigner.DesignerWindowTarget.OnMessage(ref System.Windows.Forms.Message m) + 0x55 字节
System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.WndProc(ref System.Windows.Forms.Message m) + 0x31 字节
System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.DebuggableCallback(System.IntPtr hWnd, int msg = 15, System.IntPtr wparam, System.IntPtr lparam) + 0x57 字节

【问题讨论】:

    标签: visual-studio visual-studio-2005


    【解决方案1】:

    最可能的挂起原因是自定义控件在其初始化期间进入无限循环,正在显示在设计窗体中。检查这一点的最简单方法是让 Visual Studio 冻结,然后使用 Visual Studio 的另一个实例附加到进程。中断执行,它应该揭示调用堆栈上挂起的原因。

    【讨论】:

    • 我试了一下,我只有 3 个线程在运行 Main、。主线程的调用堆栈只是说[外部代码]。所以这不是很有用。我想我可能只需要重新安装。
    • @darrickc 右键单击​​外部代码并选择“显示外部代码”选项。
    • 太棒了,我在上面的问题中添加了结果。
    • @darrickc 看起来它在本机代码的某个地方正在死去。您可以尝试使用本机调试和管理调试进行附加,它应该为您提供有关位置的更多数据。您需要添加 Microsoft 公共符号服务器 msdl.microsoft.com/download/symbols
    【解决方案2】:

    设计视图是资源密集型的。

    我的建议

    • 切换到它并小憩一下
    • 根本不使用它(在浏览器中使用 View 来查看 HTML)
    • 尝试升级您的机器

    【讨论】:

    • 哇,我做了“切换并参加会议”的方法,它奏效了!现在我必须看看初始化实际需要多长时间。
    • 它是一个皇家 PITA,过了一会儿甚至没有帮助。
    • 我刚刚又试了一次,并且计时了。我等了 35 分钟后退出了。
    • 我还要补充一点,这不是基于 Web 的解决方案,因此没有 HTML。
    猜你喜欢
    • 2016-10-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-01-30
    • 1970-01-01
    相关资源
    最近更新 更多