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
The $using: scope for remoting quietly accepts scope modifiers, but resolves to $null #9204
Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-FixedThe issue is fixed.WG-RemotingPSRP issues with any transport layer
# Define a variable and function, both named 'foo'.functionfoo { 'func' }; $global:foo='var'# Try to access these definitions remotely via $usingInvoke-Command-ComputerName . { $using:foo; $using:global:foo; $using:function:foo }
Expected behavior
var
var
'func'
Actual behavior
var
That is, $using:global:foo and $using:function:foo quietly evaluated to $null.
Environment data
PowerShell Core 6.2.0-rc.1
Windows PowerShell v5.1
Mmm. : isn't usually a valid variable character. Actually setting that variable in any reasonable way would be literally impossible, as it'd resolve to the proper expected item instead of the variable name containing the bunk character..
See PowerShell/EditorSyntax#49 (comment), while the first : separates the drive or scope from the variable name, all other : are accepted as variable name (as long as they are not doubled, because then that's a static accessor).
Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-FixedThe issue is fixed.WG-RemotingPSRP issues with any transport layer
Activity
msftrncs commentedon Apr 17, 2019
In the example:
appears like this via PR # 156 in PowerShell/EditorSyntax:

The scope can only be the first thing before the
:, and after that,:is a valid variable character. In this case,usingis the scope.mklement0 commentedon Apr 17, 2019
Thanks, Carl Morris (@msftrncs), but
:chars. aren't directly usable in variable names proper:While you can use them if you always use namespace variable notation, that is obviously impractical:
A much more sensible behavior would therefore be to support scope modifiers / drive references even after
$using:, as attempted in the OP.While technically a breaking change, it strikes me as a clear-cut case of a bucket 3 change.
vexx32 commentedon Apr 17, 2019
Mmm.
:isn't usually a valid variable character. Actually setting that variable in any reasonable way would be literally impossible, as it'd resolve to the proper expected item instead of the variable name containing the bunk character..Still a bug, in my opinion.
msftrncs commentedon Apr 18, 2019
See PowerShell/EditorSyntax#49 (comment), while the first
:separates the drive or scope from the variable name, all other:are accepted as variable name (as long as they are not doubled, because then that's a static accessor).Fixes PowerShell#9204. Fixes PowerShell#16019.