簡體   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