« first day (1019 days earlier)      last day (2161 days later) » 
00:00 - 21:0021:00 - 00:00

12:00 AM
RELOAD!
[rubberduck-vba/Rubberduck] 14 commits. 3 opened issues. 1 closed issue. 24 issue comments. 915 additions. 233 deletions.
 
12:11 AM
> not using vbWatchDog. I do use MZ-Tools but even if I unload it Rubberduck still gives me a parsing error.

I've just created a macro with one module, containing
[function addTwoNumbers(a,b) as double] => obvious code

Rubberduck did not give me a parse error.
I then added a test module through the Rubberduck dropdown, reparsed and got a parse error.
if I remove the test module, the parse error persists.
if I close and re-open, the error persists.


I have not turned on or off logg
> not using vbWatchDog. I do use MZ-Tools but even if I unload it Rubberduck still gives me a parsing error.

I've just created a macro with one module, containing
[function addTwoNumbers(a,b) as double] => obvious code

Rubberduck did not give me a parse error.
I then added a test module through the Rubberduck dropdown, reparsed and got a parse error.
if I remove the test module, the parse error persists.
if I close and re-open, the error persists.


I have not turned on or off logg
 
12:27 AM
> I suspect an IOException (or something derived from it) in the preprocessing stage - logs can get very verbose at TRACE level, but they also tell us the most about the sequence of events. We use NLog for logging, it handles all the archiving automatically, and we set it up to clear the current log everytime RD starts, which works well for diagnosing issues.
 
Are you freak'n serious, VBA?
 
> English.NETFramework40NotInstalled=Microsoft .NET Framework 4.0 installation was not detected.
 
So I got an error object from rtcErrObj() and called .Raise from managed code. Which resulted in an unhandled managed throw with the same error code that I raised. Are you kidding me?
 
VBA is mocking you?
4
 
Yeah. Apparently Err.Raise raises in .NET too. Who would have thought...
That was quite literally the last thing I expected to happen there.
2
 
OK, this is messed up. I might need to throw an unhandled managed exception and set the hresult manually so that it marshals to an unmanaged exception.
 
I can't seem to get a ListBox/ComboBox to read or write the RowSourceType property. Is it only there for some legacy reason?
 
VB6 only?
 
1:20 AM
FML. This is a complete catch-22. If I call Err.Raise in a try-catch block, it gets flagged as "handled" before it reaches the VBA runtime. If I don't use a try-catch block, it's unhandled in managed code and reaches VBA as a generic COM server error.
 
@Comintern I think it might be FoxPro
 
@Comintern The first is duh.
The second is duh too.
Not sure what else you'd want to happen.
 
The second one would be fine if the runtime didn't wrap up the exception.
Apparently the two error handlers are sharing the same exception context.
 
@ThunderFrame Please tell me you don't think I'm on that level...
 
@IvenBach Not at all - The guy doesn't even need to know what HTTPS or SQL-injection are. His biggest fail was telling the internet that his site was unbreakable.
 
@ThunderFrame That was the best part for me.
It's like asking 'Punch me in the face' to a room full of boxers... This is the interwebs!
 
Streisand-effect
 
14 years later and lessons still haven't been learned.
 
2:25 AM
Ars is one of the only places that has good comments
 
3:05 AM
> FWIW - in a project, our developers ran into a weird issue where the temp directory wouldn't be consistent, especially in a RDP environment. That is, calling %TEMP% may return one path ending with ...\Temp\01 then next time it's now ...\Temp\02. Thus it can be a mistake to assume that the %TEMP% won't change within a session. Just throwing this out in case this is relevant given that the parsers are using temporary directories.
> seems the error might not be related to the file system at all - This is from VBE6 and Access 2000, but it suggests that the error relates to a compile error:

http://www.techrepublic.com/article/access-2000-error-network-connection-may-have-been-lost-might-indicate-vbe6dll-conflict/

> Without getting into the mundane details, the basis of the problem is a conflict between Access 2000 and version 6.3.91.8 of the Vbe6.dll. This conflict prevents certain code modules from compiling and runn
> And this article suggests that the error might be because the VBA project might be corrupted.

http://kb.palisade.com/index.php?pg=kb.page&id=355

I wonder if this error is only occurring on files that have been saved *after* Rubberduck processing, and that are later re-opened? Could it be that the export/import process is occurring too fast for the VBE to keep up, or possibly before the project is ready to export, and Rubberduck inadvertently corrupts the project?

Or maybe the file fai
 
3:26 AM
@Duga - have we really corrupted the document?
2
A: Excel 2016: Error accessing file. Network connection may have been lost

