« first day (1160 days earlier)      last day (2020 days later) » 

00:00
to be fair I think R# is the culprit here
and it's the first time I turn on that continous test session feature
@Mat'sMug It looks like I can't overload ExportAll.onExecute? Does that sound right?
The more I read about C# the more neato stuff becomes: docs.microsoft.com/en-us/dotnet/csharp/whats-new/…
00:16
@shadowofsilicon meaning?
I can't make an overload method for ExportAll.onExecute, each with different constructors, because onExecute is overriding protected inherited member CommandBase.onExecute
#TIL using static #MindBlown
20 hours ago, by Mat's Mug
ok, I love using static Rubberduck.Parsing.Grammar.VBAParser;
@Mat'sMug @Hosch250 Thanks again for getting me pointed to documentation.
The more I read the cooler stuff is starting to look.
@shadowofsilicon overload a method or a constructor? I'm not following.
00:22
@Mat'sMug Couldn't understand, let alone appreciate, your comment until now.
but an overload wouldn't be on the command's interface
Yeah, I don't think I'm explaining it right... either way, I answered my own question
@IvenBach it turns context is VBAParser.SubStmtContext into context is SubStmtContext :)
@Mat'sMug I'm understanding the magic.
TBH it should be illegal to use using static on non-static types
@Hosch250 ^^ thoughts?
oops, too late
> 2017 tests succeeded
Home Time.
00:50
@SlowLearner IIRC, I did some testing, and those looping results are skewed by inefficient performance of the For Loop on a Collection.
3
The code in the article is inefficient when unnecessarily accessing the x collection's Item property 999 times:
For i = 1 To 1000
  For j = 1 To 1000
    res = x.Item(i) Mod y.Item(j)
  Next j
Next i
i.e - This runs at least twice as fast:
Dim xval As Long
For i = 1 To 1000
  xval = x.Item(i)
  For j = 1 To 1000
    res = xval Mod y.Item(j)
  Next j
Next i
@Duga woot, fixed!
@Mat'sMug I had an issue the other day where the TestMethod wasn't picked up by Test Explorer, because '@TestMethod wasn't on the line immediately before the declaration.
i.e. - this isn't recognized as a test:
'@TestMethod
'Some comment
Public Sub TestMethod1() 'TODO Rename test
    On Error GoTo TestFail

    'Arrange:

    'Act:

    'Assert:
    Assert.Inconclusive

TestExit:
    Exit Sub
TestFail:
    Assert.Fail "Test raised an error: #" & Err.Number & " - " & Err.Description
End Sub
@ThunderFrame that's kind of by design. the annotation isn't within the procedure's scope, it's... pretty hard
and crap, I broke 4 tests fixing that one
01:06
@Mat'sMug It is in the procedure's scope according to the VBE.
the VBIDE API isn't acc... hmm wait a minute...
hmm, I need to get the IVBComponent into the listener somehow
@ThunderFrame That's interesting - thanks for the follow up. FYI @BrandonBarney
Also, was just looking at this comparison of Collections & Dictionaries (which links to Chip Pearson's code for converting between Collections Dictionaries and Arrays)
@Mat'sMug This confuses the VBE about where declarations end:
Dim yyy

#If False Then
  Sub foo1()
    Beep
  End Sub

#Else
  Dim xxx
#End If
@ThunderFrame you bloody evil duck!!
7
01:23
Hmm... I see that the CodeExplorer*ViewModels do not reference that actual objects they represent (i.e. there is no property for the IVBProject that a CodeExplorerProjectViewModel represents... is that by design?
very likely
we are doing everything we can to avoid accessing COM objects when it's avoidable
and writing this made me realize that by getting the IVBComponent into the listener I'd be accessing a COM object from a background thread.
not a good idea
For what I'm working on, that's kinda the point. I could save some duplication in the ExportAllCommand if CodeExplorerProjectView exposed the IVBProject to me, or if I could pick it from the collection IVBProjects
the VM has the project's declaration; from there you can get its qualified name - look at QualifiedModuleName
/// <summary>
/// Represents a VBComponent or a VBProject.
/// </summary>
public struct QualifiedModuleName
whaa? first time seeing that
the ProjectId is what you're looking for
01:35
hmm... what does that return?
then your command will have ctor-injected IVBE, which it will use to iterate the projects collection and find the IVBProject with the ID you've retrieved from the QMN
the ProjectId is just a string
thought so... Ok, I gotta figure out how to do that
just add an IVBE parameter to your constructor, Ninject does the rest
(no configuration is needed)
@Mat'sMug I have that already. Not sure of the C# way of iterating the collection
Never mind, Intellisense finally pulled its head out of its butt and delivered it to me
project = projectVM.Declaration.Project;
Oh, duh
01:44
I swear I've been looking for just that but this is the first time Intellisense has shown it to me...
Maybe it's time I get home from this trip and sleep in my own bed again.
Sorry for having been so... ...misleading
didn't remember Declaration exposed the IVBProject
No, no... I never say "thanks" enough... Thank You for all your help =)
It Builds!!! =) Now, lemme see if it blows up when it runs...
2
01:51
I'm still stuck though. I need to know how the VBE delimits procedure scopes, and make annotations honor that... without using the VBIDE API in the inspection
@Mat'sMug I think I know the rules
procedure scopes are determine by the presence of a blank line or a continued-line
Dim yyy 'End of declaration section




