rubberduck-vba / Rubberduck

Every programmer needs a rubberduck. COM add-in for the VBA & VB6 IDE (VBE).
https://rubberduckvba.com
GNU General Public License v3.0
1.92k stars 302 forks source link

Parse Error (System.OutOfMemoryException) in RD 2.1.0.29597 #3241

Closed NDeLancie closed 6 years ago

NDeLancie commented 7 years ago

I've just installed RD 2.1.0.29597 on a Windows 7 Enterprise x64 with Office 2010 Professional Plus x86 (no complaints on installation), and am working in Word's VBA IDE. Word has multiple projects installed (most of which are not mine and locked to me).

Parsing often takes a seemingly endless amount of time, often resulting in both Word and the VBA IDE windows going white, or only showing frame outlines with no contents, or alternating between the two, and "(Not Responding)", and sometimes crashing.

When Parsing does "complete", a Parse Error is shown on the RD toolbar with a white X in a red circle to its right, and when that is clicked, the Search Results window loads, with only the Parse Errors tab, but that tab has no contents.

Whether I get to a Parse Error, or the whole thing just crashes may depend on which project is the current active project in the IDE's project explorer.

The header and first part of the log results (Minimum Log Level set to Error) are as follows:

2017-08-10 16:17:27.0166;ERROR-2.1.0.29597;Rubberduck.Parsing.VBA.ComponentParseTask;Exception thrown in thread 42 while parsing module NDeLCustomizations.CommandLineInterface, ParseTaskID 47373ac2-c3fb-46db-8cfb-bae1b3fdb64e.;System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.

[Full log file attached.]

There are several successive System.OutOfMemoryException(s) shown for different modules of the same project. All projects compile without error, however.

Essentially, RD is unusable in for Word's VBA IDE. Have not had this problem with Excel, but have very few projects in Excel with much less code.

RubberduckLog.txt

Vogel612 commented 7 years ago

Would you mind sharing your system specs? Specifically RAM and CPU data would be something that might get us started. How much code are you attempting to parse with Rubberduck?

Do note that there might be no really nice way to resolve this. In general programs are a tradeoff between speed and memory. Rubberduck extensively uses Optimizations that cost memory. As such parsing large projects with little RAM is difficult, if not outright impossible for Rubberduck right now...

NDeLancie commented 7 years ago

Runnning a Dell Latitude E7450 with Intel Core i7 5600U @ 2.6 Ghz with 16 GB RAM and a 256 GB SSD.

I'll try to gauge how much code there is, but, as most of the projects are locked to me, I'm not sure how I'll do that for them, or even for my own projects (lines of code? words of code?).

One though I just had as I begin to see what RD is trying to do is perhaps the settings should include Parse All Projects, Parse Only Projects on Parse List, and Parse All Projects Except Projects on Excluded List choices, with, a Parse List and Excluded List. That way, one could just have RD concentrate on what's needed. Pehaps all locked projects should be excluded (maybe they are already) since they can't be edited by the user.

Another possibility here is that it isn't the size of the project or projects that's the problem, but, rather, something in the code that, while it compiles without a problem, throws the parser into a fit.

Anyway, I'm not a professional programmer, only a lawyer who loves to code to make Word (primarily), Outlook, and Excel jump through hoops for my own productivity (ha ha--if it takes a minute to do something that I do regularly, then it should be automated, even if that take hours and hours, far in excess of the cumulative "saved" time) and intellectual stimulation. Having an IDE that is more like Visual Studio (which I only recently came to) is a great idea, so the idea of RD very much appealled to me when I stumbled upon it last night while reading about how to construct a class that is a collection of items of another class and a newenum capability for For ... Next those items. Frustrated a bit so far getting RD working, though, but, again, a great idea.

Thanks, Nick

ThunderFrame commented 7 years ago

If the projects are locked, Rubberduck won't parse them.