mike spurrI just came across this error, using the option to "Open and Repair" from the drop-down on the button on Excel's "Open" dialog fixed it for me.

 
> Or maybe the file is corrupt, and we're assuming the message is because of something RD is doing? Maybe the message is appearing because the file is corrupt, and would have appeared whether RD was loaded or not?

This SO answer suggests that the file can be recovered.

http://stackoverflow.com/a/41689709/5757159

> I just came across this error, using the option to "Open and Repair" from the drop-down on the button on Excel's "Open" dialog fixed it for me.
 
 
5 hours later…
8:43 AM
> Thunderframe, It's certainly possible a file can be corrupt, although usually I see a blank Error 400 when that happens rather than a network error. That's why I repeated the test after removing the RD addin, to verify that there was no error. There are a number of MS forum reports about network errors (Document not saved) so there might be some bug in Excel that nobody has pinned down yet.
I don't know the RD code, but those discussions about race conditions between RD and the VBE sound like
 
9:30 AM
> @SystemsModelling you can just drag & drop a file to attach it to the current comment. It doesn't work for all filetypes, but txts should work just fine. Usually I go around and extract the stacktraces from logs for simplicity anyways ...

Note that you can press the little stylus on the top right of your comments to edit them. This allows seeing the actual markdown itself. for the codeblocks I used to use the four-space-indent as it was common on StackExchange, but github uses "fences" lik
 
9:42 AM
> Start with RD NOT loaded in Addin Manager
Start Excel, new Book1.
Alt+F11 to see VBE
Alt-Tab back to Excel UI.
Open a .xlsm, see it in UI, as expected.

Now load RD 2.0.13, restart Excel. Repeat test
AltF+F11 shows RD splash
Alt-Tab back to Excel UI.
Open a .xlsm, VBE window is brought to front.
 
9:56 AM
> Just looked into the log. An interesting entry:
`2017-03-21 09:44:56.3238;DEBUG-2.0.13.32288;Rubberduck.Parsing.VBA.RubberduckParserState;Project '㼿㼿' was added.;

Later in that log, an error was logged.
Duh, I've just seen the prompt below
"Attach files by dragging & dropping, ..."
[Error extract.txt](https://github.com/rubberduck-vba/Rubberduck/files/857680/Error.extract.txt)
 
10:20 AM
> 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..!
 
10:48 AM
> ```

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.Parsin
> 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?
> I've successfully installed that tool that seems to be pretty awesome, but **I can't manage to get it to parse anything**...
I've tried letting VBE opened for hours with a basic project (one sub with Debug.Print), and still pending...

It is **stuck on "Pending"** ("Pending. Click to refresh."), and **nothing happen when I click it**.

The only thing that I seem able to do (sometimes, then I can't again) is to add a modules or userform.

I've tried (in all apps) with existing projects,
 
11:13 AM
> Just now, I was looking at an xlsx tab on a phone call not touching the keyboard and suddenly the VBE window came in front again. Just as well I wasn't sharing the screen :-) The RD button then changed to Ready, so it must be RD bringing the VBE to the front.
> Just now, I was looking at an xlsx tab on a phone call not touching the keyboard and suddenly the VBE window came in front again. Just as well I wasn't sharing the screen :-) The RD button then changed to Ready, so it must be RD bringing the VBE to the front.
 
12:01 PM
> I open a wb, into VBE, click Pending, status goes to Parsing and stops, stays greyed out.

Add a dummy code line, it suddenly wakes up and goes to Ready.
Click Refresh, parses and goes to Ready as expected.

No errors, but some Warnings. Too many to paste, but here's a few. Do they matter?

`2017-03-21 11:53:06.3114;WARN-2.0.13.32288;Rubberduck.Parsing.Symbols.TypeAnnotationPass;Failed to resolve type ProcCall;
2017-03-21 11:53:06.6424;WARN-2.0.13.32288;Rubberduck.Parsing.Symbols.Ident
> Although the double headed (N-S) arrow cursor appears when I hover over the bottom frame, I can't increase the height of the Navigation window by dragging the bottom frame, only the bottom right hand corner where the cursor is NW-SE. The horizontal drag (W-E) works to widen it.

Feature request: Can I have it opened at the last size I set it to?
> I have a UserForm with a CommandButton `CommandButton1`, that is shown in Object Browser as being declared in my UserForm as `WithEvents CommandButton1 As CommandButton` but VBA has extended **all** of the `Control` members to the instance, so usages of `CommandButton1` or `Me.CommandButton1` give you access to all of the `CommandButton` members and all of the `Control` Members. Eg. `Control`'s `Height` and `_GetHeight` members are both available.

But when declaring a variable `cbCommandBut
> The way the VBE handles its toolwindows is... Let's just say if it were intuitive we wouldn't be having half the teardown issues we're having ;-)

I believe a single clean exit is all it takes for it to remember what was where; my work laptop install seems to leave everything where I left it. Not sure what we can do about these resizing quirks - at least not without a shot of the VBE toolwindow layout.
> 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.
 
12:51 PM
@Mat'sMug: I have some licensing questions wrt your VBTools repository. Do you mind if I open a private conversation?
 
1:12 PM
@patszim "[VBTools is] licensed under CC-by-SA as all Stack Exchange content is."
 
1:41 PM
@patszim what's up? :)
 
I am currently also working on a list implementation.
And started out with your List. But now it ended up being a complete rewrite.
I'd like to release that under a more liberal license (BSD / MIT / CC0).
 
no problem at all - I put CC-by-SA because I had originally published pretty much all of it on Stack Overflow & Code Review where it's CC-by-SA per SE's ToS... for all I care it could be public domain :)
 
