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 300 forks source link

Rubberduck stuck on "Pending" Status.. Sub menu disabled #3033

Closed ishita799 closed 5 years ago

ishita799 commented 7 years ago

issue

Rubberduck is not working properly. Sub menus are disabled(Greyed out). "Pending" button is stuck.

Thank you in advance!

ThunderFrame commented 7 years ago

Have you clicked on the Refresh icon next to the Pending button, in order to trigger the parse?

ishita799 commented 7 years ago

Yes, I have tried clicking it many times! But nothing happens! It is stuck on "Pending".

Inarion commented 7 years ago

Can you reproduce the issue after restarting Excel? If so, you should activate logging (set to TRACE) from the Rubberduck options menu. The log file might shed some light on what is happening.

ishita799 commented 7 years ago

Now the Pending state has been changed to Parse Error.. This is the log file!

RubberduckLog.txt

Vogel612 commented 7 years ago

Exception from the log:

2017-05-24 14:02:09.3969;ERROR-2.0.13.32288;Rubberduck.Parsing.VBA.ParseCoordinator;Unexpected exception thrown in parsing run. (thread 8).;System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Vbe.Interop.VBE'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{0002E166-0000-0000-C000-000000000046}' failed due to the following error: Error loading type library/DLL. (Exception from HRESULT: 0x80029C4A (TYPE_E_CANTLOADLIBRARY)).
   at System.StubHelpers.StubHelpers.GetCOMIPFromRCW(Object objSrc, IntPtr pCPCMD, IntPtr& ppTarget, Boolean& pfNeedsRelease)
   at Microsoft.Vbe.Interop.VBE.get_VBProjects()
   at Rubberduck.VBEditor.SafeComWrappers.VBA.VBE.get_VBProjects() in C:\Users\Mathieu\Documents\GitHub\Rubberduck (main)\Rubberduck\Rubberduck.VBEEditor\SafeComWrappers\VBA\VBE.cs:line 88
   at Rubberduck.Parsing.VBA.RubberduckParserState.RefreshProjects(IVBE vbe) in C:\Users\Mathieu\Documents\GitHub\Rubberduck (main)\Rubberduck\Rubberduck.Parsing\VBA\RubberduckParserState.cs:line 242
   at Rubberduck.Parsing.VBA.ParseCoordinator.ParseAllInternal(Object requestor, CancellationToken token) in C:\Users\Mathieu\Documents\GitHub\Rubberduck (main)\Rubberduck\Rubberduck.Parsing\VBA\ParseCoordinator.cs:line 705
   at Rubberduck.Parsing.VBA.ParseCoordinator.ParseAll(Object requestor, CancellationToken token) in C:\Users\Mathieu\Documents\GitHub\Rubberduck (main)\Rubberduck\Rubberduck.Parsing\VBA\ParseCoordinator.cs:line 682
ishita799 commented 7 years ago

I am using Rubberduck inside corporate environment. I tried installing it on my colleague's PC and was successful. Can you please provide detailed resolution regarding the exception you pointed.

"System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Vbe.Interop.VBE'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{0002E166-0000-0000-C000-000000000046}' failed due to the following error: Error loading type library/DLL.

Why is installation failing on some machines and not others, is there any specific dependency on machine configuration.

retailcoder commented 7 years ago

That exception essentially says the Microsoft.Vbe.Interop assembly couldn't be loaded. Not sure how that could happen, although I did see contributors having problems with that library when setting up the project for a debug build... not sure how that happens in a release build, but one thing strikes me in your screenshot:

image

These no-name modules in the VBE's Project Explorer aren't normal, and typically weird stuff going on in the project explorer indicate a somehow corrupt VBA project.

I'd give it a shot with an empty workbook.

ishita799 commented 7 years ago

No!Actually it is the company data so i have to hide the names of the modules and everything! It's not a corrupt project.. And I have tried running Rubberduck in an empty workbook also. That didn't work.

retailcoder commented 7 years ago

@ishita799 can you expand a bit on exactly what you mean with "'Pending' button is stuck"? Does clicking it not do anything? An empty workbook without a reference to the Rubberduck type library really has no reason to bomb AFAICT.

ishita799 commented 7 years ago

Clicking on it does not do anything. I understand that in an empty workbook, it should work but it is stuck on "Pending" status only. Clicking on it does not even change to "Loading declarations" or to any other state.

retailcoder commented 7 years ago

