Skip to content

Remove SemanticVersion from list of KnownTypes for serialization - #7016

Merged
Dongbo Wang (daxian-dbw) merged 1 commit into
PowerShell:masterfrom
SteveL-MSFT:serialization
Jun 8, 2018
Merged

Remove SemanticVersion from list of KnownTypes for serialization#7016
Dongbo Wang (daxian-dbw) merged 1 commit into
PowerShell:masterfrom
SteveL-MSFT:serialization

Conversation

@SteveL-MSFT

@SteveL-MSFT Steve Lee (SteveL-MSFT) commented Jun 7, 2018

Copy link
Copy Markdown
Member

PR Summary

PowerShell serialization has a list of known PowerShell types. When an object is deserialized containing a known type it tries to deserialize the object to that specific type and throws exception if it can't succeed. SemanticVersion only exists in PSCore6 so when remoting from Windows PowerShell or importing clixml generated from PSCore6 that contains SemanticVersion, it fails.

Fix #6448
Fix #1819

PR Checklist

@iSazonov

Copy link
Copy Markdown
Collaborator

It seems to be not in line with the PowerShell Committee's conclusion in #6448.

@SteveL-MSFT Steve Lee (SteveL-MSFT) added the Review - Committee The PR/Issue needs a review from the PowerShell Committee label Jun 7, 2018
@SteveL-MSFT

Copy link
Copy Markdown
Member Author

Ilya (@iSazonov) you are correct, that committee decision was based on an incorrect hypothesis.

@daxian-dbw Dongbo Wang (daxian-dbw) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. This is probably the cleanest way to deal with this issue 🎉

@daxian-dbw

Dongbo Wang (daxian-dbw) commented Jun 7, 2018

Copy link
Copy Markdown
Member

One drawback: when PowerShell Core talks to PowerShell Core, the client side won't have a full-fledged SemanticVersion object deserialized back. So potentially this is a breaking change.

Strike my previous comment. It will be deserailzied to a PSObject with all properties from the SemanticVersion object populated. Problem solved, perfectly!

@HemantMahawar

Copy link
Copy Markdown
Contributor

Given it will come back as Deseriealized.System.Management.Automation.SemanticVersion (PSObject) in both Windows PowerShell and PowerShell Core, feels like the right fix.

@SteveL-MSFT Steve Lee (SteveL-MSFT) added Committee-Reviewed PS-Committee has reviewed this and made a decision and removed Review - Committee The PR/Issue needs a review from the PowerShell Committee labels Jun 7, 2018
@SteveL-MSFT

Copy link
Copy Markdown
Member Author

@PowerShell/powershell-committee reviewed this and agree this is approach

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that this is the right change.

@daxian-dbw
Dongbo Wang (daxian-dbw) merged commit 50d0611 into PowerShell:master Jun 8, 2018
@SteveL-MSFT
Steve Lee (SteveL-MSFT) deleted the serialization branch June 8, 2018 22:02
Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj/PowerShell that referenced this pull request Aug 6, 2026
… to enable interop between WinPS and PSCore (PowerShell#7016)

PowerShell serialization has a list of known PowerShell types. When an object is deserialized containing a known type it tries to deserialize the object to that specific type and throws an exception if it can't succeed. SemanticVersion only exists in PSCore6 so when remoting from Windows PowerShell or importing clixml generated from PSCore6 that contains SemanticVersion, it fails.

With this fix, it will be rehydrated as a "PSObject" with "Deseriealized.System.Management.Automation.SemanticVersion" in the 'TypeNames' in both Windows PowerShell and PowerShell Core.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Committee-Reviewed PS-Committee has reviewed this and made a decision

Projects

None yet

5 participants