rubberduck-vba / Rubberduck

Every programmer needs a rubberduck. COM add-in for the VBA & VB6 IDE (VBE).
https://rubberduckvba.com
GNU General Public License v3.0
1.91k stars 299 forks source link

Unhandled exception when opening VBA editor #314

Closed christophocles closed 9 years ago

christophocles commented 9 years ago

Steps to repeat:

  1. Open office application (Excel 2013 32-bit)
  2. Attempt to open VBA editor
  3. Unhandled exception occurs. Press continue.

Notes: -Exception does not always occur. Have not yet determined exactly what triggers it. -Error has not occurred with Excel 2007 32-bit (also installed on this computer)

************** Exception Text **************
System.InvalidOperationException: This operation cannot be performed while an auto-filled column is being resized.
   at System.Windows.Forms.DataGridView.PerformLayoutPrivate(Boolean useRowShortcut, Boolean computeVisibleRows, Boolean invalidInAdjustFillingColumns, Boolean repositionEditingControl)
   at System.Windows.Forms.DataGridView.SetColumnHeadersHeightInternal(Int32 columnHeadersHeight, Boolean invalidInAdjustFillingColumns)
   at System.Windows.Forms.DataGridView.AutoResizeColumnHeadersHeight(Boolean fixedRowHeadersWidth, Boolean fixedColumnsWidth)
   at System.Windows.Forms.DataGridView.OnColumnHeadersGlobalAutoSize()
   at System.Windows.Forms.DataGridView.set_TopLeftHeaderCell(DataGridViewHeaderCell value)
   at System.Windows.Forms.DataGridView.get_TopLeftHeaderCell()
   at System.Windows.Forms.DataGridView.GetCellInternal(Int32 columnIndex, Int32 rowIndex)
   at System.Windows.Forms.DataGridView.OnCellMouseEnter(DataGridViewCellEventArgs e)
   at System.Windows.Forms.DataGridView.UpdateMouseEnteredCell(HitTestInfo hti, MouseEventArgs e)
   at System.Windows.Forms.DataGridView.OnColumnWidthChanged(DataGridViewColumnEventArgs e)
   at System.Windows.Forms.DataGridView.OnBandThicknessChanged(DataGridViewBand dataGridViewBand)
   at System.Windows.Forms.DataGridViewBand.set_ThicknessInternal(Int32 value)
   at System.Windows.Forms.DataGridView.AdjustFillingColumns()
   at System.Windows.Forms.DataGridView.ComputeLayout()
   at System.Windows.Forms.DataGridView.PerformLayoutPrivate(Boolean useRowShortcut, Boolean computeVisibleRows, Boolean invalidInAdjustFillingColumns, Boolean repositionEditingControl)
   at System.Windows.Forms.DataGridView.OnHandleCreated(EventArgs e)
   at System.Windows.Forms.Control.WmCreate(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.DataGridView.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

************** Loaded Assemblies **************
mscorlib
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.34209 built by: FX452RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
Rubberduck
    Assembly Version: 1.2.5541.25883
    Win32 Version: 1.2.0.3
    CodeBase: file:///C:/Program%20Files%20(x86)/Rubberduck/Rubberduck/Rubberduck.dll
----------------------------------------
System.Windows.Forms
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.34209 built by: FX452RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.34209 built by: FX452RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.34239 built by: FX452RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Core
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.34209 built by: FX452RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
Antlr4.Runtime.net45
    Assembly Version: 4.3.0.0
    Win32 Version: 4.3.0.0
    CodeBase: file:///C:/Program%20Files%20(x86)/Rubberduck/Rubberduck/Antlr4.Runtime.net45.DLL
----------------------------------------
System.Xml
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.34230 built by: FX452RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Configuration
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.34209 built by: FX452RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
Microsoft.GeneratedCode
    Assembly Version: 1.0.0.0
    Win32 Version: 4.0.30319.34230 built by: FX452RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
Accessibility
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.33440 built by: FX45W81RTMREL
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Accessibility/v4.0_4.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
----------------------------------------
rubberduck203 commented 9 years ago

I assume you're running RD v1.2?

christophocles commented 9 years ago

Yes, version 1.2.

I suppose there could be conflict with other VBA editor addins (MZ-Tools). I will try uninstalling all other addins except RD, and see if the exception still occurs.

rubberduck203 commented 9 years ago

Are you using anything other than MZ Tools? I've personally tested RD on Office 2007 side by side with MZT and never come across this. I'm definitely going to need better repro steps for this one.

christophocles commented 9 years ago

I have MZ-Tools 3.0 as well as MZ-Tools 8.0 Beta 1.

rubberduck203 commented 9 years ago

Okay. I've not tested along side the beta version. Thanks. I'll try to repro, but if you figure out exactly how to, please share.

christophocles commented 9 years ago

This bug may also be related to another issue that is happening sometimes. After opening the VBA editor, the RubberDuck Menubar is sometimes missing several items. No exception occurs. See below:

image

rubberduck203 commented 9 years ago

@retailcoder I'm not feeling good about this.

at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

This doesn't look like it's coming from our code. If we can figure out what's causing it we might be able to catch it in the NativeWindowMethods class, but so far I can't replicate this in 2007 w/out MZT or 2010 w/ MZT.

retailcoder commented 9 years ago

Let's first standardize how menu items are created. The RubberduckMenu class needs a Code Review post.

rubberduck203 commented 9 years ago

I was actually just looking at that code. We have some bad abstractions going on. Our "menus" are often really a single button and a whole "app" connected to it. DockablePresenter implementations feel more like the views they control than they should. Life might be easier if we find a way to keep a handle on the actual ToolWindows.

But I've digressed. That's a separate issue.

retailcoder commented 9 years ago

No repro on that one in 2 releases. Closing for now.