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

Multiple resolver errors in version 2.0.13 #2990

Closed
ghost opened this issue Apr 26, 2017 · 7 comments
Closed

Multiple resolver errors in version 2.0.13 #2990

ghost opened this issue Apr 26, 2017 · 7 comments
Labels
bug Identifies work items for known bugs resolver Issue is easier to resolve with knowledge of the internal resolver API and the Antlr4 parse trees.

Comments

@ghost
Copy link

ghost commented Apr 26, 2017

I have a Word 2016 project that compiles without error but gives multiple Resolver Errors. The resolver error message isn't too helpful as it just identifies the module. How do I go about tracking the problems.

@retailcoder
Copy link
Member

retailcoder commented Apr 26, 2017

Go to Rubberduck settings, enable ERROR-level logging. Close everything, open up the failing project and reproduce the errors; the log file will contain detailed stack trace information we can use to diagnose the problem. Enable TRACE-level for more verbose logs tracing all parser/resolver steps.

@ghost
Copy link
Author

ghost commented Apr 26, 2017

At error level reporting I get one error

RubberduckLog.txt

@retailcoder
Copy link
Member

Thanks!

2017-04-26 21:14:13.1116;INFO-2.0.13.32288;Rubberduck.App;Rubberduck version 2.0.13.32288 loading:
	Operating System: Microsoft Windows NT 10.0.15063.0 x64
	Host Product: Microsoft Office 2016 x64
	Host Version: 16.0.7870.2031
	Host Executable: WINWORD.EXE;
2017-04-26 21:14:58.8156;ERROR-2.0.13.32288;Rubberduck.Parsing.VBA.ParseCoordinator;Exception thrown resolving 'Project.clsArcinovaCTDTitle' (thread 7).;System.NullReferenceException: Object reference not set to an instance of an object.
   at Rubberduck.Parsing.Binding.IndexDefaultBinding.ResolveLExpressionIsVariablePropertyFunctionNoParameters(IBoundExpression lExpression) in C:\Users\Mathieu\Documents\GitHub\Rubberduck (main)\Rubberduck\Rubberduck.Parsing\Binding\IndexDefaultBinding.cs:line 133
   at Rubberduck.Parsing.Binding.IndexDefaultBinding.Resolve(IBoundExpression lExpression) in C:\Users\Mathieu\Documents\GitHub\Rubberduck (main)\Rubberduck\Rubberduck.Parsing\Binding\IndexDefaultBinding.cs:line 91
   at Rubberduck.Parsing.Symbols.IdentifierReferenceResolver.ResolveDefault(ParserRuleContext expression, StatementResolutionContext statementContext, Boolean isAssignmentTarget, Boolean hasExplicitLetStatement) in C:\Users\Mathieu\Documents\GitHub\Rubberduck (main)\Rubberduck\Rubberduck.Parsing\Symbols\IdentifierReferenceResolver.cs:line 156
   at Rubberduck.Parsing.Symbols.IdentifierReferenceResolver.Resolve(LetStmtContext context) in C:\Users\Mathieu\Documents\GitHub\Rubberduck (main)\Rubberduck\Rubberduck.Parsing\Symbols\IdentifierReferenceResolver.cs:line 354
   at Rubberduck.Parsing.Grammar.VBAParser.LetStmtContext.EnterRule(IParseTreeListener listener) in C:\Users\Mathieu\Documents\GitHub\Rubberduck (main)\Rubberduck\Rubberduck.Parsing\Grammar\VBAParser.cs:line 8513
   at Antlr4.Runtime.Tree.ParseTreeWalker.Walk(IParseTreeListener listener, IParseTree t)
   at Antlr4.Runtime.Tree.ParseTreeWalker.Walk(IParseTreeListener listener, IParseTree t)
   at Antlr4.Runtime.Tree.ParseTreeWalker.Walk(IParseTreeListener listener, IParseTree t)
   at Antlr4.Runtime.Tree.ParseTreeWalker.Walk(IParseTreeListener listener, IParseTree t)
   at Antlr4.Runtime.Tree.ParseTreeWalker.Walk(IParseTreeListener listener, IParseTree t)
   at Antlr4.Runtime.Tree.ParseTreeWalker.Walk(IParseTreeListener listener, IParseTree t)
   at Antlr4.Runtime.Tree.ParseTreeWalker.Walk(IParseTreeListener listener, IParseTree t)
   at Antlr4.Runtime.Tree.ParseTreeWalker.Walk(IParseTreeListener listener, IParseTree t)
   at Rubberduck.Parsing.VBA.ParseCoordinator.ResolveReferences(DeclarationFinder finder, QualifiedModuleName qualifiedName, IParseTree tree, CancellationToken token) in C:\Users\Mathieu\Documents\GitHub\Rubberduck (main)\Rubberduck\Rubberduck.Parsing\VBA\ParseCoordinator.cs:line 591

Okay, so that gives us the error, but the context of the error is in the more verbose log levels.

What we do know is that Project.clsArcinovaCTDTitle was being processed, and a NullReferenceException was thrown in ResolveLExpressionIsVariablePropertyFunctionNoParameters, line 133 which looks like this:

    var asTypeName = lExpression.ReferencedDeclaration.AsTypeName;

