« first day (1689 days earlier)      last day (1491 days later) » 

12:00 AM
RELOAD!
[rubberduck-vba/Rubberduck] 3 commits. 4 opened issues. 2 closed issues. 25 issue comments. 490 additions. 16 deletions.
 
 
3 hours later…
2:55 AM
@this Last I tried yes. I'll give it a go when I get back to work.
 
 
4 hours later…
7:00 AM
> CodeExplorerTests.Count += 253 This also fixes (or greatly mitigates) an unrelated issue I stumbled across when I was live testing in Excel - there's apparently a race condition between the parser state and the disabling of the refresh button in response to the EvaluateCanExecute binding on the ReparseCommand. You could occasionally get it to execute while the parser was busy by mashing repeatedly on the refresh button in the CE. It's possible this is also an issue with other UI linked...
commands that check the parser state in their EvaluateCanExecute function.
 
7:18 AM
[rubberduck-vba/Rubberduck] build for commit 4383ecd0 on unknown branch: AppVeyor build succeeded
 
 
3 hours later…
11:30 AM
>


Version 2.3.1.4445
OS: Microsoft Windows NT 10.0.17763.0, x64
Host Product: Microsoft Office x64
Host Version: 16.0.11126.20266
Host Executable: WINWORD.EXE



**Description**
Dim my_fso As Scripting.FileSystemObject
Set my_fso = New Scripting.FileSystemObject
<code which uses my_fso for checking date modified of files>
Set my_fso = Nothing

The code inspection result is 'Assignment not used'
The code line highlighted is 'Set my_fso = Nothing'

I would not expect an a
 
 
1 hour later…
12:34 PM
I noted that the Declaration class has a member that returns IVBProject. Should it really be toting around a SCW?
 
 
2 hours later…
2:26 PM
@Duga CargoSetToNothingInspection?
@this probably not, but likely used in a bunch of legacy bits... or is it just dangling unused?
 
30 references. Including one to the newly added class for reference dialog.
I think that needs to be converted into TryGetVbProject function taking a QMN.
 
seems worth a shot
 
that's another pr, thought. the one i'm on is just bug fixes.
 
2:43 PM
The project is on the declarations primarily for the cases where we need the display name.
It is managed by the projects repository.
 
if display name is all it needs, why not cache the string?
I would prefer that classes like declarations or QMNs do not actually tote any SCWs but rather have a method to retrieve a SCW at the time it is needed.
 
We really do not want to query that unless we have to.
AFAIR, it messes with the focus.
Ideally, the declarations should not know that SCWs exist in the first place.
The problem is that it is non-trival to change all callers in a way that it works out.
 
Yeah I thought so.
 
30 call sites is fewer than I anticipated though
 
But what if we marked that as [Obsolete]
 
2:56 PM
seems sensible
 
to make sure others are not tempted into taking that shortcut?
I guess that also means providing the TryGetVbProject method, too so they have a choice to do the right thing.
Speaking of which, I think same should be done for the finder's.... what was it again?
AllUserDeclarations?
I can't remember which one I'm supposed to not use.
 
There really should be no direct possibility to get the project from a declaration.
AllUserDeclarations has legitimate use cases.
 
inspections use it a lot
 
I thought I remember being told that there was one version that should be phased out in favor for the other version.
 
They usually shouldn't.
 
2:59 PM
@this IIRC that was back when we were querying the parser state directly
 
Thereis AllUserDeclarations on the RubberduckParserState.
That should not be used.
 
I see. That might be a case for providing a xmldocs so that I can be reminded which one I actually want.
 
yeah that one - it's redirecting to the finder now
 
Ah, different class entirely.
Still, ought it be [Obsolete]'d?
 
I redirected it over a year ago.
 
3:01 PM
yeah
 
It really did not make any sense as it was before.
 
I suppose that might not matter if it's only a redirection.
It would make sense to add the [Obsolete] if we really don't want RPS to expose that in long term.
 
@this the redirect was just a "temp" thing - in a dream world all calls to RPS.AllUserDeclarations should be rewritten to query the declarations finder instead, so that the RPS obsolete method can be ultimately removed - yeah, it's [Obsolete]
 
It should really stop to expose that method in the long run.
 
Alright. I think I can at least mark those as [Obsolete] at least in my PR.
If I have to ask, others will end up making the mistake, too.
 
3:03 PM
The problem is that it advertises querying all declarations instead of using a more specialized method of the declaration finder.
 
yeah, those should be asking for the IDeclarationFinder in the ctor, not the RPS.
(assuming querying for declarations is all it does w/ the RPS)
 
