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

VB6 project events not working #4046

Closed
mansellan opened this issue May 27, 2018 · 2 comments
Closed

VB6 project events not working #4046

mansellan opened this issue May 27, 2018 · 2 comments
Assignees
Labels
has-workaround There is some way of working around this limitation / bug that is confirmed to work vb6-specific Issues which only affect RD in VB6
Projects

Comments

@mansellan
Copy link
Member

Several project-level events (Project load \ unload etc) not functional in VB6.

@mansellan mansellan added the vb6-specific Issues which only affect RD in VB6 label May 27, 2018
@mansellan mansellan self-assigned this May 27, 2018
@Vogel612 Vogel612 added this to To do in VB6 go-live May 27, 2018
@mansellan
Copy link
Member Author

mansellan commented Jun 12, 2018

I've done some more investigation on this. Events from VBProjects and VBComponents are being correctly raised and processed. However, this is not obvious for two reasons:

  1. The VB6 VBProject OM does not have a Mode property to expose whether the IDE is in Run, Break or Design mode. To work around this, for VB6 we call the EbMode function in vba6.dll. This works for installed instances of RD, however when running from source it incorrectly returns the mode as 'Run'. It's possible it's conflating the VB6 IDE mode with that of the C# IDE.
  2. Unlike VBA hosts, VBProjects does not raise the ProjectAdded event when the RD is first loaded (looks to be a timing issue). This means that RD does not do an initial parse when the IDE is opened on a new project. As events are short-circuited prior to first-parse, any project or component events before manually invoking a parse are missed.

The good news is that this means this issue has-workaround (be aware that events won't work when running RD from source, and for installed RD make sure the very first thing done after loading RD is to request a parse).

Needless to say, neither are very satisfying...

For sub-issue 1, the easiest fix is to reinstate the original 'dirty hack' of checking the VB6 IDE caption to detect the mode. Perhaps in an if-debug construct to limit it to debug builds.

For sub-issue 2, I need to find a way of forcing a parse on first load. The cleanest way is likely to check at startup for project(s), and manually fire the ProjectAdded event.

@mansellan mansellan added the has-workaround There is some way of working around this limitation / bug that is confirmed to work label Jun 12, 2018
@mansellan
Copy link
Member Author

OK - following SE chat I'm not going to pursue a fix for point 2 - there's no way to reliably parse on first open where projects load before RD does. Besides, it's not too onerous to require a parse before RD events become active.

Looks like I was wrong on point 1 - I can't get EbMode working at all now, it may have been a short-circuited build that was running when I though I saw it working.

So for now I'm going to go back to querying the main window caption. Not elegant, but it does seem to be fairly reliable.

mansellan added a commit to mansellan/Rubberduck that referenced this issue Jun 14, 2018
mansellan added a commit to mansellan/Rubberduck that referenced this issue Jun 15, 2018
@mansellan mansellan moved this from To do to In progress in VB6 go-live Jun 15, 2018
VB6 go-live automation moved this from In progress to Done Jun 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has-workaround There is some way of working around this limitation / bug that is confirmed to work vb6-specific Issues which only affect RD in VB6
Projects
No open projects
VB6 go-live
  
Done
Development

No branches or pull requests

1 participant