4

Thank to this question : Rubberduck UI submenus are disabled, I know that I may have to hit the "Refresh button" to use RubberduckVBA.

One of the error that can follow is apparently the "Resolver Error".

enter image description here

What are the different cases in which such a Resolver Error may occur?

Mathieu Guindon
  • 69,817
  • 8
  • 107
  • 235
Akita
  • 287
  • 2
  • 8
  • [This](https://rubberduckvba.wordpress.com/2016/02/06/what-do-parsing-and-resolving-mean-anyway/) might help. – John Coleman Aug 29 '18 at 15:51
  • @JohnColeman the documentation is rather thin on this subject. OP: what version are you using? The parser/resolver has seen very significant changes lately. You can copy version information to the clipboard by clicking the "version" box in the "about" dialog. – Mathieu Guindon Aug 29 '18 at 15:53
  • @MathieuGuindon I noticed that hence changed my comment. – John Coleman Aug 29 '18 at 15:53
  • @MathieuGuindon My version was 2.2.0.3439-pre. I have now installed the 2.2.0.3723-pre, but I still got the same error. Version 2.2.0.3723 OS: Microsoft Windows NT 10.0.16299.0, x64 Host Product: Microsoft Office 2016 x64 Host Version: 16.0.8730.2175 Host Executable: EXCEL.EXE – Akita Aug 30 '18 at 07:41
  • 1
    Thanks for reporting it! We have hundreds of passing automated tests for the parser & resolver, but it's hard to cover *everything* =) – Mathieu Guindon Aug 30 '18 at 11:23

2 Answers2

6

TL;DR: Rubberduck is past due for a new "official" release!

Disclaimer: I manage & contribute to the Rubberduck OSS project.

An exception was thrown while traversing the parse trees. It's hard to tell exactly what happened, because parsing+resolving VBA code is a very complex, multiple-steps process.

To find out specifically what went wrong, you need to look at the logs - logging being disabled by default (it's rather verbose), you need to enable it through the settings dialog:

Rubberduck settings dialog

Set the minimum log level to Trace for the full gory details of everything the parser/resolver is doing, or Error for a less verbose log that only includes the exception information; you can then post this log (or parts of it) into a new issue, and the project devs will promptly tag/label it accordingly, inspect the log/exception details, and determine whether the problem was fixed in a later pre-release build, or if it's a new bug that needs to be fixed.

Since pretty much every single feature needs an accurate understanding of the code in the VBE, Rubberduck devs take parser/resolver issues extremely seriously.

If you're using the latest "green" release (v2.2.0), I'm pretty sure the problem was fixed since then. Latest "pre-release" build has annoying problems with the autocompletion feature (will definitely be fixed by v2.3.0), but the resolver works very well now :)

Mathieu Guindon
  • 69,817
  • 8
  • 107
  • 235
1

At least one of the case is the following:

A Function or Sub doesn't compile and the developer is not aware of that when running the VBA project because the Sub is never called.

Solution:

This "junk" code can be spotted in Trace-level logs of Rubberduck.

For exemple in my case:

Sub CleanSheetOut()
Worksheets(sheetOut).Range("A1:XFD10485576").Clear
Worksheets(sheetOut).Range("A1:XFD10485576").Interior
        .Pattern = xlNone
       .TintAndShade = 0
     .PatternTintAndShade = 0
End Sub

...was incorrect (didn't compile) but was never called, so the project was running fine but Rubberduck couldn't resolve.

The correct code :

Sub CleanSheetOut()
   Worksheets(sheetOut).Range("A1:XFD10485576").Clear
   With Worksheets(sheetOut).Range("A1:XFD10485576").Interior
      .Pattern = xlNone
      .TintAndShade = 0
      .PatternTintAndShade = 0
   End With
End Sub

...compiles and lets Rubberduck parse and resolve normally.

The logs: enter image description here ... showed the faulty Sub and in which module I could find it.

Insight from the Rubberduck development team:

Whether the VBE compiles on the fly depends on the compile settings in the bottom right of the Editor tab of the Tools->Options menu.

We actually try to compile the project and warn the user that the project does not compile. However, the forementioned VBE settings can interfere with that. Moreover, compilation before refresh might be deactivated in Rubberduck's own settings.

See this Github thread for more details.

Akita
  • 287
  • 2
  • 8