The only thing I'm seeing would be some glitch with the reference to the VBIDE API library... I seem to recall having issues with that specific reference at one point, but AFAICT the current build doesn't. The weird part is that it works on most installs... Try re-installing?

PaulWalkerUK commented 7 years ago

Just to let you know, I'm getting the same issue on a new Windows 10 64-bit machine, running Excel 2007 32-bit and RD 2.0.13. This is from my log file when I click the "refresh" button:

2017-07-26 15:41:18.9627;INFO-2.0.13.32288;Rubberduck.App;Rubberduck version 2.0.13.32288 loading:
    Operating System: Microsoft Windows NT 6.2.9200.0 x64
    Host Product: 2007 Microsoft Office system x86
    Host Version: 12.0.6771.5000
    Host Executable: EXCEL.EXE;
2017-07-26 15:41:19.3914;INFO-2.0.13.32288;DynamicInjectorecbb804698af418098b925a7c4c1f589;Executing version check.;
2017-07-26 15:41:26.2593;DEBUG-2.0.13.32288;Rubberduck.UI.Command.MenuItems.CommandBars.AppCommandBarBase;(43084780) Executing click handler for commandbar item 'Pending', hash code 39717249;
2017-07-26 15:41:26.2784;DEBUG-2.0.13.32288;Rubberduck.Parsing.VBA.ParseCoordinator;Parsing run started. (thread 6).;
2017-07-26 15:41:26.3406;ERROR-2.0.13.32288;Rubberduck.Parsing.VBA.ParseCoordinator;Unexpected exception thrown in parsing run. (thread 6).;System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Vbe.Interop.VBE'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{0002E166-0000-0000-C000-000000000046}' failed due to the following error: Error loading type library/DLL. (Exception from HRESULT: 0x80029C4A (TYPE_E_CANTLOADLIBRARY)).
   at System.StubHelpers.StubHelpers.GetCOMIPFromRCW(Object objSrc, IntPtr pCPCMD, IntPtr& ppTarget, Boolean& pfNeedsRelease)
   at Microsoft.Vbe.Interop.VBE.get_VBProjects()
   at Rubberduck.VBEditor.SafeComWrappers.VBA.VBE.get_VBProjects() in C:\Users\Mathieu\Documents\GitHub\Rubberduck (main)\Rubberduck\Rubberduck.VBEEditor\SafeComWrappers\VBA\VBE.cs:line 88
   at Rubberduck.Parsing.VBA.RubberduckParserState.RefreshProjects(IVBE vbe) in C:\Users\Mathieu\Documents\GitHub\Rubberduck (main)\Rubberduck\Rubberduck.Parsing\VBA\RubberduckParserState.cs:line 242
   at Rubberduck.Parsing.VBA.ParseCoordinator.ParseAllInternal(Object requestor, CancellationToken token) in C:\Users\Mathieu\Documents\GitHub\Rubberduck (main)\Rubberduck\Rubberduck.Parsing\VBA\ParseCoordinator.cs:line 705
   at Rubberduck.Parsing.VBA.ParseCoordinator.ParseAll(Object requestor, CancellationToken token) in C:\Users\Mathieu\Documents\GitHub\Rubberduck (main)\Rubberduck\Rubberduck.Parsing\VBA\ParseCoordinator.cs:line 682
2017-07-26 15:41:26.3466;DEBUG-2.0.13.32288;Rubberduck.Parsing.VBA.RubberduckParserState;RubberduckParserState raised StateChanged (Error);
2017-07-26 15:41:32.8393;DEBUG-2.0.13.32288;Rubberduck.UI.Command.MenuItems.ParentMenus.ParentMenuItemBase;(34745524) Executing click handler for menu item 'S&ettings', hash code 45207585;

For me, I can't get RubberDuck to do anything at all. When I click the button, nothing happens (apart from this log being generated) and most of the menu options, eg "Rename", "Extract Interface", are greyed out (I assume because it hasn't been able to complete a parse), though the "Settings" and "About" options work fine. I also get the splash screen when opening up the editor. There was nothing to indicate a problem during the install. I've reinstalled RD several times - same result.

Note that I did have this working on a previous Windows 7 64-bit machine with Excel 2007 32-bit though I don't remember what version of RD that was. I don't recall having any difficulties getting that working, but it was a while ago...

PaulWalkerUK commented 7 years ago

I just tried the latest "pre-release" version (v2.1.2003). Same result when trying to parse:

