Different results between using [ref] and [System.Management.Automation.PSReference] - by jrjespersen

Status : 


Sign in
to vote
ID 776044 Comments
Status Active Workarounds
Type Bug Repros 1
Opened 1/8/2013 7:13:00 AM
Access Restriction Public


Running this code on PowerShell 3.0 produces different results for $x and $y:

$x = $false
$y = $false
[Boolean]::TryParse("true", [System.Management.Automation.PSReference] $x)
[Boolean]::TryParse("true", [ref] $y)

I would expect both values to be true, as is the case on PowerShell 1.0 and 2.0.
Sign in to post a comment.
Posted by Joel 'Jaykul' Bennett on 1/9/2013 at 12:53 PM
Yep. Bottom line: this is a regression from v2
Posted by jrjespersen on 1/8/2013 at 7:48 AM
An more straight-forward example to illustrate this is:


$x2 = $true


This clearly shows that $xref1 is not a reference to $x (and only in PowerShell 3.0).