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

Outlook Not Responding when opening VBE #3539

Closed aberger91 closed 6 years ago

aberger91 commented 6 years ago

I installed Rubberduck, used it for a a couple minutes in the Outlook 2013 VBE . Then after restarting Outlook I am until to open my VBE, although macros are running. I've uninstalled Rubberduck now but the problem persists. When I press Alt+F11 to get into the VBE my outlook freezes. I now have no way of editing VBA within Outlook. Windows 7

retailcoder commented 6 years ago

There is a known and documented issue where the host process doesn't consistently shut down properly. Did you verify in Task Manager that the host process (that would be OUTLOOK.EXE) is effectively gone before trying to load up a new instance?

From the release notes:

  • Possible silent crash on exit. We can't rule it out entirely still (although significant progress has been made), so when you close the host application make sure the process is no longer running in Task Manager.

Any help with getting this issue fixed is more than welcome. "Rubberduck breaks my VBE" with thumbs-down and "used it for 5 minutes and uninstalled", a little less so. I don't write release notes because it's fun, I write release notes so people read and understand them before they decide whether to use this software. Rubberduck is a project, not a product.

aberger91 commented 6 years ago

"Did you verify in Task Manager that the host process (that would be OUTLOOK.EXE) is effectively gone before trying to load up a new instance?"

Outlook does not allow two instances to run at the same time, at least not in my environment (Windows 7).

"Any help with getting this issue fixed is more than welcome. "Rubberduck breaks my VBE" with thumbs-down and "used it for 5 minutes and uninstalled", a little less so"

I gave you those details so you could understand my context. To re-word for you: I've only just installed Rubberduck, and I attempted to mitigate this issue by uninstalling, although ineffective. Now it appears that my Outlook VBE is broken because it freezes on startup, even after uninstalling Rubberduck.

Thanks for the help.

bclothier commented 6 years ago

Just to check - the uninstallation should have removed the key in this registry path: HKEY_CURRENT_USER\Software\Microsoft\VBA\VBE\6.0\Addins\Rubberduck.Extension --- can you check it's NOT there anymore? If it's there, change the LoadBehavior to 0.

retailcoder commented 6 years ago

There's a non-zero chance that Rubberduck.dll might be loaded and running in a ghost OUTLOOK.EXE process lingering in Task Manager - uninstalling won't kill that process. If anything, that process could actually be preventing a clean uninstall. Trying to help here. Can you please confirm whether or not you have that lingering process.

aberger91 commented 6 years ago

Like I said, only one Outlook.exe is running on my machine.

HKEY_CURRENT_USER\Software\Microsoft\VBA\VBE\6.0\Addins\Rubberduck.Extension does not exist

bclothier commented 6 years ago

But we don't know if this lone instance is the same instance that still had the RD loaded? Can you please shut it down and ensure it disappears completely from the task manager? Then reopen to confirm that VBE works (or not)? We need to be absolutely sure it isn't running with RD loaded, even though you might have had ran the uninstaller already.

aberger91 commented 6 years ago

I've restarted my PC

Vogel612 commented 6 years ago

So to recap:

  1. Rubberduck version ? was installed as Administrator.
  2. Outlook 2013 VBE opened (and subsequently closed)
  3. Outlook 2013 restarted, but now VBE does not open (macros themselves are not affected)
  4. Uninstall (succesful) and complete restart did not alleviate the issue
aberger91 commented 6 years ago
  1. Yes RB v2.1.1.2457 as Admin
  2. Yes with RB enabled
  3. Yes and VBE does not open and causes Outlook not to respond
  4. Yes
bclothier commented 6 years ago

Just two more questions - do you happen to have any other VBE addins?

Can you look in the key HKEY_CURRENT_USER\Software\Microsoft\VBA\VBE\6.0\Addins -- for each addin there are, there should be a subfolder; and you can temporarily disable them by setting LoadBehavior to 0.