So my two main questions:
- Could you have a look and tell if you are fine with me releasing that stuff (which was originally based on yours) under a different license? I do intend to give credit.
- The one big chunk that's left that I did not change is Strings.format. Should I remove that or are you ok with relicensing?
 
41
A: Implementing String.Format() in VB6

Mat's MugI couldn't find one anywhere, so I made my own: Public PADDING_CHAR As String Public Function StringFormat(format_string As String, ParamArray values()) As String 'VB6 implementation of .net String.Format(), slightly customized. 'Tested with Office 2010 VBA (x64) Dim return_value As St...

 
OK. Note on SO licensing: You do not lose the ownership of the code by posting it on SO. You only ALSO agree to release the code under CC-by-SA.
 
1:52 PM
eh, I hate licenses lol ...I'm ok with relicensing with attribution/credit
 
Also: There is currently a discussion about changing the license in SO code snippets. The state of that discussion is: Using SO codereview does NOT force the questioner to loose any rights of his code. They do discuss adding a second code license (MIT I think)
 
wasn't that last year?
IIRC it all fell apart and they backed down
 
OK. I'll give you a link to the code once I am done, so you can have a look.
 
sure :)
make sure you also take a look at the VBEX repo (which includes stuff derived from some of my work too)
 
First TOS change was proposed 1.Feburary, then postponed to 1.March, then put on ice (I thought that was this year and not last...)
 
1:55 PM
the lambda stuff is outright nuts
started here:
29
Q: Wait, is this... LINQ?

Mat's MugContext I'm working on a little project that consists in a series of Microsoft Excel add-ins (.xlam). The code being submitted for review here, is located in the Reflection project: Feel free to comment on the project architecture, but I'm mostly interested in the Reflection.LinqEnumerable cl...

Dim accumulator As Delegate
Set accumulator = Delegate.Create("(work,value) => value & "" "" & work")

Debug.Print LinqEnumerable.FromList(List.Create("the", "quick", "brown", "fox")) _
                          .Aggregate(accumulator)
> fox brown quick the
basically it takes the lambda string and literally creates an "anonymous function" at runtime, runs it, and then destroys it
performance probably sucks big time, but I didn't write that for performance... I wrote it because I could :)
@patszim BTW, have you tried Rubberduck?
@patszim huh, I don't even remember what that one is... that's probably some exploratory project I put up on GH in the couple of weeks that led to Rubberduck kicking off.
aand gone
 
2:19 PM
@jkpieterse - Keep in mind that you're the one that felt compelled to comment on my definition of "best practise", not the other way around. I also never used the term "best practise" - I'm saying that it creates a "readability issue", particularly with the code in question. If I'm reviewing code and find that it's hard to read, I'm going to call it out as hard to read. If I'm going to "pick a method and stick to it", it's going to be "write code that is easy to read". Of course you're perfectly entitled to your opinion - I'll look forward to reading more about it in your review. — Comintern 20 secs ago
^ Too pointed?
 
meh
the guy likes walls of declarations, it's his problem
 
also... it's "practice" - I like the passive-aggressive quoting :)
 
I thought it was some sort of regional spelling variation. I guess that speaks to my spelling ability more than anything else.
 
oh
lol
> Self-employed Office developer Excel MVP
^ saw that?
 
2:24 PM
I hadn't. Self-employed = unemployable?
 
I wonder what it takes to be able to stick "MVP" in one's profile.
pretty sure all core RD contributors could be "VBA MVP"
 
> Outstanding technical community members are nominated by their peers, Microsoft employees, and MVPs. Each year a panel of Microsoft employees reviews the contributions of each nominee for quality, quantity, and level of impact on the technical community.
 
ah, so it's a "I know someone" club
 
^
It actually looks like a hassle from some of the descriptions: "With the introduction of a site dedicated to MVPs, it is now easier to locate an MVP from a specific country and from a specific area of expertise."
I would imagine they'd expect you to answer one or two of those...
 
