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

Resolver Error while refreshing #4323

Closed
bertrandfalguiere opened this issue Aug 30, 2018 · 9 comments
Closed

Resolver Error while refreshing #4323

bertrandfalguiere opened this issue Aug 30, 2018 · 9 comments
Labels
bug Identifies work items for known bugs difficulty-03-duck Involves more challenging problems and/or developing within and revising the internals API resolver Issue is easier to resolve with knowledge of the internal resolver API and the Antlr4 parse trees.

Comments

@bertrandfalguiere
Copy link

Hi. I'm using Rubberduck 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

I got a Resolver Error. Here is the Trace-level logs:

RubberduckLog.txt

@MDoerner MDoerner added bug Identifies work items for known bugs difficulty-03-duck Involves more challenging problems and/or developing within and revising the internals API labels Aug 30, 2018
@MDoerner
Copy link
Contributor

This is a bug in the resolver.

For some reason, a MemberAccessDefaultBinding gets constructed with the lExpression being null and the the lExpressionBinding either being null or resolving to null. This should never be the case.

@MDoerner MDoerner added the resolver Issue is easier to resolve with knowledge of the internal resolver API and the Antlr4 parse trees. label Aug 30, 2018
@bertrandfalguiere
Copy link
Author

I don't know C# nor the internal mechanics of Rubberduck.

But is there any additional data I can provide to help the bug being squashed?

@Vogel612
Copy link
Member

Vogel612 commented Aug 30, 2018

From the Log it seems that the resolver chokes on the procedure CleanSheetOut in the Module GroupAnalysisPart1. If you could share that procedure (remember legal issues) or find a way to reproduce the resolver issue with some minified and anonymized code based on it, that'd be a great help 👍

@bertrandfalguiere
Copy link
Author

The code:

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

sheetOut is a global String variable declared (and initialized when the code is running) in another Module.

@daFreeMan
Copy link
Contributor

@bertrandfalguiere - OT for the bug report, but mightn't it be easier for you, coding wise, to

'add appropriate error trapping around the .Delete
Workbook.Worksheets(sheetOut).Delete
newSheet = Workbook.Worksheets.Add
newSheet.name = sheetOut

I'm not sure where that stands in terms of code execution efficiency, but I believe that your code will end up giving you a .UsedRange of the entire worksheet, whether anything was ever way out to the right or down at the bottom.

As an added bonus, it will get rid of any other formatting, like borders, that may have happened to work their way into the worksheet.

Just a thought.

We now return you to your regularly scheduled bug report.

@bertrandfalguiere
Copy link
Author

@daFreeMan This is part of a code I inherited. There is a loooot of junk in it! I will do some heavy refactoring.

Do you happen to know a tool for VBA refactoring? (JK :P)

@mansellan
Copy link
Member

Hmm... the code you posted doesn't look valid - does it compile? Looks like there should have been a With block:

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

@bertrandfalguiere
Copy link
Author

Oh yes, you're right.

CleanSheetOut is actually unused and never called. The whole project was running fine (-ish), and I thought it was, so I didn't spot it.

I guess the VBE compiles "on-the-fly" as it runs into subs and function, whereas RD needs to compile everything to parse and resolve?

Anyway, Rubberduck is not idiot-proof but it seems to be working.

To make it idiot-proof, maybe it would be good to say in the interface what didn't compile in lieu of where we are now?
image

I guess you can close the issue.

@MDoerner
Copy link
Contributor

Rubberduck always parses and resolves all components.

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.

@Vogel612 Vogel612 modified the milestone: 2.4.1 Feb 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Identifies work items for known bugs difficulty-03-duck Involves more challenging problems and/or developing within and revising the internals API resolver Issue is easier to resolve with knowledge of the internal resolver API and the Antlr4 parse trees.
Projects
None yet
Development

No branches or pull requests

5 participants