Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Fix public key token serialization issue #800

Merged
merged 4 commits into from
Oct 16, 2019

Conversation

Lxiamail
Copy link
Member

@Lxiamail Lxiamail commented Sep 7, 2019

#799, which is a breaking change introduced by PR #784


namespace Microsoft.Fx.Portability.Utils.JsonConverters
{
internal class JsonPublicKeyTokenConverter : JsonConverter<PublicKeyToken>
Copy link
Contributor

Choose a reason for hiding this comment

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

Where is this serialization used and what is it optimized for? Serializing as a string would be a much more efficient and easy to deal with encoding, but this looks like it would work.

Copy link
Member

Choose a reason for hiding this comment

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

It's probably used in returning a response or sending a request. Must not have any tests associated with it so my change wasn't caught.

Copy link
Member Author

Choose a reason for hiding this comment

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

@twsouthwick This PR fix the current problem if both client and server sides using the new binary contains PublicKeyToken struct, but if old version of client without knowledge of PublicKeyToken works with new Server, the serialization will still break. Looks like PR #784 broke backward compat serialization.

Copy link
Member

Choose a reason for hiding this comment

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

You should be able to have a converter that would work for both. Do a string serialization (maybe that's what @marklio was referring to) and it should then work for backwards compatibility

Copy link
Member

Choose a reason for hiding this comment

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

You can serialize with PublicKeyToken.ToString() and deserialize with PublicKeyToken.Parse(string). That should provide round tripping

Copy link
Member Author

Choose a reason for hiding this comment

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

Submitted a new commit. Verified working with backward compat.

twsouthwick
twsouthwick previously approved these changes Sep 9, 2019

namespace Microsoft.Fx.Portability.Utils.JsonConverters
{
internal class JsonPublicKeyTokenConverter : JsonConverter<PublicKeyToken>
Copy link
Member

Choose a reason for hiding this comment

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

It's probably used in returning a response or sending a request. Must not have any tests associated with it so my change wasn't caught.

@twsouthwick twsouthwick dismissed their stale review September 10, 2019 15:32

This should still ensure backwards compatibility

@Lxiamail
Copy link
Member Author

dotnet-appport-dev-CI failed 14 tests for known SDK issue of ilasm is missing.

@Lxiamail Lxiamail closed this Sep 18, 2019
@Lxiamail Lxiamail deleted the FixPublicKeyTokenSerialization branch September 18, 2019 20:48
@Lxiamail Lxiamail restored the FixPublicKeyTokenSerialization branch October 16, 2019 00:02
@Lxiamail Lxiamail reopened this Oct 16, 2019
@Lxiamail Lxiamail merged commit c2927cb into dev Oct 16, 2019
@Lxiamail Lxiamail deleted the FixPublicKeyTokenSerialization branch October 16, 2019 00:05
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants