I've been using this conversion to pass objects to PowerShell.Invoke() like this:
PowerShell.Invoke([System.Collections.ObjectModel.Collection[psobject]]$obj)
I'm puzzled by this conversion from [int32] to [string].
Steps to reproduce
([System.Collections.ObjectModel.Collection[psobject]]1)[0].GetType().Name
Expected behavior
I expected 1 to remain an [int32].
Actual behavior
1 is converted to a [string]
Environment data
> $PSVersionTable
Name Value
---- -----
PSVersion 6.1.0-preview.688
PSEdition Core
GitCommitId v6.1.0-preview.688
OS Microsoft Windows 6.3.9600
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
I've been using this conversion to pass objects to
PowerShell.Invoke()like this:I'm puzzled by this conversion from
[int32]to[string].Steps to reproduce
Expected behavior
I expected
1to remain an[int32].Actual behavior
1is converted to a[string]Environment data