Next, can you confirm if you can still open VBE via Excel, Word or other Office product?

aberger91 commented 6 years ago

I don't have any other addins for VBE

Opening VBE works in Excel and Word

bclothier commented 6 years ago

OK, sorry to ask a bit more - but when you were trying out RD for that few minutes - did you try out unit testing? If not, what other features were you playing with RD?

aberger91 commented 6 years ago

No problem

I opened the code explorer and code inspections, that was it

Vogel612 commented 6 years ago

And additionally: Is the logfile under %APP_DATA%/Rubberduck/Logs still available? If yes: can you upload it here?

retailcoder commented 6 years ago

FWIW I'm running out of ideas.. RD isn't loaded or even registered (i.e. HKEY_CURRENT_USER\Software\Microsoft\VBA\VBE\6.0\Addins subkey is gone), Outlook started fresh without add-ins, VBE loads in other hosts, ...

I'm consistently getting a clean exit in Outlook, with or without a parse of the (empty) project. Running 2.1.0.2382 here though.. might make a difference, though I strongly doubt the Castle Windsor port (the only major change since 2.1.0) would be responsible for wrecking Outlook's VBE.

aberger91 commented 6 years ago

Sorry there's nothing in %APP_DATA%/Rubberduck/Logs

FWIW I have the Application.Startup event defined and it reads from configuration files on my local box. I've run into similar problems in Outlook (Not Responding) when there's a bug in the Application.Startup method, however I didn't change any of my code before/after using RB in this case

retailcoder commented 6 years ago

Application_Startup would be executing well before the VBE loads up though, no?

aberger91 commented 6 years ago

Yeah disregard. I was thinking about when I had broken OnError logic within a loop, the editor would not open unless I disabled macros.

I've tried disabling macros and starting the VBE, but it still hangs

retailcoder commented 6 years ago

Would you happen to have Visual Studio installed? Attaching a debugger to the OUTLOOK.EXE process and then trying to bring up the VBE could shed a bit of light on what's going on. I can't imagine a reason for Rubberduck to be involved in any way whatsoever at this point.

BTW sorry for knee-jerking earlier.

aberger91 commented 6 years ago

Yeah I can try that, no hard feelings! Will revert ..

aberger91 commented 6 years ago

I havent been able to get any useful information from visual studio after attaching outlook.exe and attempting to bring up the VBE, but Im no expert at debugging processes in this way.

I also did a hard repair on Microsoft Office. It's still broken

aberger91 commented 6 years ago

This seems to be related to this issue: Crashes Excel.exe on start up of VBA Editor #2177 #2209

Except my problem is with Outlook. Are there any other related issues?

retailcoder commented 6 years ago

Thanks for digging this up.. except it doesn't seem related to me: #2209 was a pull request addressing #2177, which was a bug in the management of settings... I don't recall seeing any issue involving the VBE crashing or freezing after Rubberduck was uninstalled.

IMO at this point the problem seems to be more about Office than Rubberduck... I mean, if RD isn't loaded, isn't installed or registered in any way, I fail to see how RD could be involved in any way. I wish I could be more helpful and truly wish I didn't have to say this, but did you consider uninstalling+reinstalling Office?

aberger91 commented 6 years ago

As a footnote, the issue here is involving outlook freezing after Rubberduck was installed. The problem started only after I installed Rubberduck. I merely uninstalled RD to try and workaround, but the issue happened to persist.

retailcoder commented 6 years ago

I hear you, and I completely believe you; only, there's no repro here or anywhere, now or throughout the history of the project, with over 15K downloads across versions (ballpark - didn't check). We don't (intentionally, at least) persist anything in the registry after being uninstalled, and the VBE working cleanly in every other host application points to RD being out of the equation. It's good that we have this issue around for future reference, but I'm writing it off as a coincidence, however suspiciously related to RD it might look.

aberger91 commented 6 years ago

VBE working cleanly in every other host application points to RD being out of the equation

