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

Parsing Error With No Search Results #2918

Closed
pixelvertice opened this issue Mar 21, 2017 · 8 comments
Closed

Parsing Error With No Search Results #2918

pixelvertice opened this issue Mar 21, 2017 · 8 comments
Labels
bug Identifies work items for known bugs critical Marks a bug as a must-fix, showstopper issue parse-tree-preprocessing
Milestone

Comments

@pixelvertice
Copy link

Hello,
I'm relatively new to VBA and I recently installed Rubberduck for my CorelDRAW VBA environment.
I'm using CorelDRAW X7 on Windows 7 64bit.

I tried to run Rubberduck for the first time, after doing some registry workarounds to make it load in my 64 bit IDE. It works, but I stumped by Parse Error hence leave most of Rubberduck features unusable.

Here's pastebin to the log file >> http://pastebin.com/wFwMbW6v

Thank you, looking forward to be able to use this powerful add-in..!

@Vogel612
Copy link
Member


2017-03-21 17:15:25.1471;ERROR-2.0.13.32288;Rubberduck.Parsing.VBA.ComponentParseTask;Exception thrown in thread 24, ParseTaskID 6ed1af23-86ba-4b8f-bac8-a021c2075efd.;System.ArgumentOutOfRangeException: Length cannot be less than zero.
Parameter name: length
   at System.String.Substring(Int32 startIndex, Int32 length)
   at Rubberduck.Parsing.Preprocessing.LivelinessExpression.MarkAsDead(String code) in C:\Users\Mathieu\Documents\GitHub\Rubberduck (main)\Rubberduck\Rubberduck.Parsing\Preprocessing\LivelinessExpression.cs:line 26
   at Rubberduck.Parsing.Preprocessing.LivelinessExpression.Evaluate() in C:\Users\Mathieu\Documents\GitHub\Rubberduck (main)\Rubberduck\Rubberduck.Parsing\Preprocessing\LivelinessExpression.cs:line 21
   at Rubberduck.Parsing.Preprocessing.ConditionalCompilationIfExpression.Evaluate() in C:\Users\Mathieu\Documents\GitHub\Rubberduck (main)\Rubberduck\Rubberduck.Parsing\Preprocessing\ConditionalCompilationIfExpression.cs:line 48
   at Rubberduck.Parsing.Preprocessing.ConditionalCompilationBlockExpression.<>c.<Evaluate>b__2_0(IExpression child) in C:\Users\Mathieu\Documents\GitHub\Rubberduck (main)\Rubberduck\Rubberduck.Parsing\Preprocessing\ConditionalCompilationBlockExpression.cs:line 17
   at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
   at System.String.Join(String separator, IEnumerable`1 values)
   at Rubberduck.Parsing.Preprocessing.ConditionalCompilationBlockExpression.Evaluate() in C:\Users\Mathieu\Documents\GitHub\Rubberduck (main)\Rubberduck\Rubberduck.Parsing\Preprocessing\ConditionalCompilationBlockExpression.cs:line 17
   at Rubberduck.Parsing.Preprocessing.VBAPreprocessor.Execute(String moduleName, String unprocessedCode, CancellationToken token) in C:\Users\Mathieu\Documents\GitHub\Rubberduck (main)\Rubberduck\Rubberduck.Parsing\Preprocessing\VBAPreprocessor.cs:line 24
   at Rubberduck.Parsing.VBA.ComponentParseTask.RewriteAndPreprocess(CancellationToken token) in C:\Users\Mathieu\Documents\GitHub\Rubberduck (main)\Rubberduck\Rubberduck.Parsing\VBA\ComponentParseTask.cs:line 184
   at Rubberduck.Parsing.VBA.ComponentParseTask.Start(CancellationToken token) in C:\Users\Mathieu\Documents\GitHub\Rubberduck (main)\Rubberduck\Rubberduck.Parsing\VBA\ComponentParseTask.cs:line 51

It seems there is an error with the processing of "preprocessor directives" (well the name isn't strictly correct, but eh...). The point is, somewhere in your code there is something that looks like this:

#If <text here> Then

#Else 

#EndIf

This is what currently trips rubberduck up. If you could try to reproduce the parse-error with either a "minimal example" by removing code that doesn't produce the error and attaching the result here or possibly (check with your company) share the module where the parse-error is located, we can find a fix for this. Thanks :)

@Vogel612 Vogel612 added bug Identifies work items for known bugs critical Marks a bug as a must-fix, showstopper issue parse-tree-preprocessing labels Mar 21, 2017
@Vogel612
Copy link
Member

There are some additional parse-errors, namely in the modules: frmTiling, frmProgress, frmCTP and CSVReader. Are you 100% sure that the code does compile and work, especially on all precompiler-directive combinations?

@ThunderFrame
Copy link
Member

When I use Rubberduck in CorelDRAW X6, I have to unload all of the GlobalMacros as at least one of the GlobalMacros has something that is causing a ParserError, and I haven't been able to work out what it is yet.

@pixelvertice
Copy link
Author

Okay so I tried to narrow the error down by unloading some macro project from my IDE (most of it are downloaded macros), leaving only my projects open.
From my project I found some modules are causing trouble to the parser, those modules are snippets from the internet. I tried to remove those modules then refresh the parser, then it can complete its task successfully.

Here's the problematic modules:
JsonConverter: https://github.com/VBA-tools/VBA-JSON
CSVReader: http://www.freevbcode.com/ShowCode.asp?ID=7655

@ThunderFrame my Global Macros are empty, so it's not the case for me

@comintern
Copy link
Contributor

@pixelaminator - Did you import CSVReader, or did you copy and paste the code? Looks like these might be causing problems:

VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "CSVParse"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False

@pixelvertice
Copy link
Author

I copy pasted it, but I leave that declaration part because my project wouldn't run with it. So those declaration part is not in my code

@retailcoder
Copy link
Member

@pixelaminator the VBE doesn't display module and member attributes, but they're important nonetheless. That's why it's best to import modules, so that attributes are picked up by the editor. They won't compile if pasted into a code pane.

@Vogel612 Vogel612 added this to the 2.1.x Cycle milestone Nov 3, 2017
@Vogel612 Vogel612 added this to TODO in Release 2.3.0 Apr 9, 2018
@Vogel612 Vogel612 modified the milestones: 2.x Cycle, 2.3.0 Release Jun 20, 2018
@MDoerner
Copy link
Contributor

MDoerner commented Oct 4, 2018

This has long been fixed (since PR #3001).

I tested with the code from both links and there is no problem.

@MDoerner MDoerner closed this as completed Oct 4, 2018
Semi-automatic bug tracker automation moved this from ToDo to Done Oct 4, 2018
Release 2.3.0 automation moved this from TODO to Done Oct 4, 2018
@Vogel612 Vogel612 modified the milestone: 2.3.0 Release Nov 13, 2018
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 critical Marks a bug as a must-fix, showstopper issue parse-tree-preprocessing
Projects
Development

No branches or pull requests

6 participants