'@ModuleInitialize
Public Sub ModuleInitialize()
'this method runs once per module.
Set Assert = CreateObject("Rubberduck.AssertClass")

End Sub






' _


' _

'Last line of procedure

Public Sub ModuleCleanup()
'this method runs once per module.
End Sub
@ThunderFrame awesome =)
@Mat'sMug except for the compiler directive mess mentioned earlier
@ThunderFrame except I'm well beyond parsing at that point... the inspection shouldn't be doing that work
I need this to be in the annotation pass
rolls up sleeves
BTW I think we can get auto-indent-as-you-type to work rather easily, right now
3
I want that
@Mat'sMug right now, as in by EOD? :)
01:59
@Mat'sMug That would be the duck's quack!
that's something Carlos will see and go "wow"
@ThunderFrame watch me
2
@Mat'sMug need tolerance for unclosed blocks?
@Mat'sMug what triggers an indent? changing the selection so it's on a different logical line?
hmm the hook runs before the key hits the code pane, right?
@ThunderFrame [ENTER]
@Mat'sMug VBE behavior is on change of logical line. ENTER, arrow, mouse, module switch, change of window, etc.
Private Sub PhysicalCodeLine_Validate(ByVal content As String, ByVal index As Long)
02:03
IDK if we can track Drag & Drop edits? Maybe just hook the drag event?
hmm
that would be the fine-tuning I guess... we can go with ENTER at first, only when the current line doesn't look like it contains a member signature
imagines the war as user hits the indent button, and RD auto-corrects the indent...
2
that way the VBE gets to put in End Sub before we indent again
@ThunderFrame We might be closer to that that you think... you seen the late-breaking news?
@shadowofsilicon IKR - IDK why Special Ops can't get to him. leaves it up to reader to determine who I mean by "him"
02:10
Personally I don't know why we don't just drop a bomb... even if it as to be another MOAB, on his palace. We have to know where it is. He ain't sleeping anywhere else in that shithole country of his.
@shadowofsilicon because Kim is crazy enough to fire on Japan/S.Korea
also leaves it to the reader to determine who "his" is
After we kill him? Granted, it has to be done so he doesn't see it coming... But, I don't believe that his generals are crazy enough to follow though on orders in a last will and testiment
@Mat'sMug auto indent as you type, now that would be cool
@shadowofsilicon IDK - some of his generals have a lot to lose if Kim goes - embezzled millions, war-crimes etc.
and there were plenty of loyal Nazi's after Adolf was dead.
On the topic of indentation... I'll check the Feature Requests, but would be nice if white-space could be removed from blank lines.
02:18
@SlowLearner desperately tries to redirect the conversation lol
well, this is VBA Rubberducking
</mod-had>
lol... I was glued to the whole NK stuff... I guess DT can get catch Kim by surprise if Kim doesn't check his Twitter....
@Mat'sMug RD Kim crashes on exit
4
@ThunderFrame lmao
And probably the whole NK ICBM hype is code (decoy) for a super strain of ransom-ware...
02:40
Oh... just read news Re Guam.... erm - that's bad
whatever
I don't like talking politics. I've seen what happens on Twitter =)
@Mat'sMug IKR? I can't wait until Pence becomes President!!!
yeah, I saw that... lol
@shadowofsilicon what was it Baldwin's Trump said of Pence? "Pence is the reason you'll never impeach me"
02:53
I hate these damn tablet screen protectors... need a full-fledged G*damn clean room to prevent dust from getting trapped in there
@ThunderFrame it's just wishful thinking at best... they're not going to find enough to fully impeach and remove him; not with a republican congress. Even so, do they realize how his replacement is picked? Apparently not.
It's just a campaign ploy to prepare for 2018 but they're going to run out of steam before then and it'll prob explode in their face
 
