繁体   English   中英

使用Winforms Designer时Visual Studio 2013崩溃

[英]Visual studio 2013 crashes while using winforms designer

当我在Winforms Designer中使用拖放功能时,Visual Studio 2013经常崩溃,例如添加新控件,调整控件的大小或仅单击控件以查看/更改控件的属性。 操作系统-Win 7x86,VS版本-VS2013 Ultimate 12.0.21005.1 rel。 我试图以管理员身份运行VS,但是当我使用拖放功能时,它几乎始终崩溃。

我在VS的第二个实例(附加到第一个VS进程)的帮助下调试了VS,结果如下:(我运行了很多次,看起来好像抛出了3种不同类型的异常)

An unhandled exception of type 'System.InvalidOperationException' occurred in System.Drawing.dll
Additional information: Object is currently in use elsewhere.

>   System.Drawing.dll!System.Drawing.Image.RawFormat.get() Unknown
    System.Drawing.dll!System.Drawing.Graphics.DrawImage(System.Drawing.Image image, int x, int y)  Unknown
    System.Design.dll!System.Windows.Forms.Design.Behavior.DesignerActionGlyph.Paint(System.Windows.Forms.PaintEventArgs pe)    Unknown

或相同的异常但不同的调用堆栈:

>   System.Drawing.dll!System.Drawing.Graphics.FillRectangle(System.Drawing.Brush brush, int x, int y, int width, int height)   Unknown
    System.Drawing.dll!System.Drawing.Graphics.FillRectangle(System.Drawing.Brush brush, System.Drawing.Rectangle rect) Unknown
    System.Design.dll!System.Windows.Forms.Design.Behavior.SelectionBorderGlyph.Paint(System.Windows.Forms.PaintEventArgs pe)   Unknown

另一个例外:

An unhandled exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll 
Additional information: Exception has been thrown by the target of an invocation.


>   mscorlib.dll!System.Delegate.DynamicInvokeImpl(object[] args)   Unknown
    System.Windows.Forms.dll!System.Windows.Forms.Control.InvokeMarshaledCallbackDo(System.Windows.Forms.Control.ThreadMethodEntry tme) Unknown
    System.Windows.Forms.dll!System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(object obj) Unknown

最后一个:

An unhandled exception of type 'System.AccessViolationException' occurred in System.Drawing.dll
Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

>   System.Drawing.dll!System.Drawing.Graphics.FillRectangle(System.Drawing.Brush brush, int x, int y, int width, int height)   Unknown
    System.Drawing.dll!System.Drawing.Graphics.FillRectangle(System.Drawing.Brush brush, System.Drawing.Rectangle rect) Unknown
    System.Design.dll!System.Windows.Forms.Design.Behavior.SelectionBorderGlyph.Paint(System.Windows.Forms.PaintEventArgs pe)   Unknown

ETA: @GRUNGER的回答很有帮助,但是那是什么问题呢?

即使在一个新的空项目中,它也会崩溃。

我也有同样的问题。 鼠标光标闪烁?

尝试以下操作(在管理模式CMD上):

netsh winsock reset

有时它会有所帮助,但是重新启动后问题又出现了。

这可能是由于在构造函数中放入了一些危险/崩溃的代码而导致无法创建控件的缘故。 重构代码,然后将其移动到Load handler。

暂无
暂无

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

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