FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix PrimitiveObjectResolver's ability to read strings by AArnott · Pull Request #1575 · MessagePack-CSharp/MessagePack-CSharp · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .cs  (2) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,8 @@ public void Serialize(ref MessagePackWriter writer, object? value, MessagePackSe
}

case MessagePackType.String:
var stringFormatter = options.Resolver.GetFormatterWithVerify<string?>();
return stringFormatter.Deserialize(ref reader, options);
IMessagePackFormatter<string?>? stringFormatter = options.Resolver.GetFormatter<string?>();
return stringFormatter is not null ? stringFormatter.Deserialize(ref reader, options) : reader.ReadString();
case MessagePackType.Binary:
// We must copy the sequence returned by ReadBytes since the reader's sequence is only valid during deserialization.
return reader.ReadBytes()?.ToArray();
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ public void CompressibleIntegersRetainTypeInfo<T>(T value)
Assert.Equal(value, result);
}

[Fact]
public void StringType()
{
byte[] msgpack = MessagePackSerializer.Serialize<object>("message", PrimitiveObjectResolver.Options);
string result = (string)MessagePackSerializer.Deserialize<object>(msgpack, PrimitiveObjectResolver.Options);
}

[Fact]
public void IL2CPPHint()
{
Expand Down

Back | FazBrowse Home | New Git URL