2 hours later…
04:43
I'm not sure about this course and winning a prize. m.phys.org/news/2017-08-yeah-spreadsheet-title-thatd-great.html
05:18
Erm.... is it possible that RD would be preventing me from password protecting a VBA project? I tried to lock the project about 6 times (Tools > xyz Properties ...) and it simply would not work. Disabled RD from starting up and it works. Not sure if it is a co-incidence but will test further and raise issue if I gain confidence with my initial suspicions...
@Mat'sMug Auto-indent would probably need to disable itself while in debug mode, or RD would trigger project resets.
@SlowLearner Locking the project applies the password, but doesn't apply the protection until you next open the file. i.e. once a project has been unlocked, there's no way to lock it again without reopening the file
@ThunderFrame thanks but yep... I know that and I find the LockingMechanism to be a little hit and miss, sometimes it just won't lock and takes 2 or even 3 goes (fat fingers?), but never 6 goes. So after being caught out a few times I ALWAYS check.
anyway... will test around this issue a bit more, a bit later
06:01
> I just opened 27 workbooks, many of which had references to add-ins (and some of those had references to other addins). I closed all the workbooks, and abut 10 add-ins remained open. Closing the add-ins required multiple commands, in the right order, in the immediate window: `Workbooks("addin1.xlam").Close` etc.

This feature would ideally present a form and allow the user to choose all of the workbooks/add-ins that they'd like closed, and the form would be reference-aware, so that only thos
06:48
@Duga yup - and MS Word gets far less love than Excel, it's like the sinister twin
0
Q: Why don't an Application's Addins, Columns or Rows properties appear in Object Browser?

ThunderFrameHow come an Excel.Application reference shows the Addins2 property in Object Browser, but not the Addins property? Ditto Columns and Rows properties? Is that some host-specific TLB hack for the Object Browser, or are those members marked in some way? They're not hidden, they're not functions and...

 
4 hours later…
10:53
0
Q: Why don't an Application's Addins, Columns or Rows properties appear in the Locals Window?

ThunderFrameHow come an Excel.Application reference shows the Addins2 property in Locals Window, but not the Addins property? Ditto Columns and Rows properties? Is that some host-specific TLB hack for the Locals Window, or are those members marked in some way? They're not hidden, they're not functions and t...

Oops, OB != Locals
@ThunderFrame I need to read more of your stuff too: codereview.stackexchange.com/questions/156070/…
just saying :)
11:11
@NicuTofan: What you trying to accomplish?
11:28
@Jelly run unit tests
Hm.
I think I have an error like that in the past?
are you instantiating the application object in your project or the test project?
com objects cannot be marshalled across process boundries
you would need to instantiate the autocad application in the test project
I'm simply using RD and the error shows up in the log when running unit tests
and It strikes me as an odd error
oh.
as the object browser lists that method
I don't know much abt RD
11:32
and - maybe - by solving this erro, we can have tests running in other apps
I don't know the inner working of RD (ironic so i dwell here sometimes) so I don't think I can help. I thought you were debugging an addin for autocad.
And yet this is strange, right?
Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: 'Autodesk.AutoCAD.Interop.AcadApplication' does not contain a definition for 'RunMacro'
Let me check their docs
For example,

CreateObject("AutoCAD.Application.19") attempts to create a new instance of AutoCAD 2013 or AutoCAD 2014. The last used release of the product is what the new instance is based on.
CreateObject("AutoCAD.Application.19.1") attempts to create a new instance of AutoCAD 2014, even if another release that shares the same major version of the product is installed.
CreateObject("AutoCAD.Application.20") attempts to create a new instance of AutoCAD 2015.
Note: You must have the corresponding release installed that you are trying to create an instance of.
@NicuTofan
I have a single Autocad 2015 and I copied .interop.dll to the RD directory.
shouldn't you copy the tlb?
11:39
So there should only be one version of the application as there is no other .dll with same name
the tlb has the members
and why do you need to copy it?
you should add just reference in the vba (tools > references)
RD ships with a version from an older acad
yes, but RD is written in .net
this whole thing happens in .net
not in tha VBA side of things
if there are sides
:)
so the compiler is not able to resolve the member
and RD will try to use RunMacro to run individual tests
at runtime.
11:43
yes sir
so i think it's an issue of marshalling
this is a runtime exception
i know that
why do you need to copy the interops to rd directory
thats what i don't understand
because RD has a reference to the type library, the interop library needs to be there regardless of whether or not it's installed on a machine AutoCAD is installed on or not
ok
what if the application is not installed
@Mat'sMug: do you think this is a marshalling issue?
11:49
RD gets the host app instance through the VBIDE API, the type library is only needed so we have a better type than Object to work with
if CAD isn't installed, RD won't try to cast the host app instance to a CAD Application class
TBH the error makes no sense whatsoever
im not sure how you'd be to get far without an object instance.
@NicuTofan: is autocad installed in your machine?
the instance already exists, RD is running in-process
in process of the instance?
[retailcoder/Rubberduck] retailcoder pushed commit 5b3a9c02 to rd-next: fixed listener logic. doesn't support annotating the top-most member in the module [yet]. ref.#3144
of course, yes
11:54
see i think i had this error before
with sw
not with rd
everything is happening within the boundries of the same process @Mat'sMug
thats strange
now
        try
        {
            Application = (TApplication)Marshal.GetActiveObject(applicationName + ".Application");
        }
        catch (COMException)
        {
            Application = null; // unit tests don't need it anyway.
        }
