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

Odd error on closing host application. #2081

Closed daFreeMan closed 7 years ago

daFreeMan commented 8 years ago

Since installing 2.0.6, I've gotten this error message when closing the host application: rd The dialog box appears over the IDE window, not the host window (dual monitor).

It's happened in both Access and Excel - the one time I've closed Access since the install, but only intermittently when closing Excel.

Yes, I agree that it looks like a default VBA error message, but it's only appeared since installing 2.0.6.

Here's the most recent RD log file: rubberduck.log.txt

Vogel612 commented 8 years ago

Unfortunately from what I can tell the log doesn't show anything wrong with Rubberduck here. There is some warnings about unresolvable identifiers, but that's it.

retailcoder commented 8 years ago

Any KeyNotFoundException thrown in Rubberduck would be managed .net code, and we'd be logging it... this is the VBE raising an error here, and the dictionary involved can't possibly be in .net/managed code. Could it be your VBA project raising an error?

daFreeMan commented 8 years ago

I wouldn't think so. I have no on_save/shutdown events fire, and it happened when shutting down both Access & Excel - 2 different projects.

Something to keep in mind, I suppose, for the future. I'll keep an eye on it.

Stevefb commented 8 years ago

I'm getting this error too: -2146232969 (80131577) The given key was not present in the dictionary. This happens when closing MS Word I also have a multiple display setup. Can confirm this only appeared after installing RD 2.0.6

lkavicky commented 8 years ago

I'm getting the error too. Not just when closing the application, but also when I try to save the db using File > Save Database As in Access (VBE editor with RD needs to be opened). When doing so I also get an .NET Framework Exception message with following details:

************** Exception Text ************** System.Runtime.InteropServices.COMException (0x800A01A8): Exception from HRESULT: 0x800A01A8 at Microsoft.Vbe.Interop.VBProjectClass.get_VBComponents() at Rubberduck.VBEditor.Extensions.ProjectExtensions.ExportSourceFiles(VBProject project, String directoryPath) in C:\Users\hosch\Documents\Visual Studio 2015\Projects\Rubberduck\Rubberduck.VBEEditor\Extensions\VbProjectExtensions.cs:line 60 at Rubberduck.SourceControl.SourceControlProviderBase.Status() in C:\Users\hosch\Documents\Visual Studio 2015\Projects\Rubberduck\Rubberduck.SourceControl\SourceControlProviderBase.cs:line 144 at Rubberduck.SourceControl.GitProvider.Status() in C:\Users\hosch\Documents\Visual Studio 2015\Projects\Rubberduck\Rubberduck.SourceControl\GitProvider.cs:line 498 at Rubberduck.UI.SourceControl.ChangesViewViewModel.RefreshView() in C:\Users\hosch\Documents\Visual Studio 2015\Projects\Rubberduck\RetailCoder.VBE\UI\SourceControl\ChangesViewViewModel.cs:line 56 at Rubberduck.UI.SourceControl.SourceControlViewViewModel.Refresh() in C:\Users\hosch\Documents\Visual Studio 2015\Projects\Rubberduck\RetailCoder.VBE\UI\SourceControl\SourceControlViewViewModel.cs:line 876 at Rubberduck.UI.Command.MenuItems.UiDispatcher.<>c__DisplayClass5_0.<InvokeAsync>b__0(Object x) in C:\Users\hosch\Documents\Visual Studio 2015\Projects\Rubberduck\RetailCoder.VBE\UI\Command\MenuItems\UiDispatcher.cs:line 29

I can't see any related log message.

Stevefb commented 8 years ago

@daFreeMan hey how many times do you see this message? I get it x2 on closing - I have quad display and it appears on different monitors. I think you mentioned you have a dual display? Weird if it's display related...

Stevefb commented 8 years ago

Oh... and I just noticed that I also get this message if I have 2 documents open and I close only 1 of them.

Hosch250 commented 8 years ago

I thought what I was doing with the sinks was the cause. Turns out there might be a deeper cause that I was triggering with the sinks...

PeterMTaylor commented 8 years ago

Eyup, the custard thickens...

daFreeMan commented 8 years ago

@Stevefb I've got 2 monitors. The dialog appears on the one with the IDE on it.

It's been happening more consistently when I close Excel - at first it wasn't every time (I don't think...), now it is. It happens when I close the last XLSM, even if I still have an XLSX open. Oh, and to make it explicit, I do not get the error when I close and XLSX, even with the IDE open. It also happens when I close Access, though I haven't used it much in the last couple of days.

@PeterMTaylor mmmm.... custard...

Hosch250 commented 8 years ago

I'm not getting this at all on the latest build in debug mode. Maybe the next release will automagically fix this.

daFreeMan commented 8 years ago

@Hosch250 since 2.0.6 seems to have automagically broken it, we can certainly hold out hope for an automagic fix!

daFreeMan commented 8 years ago

Interesting. Running 2.0.7 now and just got the "given key..." error when closing an empty XLSX. This file was created by code in my XLSM and would have been saved as an XLSX had I not aborted processing.

I believe this is the first time I've had this error when closing an XLSX file.

daFreeMan commented 8 years ago

Sorry, @Hosch250, nothing magic happened in 2.0.8. I'm still getting it when closing an XLSM.

Stevefb commented 8 years ago

Same @daFreeMan and @Hosch250 - no automagical fix here either

msmarino commented 8 years ago

Hi! Great utility!

I've got the same problem with my Access project (ported from 2003 for what it's worth).