So many inspections take all user declarations and then filter by declarations type.
The declaration finder has a dictionary by declaration type.
 
yeah that's.... suboptimal.
 
Not IDeclarationFinder, IDeclarationFinderProvider.
Btw, there is no IDeclarationFinder.
 
ok
 
3:40 PM
is there an access to the reference priority of a project for a given declaration?
 
you need to get the IReference for that
 
thought so just checking it didn't already exist somewhere else
 
We have that information in the IProjectReferencesProvider.
It gets collected as a side effect of loading the declarations for referenced libraries.
How the information is saved there is a bit inconvenient though.
It is a collection of dictionaries (referencing project, priority) for every referenced project.
 
hmm. it also does not appear that the finder has the provider injected.
 
No, it is only used in the parsing process.
 
3:54 PM
I think I will just use the TryGetVbProject on the declaration's QMN and go from there.
 
4:12 PM
my, what a rabbit hole I have fallen in!
 
4:25 PM
@M.Doerner I think I'm missing something. The provider uses a ReferencePriorityMap which is a Dictionary<string, int> where the string is the ProjectId while the int represents the priority... but it does not tell me what the reference is actually?
 
@Duga Is that really a bug?
 
@Comintern have to look but I think we don't count the Nothing assignment.
 
2 hours ago, by Mathieu Guindon
@Duga CargoSetToNothingInspection?
I agree with the OP though; the assignment to Nothing shouldn't trip that inspection
 
My knee jerk reaction was to close it as status-by-design.
 
4:49 PM
lol IKR
 
I seem to remember a report from long ago asking for that exact behavior.
 
hmm, doesn't ring any bells
 
Here either.
Does R# will flag variables as assigned to unused values if you set them to null?
 
IIRC, yes.
I think I was thinking of those 2 issues: #3052 and #2458
At least my memory wasn't making up random stuff as it usually does.
 
If it picks up a Foo Is Nothing test as a use, then I'd say it's the correct result.
 
4:55 PM
I think that's a different thing than simply jostling electrons just to allocate a variable and set it to Nothing and wander away.
 
Because it decrements the reference count?
That's a side effect in .NET too.
 
sure - but in that example, if you new it up, then just throw it away....
something ain't right.
 
then the unused assignment should be the = New Thing, not the = Nothing
but it is used though
Dim my_fso As Scripting.FileSystemObject
Set my_fso = New Scripting.FileSystemObject
<code which uses my_fso for checking date modified of files>
Set my_fso = Nothing
 
So that should really be 2 inspection results.
 
4:59 PM
The New Scripting.FileSystemObject assignment is never used and the Nothing assignment is never used.
 
it is used... in <code which uses my_fso for checking date modified of files>
 
Oh, I was referring to the OP's code. In your example it is used.
 
hmm, his example had me thinking he was just newing it and throwing it away.
 
and technically, "using" the Nothing assignment would be RTE91
 
Not necessarily, my_fso Is Nothing is a use.
 
5:01 PM
oooh, I see... it's the code block formatting on GH that's messed up
 
Granted, it's a degenerate "use".
 
I just verified on Excel - i do get not used assignment for new/nothing
and IMO, it's correct.
Set fso = Nothing without actually using fso is... weird.
 
I've have far to little caffeine to deal with poor formatting apparently.
 
I suppose there could be side-effect in the act of newing up but if that was, that's also a huge code smell.
 
5:05 PM
@this look at the issue again... that is not the case here
 
ssshhh let me make a fool out of myself, first, please.
 
No, you'd be making a fool of yourself second. I was first.
 
Too bad it's not April
 
the point is, an object is created, then used, and then set to nothing - the inspection is complaining that the "set to nothing" assignment isn't used, and IMO the OP is correct in that this inspection shoudn't be tripped. Using the Nothing assignment would be RTE91.
now whether the Nothing assignment is needed or not, is another question
 
Not in an equity test though - If foo Is Nothing "uses" the assignment.
 
5:07 PM
true
 
Um, I don't think setting it to Nothing results in RTE91.
 
@this foo.Bar afterward does.
 