This actually makes me think the opposite. I checked the"Load Behavior" as "Loaded/Unloaded" in the Add-In Manager only for Outlook and only opened the Outlook VBE with RD installed. And then uninstalled while still in the Outlook VBE. Just speculating here. Thanks for your help.

Hosch250 commented 6 years ago

There aren't multiple VBE's. All the Office apps share the same VBE. If you had opened the VBE through any other Office app when RD was installed, it would have been in there too.

retailcoder commented 6 years ago

Outlook was the only VBE I configured with Rubberduck, by that I mean I checked the"Load Behavior" as "Loaded/Unloaded" in the Add-In Manager only for Outlook

The VBE does not work like that. If you notice the registry keys the VBE uses to load its add-ins, there is only a single key, for all VBE hosts. Either RD is registered as an add-in in all VBE hosts (given the bitness for the key it's registered under), or it isn't, and no VBE host loads it.

retailcoder commented 6 years ago

Wait hold on a second - you said you used the add-ins manager to load Rubberduck? Was it unloaded from the add-ins manager too?

Unloading RD from the add-ins manager, and then re-loading it, will definitely crash whatever host application it's being loaded in. We do have shutdown problems, they're known and we try very hard to document them:

Unloading, and then re-loading the add-in from the IDE's "addins manager" will not re-load correctly. Don't do that. We told you not to.

I think this might be it. If you can confirm that the VBE and its host application was not immediately closed (killed in Task Manager, actually - in my experience it's the only way to recover any kind of functionality) after it was unloaded from the VBE's add-ins manager, then we have a serious lead: doing that causes memory corruption and essentially bricks the VBE - again from my experience and testing it has always been recoverable after killing and restarting, but if that state persisted, it would be basically what you're describing.

I don't have an explanation for that state somehow persisting, but if the add-ins manager was involved in the loading or unloading or the add-in, then yeah we're looking at our commandbar and dockable toolwindow teardown issues, which have been plaguing us for as long as we've had dockable toolwindows. v2.1 even completely replaced the IoC container (Ninject ~> Castle Windsor) to get finer control over object lifetime, but somehow it's still not cooperating. We'll get to the bottom of it, one day. But this is far from what anyone would call a "simple thing" to fix.

Must be a combination of factors; if closing all VBE hosts, double-checking they're all gone in Task Manager, uninstalling RD, and then rebooting didn't fix it, I'm pretty sure we're down to reinstalling Outlook.

Hosch250 commented 6 years ago

Open the Task Manager and look in the processes. See if you have two Outlook processes running. I've known it to get a ghost process that causes this behavior more or less. It will be under the Details tab.

retailcoder commented 6 years ago

@Hosch250 Outlook seems to be running a mutex or something, to actively prevent multiple instances running.

aberger91 commented 6 years ago

@retailcoder Yeah thats sounds about right. Please excuse my ignorance from before and thanks for your help!

retailcoder commented 6 years ago

@aberger91 I am terribly sorry this has been your experience with Rubberduck. I'll make sure to update this issue when we finally get a completely clean load, unload & reload from the VBE's add-ins manager.

bclothier commented 6 years ago

I just tried this with recent version of Rubberduck + Outlook 2016.

This does not seem to happen. However, I did observe similar behavior in case where there is a popup asking to login into the mail server and the popup appears behind the main window, making it look non-responsive. Because there is a delay between the popup and the Outlook opening, it could easily concidence with the opening of VBA and thus making it look like it's freezing.

For now, I'm closing this issue. If anyone has a definite reproduction that isn't due to a hidden login dialog behind the Outlook main window, feel free to re-open.

retailcoder commented 6 years ago

I'm looking at RD + Outlook 2010 here, all-:ok:

@aberger91 FYI the last few pre-release builds no longer crash the host and/or brick the VBE on unload+reload - although, I still wouldn't recommend unload+reload (it's not 100% clean yet), but a lot of work went into proper teardown since November.