2017-07-26 16:25:54.3734;TRACE-2.0.14.33947;Rubberduck.Common.LogLevelHelper;
    Rubberduck version 2.0.14.33947 loading:
    Operating System: Microsoft Windows NT 6.2.9200.0 x64
    Host Product: 2007 Microsoft Office system x86
    Host Version: 12.0.6771.5000
    Host Executable: EXCEL.EXE;
2017-07-26 16:25:54.3840;TRACE-2.0.14.33947;Rubberduck.App;Checking for legacy Smart Indenter settings.;
2017-07-26 16:25:54.6317;INFO-2.0.14.33947;DynamicInjectoraf19b2b9adcf4b5e9c37ce9fca39bfea;Executing version check.;
2017-07-26 16:26:10.4718;DEBUG-2.0.14.33947;Rubberduck.UI.Command.MenuItems.CommandBars.AppCommandBarBase;(22483623) Executing click handler for commandbar item 'Pending', hash code 22122153;
2017-07-26 16:26:10.4918;DEBUG-2.0.14.33947;Rubberduck.Parsing.VBA.ParseCoordinator;Parsing run started. (thread 8).;
2017-07-26 16:26:10.4918;INFO-2.0.14.33947;Rubberduck.Parsing.VBA.RubberduckParserState;RubberduckParserState (1) is invoking StateChanged (Pending);
2017-07-26 16:26:10.4998;ERROR-2.0.14.33947;Rubberduck.Parsing.VBA.ParseCoordinator;Unexpected exception thrown in parsing run. (thread 8).;System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Office.Core.CommandBarControl'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{000C0308-0000-0000-C000-000000000046}' failed due to the following error: Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED)).
   at System.StubHelpers.StubHelpers.GetCOMIPFromRCW(Object objSrc, IntPtr pCPCMD, IntPtr& ppTarget, Boolean& pfNeedsRelease)
   at Microsoft.Office.Core.CommandBarControl.set_Enabled(Boolean pvarfEnabled)
   at Rubberduck.VBEditor.SafeComWrappers.Office.Core.CommandBarControl.set_IsEnabled(Boolean value) in C:\projects\rubberduck\Rubberduck.VBEEditor\SafeComWrappers\Office.Core\CommandBarControl.cs:line 40
   at Rubberduck.UI.Command.MenuItems.CommandBars.AppCommandBarBase.EvaluateCanExecute(RubberduckParserState state) in C:\projects\rubberduck\RetailCoder.VBE\UI\Command\MenuItems\CommandBars\AppCommandBarBase.cs:line 100
   at Rubberduck.UI.Command.MenuItems.CommandBars.RubberduckCommandBar.OnParserStateChanged(Object sender, EventArgs e) in C:\projects\rubberduck\RetailCoder.VBE\UI\Command\MenuItems\CommandBars\RubberduckCommandBar.cs:line 90
   at System.EventHandler`1.Invoke(Object sender, TEventArgs e)
   at Rubberduck.Parsing.VBA.RubberduckParserState.OnStateChanged(Object requestor, ParserState state) in C:\projects\rubberduck\Rubberduck.Parsing\VBA\RubberduckParserState.cs:line 329
   at Rubberduck.Parsing.VBA.RubberduckParserState.SetStatusAndFireStateChanged(Object requestor, ParserState status) in C:\projects\rubberduck\Rubberduck.Parsing\VBA\RubberduckParserState.cs:line 553
   at Rubberduck.Parsing.VBA.ParserStateManagerBase.SetStatusAndFireStateChanged(Object requestor, ParserState status, CancellationToken token) in C:\projects\rubberduck\Rubberduck.Parsing\VBA\ParserStateManagerBase.cs:line 51
   at Rubberduck.Parsing.VBA.ParseCoordinator.ParseAllInternal(Object requestor, CancellationToken token) in C:\projects\rubberduck\Rubberduck.Parsing\VBA\ParseCoordinator.cs:line 331
   at Rubberduck.Parsing.VBA.ParseCoordinator.ParseAll(Object requestor, CancellationToken token) in C:\projects\rubberduck\Rubberduck.Parsing\VBA\ParseCoordinator.cs:line 304
2017-07-26 16:26:10.4998;INFO-2.0.14.33947;Rubberduck.Parsing.VBA.RubberduckParserState;RubberduckParserState (2) is invoking StateChanged (Error);
MDoerner commented 7 years ago

Somehow we seem to not be able to load some libraries.

@PaulWalkerUK Which .Net version do you have installed?

PaulWalkerUK commented 7 years ago

According to the "registry" method described on Microsoft's "How to: Determine Which .NET Framework Versions Are Installed", I seem to have:

Having said that, I don't mind trying to (re)install if there's a particular version I need

retailcoder commented 7 years ago

Huh, looks like an exception was thrown trying to disable a commandbar button, in reaction to parser state changing to 'Pending'.

The end result is the same, but the cause is different. 2.0.13 was somehow failing to get the projects collection from the VBE; latest build seems to fail with a commandbar. God I hate these stupid random COM exceptions...

.net framework seems in order, RD runs off CLR 4.0.

PaulWalkerUK commented 7 years ago

... and just to be sure, I tried running the .NET 4.0 installer, but I got this:

1. Microsoft .NET Framework 4 is already a part of this operating system.  You do not need to install the .NET Framework 4 redistributable. <A HREF="http://go.microsoft.com/fwlink/?LinkId=164207">More information</A>. 

2. Same or higher version of .NET Framework 4 has already been installed on this computer.

Is there anything I can do to try to collect any more details for you?

PaulWalkerUK commented 7 years ago

Just an update from my specific occurrence... I've been upgraded to Office 365 and it's now working (I don't know whether any other patches, etc have been applied as well in the interim).

retailcoder commented 7 years ago

@PaulWalkerUK sounds like there was a problem with the Office or VBIDE interop type library; upgrading Office would have repaired it.. makes sense. Thanks for the update!

casey-little commented 6 years ago

I have the same issue. Mine error is associated with the commandbar object:

2017-11-01 14:36:39.2780;ERROR-2.1.0.2382;Rubberduck.Parsing.VBA.ParseCoordinator;Unexpected exception thrown in parsing run. (thread 7).;System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Office.Core.CommandBarControl'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{000C0308-0000-0000-C000-000000000046}' failed due to the following error: could not be found. (Exception from HRESULT: 0x80030002 (STG_E_FILENOTFOUND)).

If you click the update button the text remains "Pending". However, if you open/close the settings window, the refresh button text will change to display "Parse Error"

retailcoder commented 6 years ago

@casey-little are you running multiple versions of Office side by side? If they weren't installed in chronological order (per Microsoft), it could very well be the cause of such interop problems.

For example if you had Office 2013 installed, and then installed Access 2010, your Office install gets broken.

This unfortunately isn't something we can do anything about, other than gracefully handling the exceptions.

sushrut91 commented 6 years ago

I tried rubber duck in Corel Draw X7 VBE today. Facing the same issue. Can someone point me out why this is happening & if this is resolved for anyone in Excel. I really want to unit test my vba code using rubberduck and would appreciate if some one helps me out. Thanks ! RubberduckLog.txt

retailcoder commented 6 years ago

Seems updating the CommandBar button's caption (to reflect parser state) is throwing a COM exception again. @sushrut91 would you happen to know what version of the Office CommandBar Corel Draw X7 is using? Also, do you have Office installed? Which version, and was it installed before or after Corel Draw?

Corel Draw X7 was released in 2014, making its contemporary Office version Office 2013; if you have installed X7 on top of a later version of Office (2016?), the COM registration for the commandbars may be broken - a reinstall (in the correct sequential order) might be able to fix it.

sushrut91 commented 6 years ago

I don't have any version of MS Office installed on my machine. My machine has Windows 10 Pro 64 bit. I am unable to exactly see which version of Office CommandBar Corel Draw X7 is using but please take a look at the screenshots maybe it may give some pointers towards the version.

Is office installation necessary for RubberDuck to work ? I don't want to spend on buying MS office. Is there a work around ? img1 img2

sushrut91 commented 6 years ago

Any update on the issue @retailcoder ? Is the info in my last post useful ?

retailcoder commented 6 years ago

As far as I can see it should work... Rubberduck does not require a MS-Office install to work, however if repairing an Office install fixed it for others, maybe installing a trial version (free) could do the same? Just grasping at straws here..

santosrai commented 5 years ago

I also got stuck with this issue.

2019-03-29 10:50:40.1520;ERROR-2.3.1.4308;Rubberduck.Parsing.VBA.ParseCoordinator;Unexpected exception thrown in parsing run. (thread 4).;System.InvalidCastException: 型 'System.__ComObject'

How to solve this issues? :sob:

bclothier commented 5 years ago

Closing this issue in favor of #3837 and #4192.