Office x86 is limited to 3GB (assuming you're on 2013+ and patched).

ThunderFrame commented 7 years ago

@NDeLancie If you're curious about the protected projects, there's always this: https://stackoverflow.com/questions/1026483/is-there-a-way-to-crack-the-password-on-an-excel-vba-project

retailcoder commented 7 years ago

How much code are we looking at? Number of modules, ballpark number of variables, enums, parameters? What type libraries are referenced? Rubberduck creates a Declaration instance for every one of those, each with its own References collection containing an IdentifierReference instance for every reference the resolver could find. I admittedly haven't stress-tested RD with my largest project since a few versions, but we normally easily deal with ~60K declarations with decent performance...

I'm sorry your RD experience pretty much sucked so far - note that locked projects are ignored (trying to parse them / access their VBComponents collection throws a COMException), so they're not contributing to the load.

The parser currently handles an astounding amount of weird impossible edge cases you wouldn't even think is legal VBA code - at this point a parse error (especially one that comes up blank) is likely some exception thrown in the preprocessing passes... I need to look at that log file, but do you use precompiler directives and member attributes?

ThunderFrame commented 7 years ago

IIRC, there is still a parse error when parentheses are on a continued line, in a statement like:

  result = MsgBox _
  ("Some message")

tease - Parsing locked projects is a WIP, and coming to RD

retailcoder commented 7 years ago

One thing you can try, is to uncheck the "Run inspections on successful parse" setting in the settings dialog's "Inspections" tab. Won't help a parse error, but will certainly get you a 'Ready' state much faster, especially if there's a lot of code producing a lot of inspection results - you can also selectively disable individual inspections - "use meaningful names" is potentially creating a lot of noise, and "redundant byref modifier" will soon be disabled by default. Note that "missing attribute", "missing annotation" and "illegal annotation" inspections are currently broken and produce false positives and/or their respective quickfix is borked.

@ThunderFrame that would be a regression, I'm 99% sure Max fixed that one a couple of weeks ago...

NDeLancie commented 7 years ago

Ok, I'll try to tote up the requested info over the next couple of days. We are running Office 2010 x86 SP2, not 2013+ (but we will be moving to Windows 10 x64 and Office 2016 x64 sometime), so I don't think it can go beyond 2GB.

You guys are great by your response. Don't worry about the install experience I've had so far. We'll get there.

NDeLancie commented 7 years ago

Also, re the prior question, under 10 precompiler directives (#If VBA7 or #If Win32) and no member attributes (though my next step in the class on which I am working is to provide a newenum, which will require an Attribute NewEnum.VB_UserMemId = -4 and Attribute NewEnum.VB_MemberFlags = "40" for the NewEnum property, and the Item property (to make it the default property, will require an Attribute Item.VB_UserMemId = 0, but these haven't been done yet).

manjugb commented 6 years ago

I am trying to run rubberduck Windows 7 Enterprise, I am using big test program , when i am trying to rubberduck,Getting empty parse error

System Details

Hardware i7-5600U @ 2.60 GHz RAM 8 GB 64-bit OS I am not Administrator MS-Office -2010 IG-XL Data tool also integrated with Excel normally Excel ,i opened from Teradyn IG-XL Data Tool

why small program can able validate and rubber duck will open if i start excel containes more than one tab and data with macros , rubber duck is not able load, giving empty parse error

Do you need any admin priviliges to run rubberduck Is it possible integrate with IG-XL Data Tool software? for reference look here (http://www.teradyne.com/products/semiconductor-test/ig-xl-software)

Vogel612 commented 6 years ago

@manjugb would you please open a separate issue for this? It's not really a good place to discuss this in a separate (and probably unrelated) issue, because the conversation gets messy.

FWIW: You do not need administrator privileges to run Rubberduck, but you need them for installation.

bclothier commented 6 years ago

Closing the issue due to age and the fact that questions has been answered. Additionally, the installation changed since the issue reported (cf #3836 )