-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Line 183 in 0f23719
| if ($taskArgs.Length -eq 0) { |
Ever seen this message:
PropertyNotFoundException: C:\Users\dtm\Documents\PowerShell\Modules\PwshRun\1.3.2\pwshrun-bootstrap.ps1:183
Line |
183 | if ($taskArgs.Length -eq 0) {
| ~~~~~~~~~~~~~~~~~~~~~~
| The property 'Length' cannot be found on this object. Verify that the property exists.
So, I did some digging, and... while $taskArgs really does seem to be an IList<object>, powershell seems to be totally weird about it and (probably) wraps collections internally or something.
According to https://learn.microsoft.com/en-us/powershell/scripting/learn/deep-dives/everything-about-arrays?view=powershell-7.3#count, you can actually just use the .count property to get the length (tested on my machine). Note the lowercase. That's intentional.
Metadata
Metadata
Assignees
Labels
No labels