In all likelihood the ReferencedDeclaration was null, which caused the NRE. I suspect there might have been some WARNING-level or DEBUG-level log entries about it, in the annotation pass.

A bit of a stab in the dark, but before you dig into that, quickly scan the Project.clsArcinovaCTDTitle module for line continuations; because of VBA's ambiguous syntax, the 2.0.13 parser can easily get confused if you have something like this:

DoSomething _
    (arguments)

In other words the whitespace between a procedure and its argument list can't be replaced by a line continuation, otherwise we get the wrong parse tree and the resolver can break.

@ghost
Copy link
Author

ghost commented Apr 27, 2017

Wow. I wasn't expecting such a detailed response. As for as I an see there are no continuations in that Module, I've attached a trace level log for your information. The reason I've reported here is because I think the Resolver error is stopping access to code inspection because the code inspection window is empty when I open it. As a very novice and amateur coder I wouldn't expect to have absolutely no issues in my code.

RubberduckLog.txt

@Vogel612 Vogel612 added bug Identifies work items for known bugs resolver Issue is easier to resolve with knowledge of the internal resolver API and the Antlr4 parse trees. labels Oct 13, 2017
@Vogel612
Copy link
Member

2017-04-27 07:51:20.1026;ERROR-2.0.13.32288;Rubberduck.Parsing.VBA.ParseCoordinator;Exception thrown resolving 'Project.clsArcinovaCTDTitle' (thread 16).;System.NullReferenceException: Object reference not set to an instance of an object.
   at Rubberduck.Parsing.Binding.IndexDefaultBinding.ResolveLExpressionIsVariablePropertyFunctionNoParameters(IBoundExpression lExpression) in C:\Users\Mathieu\Documents\GitHub\Rubberduck (main)\Rubberduck\Rubberduck.Parsing\Binding\IndexDefaultBinding.cs:line 133
   at Rubberduck.Parsing.Binding.IndexDefaultBinding.Resolve(IBoundExpression lExpression) in C:\Users\Mathieu\Documents\GitHub\Rubberduck (main)\Rubberduck\Rubberduck.Parsing\Binding\IndexDefaultBinding.cs:line 91
   at Rubberduck.Parsing.Symbols.IdentifierReferenceResolver.ResolveDefault(ParserRuleContext expression, StatementResolutionContext statementContext, Boolean isAssignmentTarget, Boolean hasExplicitLetStatement) in C:\Users\Mathieu\Documents\GitHub\Rubberduck (main)\Rubberduck\Rubberduck.Parsing\Symbols\IdentifierReferenceResolver.cs:line 156
   at Rubberduck.Parsing.Symbols.IdentifierReferenceResolver.Resolve(LetStmtContext context) in C:\Users\Mathieu\Documents\GitHub\Rubberduck (main)\Rubberduck\Rubberduck.Parsing\Symbols\IdentifierReferenceResolver.cs:line 354
   at Rubberduck.Parsing.Grammar.VBAParser.LetStmtContext.EnterRule(IParseTreeListener listener) in C:\Users\Mathieu\Documents\GitHub\Rubberduck (main)\Rubberduck\Rubberduck.Parsing\Grammar\VBAParser.cs:line 8513
   at Antlr4.Runtime.Tree.ParseTreeWalker.Walk(IParseTreeListener listener, IParseTree t)
   at Antlr4.Runtime.Tree.ParseTreeWalker.Walk(IParseTreeListener listener, IParseTree t)
   at Antlr4.Runtime.Tree.ParseTreeWalker.Walk(IParseTreeListener listener, IParseTree t)
   at Antlr4.Runtime.Tree.ParseTreeWalker.Walk(IParseTreeListener listener, IParseTree t)
   at Antlr4.Runtime.Tree.ParseTreeWalker.Walk(IParseTreeListener listener, IParseTree t)
   at Antlr4.Runtime.Tree.ParseTreeWalker.Walk(IParseTreeListener listener, IParseTree t)
   at Antlr4.Runtime.Tree.ParseTreeWalker.Walk(IParseTreeListener listener, IParseTree t)
   at Antlr4.Runtime.Tree.ParseTreeWalker.Walk(IParseTreeListener listener, IParseTree t)
   at Rubberduck.Parsing.VBA.ParseCoordinator.ResolveReferences(DeclarationFinder finder, QualifiedModuleName qualifiedName, IParseTree tree, CancellationToken token) in C:\Users\Mathieu\Documents\GitHub\Rubberduck (main)\Rubberduck\Rubberduck.Parsing\VBA\ParseCoordinator.cs:line 591

@retailcoder
Copy link
Member

@SteveLaycock a rather large number of fixes were applied to the resolver over the course of the past few months; can you reproduce the issue with v2.1.0?

@ghost
Copy link
Author

ghost commented Oct 16, 2017

This issue went away some time ago. The code that was causing the issues is unchanged.

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 resolver Issue is easier to resolve with knowledge of the internal resolver API and the Antlr4 parse trees.
Projects
Development

No branches or pull requests

2 participants