Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RubberDuck should warn about ghost projects #980

Open
ThunderFrame opened this issue Jan 28, 2016 · 6 comments
Open

RubberDuck should warn about ghost projects #980

ThunderFrame opened this issue Jan 28, 2016 · 6 comments
Labels
enhancement Feature requests, or enhancements to existing features. Ideas. Anything within the project's scope.

Comments

@ThunderFrame
Copy link
Member

The VBIDE sometimes persists a project, even after the host document is closed. That sometimes results in what appears to be duplicate projects, if a workbook/project with the same name (but not necessarily the same path) is subsequently opened. That can lead to confusion about which project is real, and which is a "ghost". Iirc, changes to a ghost project aren't saved when you press Ctrl-S in the VBE. Typically, the host application must be restarted to remedy the problem.

This ghosting issue seems to be caused by host application COM addins, that appear not to release a pointer to the project's host file. For example, in my Excel 2010, the PowerQuery COM Add-In causes this behaviour in VBE, but the problem goes away after I disable PowerQuery.

RubberDuck could address this VBE deficiency, and warn when there are ghost projects, and/or when a save won't actually save.

@retailcoder
Copy link
Member

The irony? Current state of 2.0 is that closing the current project and opening a new one will send everything up in flames. That will definitely be fixed though.

The problem is that, accessing a project that's not really there will throw a COMException - but we can't presume we're getting a COMException for that reason... a COMException basically means "something isn't right", but there's no telling exactly what is wrong. So we'll swallow it and pretend it never happened. Or we can show some meaningless error message to the user, and then get support tickets for things we can't fix.

@ThunderFrame
Copy link
Member Author

I think you can inspect the FileName property, but you'll get that getters error. If that property is an error, AND any of the document module properties don't work, then you probably have a ghost?

@ThunderFrame
Copy link
Member Author

There's potentially a side issue here, in that if a ghost project is present, AND a real copy of that project is open, so you have a VBE with 2 projects that have the same name, then, IIRC, Code Explorer and Test Explorer (and probably TODO Explorer) all end up with duplicate entries under a distinct project name. That is, duplicate project names cause problems for the resolver.

@retailcoder
Copy link
Member

Duplicate project names shouldn't cause problems, since equality for a QualifiedModuleName isn't relying on the projects' names, but on the projects' object references, which would point to different addresses.

@ThunderFrame
Copy link
Member Author

Sorry, my typo. I meant 2 projects that are the same Project name and same document path, so they have the same references. I think that means that one of them must have been a ghost project.

I actually saw the duplicates in Test Explorer and Object Explorer, under CorrlDraw, under this scenario.

@retailcoder
Copy link
Member

Oh great. 😞

@Vogel612 Vogel612 added enhancement Feature requests, or enhancements to existing features. Ideas. Anything within the project's scope. and removed feature-request labels Aug 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature requests, or enhancements to existing features. Ideas. Anything within the project's scope.
Projects
None yet
Development

No branches or pull requests

4 participants