diff --git a/Directory.Packages.props b/Directory.Packages.props index a2977225e..8052aecea 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -4,7 +4,7 @@ true true - 0.13.2 + 0.13.5 3.11.0 4.4.0 @@ -36,7 +36,7 @@ - + diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 86283b94f..199d8a013 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -1,6 +1,8 @@ enable + True + $(MSBuildThisFileDirectory)..\opensource.snk diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets index 300bf924e..9af35cb00 100644 --- a/src/Directory.Build.targets +++ b/src/Directory.Build.targets @@ -1,9 +1,4 @@ - - - True - $(MSBuildThisFileDirectory)..\opensource.snk - diff --git a/src/MessagePack.GeneratorCore/MessagePack.GeneratorCore.csproj b/src/MessagePack.GeneratorCore/MessagePack.GeneratorCore.csproj index 1bb027709..2714c70f3 100644 --- a/src/MessagePack.GeneratorCore/MessagePack.GeneratorCore.csproj +++ b/src/MessagePack.GeneratorCore/MessagePack.GeneratorCore.csproj @@ -3,6 +3,7 @@ netstandard2.0 MessagePackCompiler + false diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/PrimitiveObjectFormatter.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/PrimitiveObjectFormatter.cs index 8b4859a50..829cb0d12 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/PrimitiveObjectFormatter.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/PrimitiveObjectFormatter.cs @@ -259,8 +259,8 @@ public void Serialize(ref MessagePackWriter writer, object? value, MessagePackSe } case MessagePackType.String: - var stringFormatter = options.Resolver.GetFormatterWithVerify(); - return stringFormatter.Deserialize(ref reader, options); + IMessagePackFormatter? stringFormatter = options.Resolver.GetFormatter(); + 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(); diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MonoProtection.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MonoProtection.cs index 42bf1f834..bbdf0b334 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MonoProtection.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MonoProtection.cs @@ -14,7 +14,7 @@ internal struct MonoProtection /// /// Gets a value indicating whether the mono runtime is executing this code. /// - internal static bool IsRunningOnMono => Type.GetType("Mono.Runtime") != null; + internal static bool IsRunningOnMono => Type.GetType("Mono.RuntimeStructs") != null; /// /// A lock that we enter on mono when generating dynamic types. diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Utilities.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Utilities.cs index 2ecfcfd4d..18e8839ad 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Utilities.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Utilities.cs @@ -19,7 +19,7 @@ internal static class Utilities #if UNITY_2018_3_OR_NEWER internal const bool IsMono = true; // hard code since we haven't tested whether mono is detected on all unity platforms. #else - internal static readonly bool IsMono = Type.GetType("Mono.Runtime") is Type; + internal static readonly bool IsMono = Type.GetType("Mono.RuntimeStructs") is Type; #endif internal delegate void GetWriterBytesAction(ref MessagePackWriter writer, TArg argument); diff --git a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/PrimitiveObjectFormatterTests.cs b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/PrimitiveObjectFormatterTests.cs index 0df33c75b..83761ba63 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/PrimitiveObjectFormatterTests.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/PrimitiveObjectFormatterTests.cs @@ -30,6 +30,13 @@ public void CompressibleIntegersRetainTypeInfo(T value) Assert.Equal(value, result); } + [Fact] + public void StringType() + { + byte[] msgpack = MessagePackSerializer.Serialize("message", PrimitiveObjectResolver.Options); + string result = (string)MessagePackSerializer.Deserialize(msgpack, PrimitiveObjectResolver.Options); + } + [Fact] public void IL2CPPHint() { diff --git a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/TestUtilities.cs b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/TestUtilities.cs index abc85b0fb..625dc3946 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/TestUtilities.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/TestUtilities.cs @@ -14,7 +14,7 @@ internal static class TestUtilities /// /// Gets a value indicating whether the mono runtime is executing this code. /// - internal static bool IsRunningOnMono => Type.GetType("Mono.Runtime") != null; + internal static bool IsRunningOnMono => Type.GetType("Mono.RuntimeStructs") != null; internal static string ToHex(byte[] buffer) => BitConverter.ToString(buffer).Replace("-", string.Empty).ToLowerInvariant(); }