sooner or later I'll be tweeting to Microsoft to ask them WTF is up with their VBE, why RD keeps crashing it for stupid reasons and what we can do to work around the VBE's clumsiness.
 
2:32 PM
No, not gone, just afk because $work. :-)
 
@patszim aye - I should do the same :)
 
Have tried rubberduck, but I use Excel 2013 and rubberduck somehow had all functionality grayed out excep the syntax checker.
Dunno if that is how it should be...
 
5
A: Rubberduck UI submenus are disabled

Mat's Mug Disclaimer: I'm heavily involved with the development of the Rubberduck add-in. You did nothing wrong =) In earlier alpha 2.x releases we discovered that launching the initial parse on startup was causing problems (violent crashes), because the add-in was, essentially, ready before the VBE ...

@patszim latest release 2.0.13 means to launch the initial parse automatically (doesn't consistently work though for some reason), which should enable all the menu commands. pre-.13 you need to trigger the initial parse manually by clicking the "Pending" parser state button in the Rubberduck commandbar =)
 
2:46 PM
Yay, working! I guess now I'll take a deeper look.
Thanks!
 
Woot!
 
3:01 PM
Bobby Tables strikes again: arstechnica.com/security/2017/03/…
(^ not your day-to-day SQL Injection hack, it happened because an employee of the company filed a bug with Firefox telling them to stop warning about http login/credit card pages on the company's site, saying the company had their own "security system" and hadn't been hacked in 15 years. Needless to say Bobby was all over that and the users table was dropped in short order.)
 
lol
I suppose they learned their lesson
 
Well, it's current news, so I imagine they're actually more in the panicked whiskey-tango-foxtrot stage of the process.
 
3:16 PM
someone probably needs a new job by now
 
Nah, you don't fire your nephew - he'd have to move back into your brother's basement.
 
Ha, if only he hadn't signed up to the bug site as dgeorge. If he'd used puzzlepiece87 he might have a chance at not being so fired right now
 
3:33 PM
@Mat'sMug MS gives it to you. I don't know what the requirements are.
Usually, they get to travel around giving talks, etc.
Can I get tumbleweed from an answer?
 
Isn't that under question badges?
 
Probably.
Cause I'd probably get it for this if it wasn't: codereview.stackexchange.com/questions/157609/…
Ha, doing DI wrong:
The DI cancer has spread so far... — Idan Arye 16 hours ago
From an Eric Lippert answer:
> (This is almost certainly a bad idea, but I include it for completeness!) softwareengineering.stackexchange.com/a/344562/113093
 
@Hosch250 dubbing DI a "cancer" speaks a lot about that person's understanding of DI lol
 
@Mat'sMug Yup, but the way that person is doing it is a cancer.
 
Absolutely
It's as if I'd claim the way RD inspections intake inspection results and quickfixes' dependencies "proper DI"
(it absolutely isn't)
 
3:47 PM
LOL.
I'm still trying to figure out the best way to do that.
 
Simple: we need abstract factories ctor-injected, and ninject can auto-implement them
 
I'd have to see your changes to decide on anything, anyway.
I don't see how that will work.
We are still injecting everything into the IInspection implmentations.
We are doing DI, but we aren't doing IoC.
And this is a case when IoC would be good.
 
No. We're doing half-assed DI there
 
Both, then.
We are DI'ing everything--we need to make the quick fix call the inspection result, though, not the other way around.
 
3:50 PM
The inspection should create the results, and the chain should stop there.
 
The interfaces need to change
 
Yeah.
 
And that's a PITA =)
 
Somehow, I'm thinking a dictionary <IInspection, List<IInspectionResult>> for storing the results.
 
So we need to be careful to do it right so we don't need to do it again anytime soon
 
3:51 PM
Not sure, but it seems to make sense for the groupings.
When we are in the inspection view... Hmm, I have an idea.
We need to make the quick fixes like the refactorings.
Except they can't store state.
I have a completely functional-style idea, which should work with the new TSR's.
We inject the quick fixes into the inspections viewer.
When the user chooses a quickfix, we call var rewriter(s) = SelectedQuickFix(SelectedInspectionResult)
Then, the inspections viewer is responsible for re-writing to the code modules.
I think we need to return a List<IModuleRewriter>s because the quick fixes can change multiple modules.
 
Keep in mind where inspections are headed too
 
@Mat'sMug That still works.
 
@Hosch250 isn't it easier to just get the rewriter from the RPS?
 
Because the inspections have absolutely no idea about the quick fixes in this way--the quick fixes could even be moved into their own assembly.
@Mat'sMug Oh, sure.
OK, here's an addition to the thought.
Each quick fix knows which inspection results it can fix.
That way, we just need to inject any IInspectionQuickFix we find in the solution into the inspection viewer, and they handle everything themselves.
 
@Hosch250 write that reflection in the GH discussion about IInspection redesign - it's good food for thought =)
 
3:57 PM
Where is that?
 
4:10 PM
> I have a thought about cleaning up the mess with injecting quick fix dependencies into the inspections. This is a total mess; we need to make the quick fixes call the inspection result, not vice-versa (the current way). So, suppose we told each quick fix what inspection result types it could fix and gave it a `Fix` method that took a result, like so:
```
public interface IInspectionQuickFix
{
List<IInspectionResult> CanFix { get; }
void Fix(IInspectionResult target);
}
```
Now
 
Done.
Now that it is written out more clearly, what do you think?
GTG have breakfast.
 
@Comintern It's interesting to see this viewpoint.
 
LOL - I was self employed for decades. That was meant to be a dig.
 
That may be so but I can see why some people are "self-employed"
 
> ok! Here's a log output from when I click the refresh button in the ribbon.
[RubberduckLog.txt](https://github.com/rubberduck-vba/Rubberduck/files/858866/RubberduckLog.txt)
> ok! Here's a log output from when I click the refresh button in the ribbon.
[RubberduckLog.txt](https://github.com/rubberduck-vba/Rubberduck/files/858866/RubberduckLog.txt)
 
4:41 PM
> The first log is relevant to the parse error and point to line 746, column 23 of module "AppVariables". It looks like it's failing on some sort of declaration. Are there a couple lines around there that can be shared? If not, how about the same syntax with only the variable names \ literal values changed?

The second log is a bit more puzzling - from that one it looks like we tried to load a library from a referenced project or library, but couldn't load it because the typelib wasn't regi
 
4:52 PM
> Here is the whole thing with the lines in tact, redacted where necessary.
this entire module is global variables. my ego insists that I notify you that this is legacy code I maintain. :)
[AppVariables.txt](https://github.com/rubberduck-vba/Rubberduck/files/858966/AppVariables.txt)

if is RD looking at the first line as "Attribute VB_Name = "AppVariables"" then line 746 is
"Public arySV(300, 7) As Variant"
column 23 is where there is a double space before "As Variant"
I'm surprised tha
> Here is the whole thing with the lines in tact, redacted where necessary.
this entire module is global variables. my ego insists that I notify you that this is legacy code I maintain. :)
[AppVariables.txt](https://github.com/rubberduck-vba/Rubberduck/files/858966/AppVariables.txt)

if is RD looking at the first line as "Attribute VB_Name = "AppVariables"" then line 746 is
"Public arySV(300, 7) As Variant"
column 23 is where there is a double space before "As Variant"
I'm surprised tha
> I like what @Hosch250 proposes above. However, I would take it one step further and inject an IQuickFixHandler into the view model and inject all the quickfixes into its implementation. I think the view model itself should not know the details of how applying the quickfixes works. It should just translate the input and pass it on to somebody else who knows.
> @MDoerner That makes sense.
> If I had to guess, I'd guess the grammar thinks that Public arySV(300, 7) As Variant should have a Sub or Function or something in there.
 
5:07 PM
> @Hosch250 sorr, I don't think that's it. That's a static array declaration not a method. there are 33 of them in this module
> @Hosch250 sorry, I don't think that's it. That's a static array declaration not a method. there are 33 of them in this module
> @connerk - We've had issues with the potential ambiguity in the VBA grammar between array subscripts and procedure argument lists. I'm pretty sure it's some combination of multi-dimensional fixed array, `Public` declaration, and "strong" (or in this case explicit) typing.

Thanks for providing the file - that helps tremendously.
> I pasted that into Excel, and everything works as expected.
> I pasted that entire file into Excel, and everything works as expected.
> @comintern

just saw these questions:

Referring to the actual project:
_Do you reference anything that isn't a library? For example, an .xlam file?_ => NO
_Do you reference anything that isn't on the local machine - i.e. a registered library from a network share?_ => NO
_Do you have any of the Rubberduck COM APIs referenced?_ => late bound RubberDuck.AssertClass

if I open a brand new book (no modules):
refresh => success
add test method through RD menu, early binding => parse err
> @comintern

just saw these questions:

Referring to the actual project:
_Do you reference anything that isn't a library? For example, an .xlam file?_ => NO
_Do you reference anything that isn't on the local machine - i.e. a registered library from a network share?_ => NO
_Do you have any of the Rubberduck COM APIs referenced?_ => late bound RubberDuck.AssertClass

if I open a brand new book (no modules):
refresh => success
add test method through RD menu, early binding => parse err
> Huh wtf

````
2017-03-21 10:26:34.8598;ERROR-2.0.13.32288;Rubberduck.Parsing.VBA.ParseCoordinator;Unexpected exception thrown in parsing run. (thread 13).;System.Runtime.InteropServices.COMException (0x8002801D): Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED))
at Microsoft.Vbe.Interop.Reference.get_FullPath()
at Rubberduck.VBEditor.SafeComWrappers.VBA.Reference.get_FullPath() in C:\Users\Mathieu\Documents\GitHub\Rubberduck (main)\Rubberduck\Rub
> should I re-install maybe?
> should I re-install maybe?

is it System.Runtime.InteropServices.COMException that is not registered?
> Nah, I don't think it would fix anything - looks like Rubberduck doesn't like loading its own type library at runtime; we have a plan to use actual .net reflection to pull the COM-visible declarations from Rubberduck.dll instead of loading the Rubberduck.tlb referenced type library: this is a known (but intermittent and not really explained) issue with parsing a project that has an early-bound reference to Rubberduck's API.
> A reinstall probably won't help, although we've also run into a couple instances where RD has difficulty loading its own typelib with a LoadLibrary call. Linking #2789
> ah. seems like if it has Ever been early bound it will error ever after. I dont' see any RD in the references
![image](https://cloud.githubusercontent.com/assets/1771679/24161798/a0ab1954-0e22-11e7-80dc-348bde03551e.png)

and have ensured all assertClass's are late bound. still getting the parse error
```
2017-03-21 10:38:05.6380;DEBUG-2.0.13.32288;Rubberduck.Parsing.VBA.RubberduckParserState;RubberduckParserState raised StateChanged (ResolvingReferences);
2017-03-21 10:38:05.8944;ERROR-
> ah. seems like if it has Ever been early bound it will error ever after. I dont' see any RD in the references
![image](https://cloud.githubusercontent.com/assets/1771679/24161798/a0ab1954-0e22-11e7-80dc-348bde03551e.png)

and have ensured all assertClass's are late bound. still getting the parse error
```
2017-03-21 10:38:05.6380;DEBUG-2.0.13.32288;Rubberduck.Parsing.VBA.RubberduckParserState;RubberduckParserState raised StateChanged (ResolvingReferences);
2017-03-21 10:38:05.8944;ERROR-
> @connerk hmm this looks like a bug in the declaration finder - could the project happen to be named exactly as one of the class modules under it?

---

FWIW I pasted `AppVariables.txt` in a new module and it parsed without any issues here. `arySV` is recognized as a `Variant`, but it seems to fail to recognize it as an array:

![image](https://cloud.githubusercontent.com/assets/5751684/24161839/ec3a9fa2-0e3b-11e7-8d15-a570513301cb.png)

Compare to:

![image](https://cloud.githubuserc
> @connerk hmm this looks like a bug in the declaration finder - could the project happen to be named exactly as one of the class modules under it?

---

FWIW I pasted `AppVariables.txt` in a new module and it parsed without any issues here. `arySV` is recognized as a `Variant`, but it seems to fail to recognize it as an array:

![image](https://cloud.githubusercontent.com/assets/5751684/24161839/ec3a9fa2-0e3b-11e7-8d15-a570513301cb.png)

Compare to:

![image](https://cloud.githubuserc
> @connerk hmm this looks like a bug in the declaration finder (well in the `TypeHierarchyPass` anyway) - could the project happen to be named exactly as one of the class modules under it?

---

FWIW I pasted `AppVariables.txt` in a new module and it parsed without any issues here. `arySV` is recognized as a `Variant`, but it seems to fail to recognize it as an array:

![image](https://cloud.githubusercontent.com/assets/5751684/24161839/ec3a9fa2-0e3b-11e7-8d15-a570513301cb.png)

Compare
> all names look unique
![image](https://cloud.githubusercontent.com/assets/1771679/24162089/9c865298-0e23-11e7-9337-69c9e8e00f70.png)
> if I put AppVariables into a fresh workbook I also don't get a parse error.
be advised though, I did fix the "[double space] As Variant" script though
if I add the extra space back it still doesn't error
> The double space shouldn't matter, our grammar is (mostly) written against the VBA language specifications, not against what the VBE turns processed code into (although we *do* have a few hacks that rely on it).

I'm positively confused now.

````csharp
private void AddImplementedInterface(Declaration potentialClassModule)
{
if (potentialClassModule.DeclarationType != DeclarationType.ClassModule)
{
return; // this guard clause SHOULD prevent the InvalidCastException yo
 
5:56 PM
how the F does Unable to cast object of type 'Rubberduck.Parsing.Symbols.ProjectDeclaration' to type 'Rubberduck.Parsing.Symbols.ClassModuleDeclaration'. happen here? a ProjectDeclaration can't even possibly make it this far into the method!!
 
@Duga Is it possible there's a naming collision in the referenced libraries?
 
hmm
doesn't explain the InvalidCastException though
 
I might install Reflection tonight - it could probably use a host anyway.
 
oh wait a minute
    var implementedInterface = _bindingService.ResolveType(potentialClassModule, potentialClassModule, expressionContext);
that's resolving to something we assume is a class
 
> Looking again, it looks like we're making an assumption here, that `ResolveType` returns a `ClassModuleDeclaration` (and it *should*):

````csharp
var implementedInterface = _bindingService.ResolveType(potentialClassModule, potentialClassModule, expressionContext);
````

We need to look at `ResolveType` and restrict its scope to class modules, it makes no sense that a type resolves to a project declaration.
 
6:01 PM
Yeah, that cast should always succeed.
 
ugh, this is getting very ugly, very fast!
 
This is the only place it's called from though:
    foreach (var declaration in _declarationFinder.Classes)
    {
        AddImplementedInterface(declaration);
    }
 
Yeah, but I suspect there is a .FirstOrDefault somewhere, that's favoring a project over a class
a TypeBindingContext can never resolve to a project, right?
 
_declarationFinder.Classes is just return _classes.Value; and it's loaded like this though:
_classes = new Lazy<ConcurrentBag<Declaration>>(() => new ConcurrentBag<Declaration>(declarations.Where(d => d.DeclarationType == DeclarationType.ClassModule)), true);
 
dafuq
 
6:06 PM
IKR?
Those also the only 2 usages, so the only way that can happen is if we're creating a ProjectDeclaration, but setting the DeclarationType == DeclarationType.ClassModule
 
..in which case we all deserve a beating...
IIR the ProjectDeclaration ctor hard-codes the DeclarationType.Project it passes down the base class
@Comintern this call is happening: github.com/rubberduck-vba/Rubberduck/blob/…
Would it be bad to log the binding context when resolution fails?
 
Isn't that just for scope determination?
@Mat'sMug Maybe - we could end up logging arbitrary code if the parser fails.
 
Yeah that's what I'm saying... Like here we (the user) would know what we're trying to resolve
@Comintern it looks like it's used for resolving any SimpleName context
It follows scoping rules indeed
But doesn't necessarily return a class declaration
However the typebinding should enforce that
...*somehow*
Definitely starts to smell like a name collision with one of the referenced libs
 
6:25 PM
I'm still not sure how the invalid cast is possible with a hard-coded readonly DeclarationType.
 
26 mins ago, by Mat's Mug
    var implementedInterface = _bindingService.ResolveType(potentialClassModule, potentialClassModule, expressionContext);
^ that's what we're casting
in this case var is a project declaration which we assume is a class
totally an edge case
 
Ahhh- I misread the line number.
Somebody didn't follow COM identifier rules...
Looking at you, IBM.
 
lol
 
6:39 PM
I'm not disputing any of that. I just have no clue what you're referring to when you say "because it cannot obfuscate object model calls". — Comintern 1 min ago
^Any idea WTH that guy is talking about?
 
nope
 
OK, so I'm not slowly slipping into dementia.
2
 
So wait, you have nuke launch codes in a macro-enabled worksheet? At the end of the day if a computer can run it, a decompiler can decompile it. Your question is unclear, it's more of a statement than anything else. Or are you looking for "real opinions" on these tools? The server solution seems like the only solution - run the code on your servers if you don't want your clients to access it in any way shape or form. Not sure where VBA/Excel fits in though, and that seems way overkill. And if it's meant to be called from Excel, you're killing performance to profit security. Life is a balance! — Mat's Mug 6 secs ago
I have a super secure awesome gizmo. So secure, nobody can use it.
 
lol
Either that or "I protect my IP by ham-stringing the application you paid me to spend a year and a half writing. Should have thought of that earlier. Oops."
 
almost added another comment to say "whatever you do, don't tweet that your server solution can't be attacked/cracked"
 
6:53 PM
Note to self. Hold down shift while opening "NuclearLaunch.xlsm".
 
lol
 
@Mat'sMug Bobby Tables' ears just perked up.
 
=)
 
7:09 PM
If 1 person can crack the Unviewable security, then security is broken. If the 1% can crack the security, then security is easily broken. Hint: Unviewable plus uses a decoy VBAProject.bin, and a number of other techniques, but the code can be easily extracted using freely available open-source tools. The VBA file format spec is published by Microsoft. Anybody with a spare afternoon could read the file. — ThunderFrame 2 mins ago
 
> Anybody with a spare afternoon could read the file.
4
 
I should probably take a test, but I'm so tired...
 
well...
 
I thnik the problem with the TypeHierarchyPass might be that the SimpleNameTypeBinding prefers projects over modules.
 
I think I'll write a paper instead. I don't have to get the test done until April 3.
 
7:11 PM
@M.Doerner it depends on the context though
foo = SomeProject.SomeModule.SomeType
^ given @ThunderFrame-grade naming, it has to be that way
@Zerk a hex editor is overkill. this solution "simply" hijacks the password prompt through a clever Win32 hack, to make the VBE think the correct password was entered - it's not even trying to brute-force or hash-collide the actual password. I regularly use it to unlock "protected" VBA projects we own but for which we lost the passwords. VBA project protection is an annoyance for the dev, and a joke for everyone else. — Mat's Mug 21 secs ago
 
OK, how exactly does Identifier.GetName(_expression.identifier()) work?
Is this guaranteed to return a fully qualified identifier?
 
@Mat'sMug This is why I feel I know nothing.
 
If not, every collision with the enclosing project or a referenced one will yield a project declaration from the typeBindingService.
 
@M.Doerner I think it only returns... Oh.
 
7:27 PM
@Mat'sMug How soon should we start working toward the plugin architecture?
After 2.1? Right now? Later?
 
The SimpleNameTypeBinding trys to bind in the following order: udf in enclosind module -> enum in enclosing module -> enclosing project -> referenced project -> standard module in project -> class in project -> ...
 
@Hosch250 oh, I don't have the slightest idea - that's essentially making an "extension API" that other .net projects can reference.. we need to discuss what extension points need to be exposed
and before that, the menus need to GTFO of RubberduckModule
@M.Doerner that seems correct. but does a TypeBinding returning a ProjectDeclaration make sense?
 
Is the IdentifierName on a Declaration always fully qualified?
 
nope. it never is actually.
 
If you want the qualified name, look at QualifiedModuleName.
 
7:38 PM
Then the test for equality with the projects is a simple check for unqualified name equality.
 
huh, where is that?
 
I'm really starting to lean toward something using FirstOrDefault() to pick between ambiguous options.
 
In ResolveEnclosingProject in SimpleNameTypeBinding via the DeclarationFinder.
The DeclarationFinder groups the declarations by their Identifier. This is used in MatchName, which is used for basically everything.
Moreover, IsMatch in the DeclarationFinder is just a string comparison.
 
we have to match them by name though
 
7:43 PM
This is why I want to re-write the parser to build pseudo-type libraries.
 
BTW, having square brackets around identifier does not help since we remove them prior to the comparison.
 
the brackets would be irrelevant then
the problem is that once we're in MatchByName`, we've lost all the context needed to disambiguate 2+ matches
well, depending on what we're trying to match
 
7:59 PM
If there is really a name collision, a fix to get through the TypeHierarchyPass could be to fully qualify the referenced interface.
We should do something from our side, though.
 
8:25 PM
Comintern I am required to standardised it in a particular format. Particuarly in a row and when the new user wishes to add more content, they can. I want the button or function to be easily clicked or run so it takes that content and produces the result I need. Then I can use it for automation purposes. — user7568042 10 mins ago
@Comintern ^
should I hammer it as a dupe?
 
It's probably not a dup after the edit, but it's not currently answerable either.
It got hammered once, then reopened - but since I VTC'd as duplicate I can't VTC again as unclear.
 
I have all options open
FYI when you want someone to be notified of a reply, use @TheirName to do so. Anyway declare i as a Long, not an Integer, and if you know which row you need to stop at then as people have been telling you, you need a For i = start to finish loop, where finish is, I guess, your LastRow. I'm voting to close this question as unclear what you're asking until you edit it to clarify exactly what "doesn't work" means. When you have half the VBA expertise of Stack Overflow scratching their heads, it's a sign your question isn't clear. — Mat's Mug 10 secs ago
@Mat'sMug - Declaring i as long only means he/she will have to wait longer for it to crash. :) — Jeeped 14 secs ago
LOL
 
8:41 PM
> @connerk Can you tell us the names of the interfaces/classes your classes and forms implement? That might help a lot to understand what is going wrong here.
 
@Mat'sMug I think that should be a valid reason to dim as int
 
...
heck, use a Byte instead, you'll crash even earlier
 
YowE3K Thank you very much. I tested it and it worked perfectly. In my for loop, I did "For Each text In ActiveSheet.Range("A1:A11") ...End If Next text End Sub. But it didn't work. Luckily your use of "If and Else" and "For i = 1 To LastRow" solved my problem. Thank you very much again YowE3K — user7568042 7 mins ago
OK, so I was going to get my invoice ready. What should I put on there for your time?
 
8:58 PM
Please don't decide to do that with me. I have too much to learn from those that participate here. I couldn't afford all the help I'm receiving.
 
00:00 - 21:0021:00 - 00:00

« first day (1019 days earlier)      last day (2161 days later) »