no, but "using" that assigned value later on, does (unless it's an If...Is check)
 
nope
 
5:08 PM
Public Sub foo()
    Dim fso As New Scripting.FileSystemObject
    Set fso = Nothing

    Debug.Print fso.BuildPath("ab", "cd")
End Sub
prints ab\cd
 
oh ffs
only because of As New
 
correct. as OP reported
 
So replace the existing behavior with a UnnecessarilySetToNothingInspection?
 
Dim my_fso   As Scripting.FileSystemObject
Set my_fso = New Scripting.FileSystemObject
 
5:09 PM
gah
evidently I'm not done making fool out of myself.
 
in any case, the correct fix would be to remove the variable altogether and do With New Scripting.FileSystemObject
 
Going to step away before I end up with a big ugly toupee.
 
Setting something to Nothing in order to take advantage of a side effect of an auto-instantiated class is worthy of an inspection in and of itself.
 
worthy of 10KV too
 
5:11 PM
^
Which raises the second question, is using an assignment for a side effect a reason to suppress the inspection result?
If anything, it gives a round-about reason to examine to target code to see if you're doing that.
 
that shoudl be explicitly commented w/ IgnoreOnce
because in that case, it's just wrong, man.
 
IMO OP is correct, AssignmentNotUsed shouldn't issue a result when an unused assignment is Nothing - BUT we could conceivably have another inspection that flags these assignments as redundant, with a QF that removes it
 
I'm down with that.
 
would be nice if the inspection could figure out whether the object is local; if it is then another QF could be offered, to ditch the variable and replace its refs with a With block
 
5:28 PM
@MathieuGuindon I don't think that should be too hard. We already have a couple inspection that determine whether the object is passed in via a parameter.
 
5:49 PM
Should "Predeclared" be localized? I was kind of up in the air on that and landed on "no", but my certainty level < 100% on that one.
 
6:19 PM
0
Q: RubberDuck - Faking InputBox and MsgBox and Excel Crashing

user1114I'm using RubberDuck to test an Excel Workbook, and Excel crashes when running the RubberDuck test. A sheet in the workbook contains a Worksheet_Change event that prompts the user for a password when changing a particular cell. If the user enters the correct password, a MsgBox saying "Correct P...

 
@StackDuck @Comintern fakes setup at module level would be doing that, no?
 
> **Rubberduck version information**
The info below can be copy-paste-completed from the first lines of Rubberduck's Log or the About box:

Rubberduck version 2.3.0.4227 loading:
Operating System: Microsoft Windows NT 10.0.17763.0 x64
Host Product: Microsoft Office x64
Host Version: 16.0.11029.20108
Host Executable: EXCEL.EXE;


**Description**

I'm using RubberDuck to test an Excel Workbook, and Excel crashes when running the RubberDuck test.

A sheet in the workbook contains
 
@MathieuGuindon I think so. Let me check really quick.
 
Huh why did OP delete it
 
Good question. Maybe thought the issue report was the better venue?
 
6:34 PM
FWIW, the HRESULT seems to be E_FAIL
IOW: Excel's saying "I have no idea in hell what you're asking me to do..."
(at least I assume it's Excel's OM that's throwing but that easily could be VBE, too)
 
More interestingly, I followed the OP's repro steps and it passed.
 
Hmm, could it be related to the issue I opened a month or two ago about multiple Fakes not playing well together?
(though IIRC, that issue was for 2 fakes of same type. This is 2 fakes of different types but... ?)
 
I don't think so in this case. That issue was that both methods made a call on the same underlying entry point.
 
Ah, yes that's right.
 
6:39 PM
Hmm. Did you have error handling?
I'm wondering what happens specifically when it has no error handling and the exception runs up into the type lib API
 
In the providers?
 
in the test method
OP didn't have any - it might be that it's throwing
 
I just directly copied and pasted the OP's code.
 
I know - I'm assuming that the code failed for some other reasons beyond what was posted on the issue.
 
Oh, right. Let me see if I can throw in the test method somehow.
 
6:41 PM
just Err.Raise should do, I think
Wait a minute I just saw that OP re-formatted the log
 
Still no repro. I re-formatted the log.
 
> 2019-01-20 10:18:44.7753;WARN-2.3.0.4227;Rubberduck.Inspections.Rubberduck.Inspections.Inspector;System.NullReferenceException: Object reference not set to an instance of an object.
...
2019-01-20 10:18:46.3588;INFO-2.3.0.4227;Rubberduck.Parsing.VBA.RubberduckParserState;RubberduckParserState (9) is invoking StateChanged (Busy);
Is it possible that the inspections are still running?
I think normally we get message Inspections ran for {N} seconds when it has finished inspections, no?
 
Hmmm... that's possible. It does throw a thread cancellation exception in there.
The other possibility is that the project is not compilable.
Gah, I'm not fast enough to catch it in that state. Need a project with more code in it.
I can't even crash it by letting the debugger assert, editing the code, and resetting the project.
 
> Thanks for reporting; for the record the SO question was fine too =)

The `Fakes` API objects are meant to be very short-lived, i.e. the duration of a single test. Here they're alive from before the first test runs, until after the last test finished.

These are hooks into the VBA runtime, intercepting internal function calls: them being alive for longer than they're needed is definitely not helping.

Another thing is the very nature of the test itself: unit testing isolates functionalit
 
OK, I got an exception, but it "behaved itself":
2019-01-20 12:48:35.5587;TRACE-2.3.1.22570;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.TestExplorerCommand was registered with id 49256;
2019-01-20 12:48:35.6039;ERROR-2.3.1.22570;Rubberduck.UnitTesting.TestEngine;Unexpected COM exception while initializing tests for module VBAProject.TestModule2. The module will be skipped.;System.Runtime.InteropServices.COMException (0x800A9C68): Exception from HRESULT: 0x800A9C68
   at Rubberduck.VBEditor.ComManagement.TypeLibsSupport.IDispatchHelper.Invoke(IDispatch obj, Int32 memberId, InvokeKind invokeKind,
Note that I was able to catch that while the parser was running.
 
6:54 PM
wonders whether enabling vba coders to write automated tests was a good idea in the first place
 
I guess it depends on the definition of "coder".
 
"unit" test involving worksheet events getting fired, for example
 
Yeah, that's...odd.
@this I think you might be on to something. I get an unhandled exception on this line.
Although when I continue with the debugger attached, I get a log similar to the one above and no crash.
 
I think not reporting an assignment of Nothing in AssignmentNotUsed would only be consistsnet. In VariableNotUsed we also ignore assignments of Nothing.
Btw, there are legitimate uses of an assignment of Nothing, e.g. when breaking open a reference cycle.
 
7:09 PM
@this The ReferencePriorityMap has a member ReferencedProjectId.
Regarding the assignment of Nothing, I really think that is an enhamcement, not a bug.
 
7:39 PM
heya :)
 
8:01 PM
what's the plan on release tonight/today?
 
CE folders are currently borked, no?
 
Yes, CE is broken atm.
So, we cannot release before that is fixed and field tested.
 
yea that makes sense :(
 
I'm working on fleshing out the the unit tests now, but I should be done by tonight. Agreed that it needs more "live" testing though. AFAICT we've only had one real "victim" so far.
 
@M.Doerner but I dont know what the reference is? Only the priority and the project?
 
8:12 PM
I get the impression we both call different things a reference.
 
@Vogel612 my vote is wait a bit, too. And shoot me for not having at least ref explorer before merging CE.
 
I am talking about referenced external libraries.
 
I don't mind I was just dropping by to make sure to be able to lend a hand if necessary
 
In my case i need the reference name... E.g. The library name is "Excel"
but i only have project id and priority
 
If you need the name, you have to find the ProjectDeclaration for the projectId.
 
8:15 PM
i want to know which declarations come from which library and sort them by their containing library's priority
 
I was under the impression that the ReferencePriorityMap was primarily for projects, and not external references.
 
hmm. Wait i think i see my confusion. The project id in this case is the external library's projectid and not my vba project's projectid?
 
You can just use Declaration.GetProjectParent to get the containing project.
 
yes, but i was not seeing how to map the project declaration to the priority from the dictionary
but if the projectid is actually the external library's projectid, rather than vba project's then i would be able to use the projectid from the project declaration, right?
 
8:20 PM
Yes
However, please note that the priority depends on the referencing project.
That is why the ReferencePrioityMap is a dictionary.
 
Yes thats why i was confused. I thought it would be the referencing project's projectid
 
The dictionary is referencingProjectId -> priority.
 
but i forgot that ecen libraries get their own project declaration and thus projectid
 
Keep in mind that the ProjectId is set on all of the Declarations, so you can really just group by that.
 
Each map has a member ReferencedProjectId identifying the referenced project.
 
8:23 PM
good
i still need the priority though.
but i think i see where to go from there. Thanks, Max!
 
What exactly do you need it for?
 
Right, but I didn't want to see something like declarations.GroupBy(d => GetProjectParent(d).ProjectId);
 
resolving the evaluate member
 
 
3 hours later…
11:35 PM
> This PR closes #4719. This is a redesign of the ParameterCanBeByValInspection, which was implemented in a confusing way. Now, the parts for interfaces and events use the same base logic to determin whether a parameter of an individual member could be passed by value. This logic also has been redesigned heavily. Now, it really looks at the references to the parameter and evaluates whether these references correspond to assignments or ByRef parameters. This PR also fixes that the...
inspection ignored that in VBA an implemented interface can have an implementation of its own.
 
11:53 PM
[rubberduck-vba/Rubberduck] build for commit eee24d03 on unknown branch: AppVeyor build succeeded
 

« first day (1689 days earlier)      last day (1491 days later) »