what does your stacktrace say?
applicationName + ".Application"
isn't application name enough?
        protected HostApplicationBase(string applicationName)
        {
            _applicationName = applicationName;

            try
            {
                Application = (TApplication)Marshal.GetActiveObject(applicationName + ".Application");
            }
            catch (COMException)
            {
                Application = null; // unit tests don't need it anyway.
            }
        }
11:57
i think the ".Application" is what causing the problem
no
we want the Application class
if we're in Excel that's Excel.Application
Well, perhaps you're not specifying the version?
CreateObject("AutoCAD.Application.19")
who cares about the version if there's only one installed and running?
also we don't CreateObject
i know you are not creating objects
actually I think this is the ctor invoked
        protected HostApplicationBase(IVBE vbe, string applicationName)
        {
            _applicationName = applicationName;

            try
            {
                var appProperty = vbe.VBProjects
                    .Where(project => project.Protection == ProjectProtection.Unprotected)
                    .SelectMany(project => project.VBComponents)
                    .Where(component => component.Type == ComponentType.Document
                    && component.Properties.Count > 1)
11:59
i was copying pastingg
if the host app has document modules, all we do is a cast
if not, then we might have issues if there are multiple instances open
gotta run
hm
so it's finding the wrong appProperty
otherwise why would it not find the definition for runmacro
@NicuTofan: can't help sorry. This is RD territory.
12:20
Potentially stupid question about connecting to OLAP in C#. For the OLEDB connection string, can i just copy a connection string from the PivotTable conneciton properties in Excel? Or are the connection strings different?
For example, Excel string looks like: Provider=MSOLAP.5;Integrated Security=SSPI;Persist Security Info=True;User ID="";Initial Catalog=CatalogName;Data Source=BasePath\FilePath;Location=BasePath\FilePath;MDX Compatibility=1;Safety Options=2;MDX Missing Member Mode=Error
12:49
@BrandonBarney worth a shot =)
It seems to have worked. Now I just need to figure out how to get it into a DataSet
@Jelly pretty sure nothing is wrong with RD here, AutoCAD integration works but not with CAD2015 - looks like a COM/TLB issue to me.
ok
13:21
@Jelly yes, autocad 2015 is installed
13:43
@Mat'sMug So I just started a VB.NET program which is supposed to read an Excel file (well, two, actually) and compare them and add new records to a database we have. ;)
lucky you
make sure there's no EXCEL.EXE process lingering around after your code completes
Not so much - this is for the massive sheets I told Kaz about that we get monthly. Lmao
@Mat'sMug Actually, I'm using NPOI for it.
@ThunderFrame Tell me about the advantages of String.Join over concatentation?
fewer memory allocations
@puzzlepiece87 string.Join is not supposed to create excessive allocations, which concatenation does.
13:46
Ah, thanks.
When you write str1 + " " + str2 it does two-steps: var tempStr = str1 + " ", then var resultStr = tempStr + str2 (basically).
@ThunderFrame sheepishly fixes the rest of his sins, like use of Dir()
3
@EBrown not .net
@Mat'sMug Oh, VBA?
yeah. it's Strings.Join actually
13:47
@Mat'sMug Re using static on non-static types.
where Strings is the VBA.Strings standard module
Ah, in either case the principle is the same.
Non-static types can have static members, which are the only thing you can access.
VBAParser.FooContext isn't static, it's a nested type
13:48
@EBrown, @puzzlepiece87 Jeroen wrote a blog post on this. Long and short, it doesn't matter much because the C# compiler can handle it.
@Mat'sMug Is that an enum?
If so, it is, really.
it's a nested class
@Hosch250 I don't do a lot of string concat / joining anyway.
Well, that's probably the exception.
using static to shorthand nested types is practical, but strikes me as an abuse of the feature
13:50
If it is legal, go for it, but keep it clean.
It doesn't seem like a huge issue to me, because you don't need an instance of the parent type to access the nested type.
It isn't really static, but from the point of view of the parent, it kind of is.
And it would be confusing to add a new keyword for this feature.
agreed
Tilting at bugs that nobody can explain. And we can't test under the debugger for various reasons.
Oh hmmm... This is a little nasty considering we are releasing tomorrow, but we technically could test in stage if we deliberately put a debugger beak statement in there.
Not sure how that would work since the code is already compiled and all that on the server.
@Mat'sMug - hence Read quickly, sadly documentation is going away. :) — FreeMan 32 secs ago
note to self: read the thing to the end before commenting
2
Yeah, I made a list of C# 6/7 features so I remember them.
@Mat'sMug lulz

« first day (1160 days earlier)      last day (2020 days later) »