You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Get-PSCallStack's Arguments script property contains no useful information #11208
The .Arguments property on the System.Management.Automation.CallStackFrame instances output by Get-PSCallStack is a script property that - I presume - is meant to reflect the arguments passed.
The property isn't documented, but it seems to contain no useful information, seemingly containing $null in any non-global scope.
While you con obtain argument information via the type-native .InvocationInfo property, I assume there is a purpose to .Arguments that it currently doesn't fulfill.
Steps to reproduce
& { (Get-PSCallStack)[0].Arguments } 'foo'| Should -match'foo'
Expected behavior
The test should pass.
Actual behavior
The test fails, because .Arguments is $null:
Expected regular expression 'foo' to match $null, but it did not match.
Activity
SeeminglyScience commentedon Nov 28, 2019
Looks like that script property got hit by the script that was replacing
""withstring.Empty.The line was (and is in Windows PowerShell):
But is now
Which is a syntax error.
You can see it with
(Get-PSCallStack)[0].psobject.Properties['Arguments'].GetterScriptiSazonov commentedon Nov 28, 2019
Michael Klement (@mklement0) Thanks! I pulled PR with fix.