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 latest daily throws Cannot create boxed ByRef-like values when accessing $OutputEncoding #7301
>$PSVersionTable
Name Value
---------
PSVersion 6.1.0-preview.10545
PSEdition Core
GitCommitId 6.1.0-preview.10545
OS Darwin 17.6.0 Darwin Kernel Version 17.6.0: Tue May 815:22:16 PDT 2018; root:xnu-4570.61.1~1/RELEASE_X86_64
Platform Unix
PSCompatibleVersions {1.0,2.0,3.0,4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
This also happens on Windows (6.1.0-preview.744 and 6.1.0-preview.746 so it must have been introduced at least 2 days ago) and it seems the error formatting is slightly off as well:
>$OutputEncodingformat-default : Cannot create boxed ByRef-like values.
+ CategoryInfo : NotSpecified: (:) [format-default], InvalidProgramException
+ FullyQualifiedErrorId : System.InvalidProgramException,Microsoft.PowerShell.Commands.FormatDefaultCommand
>$PSVersionTable
Name Value
---------
PSVersion 6.1.0-preview.744
PSEdition Core
GitCommitId v6.1.0-preview.744
OS Microsoft Windows 10.0.17134
Platform Win32NT
PSCompatibleVersions {1.0,2.0,3.0,4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
This issue was surfaced by the changes to Mshexpression.cs in the PR #6898 -- getting property values via binder instead of DotNetAdapter.
The root cause is the new property Preamble added to Encoding type in 2.1.0 -- the property type is System.ReadOnlySpan[byte], a ByRef-Like type. The ByRef-Like value type was newly introduced in 2.1.0, and obviously our binder doesn't handle it properly (this value type is supposed to be used only on the stack, and thus cannot be boxed). You can trigger the same failure even with 6.1.0-preview.3, by running $OutputEncoding.Preamble.
It's a more fundamental issue that we have to fix in our compiler/binder code.
Reacted by Michael Klement and Christoph Bergmeister
Activity
bergmeister commentedon Jul 17, 2018
This also happens on Windows (
6.1.0-preview.744and6.1.0-preview.746so it must have been introduced at least 2 days ago) and it seems the error formatting is slightly off as well:daxian-dbw commentedon Jul 18, 2018
This issue was surfaced by the changes to
Mshexpression.csin the PR #6898 -- getting property values via binder instead ofDotNetAdapter.The root cause is the new property
Preambleadded toEncodingtype in 2.1.0 -- the property type isSystem.ReadOnlySpan[byte], aByRef-Liketype. TheByRef-Likevalue type was newly introduced in 2.1.0, and obviously our binder doesn't handle it properly (this value type is supposed to be used only on the stack, and thus cannot be boxed). You can trigger the same failure even with6.1.0-preview.3, by running$OutputEncoding.Preamble.It's a more fundamental issue that we have to fix in our compiler/binder code.