When I open the IDE the CPU gets stuck on 25% and when I close it I get the error.

If I Accept the error and reopen the Access project it stays in background without a visible interface.

Running Windows 10 Pro + Access 2010 + RD 2.0.8 + Single Display

Full TRACE RubberduckLog.txt

ubidev commented 8 years ago

Hi in 2.0.8 on fresh/patched Win10x64 O2016x86ProPlus SQL2014DEVx64 (the following behaviors on new dbs/documents are systematic)

EXCEL:

OUTLOOK:

ACCESS/POWERPOINT/VISIO/PROJECT/PUBLISHER

Hope this helps ubidev

Octopus134 commented 7 years ago

reproducable way (Access2013-32, Win8.1-64, rubberduck 2.0.8.30557, 3 displays): Create an empty database. Create a module1, create a proc inside. Save the module and type in the name ("module1"), close Access. >> runtime error '-2146232969 (80131577)': "The given key was not present in the dictionary." Crash: Access tries to restore ...

Nevertheless: the project looks very very interesting, but at the moment there are many crashes. Thomas

Vogel612 commented 7 years ago

Because of the widespreadedness and reproductions I've assigned this bug into critical. It's basically a blocker for a full release.

ubidev commented 7 years ago

It’s about time amigo! ☺

Thanks a zillion!

De : Clemens Lieb [mailto:notifications@github.com] Envoyé : 8 octobre 2016 14:03 À : rubberduck-vba/Rubberduck Rubberduck@noreply.github.com Cc : Georges VIVIER gvivier@ubilogia.com; Comment comment@noreply.github.com Objet : Re: [rubberduck-vba/Rubberduck] Odd error on closing host application. (#2081)

Because of the widespreadedness and reproductions I've assigned this bug into critical. It's basically a blocker for a full release.

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/rubberduck-vba/Rubberduck/issues/2081#issuecomment-252439168, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ANj1af52aPALmi9Y6knkv3azlxAPiV62ks5qx9rFgaJpZM4JPIba.

Vogel612 commented 7 years ago

"Cannot reproduce" on Access 2016 from the latest code. Instead of the mentioned exception I get access violations flying all over the place. It seems the Auto-Save Feature is involved somehow, since that only appears after I squashed a small bug there ...

I'll try to track this down in the released 2.0.8 code

Vogel612 commented 7 years ago

Since I could reproduce this just fine in the released code on Access 2016 and it errored out deep inside COM handling, I think it's safe to assume that the changes coming with #2289 and related PRs and Issues will fix this (or give us a better idea where the problem is).

AFAICT all Rubberduck Code has already been unloaded by the point the exception occurs... This doesn't mean we're not responsible, but it means we can't necessarily clean the mess up 😞

Octopus134 commented 7 years ago

Reproducable:

rename a module in Access 2013 by Rubberduck > Refactor > Rename. The renaming works, but afterwards there is again runtime error '-2146232969 (80131577)': "The given key was not present in the dictionary."*

Aftwards Open the same database again without rubberduck (the renamed module remains renamed) activate rubberduck, close Access: runtime error again

afterwards: Open the same database with rubberduck loaded at start, do nothing, close the database: OK

Afterwards: Open the database with rubberduck loaded at start, open the IDE, do nothing, close the database: runtime error

Create afterwards a new database, empty, nothing in it, open the IDE, close it, close Access: runtime error. So it seems nothing to do with the database but with opening the IDE.

(I had a crash directly after installing rubberduck, I do not remember exactly: loading it. There is some GUI-doing, something with the toolbars, open rubberduck memu; crash. Netx try: positioning the toolbars differently: it worked so far. But I do not know any more whether it was the problem with the dictionary)

ThunderFrame commented 7 years ago

How to reproduce in Word 2016 (32-bit) using 2.0.10.17326.

  1. Open Word
  2. Allow a new blank document to be created
  3. Leave the new document open
  4. Open VBE
  5. Observe that there is a Word Document (typically called Document1) project and a Word Template (typically called Normal) project
  6. Observe that the Word Document project refers to Word Template project
  7. Parse once
  8. Switch to the Word UI
  9. Close the Document without saving
  10. Encounter error: Run-time error '-2146232969 (80131577)': The given key was not present in the dictionary.
  11. Acknowledge the error
  12. Add a new document (will typically be called Document2)
  13. Observe the new document's project is in the VBE
  14. Observe that RD automatically parses, but gets stuck at "Resolving Declarations"
  15. Close the new document
  16. Encounter error: Run-time error '-2147467261 (80004003)': Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
  17. Acknowledge error
  18. Close Word cleanly
daFreeMan commented 7 years ago

FWIW, this does seem to be resolved in Access & Excel (2010, 32-bit) in RD 2.0.9.