Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/aspnet/MessagePack-CSharp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@live.com>2022-05-12 15:36:57 +0300
committerAndrew Arnott <andrewarnott@live.com>2022-05-12 15:36:57 +0300
commita70e0192168c84b517aa2c72520d0f3374bf419e (patch)
tree09710d505214b6e77495284570a71b8385b7a5ff
parent11bdfed53cb331e8ff948d28dab5181d1f9b24b3 (diff)
parent8da2ab05f9cc1b1c2c3dd5e32a57ec57ecb4dbd8 (diff)
Resolve merge conflicts with develop
-rw-r--r--Directory.Build.props8
-rw-r--r--README.md46
-rw-r--r--azure-pipelines.yml10
-rw-r--r--azure-pipelines/build_nonWindows.yml8
-rw-r--r--global.json2
-rw-r--r--sandbox/DynamicCodeDumper/DynamicCodeDumper.csproj3
-rw-r--r--sandbox/Sandbox/Generated.cs468
-rw-r--r--sandbox/Sandbox/codegen.ps12
-rw-r--r--sandbox/TestData2/A.cs15
-rw-r--r--sandbox/TestData2/B.cs17
-rw-r--r--sandbox/TestData2/C.cs16
-rw-r--r--sandbox/TestData2/Generated.cs99
-rw-r--r--sandbox/TestData2/TestData2.csproj6
-rw-r--r--sandbox/TestData2/codegen.ps12
-rw-r--r--src/MessagePack.Generator/MessagePack.Generator.csproj8
-rw-r--r--src/MessagePack.GeneratorCore/CodeAnalysis/Definitions.cs14
-rw-r--r--src/MessagePack.GeneratorCore/CodeAnalysis/TypeCollector.cs7
-rw-r--r--src/MessagePack.GeneratorCore/CodeGenerator.cs72
-rw-r--r--src/MessagePack.GeneratorCore/Generator/EnumTemplate.cs21
-rw-r--r--src/MessagePack.GeneratorCore/Generator/EnumTemplate.tt11
-rw-r--r--src/MessagePack.GeneratorCore/Generator/FormatterTemplate.cs8
-rw-r--r--src/MessagePack.GeneratorCore/Generator/FormatterTemplate.tt9
-rw-r--r--src/MessagePack.GeneratorCore/Generator/ResolverTemplate.cs10
-rw-r--r--src/MessagePack.GeneratorCore/Generator/ResolverTemplate.tt14
-rw-r--r--src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterTemplate.cs21
-rw-r--r--src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterTemplate.tt19
-rw-r--r--src/MessagePack.GeneratorCore/Generator/UnionTemplate.cs34
-rw-r--r--src/MessagePack.GeneratorCore/Generator/UnionTemplate.tt25
-rw-r--r--src/MessagePack.GeneratorCore/MessagePack.GeneratorCore.csproj5
-rw-r--r--src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/StringInterningFormatter.cs61
-rw-r--r--src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePack.asmdef3
-rw-r--r--src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSecurity.cs4
-rw-r--r--src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.cs16
-rw-r--r--src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs2
-rw-r--r--src/MessagePack.UnityClient/Assets/Scripts/MessagePack/package.json2
-rw-r--r--src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/StringInterningTests.cs107
-rw-r--r--src/MessagePack.UnityClient/Assets/Scripts/Tests/Shims/XUnit.cs5
-rw-r--r--src/MessagePack.UnityClient/copy_assets.bat1
-rwxr-xr-xsrc/MessagePack.UnityClient/copy_assets.sh1
-rw-r--r--src/MessagePack/MessagePack.csproj17
-rw-r--r--src/MessagePack/net5.0/PublicAPI.Shipped.txt28
-rw-r--r--src/MessagePack/net5.0/PublicAPI.Unshipped.txt34
-rw-r--r--src/MessagePack/net6.0/PublicAPI.Shipped.txt (renamed from src/MessagePack/netcoreapp2.1/PublicAPI.Shipped.txt)32
-rw-r--r--src/MessagePack/net6.0/PublicAPI.Unshipped.txt6
-rw-r--r--src/MessagePack/netcoreapp2.1/PublicAPI.Unshipped.txt22
-rw-r--r--src/MessagePack/netcoreapp3.1/PublicAPI.Shipped.txt24
-rw-r--r--src/MessagePack/netcoreapp3.1/PublicAPI.Unshipped.txt28
-rw-r--r--src/MessagePack/netstandard2.0/PublicAPI.Shipped.txt24
-rw-r--r--src/MessagePack/netstandard2.0/PublicAPI.Unshipped.txt28
-rw-r--r--src/MessagePackAnalyzer/MessagePackAnalyzer.csproj1
-rw-r--r--tests/MessagePack.Tests/MessagePack.Tests.csproj4
-rwxr-xr-xtools/Install-DotNetSdk.ps125
-rw-r--r--version.json2
53 files changed, 888 insertions, 569 deletions
diff --git a/Directory.Build.props b/Directory.Build.props
index 99d92e03..fc7c5f0f 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -28,10 +28,10 @@
<AdditionalFiles Include="$(MSBuildThisFileDirectory)stylecop.json" Visible="false" />
</ItemGroup>
<ItemGroup>
- <PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
- <PackageReference Include="Nerdbank.GitVersioning" Version="3.2.7-beta" PrivateAssets="all" />
- <PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="16.5.124-alpha" PrivateAssets="All" />
- <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
+ <PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.2" PrivateAssets="All" />
+ <PackageReference Include="Nerdbank.GitVersioning" Version="3.4.244" PrivateAssets="all" />
+ <PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.0.64" PrivateAssets="All" />
+ <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.261" PrivateAssets="all" />
</ItemGroup>
diff --git a/README.md b/README.md
index e5730bae..b6427567 100644
--- a/README.md
+++ b/README.md
@@ -34,6 +34,7 @@ MessagePack has a compact binary size and a full set of general purpose expressi
- [Security](#security)
- [Performance](#performance)
- [Deserialization Performance for different options](#deserialization-performance-for-different-options)
+ - [String interning](#string-interning)
- [LZ4 Compression](#lz4-compression)
- [Attributions](#attributions)
- [Comparison with protobuf, JSON, ZeroFormatter](#comparison-with-protobuf-json-zeroformatter)
@@ -699,7 +700,7 @@ Benchmarks comparing MessagePack For C# to other serializers were run on `Window
* Avoid string key decoding for lookup maps (string key and use automata based name lookup with inlined IL code generation, see: [AutomataDictionary](https://github.com/neuecc/MessagePack-CSharp/blob/bcedbce3fd98cb294210d6b4a22bdc4c75ccd916/src/MessagePack/Internal/AutomataDictionary.cs)
* To encode string keys, use pre-generated member name bytes and fixed sized byte array copies in IL, see: [UnsafeMemory.cs](https://github.com/neuecc/MessagePack-CSharp/blob/f17ddc5d107d3a2f66f60398b214ef87919ff892/src/MessagePack/Internal/UnsafeMemory.cs)
-Before creating this library, I implemented a fast fast serializer with [ZeroFormatter#Performance](https://github.com/neuecc/ZeroFormatter#performance). This is a further evolved implementation. MessagePack for C# is always fast and optimized for all types (primitive, small struct, large object, any collections).
+Before creating this library, I implemented a fast serializer with [ZeroFormatter#Performance](https://github.com/neuecc/ZeroFormatter#performance). This is a further evolved implementation. MessagePack for C# is always fast and optimized for all types (primitive, small struct, large object, any collections).
### <a name="deserialize-performance"></a>Deserialization Performance for different options
@@ -758,6 +759,49 @@ Extra note, this is serialization benchmark result.
Of course, `IntKey` is fastest but `StringKey` also performs reasonably well.
+### <a name="string-interning"></a>String interning
+
+The msgpack format does not provide for reusing strings in the data stream.
+This naturally leads the deserializer to create a new `string` object for every string encountered,
+even if it is equal to another string previously encountered.
+
+When deserializing data that may contain the same strings repeatedly it can be worthwhile
+to have the deserializer take a little extra time to check whether it has seen a given string before
+and reuse it if it has.
+
+To enable string interning on *all* string values, use a resolver that specifies `StringInterningFormatter`
+before any of the standard ones, like this:
+
+```cs
+var options = MessagePackSerializerOptions.Standard.WithResolver(
+ CompositeResolver.Create(
+ new IMessagePackFormatter[] { new StringInterningFormatter() },
+ new IFormatterResolver[] { StandardResolver.Instance }));
+
+MessagePackSerializer.Deserialize<ClassOfStrings>(data, options);
+```
+
+If you know which fields of a particular type are likely to contain duplicate strings,
+you can apply the string interning formatter to just those fields so the deserializer only pays
+for the interned string check where it matters most.
+Note that this technique requires a `[MessagePackObject]` or `[DataContract]` class.
+
+```cs
+[MessagePackObject]
+public class ClassOfStrings
+{
+ [Key(0)]
+ [MessagePackFormatter(typeof(StringInterningFormatter))]
+ public string InternedString { get; set; }
+
+ [Key(1)]
+ public string OrdinaryString { get; set; }
+}
+```
+
+If you are writing your own formatter for some type that contains strings,
+you can call on the `StringInterningFormatter` directly from your formatter as well for the strings.
+
## LZ4 Compression
MessagePack is a fast and *compact* format but it is not compression. [LZ4](https://github.com/lz4/lz4) is an extremely fast compression algorithm, and using it MessagePack for C# can achieve extremely fast performance as well as extremely compact binary sizes!
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index 2c179114..d18997c3 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -19,7 +19,7 @@ stages:
jobs:
- job: Windows
pool:
- vmImage: windows-2019
+ vmImage: windows-2022
steps:
- checkout: self
clean: true
@@ -44,7 +44,7 @@ stages:
- job: Linux
pool:
- vmImage: Ubuntu 18.04
+ vmImage: ubuntu-20.04
steps:
- checkout: self
clean: true
@@ -53,7 +53,7 @@ stages:
- job: macOS
pool:
- vmImage: macOS-10.15
+ vmImage: macOS-11
steps:
- checkout: self
clean: true
@@ -64,7 +64,7 @@ stages:
# It also helps exercise mpc so bugs don't go unnoticed.
- job: codegen_diff
pool:
- vmImage: ubuntu-latest
+ vmImage: ubuntu-20.04
steps:
- checkout: self
clean: true
@@ -84,7 +84,7 @@ stages:
jobs:
- job: push
pool:
- vmImage: ubuntu-latest
+ vmImage: ubuntu-20.04
steps:
- download: current
artifact: nuget
diff --git a/azure-pipelines/build_nonWindows.yml b/azure-pipelines/build_nonWindows.yml
index 6b5ac10a..9a57e2f9 100644
--- a/azure-pipelines/build_nonWindows.yml
+++ b/azure-pipelines/build_nonWindows.yml
@@ -21,6 +21,14 @@ steps:
arguments: --no-build -c $(BuildConfiguration) -f net5.0 -v n --settings "$(Build.Repository.LocalPath)/azure-pipelines/$(Agent.OS).runsettings"
testRunTitle: net5.0-$(Agent.JobName)
+- task: DotNetCoreCLI@2
+ displayName: Run MessagePack.Tests (net6.0)
+ inputs:
+ command: test
+ projects: tests/MessagePack.Tests/MessagePack.Tests.csproj
+ arguments: --no-build -c $(BuildConfiguration) -f net6.0 -v n --settings "$(Build.Repository.LocalPath)/azure-pipelines/$(Agent.OS).runsettings"
+ testRunTitle: net6.0-$(Agent.JobName)
+
- bash: mono ~/.nuget/packages/xunit.runner.console/2.4.1/tools/net472/xunit.console.exe bin/MessagePack.Tests/$(BuildConfiguration)/net472/MessagePack.Tests.dll -html $(BUILD.ARTIFACTSTAGINGDIRECTORY)/build_logs/mono_testrun.html
displayName: Run MessagePack.Tests (mono)
diff --git a/global.json b/global.json
index 3057bb45..2645bb53 100644
--- a/global.json
+++ b/global.json
@@ -1,6 +1,6 @@
{
"sdk": {
- "version": "5.0.401",
+ "version": "6.0.102",
"rollForward": "patch",
"allowPrerelease": false
}
diff --git a/sandbox/DynamicCodeDumper/DynamicCodeDumper.csproj b/sandbox/DynamicCodeDumper/DynamicCodeDumper.csproj
index f7f443f0..633265af 100644
--- a/sandbox/DynamicCodeDumper/DynamicCodeDumper.csproj
+++ b/sandbox/DynamicCodeDumper/DynamicCodeDumper.csproj
@@ -144,7 +144,6 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Nerdbank.Streams" Version="2.4.48" />
- <PackageReference Include="System.Memory" Version="4.5.3" />
- <PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.5.2" />
+ <PackageReference Include="Microsoft.NET.StringTools" Version="1.0.0" />
</ItemGroup>
</Project>
diff --git a/sandbox/Sandbox/Generated.cs b/sandbox/Sandbox/Generated.cs
index 64f68f84..9b5c623c 100644
--- a/sandbox/Sandbox/Generated.cs
+++ b/sandbox/Sandbox/Generated.cs
@@ -7,14 +7,11 @@
#pragma warning disable 414
#pragma warning disable 168
-#pragma warning disable SA1200 // Using directives should be placed correctly
#pragma warning disable SA1312 // Variable names should begin with lower-case letter
#pragma warning disable SA1649 // File name should match first type name
namespace MessagePack.Resolvers
{
- using System;
-
public class GeneratedResolver : global::MessagePack.IFormatterResolver
{
public static readonly global::MessagePack.IFormatterResolver Instance = new GeneratedResolver();
@@ -45,11 +42,11 @@ namespace MessagePack.Resolvers
internal static class GeneratedResolverGetFormatterHelper
{
- private static readonly global::System.Collections.Generic.Dictionary<Type, int> lookup;
+ private static readonly global::System.Collections.Generic.Dictionary<global::System.Type, int> lookup;
static GeneratedResolverGetFormatterHelper()
{
- lookup = new global::System.Collections.Generic.Dictionary<Type, int>(72)
+ lookup = new global::System.Collections.Generic.Dictionary<global::System.Type, int>(72)
{
{ typeof(global::GlobalMyEnum[,]), 0 },
{ typeof(global::GlobalMyEnum[]), 1 },
@@ -126,7 +123,7 @@ namespace MessagePack.Resolvers
};
}
- internal static object GetFormatter(Type t)
+ internal static object GetFormatter(global::System.Type t)
{
int key;
if (!lookup.TryGetValue(t, out key))
@@ -220,7 +217,6 @@ namespace MessagePack.Resolvers
#pragma warning restore 612
#pragma warning restore SA1312 // Variable names should begin with lower-case letter
-#pragma warning restore SA1200 // Using directives should be placed correctly
#pragma warning restore SA1649 // File name should match first type name
@@ -233,24 +229,20 @@ namespace MessagePack.Resolvers
#pragma warning disable 414
#pragma warning disable 168
-#pragma warning disable SA1200 // Using directives should be placed correctly
#pragma warning disable SA1403 // File may only contain a single namespace
#pragma warning disable SA1649 // File name should match first type name
namespace MessagePack.Formatters
{
- using System;
- using System.Buffers;
- using MessagePack;
public sealed class GlobalMyEnumFormatter : global::MessagePack.Formatters.IMessagePackFormatter<global::GlobalMyEnum>
{
- public void Serialize(ref MessagePackWriter writer, global::GlobalMyEnum value, global::MessagePack.MessagePackSerializerOptions options)
+ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::GlobalMyEnum value, global::MessagePack.MessagePackSerializerOptions options)
{
- writer.Write((Int32)value);
+ writer.Write((global::System.Int32)value);
}
- public global::GlobalMyEnum Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options)
+ public global::GlobalMyEnum Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options)
{
return (global::GlobalMyEnum)reader.ReadInt32();
}
@@ -262,7 +254,6 @@ namespace MessagePack.Formatters
#pragma warning restore 618
#pragma warning restore 612
-#pragma warning restore SA1200 // Using directives should be placed correctly
#pragma warning restore SA1403 // File may only contain a single namespace
#pragma warning restore SA1649 // File name should match first type name
@@ -275,24 +266,20 @@ namespace MessagePack.Formatters
#pragma warning disable 414
#pragma warning disable 168
-#pragma warning disable SA1200 // Using directives should be placed correctly
#pragma warning disable SA1403 // File may only contain a single namespace
#pragma warning disable SA1649 // File name should match first type name
namespace MessagePack.Formatters.SharedData
{
- using System;
- using System.Buffers;
- using MessagePack;
public sealed class ByteEnumFormatter : global::MessagePack.Formatters.IMessagePackFormatter<global::SharedData.ByteEnum>
{
- public void Serialize(ref MessagePackWriter writer, global::SharedData.ByteEnum value, global::MessagePack.MessagePackSerializerOptions options)
+ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.ByteEnum value, global::MessagePack.MessagePackSerializerOptions options)
{
- writer.Write((Byte)value);
+ writer.Write((global::System.Byte)value);
}
- public global::SharedData.ByteEnum Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options)
+ public global::SharedData.ByteEnum Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options)
{
return (global::SharedData.ByteEnum)reader.ReadByte();
}
@@ -304,7 +291,6 @@ namespace MessagePack.Formatters.SharedData
#pragma warning restore 618
#pragma warning restore 612
-#pragma warning restore SA1200 // Using directives should be placed correctly
#pragma warning restore SA1403 // File may only contain a single namespace
#pragma warning restore SA1649 // File name should match first type name
@@ -318,31 +304,25 @@ namespace MessagePack.Formatters.SharedData
#pragma warning disable 414
#pragma warning disable 168
-#pragma warning disable SA1200 // Using directives should be placed correctly
#pragma warning disable SA1403 // File may only contain a single namespace
#pragma warning disable SA1649 // File name should match first type name
namespace MessagePack.Formatters
{
- using System;
- using System.Buffers;
- using System.Collections.Generic;
- using MessagePack;
-
public sealed class IMessageBodyFormatter : global::MessagePack.Formatters.IMessagePackFormatter<global::IMessageBody>
{
- private readonly Dictionary<RuntimeTypeHandle, KeyValuePair<int, int>> typeToKeyAndJumpMap;
- private readonly Dictionary<int, int> keyToJumpMap;
+ private readonly global::System.Collections.Generic.Dictionary<global::System.RuntimeTypeHandle, global::System.Collections.Generic.KeyValuePair<int, int>> typeToKeyAndJumpMap;
+ private readonly global::System.Collections.Generic.Dictionary<int, int> keyToJumpMap;
public IMessageBodyFormatter()
{
- this.typeToKeyAndJumpMap = new Dictionary<RuntimeTypeHandle, KeyValuePair<int, int>>(3, global::MessagePack.Internal.RuntimeTypeHandleEqualityComparer.Default)
+ this.typeToKeyAndJumpMap = new global::System.Collections.Generic.Dictionary<global::System.RuntimeTypeHandle, global::System.Collections.Generic.KeyValuePair<int, int>>(3, global::MessagePack.Internal.RuntimeTypeHandleEqualityComparer.Default)
{
- { typeof(global::TextMessageBody).TypeHandle, new KeyValuePair<int, int>(10, 0) },
- { typeof(global::StampMessageBody).TypeHandle, new KeyValuePair<int, int>(14, 1) },
- { typeof(global::QuestMessageBody).TypeHandle, new KeyValuePair<int, int>(25, 2) },
+ { typeof(global::TextMessageBody).TypeHandle, new global::System.Collections.Generic.KeyValuePair<int, int>(10, 0) },
+ { typeof(global::StampMessageBody).TypeHandle, new global::System.Collections.Generic.KeyValuePair<int, int>(14, 1) },
+ { typeof(global::QuestMessageBody).TypeHandle, new global::System.Collections.Generic.KeyValuePair<int, int>(25, 2) },
};
- this.keyToJumpMap = new Dictionary<int, int>(3)
+ this.keyToJumpMap = new global::System.Collections.Generic.Dictionary<int, int>(3)
{
{ 10, 0 },
{ 14, 1 },
@@ -350,9 +330,9 @@ namespace MessagePack.Formatters
};
}
- public void Serialize(ref MessagePackWriter writer, global::IMessageBody value, global::MessagePack.MessagePackSerializerOptions options)
+ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::IMessageBody value, global::MessagePack.MessagePackSerializerOptions options)
{
- KeyValuePair<int, int> keyValuePair;
+ global::System.Collections.Generic.KeyValuePair<int, int> keyValuePair;
if (value != null && this.typeToKeyAndJumpMap.TryGetValue(value.GetType().TypeHandle, out keyValuePair))
{
writer.WriteArrayHeader(2);
@@ -378,7 +358,7 @@ namespace MessagePack.Formatters
writer.WriteNil();
}
- public global::IMessageBody Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options)
+ public global::IMessageBody Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options)
{
if (reader.TryReadNil())
{
@@ -387,7 +367,7 @@ namespace MessagePack.Formatters
if (reader.ReadArrayHeader() != 2)
{
- throw new InvalidOperationException("Invalid Union data was detected. Type:global::IMessageBody");
+ throw new global::System.InvalidOperationException("Invalid Union data was detected. Type:global::IMessageBody");
}
options.Security.DepthStep(ref reader);
@@ -428,7 +408,6 @@ namespace MessagePack.Formatters
#pragma warning restore 618
#pragma warning restore 612
-#pragma warning restore SA1200 // Using directives should be placed correctly
#pragma warning restore SA1403 // File may only contain a single namespace
#pragma warning restore SA1649 // File name should match first type name
@@ -441,37 +420,31 @@ namespace MessagePack.Formatters
#pragma warning disable 414
#pragma warning disable 168
-#pragma warning disable SA1200 // Using directives should be placed correctly
#pragma warning disable SA1403 // File may only contain a single namespace
#pragma warning disable SA1649 // File name should match first type name
namespace MessagePack.Formatters.SharedData
{
- using System;
- using System.Buffers;
- using System.Collections.Generic;
- using MessagePack;
-
public sealed class IIVersioningUnionFormatter : global::MessagePack.Formatters.IMessagePackFormatter<global::SharedData.IIVersioningUnion>
{
- private readonly Dictionary<RuntimeTypeHandle, KeyValuePair<int, int>> typeToKeyAndJumpMap;
- private readonly Dictionary<int, int> keyToJumpMap;
+ private readonly global::System.Collections.Generic.Dictionary<global::System.RuntimeTypeHandle, global::System.Collections.Generic.KeyValuePair<int, int>> typeToKeyAndJumpMap;
+ private readonly global::System.Collections.Generic.Dictionary<int, int> keyToJumpMap;
public IIVersioningUnionFormatter()
{
- this.typeToKeyAndJumpMap = new Dictionary<RuntimeTypeHandle, KeyValuePair<int, int>>(1, global::MessagePack.Internal.RuntimeTypeHandleEqualityComparer.Default)
+ this.typeToKeyAndJumpMap = new global::System.Collections.Generic.Dictionary<global::System.RuntimeTypeHandle, global::System.Collections.Generic.KeyValuePair<int, int>>(1, global::MessagePack.Internal.RuntimeTypeHandleEqualityComparer.Default)
{
- { typeof(global::SharedData.MySubUnion1).TypeHandle, new KeyValuePair<int, int>(0, 0) },
+ { typeof(global::SharedData.MySubUnion1).TypeHandle, new global::System.Collections.Generic.KeyValuePair<int, int>(0, 0) },
};
- this.keyToJumpMap = new Dictionary<int, int>(1)
+ this.keyToJumpMap = new global::System.Collections.Generic.Dictionary<int, int>(1)
{
{ 0, 0 },
};
}
- public void Serialize(ref MessagePackWriter writer, global::SharedData.IIVersioningUnion value, global::MessagePack.MessagePackSerializerOptions options)
+ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.IIVersioningUnion value, global::MessagePack.MessagePackSerializerOptions options)
{
- KeyValuePair<int, int> keyValuePair;
+ global::System.Collections.Generic.KeyValuePair<int, int> keyValuePair;
if (value != null && this.typeToKeyAndJumpMap.TryGetValue(value.GetType().TypeHandle, out keyValuePair))
{
writer.WriteArrayHeader(2);
@@ -491,7 +464,7 @@ namespace MessagePack.Formatters.SharedData
writer.WriteNil();
}
- public global::SharedData.IIVersioningUnion Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options)
+ public global::SharedData.IIVersioningUnion Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options)
{
if (reader.TryReadNil())
{
@@ -500,7 +473,7 @@ namespace MessagePack.Formatters.SharedData
if (reader.ReadArrayHeader() != 2)
{
- throw new InvalidOperationException("Invalid Union data was detected. Type:global::SharedData.IIVersioningUnion");
+ throw new global::System.InvalidOperationException("Invalid Union data was detected. Type:global::SharedData.IIVersioningUnion");
}
options.Security.DepthStep(ref reader);
@@ -529,19 +502,19 @@ namespace MessagePack.Formatters.SharedData
public sealed class IUnionCheckerFormatter : global::MessagePack.Formatters.IMessagePackFormatter<global::SharedData.IUnionChecker>
{
- private readonly Dictionary<RuntimeTypeHandle, KeyValuePair<int, int>> typeToKeyAndJumpMap;
- private readonly Dictionary<int, int> keyToJumpMap;
+ private readonly global::System.Collections.Generic.Dictionary<global::System.RuntimeTypeHandle, global::System.Collections.Generic.KeyValuePair<int, int>> typeToKeyAndJumpMap;
+ private readonly global::System.Collections.Generic.Dictionary<int, int> keyToJumpMap;
public IUnionCheckerFormatter()
{
- this.typeToKeyAndJumpMap = new Dictionary<RuntimeTypeHandle, KeyValuePair<int, int>>(4, global::MessagePack.Internal.RuntimeTypeHandleEqualityComparer.Default)
+ this.typeToKeyAndJumpMap = new global::System.Collections.Generic.Dictionary<global::System.RuntimeTypeHandle, global::System.Collections.Generic.KeyValuePair<int, int>>(4, global::MessagePack.Internal.RuntimeTypeHandleEqualityComparer.Default)
{
- { typeof(global::SharedData.MySubUnion1).TypeHandle, new KeyValuePair<int, int>(0, 0) },
- { typeof(global::SharedData.MySubUnion2).TypeHandle, new KeyValuePair<int, int>(1, 1) },
- { typeof(global::SharedData.MySubUnion3).TypeHandle, new KeyValuePair<int, int>(2, 2) },
- { typeof(global::SharedData.MySubUnion4).TypeHandle, new KeyValuePair<int, int>(3, 3) },
+ { typeof(global::SharedData.MySubUnion1).TypeHandle, new global::System.Collections.Generic.KeyValuePair<int, int>(0, 0) },
+ { typeof(global::SharedData.MySubUnion2).TypeHandle, new global::System.Collections.Generic.KeyValuePair<int, int>(1, 1) },
+ { typeof(global::SharedData.MySubUnion3).TypeHandle, new global::System.Collections.Generic.KeyValuePair<int, int>(2, 2) },
+ { typeof(global::SharedData.MySubUnion4).TypeHandle, new global::System.Collections.Generic.KeyValuePair<int, int>(3, 3) },
};
- this.keyToJumpMap = new Dictionary<int, int>(4)
+ this.keyToJumpMap = new global::System.Collections.Generic.Dictionary<int, int>(4)
{
{ 0, 0 },
{ 1, 1 },
@@ -550,9 +523,9 @@ namespace MessagePack.Formatters.SharedData
};
}
- public void Serialize(ref MessagePackWriter writer, global::SharedData.IUnionChecker value, global::MessagePack.MessagePackSerializerOptions options)
+ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.IUnionChecker value, global::MessagePack.MessagePackSerializerOptions options)
{
- KeyValuePair<int, int> keyValuePair;
+ global::System.Collections.Generic.KeyValuePair<int, int> keyValuePair;
if (value != null && this.typeToKeyAndJumpMap.TryGetValue(value.GetType().TypeHandle, out keyValuePair))
{
writer.WriteArrayHeader(2);
@@ -581,7 +554,7 @@ namespace MessagePack.Formatters.SharedData
writer.WriteNil();
}
- public global::SharedData.IUnionChecker Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options)
+ public global::SharedData.IUnionChecker Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options)
{
if (reader.TryReadNil())
{
@@ -590,7 +563,7 @@ namespace MessagePack.Formatters.SharedData
if (reader.ReadArrayHeader() != 2)
{
- throw new InvalidOperationException("Invalid Union data was detected. Type:global::SharedData.IUnionChecker");
+ throw new global::System.InvalidOperationException("Invalid Union data was detected. Type:global::SharedData.IUnionChecker");
}
options.Security.DepthStep(ref reader);
@@ -628,19 +601,19 @@ namespace MessagePack.Formatters.SharedData
public sealed class IUnionChecker2Formatter : global::MessagePack.Formatters.IMessagePackFormatter<global::SharedData.IUnionChecker2>
{
- private readonly Dictionary<RuntimeTypeHandle, KeyValuePair<int, int>> typeToKeyAndJumpMap;
- private readonly Dictionary<int, int> keyToJumpMap;
+ private readonly global::System.Collections.Generic.Dictionary<global::System.RuntimeTypeHandle, global::System.Collections.Generic.KeyValuePair<int, int>> typeToKeyAndJumpMap;
+ private readonly global::System.Collections.Generic.Dictionary<int, int> keyToJumpMap;
public IUnionChecker2Formatter()
{
- this.typeToKeyAndJumpMap = new Dictionary<RuntimeTypeHandle, KeyValuePair<int, int>>(4, global::MessagePack.Internal.RuntimeTypeHandleEqualityComparer.Default)
+ this.typeToKeyAndJumpMap = new global::System.Collections.Generic.Dictionary<global::System.RuntimeTypeHandle, global::System.Collections.Generic.KeyValuePair<int, int>>(4, global::MessagePack.Internal.RuntimeTypeHandleEqualityComparer.Default)
{
- { typeof(global::SharedData.MySubUnion2).TypeHandle, new KeyValuePair<int, int>(31, 0) },
- { typeof(global::SharedData.MySubUnion3).TypeHandle, new KeyValuePair<int, int>(42, 1) },
- { typeof(global::SharedData.MySubUnion4).TypeHandle, new KeyValuePair<int, int>(63, 2) },
- { typeof(global::SharedData.MySubUnion1).TypeHandle, new KeyValuePair<int, int>(120, 3) },
+ { typeof(global::SharedData.MySubUnion2).TypeHandle, new global::System.Collections.Generic.KeyValuePair<int, int>(31, 0) },
+ { typeof(global::SharedData.MySubUnion3).TypeHandle, new global::System.Collections.Generic.KeyValuePair<int, int>(42, 1) },
+ { typeof(global::SharedData.MySubUnion4).TypeHandle, new global::System.Collections.Generic.KeyValuePair<int, int>(63, 2) },
+ { typeof(global::SharedData.MySubUnion1).TypeHandle, new global::System.Collections.Generic.KeyValuePair<int, int>(120, 3) },
};
- this.keyToJumpMap = new Dictionary<int, int>(4)
+ this.keyToJumpMap = new global::System.Collections.Generic.Dictionary<int, int>(4)
{
{ 31, 0 },
{ 42, 1 },
@@ -649,9 +622,9 @@ namespace MessagePack.Formatters.SharedData
};
}
- public void Serialize(ref MessagePackWriter writer, global::SharedData.IUnionChecker2 value, global::MessagePack.MessagePackSerializerOptions options)
+ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.IUnionChecker2 value, global::MessagePack.MessagePackSerializerOptions options)
{
- KeyValuePair<int, int> keyValuePair;
+ global::System.Collections.Generic.KeyValuePair<int, int> keyValuePair;
if (value != null && this.typeToKeyAndJumpMap.TryGetValue(value.GetType().TypeHandle, out keyValuePair))
{
writer.WriteArrayHeader(2);
@@ -680,7 +653,7 @@ namespace MessagePack.Formatters.SharedData
writer.WriteNil();
}
- public global::SharedData.IUnionChecker2 Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options)
+ public global::SharedData.IUnionChecker2 Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options)
{
if (reader.TryReadNil())
{
@@ -689,7 +662,7 @@ namespace MessagePack.Formatters.SharedData
if (reader.ReadArrayHeader() != 2)
{
- throw new InvalidOperationException("Invalid Union data was detected. Type:global::SharedData.IUnionChecker2");
+ throw new global::System.InvalidOperationException("Invalid Union data was detected. Type:global::SharedData.IUnionChecker2");
}
options.Security.DepthStep(ref reader);
@@ -727,26 +700,26 @@ namespace MessagePack.Formatters.SharedData
public sealed class IUnionSampleFormatter : global::MessagePack.Formatters.IMessagePackFormatter<global::SharedData.IUnionSample>
{
- private readonly Dictionary<RuntimeTypeHandle, KeyValuePair<int, int>> typeToKeyAndJumpMap;
- private readonly Dictionary<int, int> keyToJumpMap;
+ private readonly global::System.Collections.Generic.Dictionary<global::System.RuntimeTypeHandle, global::System.Collections.Generic.KeyValuePair<int, int>> typeToKeyAndJumpMap;
+ private readonly global::System.Collections.Generic.Dictionary<int, int> keyToJumpMap;
public IUnionSampleFormatter()
{
- this.typeToKeyAndJumpMap = new Dictionary<RuntimeTypeHandle, KeyValuePair<int, int>>(2, global::MessagePack.Internal.RuntimeTypeHandleEqualityComparer.Default)
+ this.typeToKeyAndJumpMap = new global::System.Collections.Generic.Dictionary<global::System.RuntimeTypeHandle, global::System.Collections.Generic.KeyValuePair<int, int>>(2, global::MessagePack.Internal.RuntimeTypeHandleEqualityComparer.Default)
{
- { typeof(global::SharedData.FooClass).TypeHandle, new KeyValuePair<int, int>(0, 0) },
- { typeof(global::SharedData.BarClass).TypeHandle, new KeyValuePair<int, int>(100, 1) },
+ { typeof(global::SharedData.FooClass).TypeHandle, new global::System.Collections.Generic.KeyValuePair<int, int>(0, 0) },
+ { typeof(global::SharedData.BarClass).TypeHandle, new global::System.Collections.Generic.KeyValuePair<int, int>(100, 1) },
};
- this.keyToJumpMap = new Dictionary<int, int>(2)
+ this.keyToJumpMap = new global::System.Collections.Generic.Dictionary<int, int>(2)
{
{ 0, 0 },
{ 100, 1 },
};
}
- public void Serialize(ref MessagePackWriter writer, global::SharedData.IUnionSample value, global::MessagePack.MessagePackSerializerOptions options)
+ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.IUnionSample value, global::MessagePack.MessagePackSerializerOptions options)
{
- KeyValuePair<int, int> keyValuePair;
+ global::System.Collections.Generic.KeyValuePair<int, int> keyValuePair;
if (value != null && this.typeToKeyAndJumpMap.TryGetValue(value.GetType().TypeHandle, out keyValuePair))
{
writer.WriteArrayHeader(2);
@@ -769,7 +742,7 @@ namespace MessagePack.Formatters.SharedData
writer.WriteNil();
}
- public global::SharedData.IUnionSample Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options)
+ public global::SharedData.IUnionSample Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options)
{
if (reader.TryReadNil())
{
@@ -778,7 +751,7 @@ namespace MessagePack.Formatters.SharedData
if (reader.ReadArrayHeader() != 2)
{
- throw new InvalidOperationException("Invalid Union data was detected. Type:global::SharedData.IUnionSample");
+ throw new global::System.InvalidOperationException("Invalid Union data was detected. Type:global::SharedData.IUnionSample");
}
options.Security.DepthStep(ref reader);
@@ -810,26 +783,26 @@ namespace MessagePack.Formatters.SharedData
public sealed class RootUnionTypeFormatter : global::MessagePack.Formatters.IMessagePackFormatter<global::SharedData.RootUnionType>
{
- private readonly Dictionary<RuntimeTypeHandle, KeyValuePair<int, int>> typeToKeyAndJumpMap;
- private readonly Dictionary<int, int> keyToJumpMap;
+ private readonly global::System.Collections.Generic.Dictionary<global::System.RuntimeTypeHandle, global::System.Collections.Generic.KeyValuePair<int, int>> typeToKeyAndJumpMap;
+ private readonly global::System.Collections.Generic.Dictionary<int, int> keyToJumpMap;
public RootUnionTypeFormatter()
{
- this.typeToKeyAndJumpMap = new Dictionary<RuntimeTypeHandle, KeyValuePair<int, int>>(2, global::MessagePack.Internal.RuntimeTypeHandleEqualityComparer.Default)
+ this.typeToKeyAndJumpMap = new global::System.Collections.Generic.Dictionary<global::System.RuntimeTypeHandle, global::System.Collections.Generic.KeyValuePair<int, int>>(2, global::MessagePack.Internal.RuntimeTypeHandleEqualityComparer.Default)
{
- { typeof(global::SharedData.SubUnionType1).TypeHandle, new KeyValuePair<int, int>(0, 0) },
- { typeof(global::SharedData.SubUnionType2).TypeHandle, new KeyValuePair<int, int>(1, 1) },
+ { typeof(global::SharedData.SubUnionType1).TypeHandle, new global::System.Collections.Generic.KeyValuePair<int, int>(0, 0) },
+ { typeof(global::SharedData.SubUnionType2).TypeHandle, new global::System.Collections.Generic.KeyValuePair<int, int>(1, 1) },
};
- this.keyToJumpMap = new Dictionary<int, int>(2)
+ this.keyToJumpMap = new global::System.Collections.Generic.Dictionary<int, int>(2)
{
{ 0, 0 },
{ 1, 1 },
};
}
- public void Serialize(ref MessagePackWriter writer, global::SharedData.RootUnionType value, global::MessagePack.MessagePackSerializerOptions options)
+ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.RootUnionType value, global::MessagePack.MessagePackSerializerOptions options)
{
- KeyValuePair<int, int> keyValuePair;
+ global::System.Collections.Generic.KeyValuePair<int, int> keyValuePair;
if (value != null && this.typeToKeyAndJumpMap.TryGetValue(value.GetType().TypeHandle, out keyValuePair))
{
writer.WriteArrayHeader(2);
@@ -852,7 +825,7 @@ namespace MessagePack.Formatters.SharedData
writer.WriteNil();
}
- public global::SharedData.RootUnionType Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options)
+ public global::SharedData.RootUnionType Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options)
{
if (reader.TryReadNil())
{
@@ -861,7 +834,7 @@ namespace MessagePack.Formatters.SharedData
if (reader.ReadArrayHeader() != 2)
{
- throw new InvalidOperationException("Invalid Union data was detected. Type:global::SharedData.RootUnionType");
+ throw new global::System.InvalidOperationException("Invalid Union data was detected. Type:global::SharedData.RootUnionType");
}
options.Security.DepthStep(ref reader);
@@ -899,7 +872,6 @@ namespace MessagePack.Formatters.SharedData
#pragma warning restore 618
#pragma warning restore 612
-#pragma warning restore SA1200 // Using directives should be placed correctly
#pragma warning restore SA1403 // File may only contain a single namespace
#pragma warning restore SA1649 // File name should match first type name
@@ -914,7 +886,6 @@ namespace MessagePack.Formatters.SharedData
#pragma warning disable 168
#pragma warning disable SA1129 // Do not use default value type constructor
-#pragma warning disable SA1200 // Using directives should be placed correctly
#pragma warning disable SA1309 // Field names should not begin with underscore
#pragma warning disable SA1312 // Variable names should begin with lower-case letter
#pragma warning disable SA1403 // File may only contain a single namespace
@@ -922,9 +893,6 @@ namespace MessagePack.Formatters.SharedData
namespace MessagePack.Formatters.Abcdefg.Efcdigjl.Ateatatea.Hgfagfafgad
{
- using global::System.Buffers;
- using global::MessagePack;
-
public sealed class TnonodsfarnoiuAtatqagaFormatter : global::MessagePack.Formatters.IMessagePackFormatter<global::Abcdefg.Efcdigjl.Ateatatea.Hgfagfafgad.TnonodsfarnoiuAtatqaga>
{
@@ -968,6 +936,7 @@ namespace MessagePack.Formatters.Abcdefg.Efcdigjl.Ateatatea.Hgfagfafgad
return ____result;
}
}
+
}
#pragma warning restore 168
@@ -976,7 +945,6 @@ namespace MessagePack.Formatters.Abcdefg.Efcdigjl.Ateatatea.Hgfagfafgad
#pragma warning restore 612
#pragma warning restore SA1129 // Do not use default value type constructor
-#pragma warning restore SA1200 // Using directives should be placed correctly
#pragma warning restore SA1309 // Field names should not begin with underscore
#pragma warning restore SA1312 // Variable names should begin with lower-case letter
#pragma warning restore SA1403 // File may only contain a single namespace
@@ -992,7 +960,6 @@ namespace MessagePack.Formatters.Abcdefg.Efcdigjl.Ateatatea.Hgfagfafgad
#pragma warning disable 168
#pragma warning disable SA1129 // Do not use default value type constructor
-#pragma warning disable SA1200 // Using directives should be placed correctly
#pragma warning disable SA1309 // Field names should not begin with underscore
#pragma warning disable SA1312 // Variable names should begin with lower-case letter
#pragma warning disable SA1403 // File may only contain a single namespace
@@ -1000,9 +967,6 @@ namespace MessagePack.Formatters.Abcdefg.Efcdigjl.Ateatatea.Hgfagfafgad
namespace MessagePack.Formatters
{
- using global::System.Buffers;
- using global::MessagePack;
-
public sealed class ArrayTestTestFormatter : global::MessagePack.Formatters.IMessagePackFormatter<global::ArrayTestTest>
{
@@ -1016,13 +980,13 @@ namespace MessagePack.Formatters
global::MessagePack.IFormatterResolver formatterResolver = options.Resolver;
writer.WriteArrayHeader(7);
- formatterResolver.GetFormatterWithVerify<int[]>().Serialize(ref writer, value.MyProperty0, options);
- formatterResolver.GetFormatterWithVerify<int[,]>().Serialize(ref writer, value.MyProperty1, options);
- formatterResolver.GetFormatterWithVerify<global::GlobalMyEnum[,]>().Serialize(ref writer, value.MyProperty2, options);
- formatterResolver.GetFormatterWithVerify<int[,,]>().Serialize(ref writer, value.MyProperty3, options);
- formatterResolver.GetFormatterWithVerify<int[,,,]>().Serialize(ref writer, value.MyProperty4, options);
- formatterResolver.GetFormatterWithVerify<global::GlobalMyEnum[]>().Serialize(ref writer, value.MyProperty5, options);
- formatterResolver.GetFormatterWithVerify<global::QuestMessageBody[]>().Serialize(ref writer, value.MyProperty6, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<int[]>(formatterResolver).Serialize(ref writer, value.MyProperty0, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<int[,]>(formatterResolver).Serialize(ref writer, value.MyProperty1, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<global::GlobalMyEnum[,]>(formatterResolver).Serialize(ref writer, value.MyProperty2, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<int[,,]>(formatterResolver).Serialize(ref writer, value.MyProperty3, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<int[,,,]>(formatterResolver).Serialize(ref writer, value.MyProperty4, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<global::GlobalMyEnum[]>(formatterResolver).Serialize(ref writer, value.MyProperty5, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<global::QuestMessageBody[]>(formatterResolver).Serialize(ref writer, value.MyProperty6, options);
}
public global::ArrayTestTest Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options)
@@ -1042,25 +1006,25 @@ namespace MessagePack.Formatters
switch (i)
{
case 0:
- ____result.MyProperty0 = formatterResolver.GetFormatterWithVerify<int[]>().Deserialize(ref reader, options);
+ ____result.MyProperty0 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<int[]>(formatterResolver).Deserialize(ref reader, options);
break;
case 1:
- ____result.MyProperty1 = formatterResolver.GetFormatterWithVerify<int[,]>().Deserialize(ref reader, options);
+ ____result.MyProperty1 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<int[,]>(formatterResolver).Deserialize(ref reader, options);
break;
case 2:
- ____result.MyProperty2 = formatterResolver.GetFormatterWithVerify<global::GlobalMyEnum[,]>().Deserialize(ref reader, options);
+ ____result.MyProperty2 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<global::GlobalMyEnum[,]>(formatterResolver).Deserialize(ref reader, options);
break;
case 3:
- ____result.MyProperty3 = formatterResolver.GetFormatterWithVerify<int[,,]>().Deserialize(ref reader, options);
+ ____result.MyProperty3 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<int[,,]>(formatterResolver).Deserialize(ref reader, options);
break;
case 4:
- ____result.MyProperty4 = formatterResolver.GetFormatterWithVerify<int[,,,]>().Deserialize(ref reader, options);
+ ____result.MyProperty4 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<int[,,,]>(formatterResolver).Deserialize(ref reader, options);
break;
case 5:
- ____result.MyProperty5 = formatterResolver.GetFormatterWithVerify<global::GlobalMyEnum[]>().Deserialize(ref reader, options);
+ ____result.MyProperty5 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<global::GlobalMyEnum[]>(formatterResolver).Deserialize(ref reader, options);
break;
case 6:
- ____result.MyProperty6 = formatterResolver.GetFormatterWithVerify<global::QuestMessageBody[]>().Deserialize(ref reader, options);
+ ____result.MyProperty6 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<global::QuestMessageBody[]>(formatterResolver).Deserialize(ref reader, options);
break;
default:
reader.Skip();
@@ -1132,8 +1096,8 @@ namespace MessagePack.Formatters
writer.WriteArrayHeader(4);
writer.Write(value.UserId);
writer.Write(value.RoomId);
- formatterResolver.GetFormatterWithVerify<global::System.DateTime>().Serialize(ref writer, value.PostTime, options);
- formatterResolver.GetFormatterWithVerify<global::IMessageBody>().Serialize(ref writer, value.Body, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<global::System.DateTime>(formatterResolver).Serialize(ref writer, value.PostTime, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<global::IMessageBody>(formatterResolver).Serialize(ref writer, value.Body, options);
}
public global::Message Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options)
@@ -1159,10 +1123,10 @@ namespace MessagePack.Formatters
____result.RoomId = reader.ReadInt32();
break;
case 2:
- ____result.PostTime = formatterResolver.GetFormatterWithVerify<global::System.DateTime>().Deserialize(ref reader, options);
+ ____result.PostTime = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<global::System.DateTime>(formatterResolver).Deserialize(ref reader, options);
break;
case 3:
- ____result.Body = formatterResolver.GetFormatterWithVerify<global::IMessageBody>().Deserialize(ref reader, options);
+ ____result.Body = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<global::IMessageBody>(formatterResolver).Deserialize(ref reader, options);
break;
default:
reader.Skip();
@@ -1234,7 +1198,7 @@ namespace MessagePack.Formatters
global::MessagePack.IFormatterResolver formatterResolver = options.Resolver;
writer.WriteArrayHeader(2);
writer.Write(value.QuestId);
- formatterResolver.GetFormatterWithVerify<string>().Serialize(ref writer, value.Text, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<string>(formatterResolver).Serialize(ref writer, value.Text, options);
}
public global::QuestMessageBody Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options)
@@ -1257,7 +1221,7 @@ namespace MessagePack.Formatters
____result.QuestId = reader.ReadInt32();
break;
case 1:
- ____result.Text = formatterResolver.GetFormatterWithVerify<string>().Deserialize(ref reader, options);
+ ____result.Text = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<string>(formatterResolver).Deserialize(ref reader, options);
break;
default:
reader.Skip();
@@ -1327,7 +1291,7 @@ namespace MessagePack.Formatters
global::MessagePack.IFormatterResolver formatterResolver = options.Resolver;
writer.WriteArrayHeader(1);
- formatterResolver.GetFormatterWithVerify<string>().Serialize(ref writer, value.Text, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<string>(formatterResolver).Serialize(ref writer, value.Text, options);
}
public global::TextMessageBody Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options)
@@ -1347,7 +1311,7 @@ namespace MessagePack.Formatters
switch (i)
{
case 0:
- ____result.Text = formatterResolver.GetFormatterWithVerify<string>().Deserialize(ref reader, options);
+ ____result.Text = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<string>(formatterResolver).Deserialize(ref reader, options);
break;
default:
reader.Skip();
@@ -1359,6 +1323,7 @@ namespace MessagePack.Formatters
return ____result;
}
}
+
}
#pragma warning restore 168
@@ -1367,7 +1332,6 @@ namespace MessagePack.Formatters
#pragma warning restore 612
#pragma warning restore SA1129 // Do not use default value type constructor
-#pragma warning restore SA1200 // Using directives should be placed correctly
#pragma warning restore SA1309 // Field names should not begin with underscore
#pragma warning restore SA1312 // Variable names should begin with lower-case letter
#pragma warning restore SA1403 // File may only contain a single namespace
@@ -1383,7 +1347,6 @@ namespace MessagePack.Formatters
#pragma warning disable 168
#pragma warning disable SA1129 // Do not use default value type constructor
-#pragma warning disable SA1200 // Using directives should be placed correctly
#pragma warning disable SA1309 // Field names should not begin with underscore
#pragma warning disable SA1312 // Variable names should begin with lower-case letter
#pragma warning disable SA1403 // File may only contain a single namespace
@@ -1391,9 +1354,6 @@ namespace MessagePack.Formatters
namespace MessagePack.Formatters
{
- using global::System.Buffers;
- using global::MessagePack;
-
public sealed class ComplexModelFormatter : global::MessagePack.Formatters.IMessagePackFormatter<global::ComplexModel>
{
// AdditionalProperty
@@ -1420,17 +1380,17 @@ namespace MessagePack.Formatters
var formatterResolver = options.Resolver;
writer.WriteMapHeader(6);
writer.WriteRaw(GetSpan_AdditionalProperty());
- formatterResolver.GetFormatterWithVerify<global::System.Collections.Generic.IDictionary<string, string>>().Serialize(ref writer, value.AdditionalProperty, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<global::System.Collections.Generic.IDictionary<string, string>>(formatterResolver).Serialize(ref writer, value.AdditionalProperty, options);
writer.WriteRaw(GetSpan_CreatedOn());
- formatterResolver.GetFormatterWithVerify<global::System.DateTimeOffset>().Serialize(ref writer, value.CreatedOn, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<global::System.DateTimeOffset>(formatterResolver).Serialize(ref writer, value.CreatedOn, options);
writer.WriteRaw(GetSpan_Id());
- formatterResolver.GetFormatterWithVerify<global::System.Guid>().Serialize(ref writer, value.Id, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<global::System.Guid>(formatterResolver).Serialize(ref writer, value.Id, options);
writer.WriteRaw(GetSpan_Name());
- formatterResolver.GetFormatterWithVerify<string>().Serialize(ref writer, value.Name, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<string>(formatterResolver).Serialize(ref writer, value.Name, options);
writer.WriteRaw(GetSpan_UpdatedOn());
- formatterResolver.GetFormatterWithVerify<global::System.DateTimeOffset>().Serialize(ref writer, value.UpdatedOn, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<global::System.DateTimeOffset>(formatterResolver).Serialize(ref writer, value.UpdatedOn, options);
writer.WriteRaw(GetSpan_SimpleModels());
- formatterResolver.GetFormatterWithVerify<global::System.Collections.Generic.IList<global::SimpleModel>>().Serialize(ref writer, value.SimpleModels, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<global::System.Collections.Generic.IList<global::SimpleModel>>(formatterResolver).Serialize(ref writer, value.SimpleModels, options);
}
public global::ComplexModel Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options)
@@ -1466,25 +1426,25 @@ namespace MessagePack.Formatters
case 5720808977192022595UL:
if (stringKey[0] != 110) { goto FAIL; }
- ____result.CreatedOn = formatterResolver.GetFormatterWithVerify<global::System.DateTimeOffset>().Deserialize(ref reader, options);
+ ____result.CreatedOn = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<global::System.DateTimeOffset>(formatterResolver).Deserialize(ref reader, options);
continue;
case 5720808977191956565UL:
if (stringKey[0] != 110) { goto FAIL; }
- ____result.UpdatedOn = formatterResolver.GetFormatterWithVerify<global::System.DateTimeOffset>().Deserialize(ref reader, options);
+ ____result.UpdatedOn = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<global::System.DateTimeOffset>(formatterResolver).Deserialize(ref reader, options);
continue;
}
case 2:
if (global::MessagePack.Internal.AutomataKeyGen.GetKey(ref stringKey) != 25673UL) { goto FAIL; }
- ____result.Id = formatterResolver.GetFormatterWithVerify<global::System.Guid>().Deserialize(ref reader, options);
+ ____result.Id = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<global::System.Guid>(formatterResolver).Deserialize(ref reader, options);
continue;
case 4:
if (global::MessagePack.Internal.AutomataKeyGen.GetKey(ref stringKey) != 1701667150UL) { goto FAIL; }
- ____result.Name = formatterResolver.GetFormatterWithVerify<string>().Deserialize(ref reader, options);
+ ____result.Name = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<string>(formatterResolver).Deserialize(ref reader, options);
continue;
case 12:
if (!global::System.MemoryExtensions.SequenceEqual(stringKey, GetSpan_SimpleModels().Slice(1))) { goto FAIL; }
@@ -1528,13 +1488,13 @@ namespace MessagePack.Formatters
writer.WriteRaw(GetSpan_Id());
writer.Write(value.Id);
writer.WriteRaw(GetSpan_Name());
- formatterResolver.GetFormatterWithVerify<string>().Serialize(ref writer, value.Name, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<string>(formatterResolver).Serialize(ref writer, value.Name, options);
writer.WriteRaw(GetSpan_CreatedOn());
- formatterResolver.GetFormatterWithVerify<global::System.DateTime>().Serialize(ref writer, value.CreatedOn, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<global::System.DateTime>(formatterResolver).Serialize(ref writer, value.CreatedOn, options);
writer.WriteRaw(GetSpan_Precision());
writer.Write(value.Precision);
writer.WriteRaw(GetSpan_Money());
- formatterResolver.GetFormatterWithVerify<decimal>().Serialize(ref writer, value.Money, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<decimal>(formatterResolver).Serialize(ref writer, value.Money, options);
writer.WriteRaw(GetSpan_Amount());
writer.Write(value.Amount);
}
@@ -1568,7 +1528,7 @@ namespace MessagePack.Formatters
case 4:
if (global::MessagePack.Internal.AutomataKeyGen.GetKey(ref stringKey) != 1701667150UL) { goto FAIL; }
- ____result.Name = formatterResolver.GetFormatterWithVerify<string>().Deserialize(ref reader, options);
+ ____result.Name = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<string>(formatterResolver).Deserialize(ref reader, options);
continue;
case 9:
switch (global::MessagePack.Internal.AutomataKeyGen.GetKey(ref stringKey))
@@ -1577,7 +1537,7 @@ namespace MessagePack.Formatters
case 5720808977192022595UL:
if (stringKey[0] != 110) { goto FAIL; }
- ____result.CreatedOn = formatterResolver.GetFormatterWithVerify<global::System.DateTime>().Deserialize(ref reader, options);
+ ____result.CreatedOn = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<global::System.DateTime>(formatterResolver).Deserialize(ref reader, options);
continue;
case 8028074707240972880UL:
@@ -1590,7 +1550,7 @@ namespace MessagePack.Formatters
case 5:
if (global::MessagePack.Internal.AutomataKeyGen.GetKey(ref stringKey) != 521392779085UL) { goto FAIL; }
- ____result.Money = formatterResolver.GetFormatterWithVerify<decimal>().Deserialize(ref reader, options);
+ ____result.Money = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<decimal>(formatterResolver).Deserialize(ref reader, options);
continue;
case 6:
if (global::MessagePack.Internal.AutomataKeyGen.GetKey(ref stringKey) != 128017765461313UL) { goto FAIL; }
@@ -1605,8 +1565,20 @@ namespace MessagePack.Formatters
return ____result;
}
}
+
}
+#pragma warning restore 168
+#pragma warning restore 414
+#pragma warning restore 618
+#pragma warning restore 612
+
+#pragma warning restore SA1129 // Do not use default value type constructor
+#pragma warning restore SA1309 // Field names should not begin with underscore
+#pragma warning restore SA1312 // Variable names should begin with lower-case letter
+#pragma warning restore SA1403 // File may only contain a single namespace
+#pragma warning restore SA1649 // File name should match first type name
+
// <auto-generated>
// THIS (.cs) FILE IS GENERATED BY MPC(MessagePack-CSharp). DO NOT CHANGE IT.
// </auto-generated>
@@ -1617,7 +1589,6 @@ namespace MessagePack.Formatters
#pragma warning disable 168
#pragma warning disable SA1129 // Do not use default value type constructor
-#pragma warning disable SA1200 // Using directives should be placed correctly
#pragma warning disable SA1309 // Field names should not begin with underscore
#pragma warning disable SA1312 // Variable names should begin with lower-case letter
#pragma warning disable SA1403 // File may only contain a single namespace
@@ -1625,9 +1596,6 @@ namespace MessagePack.Formatters
namespace MessagePack.Formatters.PerfBenchmarkDotNet
{
- using global::System.Buffers;
- using global::MessagePack;
-
public sealed class StringKeySerializerTargetFormatter : global::MessagePack.Formatters.IMessagePackFormatter<global::PerfBenchmarkDotNet.StringKeySerializerTarget>
{
// MyProperty1
@@ -1744,8 +1712,20 @@ namespace MessagePack.Formatters.PerfBenchmarkDotNet
return ____result;
}
}
+
}
+#pragma warning restore 168
+#pragma warning restore 414
+#pragma warning restore 618
+#pragma warning restore 612
+
+#pragma warning restore SA1129 // Do not use default value type constructor
+#pragma warning restore SA1309 // Field names should not begin with underscore
+#pragma warning restore SA1312 // Variable names should begin with lower-case letter
+#pragma warning restore SA1403 // File may only contain a single namespace
+#pragma warning restore SA1649 // File name should match first type name
+
// <auto-generated>
// THIS (.cs) FILE IS GENERATED BY MPC(MessagePack-CSharp). DO NOT CHANGE IT.
// </auto-generated>
@@ -1756,7 +1736,6 @@ namespace MessagePack.Formatters.PerfBenchmarkDotNet
#pragma warning disable 168
#pragma warning disable SA1129 // Do not use default value type constructor
-#pragma warning disable SA1200 // Using directives should be placed correctly
#pragma warning disable SA1309 // Field names should not begin with underscore
#pragma warning disable SA1312 // Variable names should begin with lower-case letter
#pragma warning disable SA1403 // File may only contain a single namespace
@@ -1764,9 +1743,6 @@ namespace MessagePack.Formatters.PerfBenchmarkDotNet
namespace MessagePack.Formatters.SharedData
{
- using global::System.Buffers;
- using global::MessagePack;
-
public sealed class ArrayOptimizeClassFormatter : global::MessagePack.Formatters.IMessagePackFormatter<global::SharedData.ArrayOptimizeClass>
{
@@ -1884,7 +1860,7 @@ namespace MessagePack.Formatters.SharedData
global::MessagePack.IFormatterResolver formatterResolver = options.Resolver;
writer.WriteArrayHeader(1);
- formatterResolver.GetFormatterWithVerify<string>().Serialize(ref writer, value.OPQ, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<string>(formatterResolver).Serialize(ref writer, value.OPQ, options);
}
public global::SharedData.BarClass Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options)
@@ -1904,7 +1880,7 @@ namespace MessagePack.Formatters.SharedData
switch (i)
{
case 0:
- ____result.OPQ = formatterResolver.GetFormatterWithVerify<string>().Deserialize(ref reader, options);
+ ____result.OPQ = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<string>(formatterResolver).Deserialize(ref reader, options);
break;
default:
reader.Skip();
@@ -2026,8 +2002,8 @@ namespace MessagePack.Formatters.SharedData
writer.WriteArrayHeader(4);
writer.Write(value.Prop1);
writer.Write(value.Prop2);
- formatterResolver.GetFormatterWithVerify<string>().Serialize(ref writer, value.Prop3, options);
- formatterResolver.GetFormatterWithVerify<string>().Serialize(ref writer, value.Prop4, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<string>(formatterResolver).Serialize(ref writer, value.Prop3, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<string>(formatterResolver).Serialize(ref writer, value.Prop4, options);
}
public global::SharedData.DefaultValueIntKeyClassWithExplicitConstructor Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options)
@@ -2056,10 +2032,10 @@ namespace MessagePack.Formatters.SharedData
__Prop2__ = reader.ReadInt32();
break;
case 2:
- __Prop3__ = formatterResolver.GetFormatterWithVerify<string>().Deserialize(ref reader, options);
+ __Prop3__ = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<string>(formatterResolver).Deserialize(ref reader, options);
break;
case 3:
- __Prop4__ = formatterResolver.GetFormatterWithVerify<string>().Deserialize(ref reader, options);
+ __Prop4__ = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<string>(formatterResolver).Deserialize(ref reader, options);
break;
default:
reader.Skip();
@@ -2200,15 +2176,15 @@ namespace MessagePack.Formatters.SharedData
{
global::MessagePack.IFormatterResolver formatterResolver = options.Resolver;
writer.WriteArrayHeader(9);
- formatterResolver.GetFormatterWithVerify<T1>().Serialize(ref writer, value.Item1, options);
- formatterResolver.GetFormatterWithVerify<T2>().Serialize(ref writer, value.Item2, options);
- formatterResolver.GetFormatterWithVerify<T3>().Serialize(ref writer, value.Item3, options);
- formatterResolver.GetFormatterWithVerify<T4>().Serialize(ref writer, value.Item4, options);
- formatterResolver.GetFormatterWithVerify<T5>().Serialize(ref writer, value.Item5, options);
- formatterResolver.GetFormatterWithVerify<T6>().Serialize(ref writer, value.Item6, options);
- formatterResolver.GetFormatterWithVerify<T7>().Serialize(ref writer, value.Item7, options);
- formatterResolver.GetFormatterWithVerify<T8>().Serialize(ref writer, value.Item8, options);
- formatterResolver.GetFormatterWithVerify<T9>().Serialize(ref writer, value.Item9, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<T1>(formatterResolver).Serialize(ref writer, value.Item1, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<T2>(formatterResolver).Serialize(ref writer, value.Item2, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<T3>(formatterResolver).Serialize(ref writer, value.Item3, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<T4>(formatterResolver).Serialize(ref writer, value.Item4, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<T5>(formatterResolver).Serialize(ref writer, value.Item5, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<T6>(formatterResolver).Serialize(ref writer, value.Item6, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<T7>(formatterResolver).Serialize(ref writer, value.Item7, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<T8>(formatterResolver).Serialize(ref writer, value.Item8, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<T9>(formatterResolver).Serialize(ref writer, value.Item9, options);
}
public global::SharedData.DynamicArgumentTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9> Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options)
@@ -2236,31 +2212,31 @@ namespace MessagePack.Formatters.SharedData
switch (i)
{
case 0:
- __Item1__ = formatterResolver.GetFormatterWithVerify<T1>().Deserialize(ref reader, options);
+ __Item1__ = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<T1>(formatterResolver).Deserialize(ref reader, options);
break;
case 1:
- __Item2__ = formatterResolver.GetFormatterWithVerify<T2>().Deserialize(ref reader, options);
+ __Item2__ = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<T2>(formatterResolver).Deserialize(ref reader, options);
break;
case 2:
- __Item3__ = formatterResolver.GetFormatterWithVerify<T3>().Deserialize(ref reader, options);
+ __Item3__ = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<T3>(formatterResolver).Deserialize(ref reader, options);
break;
case 3:
- __Item4__ = formatterResolver.GetFormatterWithVerify<T4>().Deserialize(ref reader, options);
+ __Item4__ = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<T4>(formatterResolver).Deserialize(ref reader, options);
break;
case 4:
- __Item5__ = formatterResolver.GetFormatterWithVerify<T5>().Deserialize(ref reader, options);
+ __Item5__ = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<T5>(formatterResolver).Deserialize(ref reader, options);
break;
case 5:
- __Item6__ = formatterResolver.GetFormatterWithVerify<T6>().Deserialize(ref reader, options);
+ __Item6__ = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<T6>(formatterResolver).Deserialize(ref reader, options);
break;
case 6:
- __Item7__ = formatterResolver.GetFormatterWithVerify<T7>().Deserialize(ref reader, options);
+ __Item7__ = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<T7>(formatterResolver).Deserialize(ref reader, options);
break;
case 7:
- __Item8__ = formatterResolver.GetFormatterWithVerify<T8>().Deserialize(ref reader, options);
+ __Item8__ = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<T8>(formatterResolver).Deserialize(ref reader, options);
break;
case 8:
- __Item9__ = formatterResolver.GetFormatterWithVerify<T9>().Deserialize(ref reader, options);
+ __Item9__ = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<T9>(formatterResolver).Deserialize(ref reader, options);
break;
default:
reader.Skip();
@@ -2360,7 +2336,7 @@ namespace MessagePack.Formatters.SharedData
global::MessagePack.IFormatterResolver formatterResolver = options.Resolver;
writer.WriteArrayHeader(3);
writer.Write(value.Prop1);
- formatterResolver.GetFormatterWithVerify<string>().Serialize(ref writer, value.Prop2, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<string>(formatterResolver).Serialize(ref writer, value.Prop2, options);
writer.Write(value.Prop3);
}
@@ -2384,7 +2360,7 @@ namespace MessagePack.Formatters.SharedData
____result.Prop1 = reader.ReadInt32();
break;
case 1:
- ____result.Prop2 = formatterResolver.GetFormatterWithVerify<string>().Deserialize(ref reader, options);
+ ____result.Prop2 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<string>(formatterResolver).Deserialize(ref reader, options);
break;
case 2:
____result.Prop3 = reader.ReadInt32();
@@ -2457,8 +2433,8 @@ namespace MessagePack.Formatters.SharedData
global::MessagePack.IFormatterResolver formatterResolver = options.Resolver;
writer.WriteArrayHeader(2);
- formatterResolver.GetFormatterWithVerify<T1>().Serialize(ref writer, value.MyProperty0, options);
- formatterResolver.GetFormatterWithVerify<T2>().Serialize(ref writer, value.MyProperty1, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<T1>(formatterResolver).Serialize(ref writer, value.MyProperty0, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<T2>(formatterResolver).Serialize(ref writer, value.MyProperty1, options);
}
public global::SharedData.GenericClass<T1, T2> Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options)
@@ -2478,10 +2454,10 @@ namespace MessagePack.Formatters.SharedData
switch (i)
{
case 0:
- ____result.MyProperty0 = formatterResolver.GetFormatterWithVerify<T1>().Deserialize(ref reader, options);
+ ____result.MyProperty0 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<T1>(formatterResolver).Deserialize(ref reader, options);
break;
case 1:
- ____result.MyProperty1 = formatterResolver.GetFormatterWithVerify<T2>().Deserialize(ref reader, options);
+ ____result.MyProperty1 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<T2>(formatterResolver).Deserialize(ref reader, options);
break;
default:
reader.Skip();
@@ -2509,8 +2485,8 @@ namespace MessagePack.Formatters.SharedData
global::MessagePack.IFormatterResolver formatterResolver = options.Resolver;
writer.WriteArrayHeader(2);
- formatterResolver.GetFormatterWithVerify<T1>().Serialize(ref writer, value.MyProperty0, options);
- formatterResolver.GetFormatterWithVerify<T2>().Serialize(ref writer, value.Comparer, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<T1>(formatterResolver).Serialize(ref writer, value.MyProperty0, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<T2>(formatterResolver).Serialize(ref writer, value.Comparer, options);
}
public global::SharedData.GenericConstrainedClassIntKey<T1, T2> Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options)
@@ -2530,10 +2506,10 @@ namespace MessagePack.Formatters.SharedData
switch (i)
{
case 0:
- ____result.MyProperty0 = formatterResolver.GetFormatterWithVerify<T1>().Deserialize(ref reader, options);
+ ____result.MyProperty0 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<T1>(formatterResolver).Deserialize(ref reader, options);
break;
case 1:
- ____result.Comparer = formatterResolver.GetFormatterWithVerify<T2>().Deserialize(ref reader, options);
+ ____result.Comparer = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<T2>(formatterResolver).Deserialize(ref reader, options);
break;
default:
reader.Skip();
@@ -2555,8 +2531,8 @@ namespace MessagePack.Formatters.SharedData
{
global::MessagePack.IFormatterResolver formatterResolver = options.Resolver;
writer.WriteArrayHeader(2);
- formatterResolver.GetFormatterWithVerify<T1>().Serialize(ref writer, value.MyProperty0, options);
- formatterResolver.GetFormatterWithVerify<T2>().Serialize(ref writer, value.Comparer, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<T1>(formatterResolver).Serialize(ref writer, value.MyProperty0, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<T2>(formatterResolver).Serialize(ref writer, value.Comparer, options);
}
public global::SharedData.GenericConstrainedStructIntKey<T1, T2> Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options)
@@ -2576,10 +2552,10 @@ namespace MessagePack.Formatters.SharedData
switch (i)
{
case 0:
- ____result.MyProperty0 = formatterResolver.GetFormatterWithVerify<T1>().Deserialize(ref reader, options);
+ ____result.MyProperty0 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<T1>(formatterResolver).Deserialize(ref reader, options);
break;
case 1:
- ____result.Comparer = formatterResolver.GetFormatterWithVerify<T2>().Deserialize(ref reader, options);
+ ____result.Comparer = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<T2>(formatterResolver).Deserialize(ref reader, options);
break;
default:
reader.Skip();
@@ -2599,8 +2575,8 @@ namespace MessagePack.Formatters.SharedData
{
global::MessagePack.IFormatterResolver formatterResolver = options.Resolver;
writer.WriteArrayHeader(2);
- formatterResolver.GetFormatterWithVerify<T1>().Serialize(ref writer, value.MyProperty0, options);
- formatterResolver.GetFormatterWithVerify<T2>().Serialize(ref writer, value.MyProperty1, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<T1>(formatterResolver).Serialize(ref writer, value.MyProperty0, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<T2>(formatterResolver).Serialize(ref writer, value.MyProperty1, options);
}
public global::SharedData.GenericStruct<T1, T2> Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options)
@@ -2620,10 +2596,10 @@ namespace MessagePack.Formatters.SharedData
switch (i)
{
case 0:
- ____result.MyProperty0 = formatterResolver.GetFormatterWithVerify<T1>().Deserialize(ref reader, options);
+ ____result.MyProperty0 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<T1>(formatterResolver).Deserialize(ref reader, options);
break;
case 1:
- ____result.MyProperty1 = formatterResolver.GetFormatterWithVerify<T2>().Deserialize(ref reader, options);
+ ____result.MyProperty1 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<T2>(formatterResolver).Deserialize(ref reader, options);
break;
default:
reader.Skip();
@@ -2649,7 +2625,7 @@ namespace MessagePack.Formatters.SharedData
global::MessagePack.IFormatterResolver formatterResolver = options.Resolver;
writer.WriteArrayHeader(2);
- formatterResolver.GetFormatterWithVerify<global::SharedData.Version0>().Serialize(ref writer, value.MyProperty1, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<global::SharedData.Version0>(formatterResolver).Serialize(ref writer, value.MyProperty1, options);
writer.Write(value.After);
}
@@ -2670,7 +2646,7 @@ namespace MessagePack.Formatters.SharedData
switch (i)
{
case 0:
- ____result.MyProperty1 = formatterResolver.GetFormatterWithVerify<global::SharedData.Version0>().Deserialize(ref reader, options);
+ ____result.MyProperty1 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<global::SharedData.Version0>(formatterResolver).Deserialize(ref reader, options);
break;
case 1:
____result.After = reader.ReadInt32();
@@ -2699,7 +2675,7 @@ namespace MessagePack.Formatters.SharedData
global::MessagePack.IFormatterResolver formatterResolver = options.Resolver;
writer.WriteArrayHeader(2);
- formatterResolver.GetFormatterWithVerify<global::SharedData.Version1>().Serialize(ref writer, value.MyProperty1, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<global::SharedData.Version1>(formatterResolver).Serialize(ref writer, value.MyProperty1, options);
writer.Write(value.After);
}
@@ -2720,7 +2696,7 @@ namespace MessagePack.Formatters.SharedData
switch (i)
{
case 0:
- ____result.MyProperty1 = formatterResolver.GetFormatterWithVerify<global::SharedData.Version1>().Deserialize(ref reader, options);
+ ____result.MyProperty1 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<global::SharedData.Version1>(formatterResolver).Deserialize(ref reader, options);
break;
case 1:
____result.After = reader.ReadInt32();
@@ -2749,7 +2725,7 @@ namespace MessagePack.Formatters.SharedData
global::MessagePack.IFormatterResolver formatterResolver = options.Resolver;
writer.WriteArrayHeader(2);
- formatterResolver.GetFormatterWithVerify<global::SharedData.Version2>().Serialize(ref writer, value.MyProperty1, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<global::SharedData.Version2>(formatterResolver).Serialize(ref writer, value.MyProperty1, options);
writer.Write(value.After);
}
@@ -2770,7 +2746,7 @@ namespace MessagePack.Formatters.SharedData
switch (i)
{
case 0:
- ____result.MyProperty1 = formatterResolver.GetFormatterWithVerify<global::SharedData.Version2>().Deserialize(ref reader, options);
+ ____result.MyProperty1 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<global::SharedData.Version2>(formatterResolver).Deserialize(ref reader, options);
break;
case 1:
____result.After = reader.ReadInt32();
@@ -3121,11 +3097,11 @@ namespace MessagePack.Formatters.SharedData
global::MessagePack.IFormatterResolver formatterResolver = options.Resolver;
writer.WriteArrayHeader(7);
writer.Write(value.Prop1);
- formatterResolver.GetFormatterWithVerify<global::SharedData.ByteEnum>().Serialize(ref writer, value.Prop2, options);
- formatterResolver.GetFormatterWithVerify<string>().Serialize(ref writer, value.Prop3, options);
- formatterResolver.GetFormatterWithVerify<global::SharedData.SimpleStringKeyData>().Serialize(ref writer, value.Prop4, options);
- formatterResolver.GetFormatterWithVerify<global::SharedData.SimpleStructIntKeyData>().Serialize(ref writer, value.Prop5, options);
- formatterResolver.GetFormatterWithVerify<global::SharedData.SimpleStructStringKeyData>().Serialize(ref writer, value.Prop6, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<global::SharedData.ByteEnum>(formatterResolver).Serialize(ref writer, value.Prop2, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<string>(formatterResolver).Serialize(ref writer, value.Prop3, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<global::SharedData.SimpleStringKeyData>(formatterResolver).Serialize(ref writer, value.Prop4, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<global::SharedData.SimpleStructIntKeyData>(formatterResolver).Serialize(ref writer, value.Prop5, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<global::SharedData.SimpleStructStringKeyData>(formatterResolver).Serialize(ref writer, value.Prop6, options);
writer.Write(value.BytesSpecial);
}
@@ -3149,22 +3125,22 @@ namespace MessagePack.Formatters.SharedData
____result.Prop1 = reader.ReadInt32();
break;
case 1:
- ____result.Prop2 = formatterResolver.GetFormatterWithVerify<global::SharedData.ByteEnum>().Deserialize(ref reader, options);
+ ____result.Prop2 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<global::SharedData.ByteEnum>(formatterResolver).Deserialize(ref reader, options);
break;
case 2:
- ____result.Prop3 = formatterResolver.GetFormatterWithVerify<string>().Deserialize(ref reader, options);
+ ____result.Prop3 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<string>(formatterResolver).Deserialize(ref reader, options);
break;
case 3:
- ____result.Prop4 = formatterResolver.GetFormatterWithVerify<global::SharedData.SimpleStringKeyData>().Deserialize(ref reader, options);
+ ____result.Prop4 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<global::SharedData.SimpleStringKeyData>(formatterResolver).Deserialize(ref reader, options);
break;
case 4:
- ____result.Prop5 = formatterResolver.GetFormatterWithVerify<global::SharedData.SimpleStructIntKeyData>().Deserialize(ref reader, options);
+ ____result.Prop5 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<global::SharedData.SimpleStructIntKeyData>(formatterResolver).Deserialize(ref reader, options);
break;
case 5:
- ____result.Prop6 = formatterResolver.GetFormatterWithVerify<global::SharedData.SimpleStructStringKeyData>().Deserialize(ref reader, options);
+ ____result.Prop6 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<global::SharedData.SimpleStructStringKeyData>(formatterResolver).Deserialize(ref reader, options);
break;
case 6:
- ____result.BytesSpecial = reader.ReadBytes()?.ToArray();
+ ____result.BytesSpecial = global::MessagePack.Internal.CodeGenHelpers.GetArrayFromNullableSequence(reader.ReadBytes());
break;
default:
reader.Skip();
@@ -3210,7 +3186,7 @@ namespace MessagePack.Formatters.SharedData
____result.Y = reader.ReadInt32();
break;
case 2:
- ____result.BytesSpecial = reader.ReadBytes()?.ToArray();
+ ____result.BytesSpecial = global::MessagePack.Internal.CodeGenHelpers.GetArrayFromNullableSequence(reader.ReadBytes());
break;
default:
reader.Skip();
@@ -3681,7 +3657,7 @@ namespace MessagePack.Formatters.SharedData
global::MessagePack.IFormatterResolver formatterResolver = options.Resolver;
writer.WriteArrayHeader(3);
writer.Write(value.MyProperty);
- formatterResolver.GetFormatterWithVerify<global::SharedData.MyClass>().Serialize(ref writer, value.UnknownBlock, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<global::SharedData.MyClass>(formatterResolver).Serialize(ref writer, value.UnknownBlock, options);
writer.Write(value.MyProperty2);
}
@@ -3705,7 +3681,7 @@ namespace MessagePack.Formatters.SharedData
____result.MyProperty = reader.ReadInt32();
break;
case 1:
- ____result.UnknownBlock = formatterResolver.GetFormatterWithVerify<global::SharedData.MyClass>().Deserialize(ref reader, options);
+ ____result.UnknownBlock = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<global::SharedData.MyClass>(formatterResolver).Deserialize(ref reader, options);
break;
case 2:
____result.MyProperty2 = reader.ReadInt32();
@@ -3786,7 +3762,7 @@ namespace MessagePack.Formatters.SharedData
global::MessagePack.IFormatterResolver formatterResolver = options.Resolver;
writer.WriteArrayHeader(2);
writer.Write(value.Data1);
- formatterResolver.GetFormatterWithVerify<string>().Serialize(ref writer, value.Data2, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<string>(formatterResolver).Serialize(ref writer, value.Data2, options);
}
public global::SharedData.WithIndexer Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options)
@@ -3809,7 +3785,7 @@ namespace MessagePack.Formatters.SharedData
____result.Data1 = reader.ReadInt32();
break;
case 1:
- ____result.Data2 = formatterResolver.GetFormatterWithVerify<string>().Deserialize(ref reader, options);
+ ____result.Data2 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<string>(formatterResolver).Deserialize(ref reader, options);
break;
default:
reader.Skip();
@@ -3821,6 +3797,7 @@ namespace MessagePack.Formatters.SharedData
return ____result;
}
}
+
}
#pragma warning restore 168
@@ -3829,7 +3806,6 @@ namespace MessagePack.Formatters.SharedData
#pragma warning restore 612
#pragma warning restore SA1129 // Do not use default value type constructor
-#pragma warning restore SA1200 // Using directives should be placed correctly
#pragma warning restore SA1309 // Field names should not begin with underscore
#pragma warning restore SA1312 // Variable names should begin with lower-case letter
#pragma warning restore SA1403 // File may only contain a single namespace
@@ -3845,7 +3821,6 @@ namespace MessagePack.Formatters.SharedData
#pragma warning disable 168
#pragma warning disable SA1129 // Do not use default value type constructor
-#pragma warning disable SA1200 // Using directives should be placed correctly
#pragma warning disable SA1309 // Field names should not begin with underscore
#pragma warning disable SA1312 // Variable names should begin with lower-case letter
#pragma warning disable SA1403 // File may only contain a single namespace
@@ -3853,9 +3828,6 @@ namespace MessagePack.Formatters.SharedData
namespace MessagePack.Formatters.SharedData
{
- using global::System.Buffers;
- using global::MessagePack;
-
public sealed class Callback2Formatter : global::MessagePack.Formatters.IMessagePackFormatter<global::SharedData.Callback2>
{
// X
@@ -4198,9 +4170,9 @@ namespace MessagePack.Formatters.SharedData
var formatterResolver = options.Resolver;
writer.WriteMapHeader(2);
writer.WriteRaw(GetSpan_MyProperty0());
- formatterResolver.GetFormatterWithVerify<T1>().Serialize(ref writer, value.MyProperty0, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<T1>(formatterResolver).Serialize(ref writer, value.MyProperty0, options);
writer.WriteRaw(GetSpan_Comparer());
- formatterResolver.GetFormatterWithVerify<T2>().Serialize(ref writer, value.Comparer, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<T2>(formatterResolver).Serialize(ref writer, value.Comparer, options);
}
public global::SharedData.GenericConstrainedClassStringKey<T1, T2> Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options)
@@ -4227,12 +4199,12 @@ namespace MessagePack.Formatters.SharedData
case 11:
if (!global::System.MemoryExtensions.SequenceEqual(stringKey, GetSpan_MyProperty0().Slice(1))) { goto FAIL; }
- ____result.MyProperty0 = formatterResolver.GetFormatterWithVerify<T1>().Deserialize(ref reader, options);
+ ____result.MyProperty0 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<T1>(formatterResolver).Deserialize(ref reader, options);
continue;
case 8:
if (global::MessagePack.Internal.AutomataKeyGen.GetKey(ref stringKey) != 8243120455795175235UL) { goto FAIL; }
- ____result.Comparer = formatterResolver.GetFormatterWithVerify<T2>().Deserialize(ref reader, options);
+ ____result.Comparer = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<T2>(formatterResolver).Deserialize(ref reader, options);
continue;
}
@@ -4257,9 +4229,9 @@ namespace MessagePack.Formatters.SharedData
var formatterResolver = options.Resolver;
writer.WriteMapHeader(2);
writer.WriteRaw(GetSpan_MyProperty0());
- formatterResolver.GetFormatterWithVerify<T1>().Serialize(ref writer, value.MyProperty0, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<T1>(formatterResolver).Serialize(ref writer, value.MyProperty0, options);
writer.WriteRaw(GetSpan_Comparer());
- formatterResolver.GetFormatterWithVerify<T2>().Serialize(ref writer, value.Comparer, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<T2>(formatterResolver).Serialize(ref writer, value.Comparer, options);
}
public global::SharedData.GenericConstrainedStructStringKey<T1, T2> Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options)
@@ -4286,12 +4258,12 @@ namespace MessagePack.Formatters.SharedData
case 11:
if (!global::System.MemoryExtensions.SequenceEqual(stringKey, GetSpan_MyProperty0().Slice(1))) { goto FAIL; }
- ____result.MyProperty0 = formatterResolver.GetFormatterWithVerify<T1>().Deserialize(ref reader, options);
+ ____result.MyProperty0 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<T1>(formatterResolver).Deserialize(ref reader, options);
continue;
case 8:
if (global::MessagePack.Internal.AutomataKeyGen.GetKey(ref stringKey) != 8243120455795175235UL) { goto FAIL; }
- ____result.Comparer = formatterResolver.GetFormatterWithVerify<T2>().Deserialize(ref reader, options);
+ ____result.Comparer = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<T2>(formatterResolver).Deserialize(ref reader, options);
continue;
}
@@ -4376,7 +4348,7 @@ namespace MessagePack.Formatters.SharedData
writer.WriteRaw(GetSpan_Prop1());
writer.Write(value.Prop1);
writer.WriteRaw(GetSpan_Prop2());
- formatterResolver.GetFormatterWithVerify<global::SharedData.ByteEnum>().Serialize(ref writer, value.Prop2, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<global::SharedData.ByteEnum>(formatterResolver).Serialize(ref writer, value.Prop2, options);
writer.WriteRaw(GetSpan_Prop3());
writer.Write(value.Prop3);
}
@@ -4410,7 +4382,7 @@ namespace MessagePack.Formatters.SharedData
____result.Prop1 = reader.ReadInt32();
continue;
case 216634716752UL:
- ____result.Prop2 = formatterResolver.GetFormatterWithVerify<global::SharedData.ByteEnum>().Deserialize(ref reader, options);
+ ____result.Prop2 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<global::SharedData.ByteEnum>(formatterResolver).Deserialize(ref reader, options);
continue;
case 220929684048UL:
____result.Prop3 = reader.ReadInt32();
@@ -4439,7 +4411,7 @@ namespace MessagePack.Formatters.SharedData
writer.WriteRaw(GetSpan_X());
writer.Write(value.X);
writer.WriteRaw(GetSpan_Y());
- formatterResolver.GetFormatterWithVerify<int[]>().Serialize(ref writer, value.Y, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<int[]>(formatterResolver).Serialize(ref writer, value.Y, options);
}
public global::SharedData.SimpleStructStringKeyData Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options)
@@ -4471,7 +4443,7 @@ namespace MessagePack.Formatters.SharedData
____result.X = reader.ReadInt32();
continue;
case 383015019883UL:
- ____result.Y = formatterResolver.GetFormatterWithVerify<int[]>().Deserialize(ref reader, options);
+ ____result.Y = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<int[]>(formatterResolver).Deserialize(ref reader, options);
continue;
}
@@ -4482,5 +4454,17 @@ namespace MessagePack.Formatters.SharedData
return ____result;
}
}
+
}
+#pragma warning restore 168
+#pragma warning restore 414
+#pragma warning restore 618
+#pragma warning restore 612
+
+#pragma warning restore SA1129 // Do not use default value type constructor
+#pragma warning restore SA1309 // Field names should not begin with underscore
+#pragma warning restore SA1312 // Variable names should begin with lower-case letter
+#pragma warning restore SA1403 // File may only contain a single namespace
+#pragma warning restore SA1649 // File name should match first type name
+
diff --git a/sandbox/Sandbox/codegen.ps1 b/sandbox/Sandbox/codegen.ps1
index 2a595dee..279718f6 100644
--- a/sandbox/Sandbox/codegen.ps1
+++ b/sandbox/Sandbox/codegen.ps1
@@ -1 +1 @@
-dotnet run -f "net5.0" -p "$PSScriptRoot/../../src/MessagePack.Generator/MessagePack.Generator.csproj" -- -i "$PSScriptRoot/../SharedData/SharedData.csproj" -o "$PSScriptRoot/Generated.cs"
+dotnet run -f "net6.0" --project "$PSScriptRoot/../../src/MessagePack.Generator/MessagePack.Generator.csproj" -- -i "$PSScriptRoot/../SharedData/SharedData.csproj" -o "$PSScriptRoot/Generated.cs"
diff --git a/sandbox/TestData2/A.cs b/sandbox/TestData2/A.cs
index 44b0a47f..a7eeef9d 100644
--- a/sandbox/TestData2/A.cs
+++ b/sandbox/TestData2/A.cs
@@ -1,17 +1,14 @@
// Copyright (c) All contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-using System.Collections.Generic;
-using MessagePack;
-
#pragma warning disable SA1307 // Accessible fields should begin with upper-case letter
#pragma warning disable SA1401 // Fields should be private
+#nullable enable
+
+namespace TestData2;
-namespace TestData2
+[MessagePackObject(true)]
+public class A
{
- [MessagePackObject(true)]
- public class A
- {
- public int a; public List<B> bs; public C c;
- }
+ public int a; public List<B?>? bs; public C? c;
}
diff --git a/sandbox/TestData2/B.cs b/sandbox/TestData2/B.cs
index 769c0e1c..d9c4029e 100644
--- a/sandbox/TestData2/B.cs
+++ b/sandbox/TestData2/B.cs
@@ -1,17 +1,14 @@
-// Copyright (c) All contributors. All rights reserved.
+// Copyright (c) All contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-using System.Collections.Generic;
-using MessagePack;
-
#pragma warning disable SA1307 // Accessible fields should begin with upper-case letter
#pragma warning disable SA1401 // Fields should be private
+#nullable enable
+
+namespace TestData2;
-namespace TestData2
+[MessagePackObject(true)]
+public class B
{
- [MessagePackObject(true)]
- public class B
- {
- public List<A> ass; public C c; public int a;
- }
+ public List<A?>? ass; public C? c; public int a;
}
diff --git a/sandbox/TestData2/C.cs b/sandbox/TestData2/C.cs
index 079c171e..741517ff 100644
--- a/sandbox/TestData2/C.cs
+++ b/sandbox/TestData2/C.cs
@@ -1,16 +1,14 @@
-// Copyright (c) All contributors. All rights reserved.
+// Copyright (c) All contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-using MessagePack;
-
#pragma warning disable SA1307 // Accessible fields should begin with upper-case letter
#pragma warning disable SA1401 // Fields should be private
+#nullable enable
+
+namespace TestData2;
-namespace TestData2
+[MessagePackObject(true)]
+public class C
{
- [MessagePackObject(true)]
- public class C
- {
- public B b; public int a;
- }
+ public B? b; public int a;
}
diff --git a/sandbox/TestData2/Generated.cs b/sandbox/TestData2/Generated.cs
index 606e2dca..e4f08ad5 100644
--- a/sandbox/TestData2/Generated.cs
+++ b/sandbox/TestData2/Generated.cs
@@ -7,14 +7,11 @@
#pragma warning disable 414
#pragma warning disable 168
-#pragma warning disable SA1200 // Using directives should be placed correctly
#pragma warning disable SA1312 // Variable names should begin with lower-case letter
#pragma warning disable SA1649 // File name should match first type name
namespace MessagePack.Resolvers
{
- using System;
-
public class GeneratedResolver : global::MessagePack.IFormatterResolver
{
public static readonly global::MessagePack.IFormatterResolver Instance = new GeneratedResolver();
@@ -45,11 +42,11 @@ namespace MessagePack.Resolvers
internal static class GeneratedResolverGetFormatterHelper
{
- private static readonly global::System.Collections.Generic.Dictionary<Type, int> lookup;
+ private static readonly global::System.Collections.Generic.Dictionary<global::System.Type, int> lookup;
static GeneratedResolverGetFormatterHelper()
{
- lookup = new global::System.Collections.Generic.Dictionary<Type, int>(14)
+ lookup = new global::System.Collections.Generic.Dictionary<global::System.Type, int>(14)
{
{ typeof(global::System.Collections.Generic.List<global::TestData2.A>), 0 },
{ typeof(global::System.Collections.Generic.List<global::TestData2.B>), 1 },
@@ -68,7 +65,7 @@ namespace MessagePack.Resolvers
};
}
- internal static object GetFormatter(Type t)
+ internal static object GetFormatter(global::System.Type t)
{
int key;
if (!lookup.TryGetValue(t, out key))
@@ -104,7 +101,6 @@ namespace MessagePack.Resolvers
#pragma warning restore 612
#pragma warning restore SA1312 // Variable names should begin with lower-case letter
-#pragma warning restore SA1200 // Using directives should be placed correctly
#pragma warning restore SA1649 // File name should match first type name
@@ -117,24 +113,20 @@ namespace MessagePack.Resolvers
#pragma warning disable 414
#pragma warning disable 168
-#pragma warning disable SA1200 // Using directives should be placed correctly
#pragma warning disable SA1403 // File may only contain a single namespace
#pragma warning disable SA1649 // File name should match first type name
namespace MessagePack.Formatters.TestData2
{
- using System;
- using System.Buffers;
- using MessagePack;
public sealed class Nest1_IdFormatter : global::MessagePack.Formatters.IMessagePackFormatter<global::TestData2.Nest1.Id>
{
- public void Serialize(ref MessagePackWriter writer, global::TestData2.Nest1.Id value, global::MessagePack.MessagePackSerializerOptions options)
+ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::TestData2.Nest1.Id value, global::MessagePack.MessagePackSerializerOptions options)
{
- writer.Write((Int32)value);
+ writer.Write((global::System.Int32)value);
}
- public global::TestData2.Nest1.Id Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options)
+ public global::TestData2.Nest1.Id Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options)
{
return (global::TestData2.Nest1.Id)reader.ReadInt32();
}
@@ -142,12 +134,12 @@ namespace MessagePack.Formatters.TestData2
public sealed class Nest2_IdFormatter : global::MessagePack.Formatters.IMessagePackFormatter<global::TestData2.Nest2.Id>
{
- public void Serialize(ref MessagePackWriter writer, global::TestData2.Nest2.Id value, global::MessagePack.MessagePackSerializerOptions options)
+ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::TestData2.Nest2.Id value, global::MessagePack.MessagePackSerializerOptions options)
{
- writer.Write((Int32)value);
+ writer.Write((global::System.Int32)value);
}
- public global::TestData2.Nest2.Id Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options)
+ public global::TestData2.Nest2.Id Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options)
{
return (global::TestData2.Nest2.Id)reader.ReadInt32();
}
@@ -159,7 +151,6 @@ namespace MessagePack.Formatters.TestData2
#pragma warning restore 618
#pragma warning restore 612
-#pragma warning restore SA1200 // Using directives should be placed correctly
#pragma warning restore SA1403 // File may only contain a single namespace
#pragma warning restore SA1649 // File name should match first type name
@@ -175,7 +166,6 @@ namespace MessagePack.Formatters.TestData2
#pragma warning disable 168
#pragma warning disable SA1129 // Do not use default value type constructor
-#pragma warning disable SA1200 // Using directives should be placed correctly
#pragma warning disable SA1309 // Field names should not begin with underscore
#pragma warning disable SA1312 // Variable names should begin with lower-case letter
#pragma warning disable SA1403 // File may only contain a single namespace
@@ -183,9 +173,6 @@ namespace MessagePack.Formatters.TestData2
namespace MessagePack.Formatters.TestData2
{
- using global::System.Buffers;
- using global::MessagePack;
-
public sealed class AFormatter : global::MessagePack.Formatters.IMessagePackFormatter<global::TestData2.A>
{
// a
@@ -208,9 +195,9 @@ namespace MessagePack.Formatters.TestData2
writer.WriteRaw(GetSpan_a());
writer.Write(value.a);
writer.WriteRaw(GetSpan_bs());
- formatterResolver.GetFormatterWithVerify<global::System.Collections.Generic.List<global::TestData2.B>>().Serialize(ref writer, value.bs, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<global::System.Collections.Generic.List<global::TestData2.B>>(formatterResolver).Serialize(ref writer, value.bs, options);
writer.WriteRaw(GetSpan_c());
- formatterResolver.GetFormatterWithVerify<global::TestData2.C>().Serialize(ref writer, value.c, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<global::TestData2.C>(formatterResolver).Serialize(ref writer, value.c, options);
}
public global::TestData2.A Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options)
@@ -242,13 +229,13 @@ namespace MessagePack.Formatters.TestData2
____result.a = reader.ReadInt32();
continue;
case 99UL:
- ____result.c = formatterResolver.GetFormatterWithVerify<global::TestData2.C>().Deserialize(ref reader, options);
+ ____result.c = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<global::TestData2.C>(formatterResolver).Deserialize(ref reader, options);
continue;
}
case 2:
if (global::MessagePack.Internal.AutomataKeyGen.GetKey(ref stringKey) != 29538UL) { goto FAIL; }
- ____result.bs = formatterResolver.GetFormatterWithVerify<global::System.Collections.Generic.List<global::TestData2.B>>().Deserialize(ref reader, options);
+ ____result.bs = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<global::System.Collections.Generic.List<global::TestData2.B>>(formatterResolver).Deserialize(ref reader, options);
continue;
}
@@ -279,9 +266,9 @@ namespace MessagePack.Formatters.TestData2
var formatterResolver = options.Resolver;
writer.WriteMapHeader(3);
writer.WriteRaw(GetSpan_ass());
- formatterResolver.GetFormatterWithVerify<global::System.Collections.Generic.List<global::TestData2.A>>().Serialize(ref writer, value.ass, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<global::System.Collections.Generic.List<global::TestData2.A>>(formatterResolver).Serialize(ref writer, value.ass, options);
writer.WriteRaw(GetSpan_c());
- formatterResolver.GetFormatterWithVerify<global::TestData2.C>().Serialize(ref writer, value.c, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<global::TestData2.C>(formatterResolver).Serialize(ref writer, value.c, options);
writer.WriteRaw(GetSpan_a());
writer.Write(value.a);
}
@@ -310,14 +297,14 @@ namespace MessagePack.Formatters.TestData2
case 3:
if (global::MessagePack.Internal.AutomataKeyGen.GetKey(ref stringKey) != 7566177UL) { goto FAIL; }
- ____result.ass = formatterResolver.GetFormatterWithVerify<global::System.Collections.Generic.List<global::TestData2.A>>().Deserialize(ref reader, options);
+ ____result.ass = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<global::System.Collections.Generic.List<global::TestData2.A>>(formatterResolver).Deserialize(ref reader, options);
continue;
case 1:
switch (global::MessagePack.Internal.AutomataKeyGen.GetKey(ref stringKey))
{
default: goto FAIL;
case 99UL:
- ____result.c = formatterResolver.GetFormatterWithVerify<global::TestData2.C>().Deserialize(ref reader, options);
+ ____result.c = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<global::TestData2.C>(formatterResolver).Deserialize(ref reader, options);
continue;
case 97UL:
____result.a = reader.ReadInt32();
@@ -350,7 +337,7 @@ namespace MessagePack.Formatters.TestData2
var formatterResolver = options.Resolver;
writer.WriteMapHeader(2);
writer.WriteRaw(GetSpan_b());
- formatterResolver.GetFormatterWithVerify<global::TestData2.B>().Serialize(ref writer, value.b, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<global::TestData2.B>(formatterResolver).Serialize(ref writer, value.b, options);
writer.WriteRaw(GetSpan_a());
writer.Write(value.a);
}
@@ -381,7 +368,7 @@ namespace MessagePack.Formatters.TestData2
{
default: goto FAIL;
case 98UL:
- ____result.b = formatterResolver.GetFormatterWithVerify<global::TestData2.B>().Deserialize(ref reader, options);
+ ____result.b = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<global::TestData2.B>(formatterResolver).Deserialize(ref reader, options);
continue;
case 97UL:
____result.a = reader.ReadInt32();
@@ -414,9 +401,9 @@ namespace MessagePack.Formatters.TestData2
var formatterResolver = options.Resolver;
writer.WriteMapHeader(2);
writer.WriteRaw(GetSpan_EnumId());
- formatterResolver.GetFormatterWithVerify<global::TestData2.Nest1.Id>().Serialize(ref writer, value.EnumId, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<global::TestData2.Nest1.Id>(formatterResolver).Serialize(ref writer, value.EnumId, options);
writer.WriteRaw(GetSpan_ClassId());
- formatterResolver.GetFormatterWithVerify<global::TestData2.Nest1.IdType>().Serialize(ref writer, value.ClassId, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<global::TestData2.Nest1.IdType>(formatterResolver).Serialize(ref writer, value.ClassId, options);
}
public global::TestData2.Nest1 Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options)
@@ -443,12 +430,12 @@ namespace MessagePack.Formatters.TestData2
case 6:
if (global::MessagePack.Internal.AutomataKeyGen.GetKey(ref stringKey) != 110266531802693UL) { goto FAIL; }
- ____result.EnumId = formatterResolver.GetFormatterWithVerify<global::TestData2.Nest1.Id>().Deserialize(ref reader, options);
+ ____result.EnumId = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<global::TestData2.Nest1.Id>(formatterResolver).Deserialize(ref reader, options);
continue;
case 7:
if (global::MessagePack.Internal.AutomataKeyGen.GetKey(ref stringKey) != 28228257876896835UL) { goto FAIL; }
- ____result.ClassId = formatterResolver.GetFormatterWithVerify<global::TestData2.Nest1.IdType>().Deserialize(ref reader, options);
+ ____result.ClassId = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<global::TestData2.Nest1.IdType>(formatterResolver).Deserialize(ref reader, options);
continue;
}
@@ -503,9 +490,9 @@ namespace MessagePack.Formatters.TestData2
var formatterResolver = options.Resolver;
writer.WriteMapHeader(2);
writer.WriteRaw(GetSpan_EnumId());
- formatterResolver.GetFormatterWithVerify<global::TestData2.Nest2.Id>().Serialize(ref writer, value.EnumId, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<global::TestData2.Nest2.Id>(formatterResolver).Serialize(ref writer, value.EnumId, options);
writer.WriteRaw(GetSpan_ClassId());
- formatterResolver.GetFormatterWithVerify<global::TestData2.Nest2.IdType>().Serialize(ref writer, value.ClassId, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<global::TestData2.Nest2.IdType>(formatterResolver).Serialize(ref writer, value.ClassId, options);
}
public global::TestData2.Nest2 Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options)
@@ -532,12 +519,12 @@ namespace MessagePack.Formatters.TestData2
case 6:
if (global::MessagePack.Internal.AutomataKeyGen.GetKey(ref stringKey) != 110266531802693UL) { goto FAIL; }
- ____result.EnumId = formatterResolver.GetFormatterWithVerify<global::TestData2.Nest2.Id>().Deserialize(ref reader, options);
+ ____result.EnumId = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<global::TestData2.Nest2.Id>(formatterResolver).Deserialize(ref reader, options);
continue;
case 7:
if (global::MessagePack.Internal.AutomataKeyGen.GetKey(ref stringKey) != 28228257876896835UL) { goto FAIL; }
- ____result.ClassId = formatterResolver.GetFormatterWithVerify<global::TestData2.Nest2.IdType>().Deserialize(ref reader, options);
+ ____result.ClassId = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<global::TestData2.Nest2.IdType>(formatterResolver).Deserialize(ref reader, options);
continue;
}
@@ -592,9 +579,9 @@ namespace MessagePack.Formatters.TestData2
var formatterResolver = options.Resolver;
writer.WriteMapHeader(2);
writer.WriteRaw(GetSpan_MyProperty1());
- formatterResolver.GetFormatterWithVerify<string>().Serialize(ref writer, value.MyProperty1, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<string>(formatterResolver).Serialize(ref writer, value.MyProperty1, options);
writer.WriteRaw(GetSpan_MyProperty2());
- formatterResolver.GetFormatterWithVerify<string>().Serialize(ref writer, value.MyProperty2, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<string>(formatterResolver).Serialize(ref writer, value.MyProperty2, options);
}
public global::TestData2.PropNameCheck1 Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options)
@@ -627,10 +614,10 @@ namespace MessagePack.Formatters.TestData2
{
default: goto FAIL;
case 3242356UL:
- ____result.MyProperty1 = formatterResolver.GetFormatterWithVerify<string>().Deserialize(ref reader, options);
+ ____result.MyProperty1 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<string>(formatterResolver).Deserialize(ref reader, options);
continue;
case 3307892UL:
- ____result.MyProperty2 = formatterResolver.GetFormatterWithVerify<string>().Deserialize(ref reader, options);
+ ____result.MyProperty2 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<string>(formatterResolver).Deserialize(ref reader, options);
continue;
}
@@ -662,9 +649,9 @@ namespace MessagePack.Formatters.TestData2
var formatterResolver = options.Resolver;
writer.WriteMapHeader(2);
writer.WriteRaw(GetSpan_MyProperty1());
- formatterResolver.GetFormatterWithVerify<string>().Serialize(ref writer, value.MyProperty1, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<string>(formatterResolver).Serialize(ref writer, value.MyProperty1, options);
writer.WriteRaw(GetSpan_MyProperty2());
- formatterResolver.GetFormatterWithVerify<string>().Serialize(ref writer, value.MyProperty2, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<string>(formatterResolver).Serialize(ref writer, value.MyProperty2, options);
}
public global::TestData2.PropNameCheck2 Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options)
@@ -697,10 +684,10 @@ namespace MessagePack.Formatters.TestData2
{
default: goto FAIL;
case 3242356UL:
- ____result.MyProperty1 = formatterResolver.GetFormatterWithVerify<string>().Deserialize(ref reader, options);
+ ____result.MyProperty1 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<string>(formatterResolver).Deserialize(ref reader, options);
continue;
case 3307892UL:
- ____result.MyProperty2 = formatterResolver.GetFormatterWithVerify<string>().Deserialize(ref reader, options);
+ ____result.MyProperty2 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<string>(formatterResolver).Deserialize(ref reader, options);
continue;
}
@@ -730,7 +717,7 @@ namespace MessagePack.Formatters.TestData2
var formatterResolver = options.Resolver;
writer.WriteMapHeader(1);
writer.WriteRaw(GetSpan_SomeProperty());
- formatterResolver.GetFormatterWithVerify<string>().Serialize(ref writer, value.SomeProperty, options);
+ global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<string>(formatterResolver).Serialize(ref writer, value.SomeProperty, options);
}
public global::TestData2.Record Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options)
@@ -757,7 +744,7 @@ namespace MessagePack.Formatters.TestData2
case 12:
if (!global::System.MemoryExtensions.SequenceEqual(stringKey, GetSpan_SomeProperty().Slice(1))) { goto FAIL; }
- __SomeProperty__ = formatterResolver.GetFormatterWithVerify<string>().Deserialize(ref reader, options);
+ __SomeProperty__ = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<string>(formatterResolver).Deserialize(ref reader, options);
continue;
}
@@ -768,5 +755,17 @@ namespace MessagePack.Formatters.TestData2
return ____result;
}
}
+
}
+#pragma warning restore 168
+#pragma warning restore 414
+#pragma warning restore 618
+#pragma warning restore 612
+
+#pragma warning restore SA1129 // Do not use default value type constructor
+#pragma warning restore SA1309 // Field names should not begin with underscore
+#pragma warning restore SA1312 // Variable names should begin with lower-case letter
+#pragma warning restore SA1403 // File may only contain a single namespace
+#pragma warning restore SA1649 // File name should match first type name
+
diff --git a/sandbox/TestData2/TestData2.csproj b/sandbox/TestData2/TestData2.csproj
index 241bef29..a7313049 100644
--- a/sandbox/TestData2/TestData2.csproj
+++ b/sandbox/TestData2/TestData2.csproj
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net461</TargetFramework>
- <LangVersion>9</LangVersion>
+ <LangVersion>10</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MessagePack" Version="2.1.90" />
@@ -9,4 +9,8 @@
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.3" />
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
</ItemGroup>
+ <ItemGroup>
+ <Using Include="System.Collections.Generic" />
+ <Using Include="MessagePack" />
+ </ItemGroup>
</Project>
diff --git a/sandbox/TestData2/codegen.ps1 b/sandbox/TestData2/codegen.ps1
index d3af9269..6781688e 100644
--- a/sandbox/TestData2/codegen.ps1
+++ b/sandbox/TestData2/codegen.ps1
@@ -1 +1 @@
-dotnet run -f "net5.0" -p "$PSScriptRoot/../../src/MessagePack.Generator/MessagePack.Generator.csproj" -- -i "$PSScriptRoot/TestData2.csproj" -o "$PSScriptRoot/Generated.cs"
+dotnet run -f "net6.0" --project "$PSScriptRoot/../../src/MessagePack.Generator/MessagePack.Generator.csproj" -- -i "$PSScriptRoot/TestData2.csproj" -o "$PSScriptRoot/Generated.cs"
diff --git a/src/MessagePack.Generator/MessagePack.Generator.csproj b/src/MessagePack.Generator/MessagePack.Generator.csproj
index b684a5b8..be7a1027 100644
--- a/src/MessagePack.Generator/MessagePack.Generator.csproj
+++ b/src/MessagePack.Generator/MessagePack.Generator.csproj
@@ -3,8 +3,8 @@
<PropertyGroup>
<AssemblyName>mpc</AssemblyName>
<OutputType>Exe</OutputType>
- <TargetFrameworks>netcoreapp3.1;net5.0</TargetFrameworks>
- <LangVersion>9</LangVersion>
+ <TargetFrameworks>netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
+ <LangVersion>10</LangVersion>
<Nullable>enable</Nullable>
<IsPackable>true</IsPackable>
<PackAsTool>true</PackAsTool>
@@ -18,11 +18,11 @@
</PropertyGroup>
<ItemGroup>
- <PackageReference Include="ConsoleAppFramework" Version="2.0.0" />
+ <PackageReference Include="ConsoleAppFramework" Version="3.3.2" />
<PackageReference Include="Microsoft.Build.Locator" Version="1.4.1" />
<PackageReference Include="Microsoft.Build.Framework" Version="16.5.0" ExcludeAssets="runtime" />
<PackageReference Include="Microsoft.Build" Version="16.5.0" ExcludeAssets="runtime" />
- <PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="3.10.0" />
+ <PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="4.0.1" />
</ItemGroup>
<ItemGroup>
diff --git a/src/MessagePack.GeneratorCore/CodeAnalysis/Definitions.cs b/src/MessagePack.GeneratorCore/CodeAnalysis/Definitions.cs
index 532cdc71..30aaedb9 100644
--- a/src/MessagePack.GeneratorCore/CodeAnalysis/Definitions.cs
+++ b/src/MessagePack.GeneratorCore/CodeAnalysis/Definitions.cs
@@ -170,7 +170,7 @@ namespace MessagePackCompiler.CodeAnalysis
}
else
{
- return $"formatterResolver.GetFormatterWithVerify<{this.Type}>().Serialize(ref writer, value.{this.Name}, options)";
+ return $"global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<{this.Type}>(formatterResolver).Serialize(ref writer, value.{this.Name}, options)";
}
}
@@ -182,12 +182,18 @@ namespace MessagePackCompiler.CodeAnalysis
}
else if (this.primitiveTypes.Contains(this.Type))
{
- string suffix = this.Type == "byte[]" ? "?.ToArray()" : string.Empty;
- return $"reader.Read{this.ShortTypeName!.Replace("[]", "s")}()" + suffix;
+ if (this.Type == "byte[]")
+ {
+ return "global::MessagePack.Internal.CodeGenHelpers.GetArrayFromNullableSequence(reader.ReadBytes())";
+ }
+ else
+ {
+ return $"reader.Read{this.ShortTypeName!.Replace("[]", "s")}()";
+ }
}
else
{
- return $"formatterResolver.GetFormatterWithVerify<{this.Type}>().Deserialize(ref reader, options)";
+ return $"global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<{this.Type}>(formatterResolver).Deserialize(ref reader, options)";
}
}
}
diff --git a/src/MessagePack.GeneratorCore/CodeAnalysis/TypeCollector.cs b/src/MessagePack.GeneratorCore/CodeAnalysis/TypeCollector.cs
index d2537dcd..935ceb87 100644
--- a/src/MessagePack.GeneratorCore/CodeAnalysis/TypeCollector.cs
+++ b/src/MessagePack.GeneratorCore/CodeAnalysis/TypeCollector.cs
@@ -971,10 +971,11 @@ namespace MessagePackCompiler.CodeAnalysis
{
var name = type.ContainingType is object ? GetMinimallyQualifiedClassName(type.ContainingType) + "_" : string.Empty;
name += type.ToDisplayString(SymbolDisplayFormat.MinimallyQualifiedFormat);
- name = name.Replace(".", "_");
- name = name.Replace("<", "_");
- name = name.Replace(">", "_");
+ name = name.Replace('.', '_');
+ name = name.Replace('<', '_');
+ name = name.Replace('>', '_');
name = Regex.Replace(name, @"\[([,])*\]", match => $"Array{match.Length - 1}");
+ name = name.Replace("?", string.Empty);
return name;
}
diff --git a/src/MessagePack.GeneratorCore/CodeGenerator.cs b/src/MessagePack.GeneratorCore/CodeGenerator.cs
index f9654693..1f48973e 100644
--- a/src/MessagePack.GeneratorCore/CodeGenerator.cs
+++ b/src/MessagePack.GeneratorCore/CodeGenerator.cs
@@ -2,6 +2,7 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
+using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
@@ -16,6 +17,8 @@ namespace MessagePackCompiler
{
public class CodeGenerator
{
+ private static readonly HashSet<char> InvalidFileCharSet = new(Path.GetInvalidFileNameChars());
+
private static readonly Encoding NoBomUtf8 = new UTF8Encoding(false);
private readonly Action<string> logger;
@@ -212,15 +215,76 @@ namespace MessagePackCompiler
private Task OutputToDirAsync(string dir, string ns, string name, string multipleOutSymbol, string text)
{
- if (multipleOutSymbol == string.Empty)
+ var builder = new StringBuilder();
+ void AppendDir(string dir)
+ {
+ if (dir.Length != 0)
+ {
+ builder.Append(dir);
+ if (dir[dir.Length - 1] != Path.DirectorySeparatorChar && dir[dir.Length - 1] != Path.AltDirectorySeparatorChar)
+ {
+ builder.Append(Path.DirectorySeparatorChar);
+ }
+ }
+ }
+
+ void AppendChar(char c)
+ {
+ if (c == '.' || InvalidFileCharSet.Contains(c))
+ {
+ builder.Append('_');
+ }
+ else
+ {
+ builder.Append(c);
+ }
+ }
+
+ void Append(string text)
{
- return OutputAsync(Path.Combine(dir, $"{ns}_{name}".Replace(".", "_").Replace("global::", string.Empty) + ".cs"), text);
+ var span = text.AsSpan();
+ while (!span.IsEmpty)
+ {
+ var index = span.IndexOf("global::".AsSpan());
+ if (index == -1)
+ {
+ foreach (var c in span)
+ {
+ AppendChar(c);
+ }
+
+ break;
+ }
+
+ if (index == 0)
+ {
+ span = span.Slice("global::".Length);
+ continue;
+ }
+
+ foreach (var c in span.Slice(0, index))
+ {
+ AppendChar(c);
+ }
+
+ span = span.Slice(index + "global::".Length);
+ }
}
- else
+
+ AppendDir(dir);
+
+ if (!string.IsNullOrWhiteSpace(multipleOutSymbol))
{
text = $"#if {multipleOutSymbol}" + Environment.NewLine + text + Environment.NewLine + "#endif";
- return OutputAsync(Path.Combine(dir, MultiSymbolToSafeFilePath(multipleOutSymbol), $"{ns}_{name}".Replace(".", "_").Replace("global::", string.Empty) + ".cs"), text);
+ AppendDir(MultiSymbolToSafeFilePath(multipleOutSymbol));
}
+
+ Append(ns);
+ builder.Append('_');
+ Append(name);
+ builder.Append(".cs");
+
+ return OutputAsync(builder.ToString(), text);
}
private Task OutputAsync(string path, string text)
diff --git a/src/MessagePack.GeneratorCore/Generator/EnumTemplate.cs b/src/MessagePack.GeneratorCore/Generator/EnumTemplate.cs
index b64b4912..66c9fc14 100644
--- a/src/MessagePack.GeneratorCore/Generator/EnumTemplate.cs
+++ b/src/MessagePack.GeneratorCore/Generator/EnumTemplate.cs
@@ -1,10 +1,10 @@
// ------------------------------------------------------------------------------
// <auto-generated>
-// このコードはツールによって生成されました。
-// ランタイム バージョン: 16.0.0.0
+// This code was generated by a tool.
+// Runtime Version: 16.0.0.0
//
-// このファイルへの変更は、正しくない動作の原因になる可能性があり、
-// コードが再生成されると失われます。
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
// </auto-generated>
// ------------------------------------------------------------------------------
namespace MessagePackCompiler.Generator
@@ -34,27 +34,27 @@ namespace MessagePackCompiler.Generator
#pragma warning disable 414
#pragma warning disable 168
-#pragma warning disable SA1200 // Using directives should be placed correctly
#pragma warning disable SA1403 // File may only contain a single namespace
#pragma warning disable SA1649 // File name should match first type name
namespace ");
this.Write(this.ToStringHelper.ToStringWithCulture(Namespace));
- this.Write("\r\n{\r\n using System;\r\n using System.Buffers;\r\n using MessagePack;\r\n");
+ this.Write("\r\n{\r\n");
foreach(var info in EnumSerializationInfos) {
this.Write("\r\n public sealed class ");
this.Write(this.ToStringHelper.ToStringWithCulture(info.Name));
this.Write("Formatter : global::MessagePack.Formatters.IMessagePackFormatter<");
this.Write(this.ToStringHelper.ToStringWithCulture(info.FullName));
- this.Write(">\r\n {\r\n public void Serialize(ref MessagePackWriter writer, ");
+ this.Write(">\r\n {\r\n public void Serialize(ref global::MessagePack.MessagePackWriter" +
+ " writer, ");
this.Write(this.ToStringHelper.ToStringWithCulture(info.FullName));
this.Write(" value, global::MessagePack.MessagePackSerializerOptions options)\r\n {\r\n " +
- " writer.Write((");
+ " writer.Write((global::System.");
this.Write(this.ToStringHelper.ToStringWithCulture(info.UnderlyingType));
this.Write(")value);\r\n }\r\n\r\n public ");
this.Write(this.ToStringHelper.ToStringWithCulture(info.FullName));
- this.Write(" Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSeriali" +
- "zerOptions options)\r\n {\r\n return (");
+ this.Write(" Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePac" +
+ "k.MessagePackSerializerOptions options)\r\n {\r\n return (");
this.Write(this.ToStringHelper.ToStringWithCulture(info.FullName));
this.Write(")reader.Read");
this.Write(this.ToStringHelper.ToStringWithCulture(info.UnderlyingType));
@@ -67,7 +67,6 @@ namespace ");
#pragma warning restore 618
#pragma warning restore 612
-#pragma warning restore SA1200 // Using directives should be placed correctly
#pragma warning restore SA1403 // File may only contain a single namespace
#pragma warning restore SA1649 // File name should match first type name
");
diff --git a/src/MessagePack.GeneratorCore/Generator/EnumTemplate.tt b/src/MessagePack.GeneratorCore/Generator/EnumTemplate.tt
index 28d34550..d9fda115 100644
--- a/src/MessagePack.GeneratorCore/Generator/EnumTemplate.tt
+++ b/src/MessagePack.GeneratorCore/Generator/EnumTemplate.tt
@@ -12,25 +12,21 @@
#pragma warning disable 414
#pragma warning disable 168
-#pragma warning disable SA1200 // Using directives should be placed correctly
#pragma warning disable SA1403 // File may only contain a single namespace
#pragma warning disable SA1649 // File name should match first type name
namespace <#= Namespace #>
{
- using System;
- using System.Buffers;
- using MessagePack;
<# foreach(var info in EnumSerializationInfos) { #>
public sealed class <#= info.Name #>Formatter : global::MessagePack.Formatters.IMessagePackFormatter<<#= info.FullName #>>
{
- public void Serialize(ref MessagePackWriter writer, <#= info.FullName #> value, global::MessagePack.MessagePackSerializerOptions options)
+ public void Serialize(ref global::MessagePack.MessagePackWriter writer, <#= info.FullName #> value, global::MessagePack.MessagePackSerializerOptions options)
{
- writer.Write((<#= info.UnderlyingType #>)value);
+ writer.Write((global::System.<#= info.UnderlyingType #>)value);
}
- public <#= info.FullName #> Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options)
+ public <#= info.FullName #> Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options)
{
return (<#= info.FullName #>)reader.Read<#= info.UnderlyingType #>();
}
@@ -43,6 +39,5 @@ namespace <#= Namespace #>
#pragma warning restore 618
#pragma warning restore 612
-#pragma warning restore SA1200 // Using directives should be placed correctly
#pragma warning restore SA1403 // File may only contain a single namespace
#pragma warning restore SA1649 // File name should match first type name
diff --git a/src/MessagePack.GeneratorCore/Generator/FormatterTemplate.cs b/src/MessagePack.GeneratorCore/Generator/FormatterTemplate.cs
index e153d5eb..dfb84caf 100644
--- a/src/MessagePack.GeneratorCore/Generator/FormatterTemplate.cs
+++ b/src/MessagePack.GeneratorCore/Generator/FormatterTemplate.cs
@@ -35,7 +35,6 @@ namespace MessagePackCompiler.Generator
#pragma warning disable 168
#pragma warning disable SA1129 // Do not use default value type constructor
-#pragma warning disable SA1200 // Using directives should be placed correctly
#pragma warning disable SA1309 // Field names should not begin with underscore
#pragma warning disable SA1312 // Variable names should begin with lower-case letter
#pragma warning disable SA1403 // File may only contain a single namespace
@@ -43,10 +42,10 @@ namespace MessagePackCompiler.Generator
namespace ");
this.Write(this.ToStringHelper.ToStringWithCulture(Namespace));
- this.Write("\r\n{\r\n using global::System.Buffers;\r\n using global::MessagePack;\r\n");
+ this.Write("\r\n{\r\n");
foreach (var objInfo in ObjectSerializationInfos) {
bool isFormatterResolverNecessary = ShouldUseFormatterResolverHelper.ShouldUseFormatterResolver(objInfo.Members);
- this.Write("\r\n public sealed class ");
+ this.Write(" public sealed class ");
this.Write(this.ToStringHelper.ToStringWithCulture(objInfo.FormatterNameWithoutNameSpace));
this.Write(" : global::MessagePack.Formatters.IMessagePackFormatter<");
this.Write(this.ToStringHelper.ToStringWithCulture(objInfo.FullName));
@@ -205,7 +204,7 @@ namespace ");
}
this.Write(" reader.Depth--;\r\n return ____result;\r\n");
}
- this.Write(" }\r\n }\r\n");
+ this.Write(" }\r\n }\r\n\r\n");
}
this.Write(@"}
@@ -215,7 +214,6 @@ namespace ");
#pragma warning restore 612
#pragma warning restore SA1129 // Do not use default value type constructor
-#pragma warning restore SA1200 // Using directives should be placed correctly
#pragma warning restore SA1309 // Field names should not begin with underscore
#pragma warning restore SA1312 // Variable names should begin with lower-case letter
#pragma warning restore SA1403 // File may only contain a single namespace
diff --git a/src/MessagePack.GeneratorCore/Generator/FormatterTemplate.tt b/src/MessagePack.GeneratorCore/Generator/FormatterTemplate.tt
index 631dc9f1..bf96d9e5 100644
--- a/src/MessagePack.GeneratorCore/Generator/FormatterTemplate.tt
+++ b/src/MessagePack.GeneratorCore/Generator/FormatterTemplate.tt
@@ -13,7 +13,6 @@
#pragma warning disable 168
#pragma warning disable SA1129 // Do not use default value type constructor
-#pragma warning disable SA1200 // Using directives should be placed correctly
#pragma warning disable SA1309 // Field names should not begin with underscore
#pragma warning disable SA1312 // Variable names should begin with lower-case letter
#pragma warning disable SA1403 // File may only contain a single namespace
@@ -21,11 +20,8 @@
namespace <#= Namespace #>
{
- using global::System.Buffers;
- using global::MessagePack;
<# foreach (var objInfo in ObjectSerializationInfos) {
bool isFormatterResolverNecessary = ShouldUseFormatterResolverHelper.ShouldUseFormatterResolver(objInfo.Members);#>
-
public sealed class <#= objInfo.FormatterNameWithoutNameSpace #> : global::MessagePack.Formatters.IMessagePackFormatter<<#= objInfo.FullName #>>
<# foreach (var typeArg in objInfo.GenericTypeParameters.Where(x => x.HasConstraints)) { #>
where <#= typeArg.Name #> : <#= typeArg.Constraints #>
@@ -155,8 +151,8 @@ namespace <#= Namespace #>
<# } #>
}
}
-<# } #>
-}
+
+<# } #>}
#pragma warning restore 168
#pragma warning restore 414
@@ -164,7 +160,6 @@ namespace <#= Namespace #>
#pragma warning restore 612
#pragma warning restore SA1129 // Do not use default value type constructor
-#pragma warning restore SA1200 // Using directives should be placed correctly
#pragma warning restore SA1309 // Field names should not begin with underscore
#pragma warning restore SA1312 // Variable names should begin with lower-case letter
#pragma warning restore SA1403 // File may only contain a single namespace
diff --git a/src/MessagePack.GeneratorCore/Generator/ResolverTemplate.cs b/src/MessagePack.GeneratorCore/Generator/ResolverTemplate.cs
index 48e4df6b..c433e545 100644
--- a/src/MessagePack.GeneratorCore/Generator/ResolverTemplate.cs
+++ b/src/MessagePack.GeneratorCore/Generator/ResolverTemplate.cs
@@ -34,13 +34,12 @@ namespace MessagePackCompiler.Generator
#pragma warning disable 414
#pragma warning disable 168
-#pragma warning disable SA1200 // Using directives should be placed correctly
#pragma warning disable SA1312 // Variable names should begin with lower-case letter
#pragma warning disable SA1649 // File name should match first type name
namespace ");
this.Write(this.ToStringHelper.ToStringWithCulture(Namespace));
- this.Write("\r\n{\r\n using System;\r\n\r\n public class ");
+ this.Write("\r\n{\r\n public class ");
this.Write(this.ToStringHelper.ToStringWithCulture(ResolverName));
this.Write(" : global::MessagePack.IFormatterResolver\r\n {\r\n public static readonly " +
"global::MessagePack.IFormatterResolver Instance = new ");
@@ -76,10 +75,10 @@ namespace ");
internal static class ");
this.Write(this.ToStringHelper.ToStringWithCulture(ResolverName));
this.Write("GetFormatterHelper\r\n {\r\n private static readonly global::System.Collect" +
- "ions.Generic.Dictionary<Type, int> lookup;\r\n\r\n static ");
+ "ions.Generic.Dictionary<global::System.Type, int> lookup;\r\n\r\n static ");
this.Write(this.ToStringHelper.ToStringWithCulture(ResolverName));
this.Write("GetFormatterHelper()\r\n {\r\n lookup = new global::System.Collecti" +
- "ons.Generic.Dictionary<Type, int>(");
+ "ons.Generic.Dictionary<global::System.Type, int>(");
this.Write(this.ToStringHelper.ToStringWithCulture(RegisterInfos.Length));
this.Write(")\r\n {\r\n");
for(var i = 0; i < RegisterInfos.Length; i++) { var x = RegisterInfos[i];
@@ -92,7 +91,7 @@ namespace ");
this.Write(@" };
}
- internal static object GetFormatter(Type t)
+ internal static object GetFormatter(global::System.Type t)
{
int key;
if (!lookup.TryGetValue(t, out key))
@@ -122,7 +121,6 @@ namespace ");
#pragma warning restore 612
#pragma warning restore SA1312 // Variable names should begin with lower-case letter
-#pragma warning restore SA1200 // Using directives should be placed correctly
#pragma warning restore SA1649 // File name should match first type name
");
return this.GenerationEnvironment.ToString();
diff --git a/src/MessagePack.GeneratorCore/Generator/ResolverTemplate.tt b/src/MessagePack.GeneratorCore/Generator/ResolverTemplate.tt
index e61688a1..1fcd9839 100644
--- a/src/MessagePack.GeneratorCore/Generator/ResolverTemplate.tt
+++ b/src/MessagePack.GeneratorCore/Generator/ResolverTemplate.tt
@@ -12,16 +12,11 @@
#pragma warning disable 414
#pragma warning disable 168
-#pragma warning disable SA1200 // Using directives should be placed correctly
#pragma warning disable SA1312 // Variable names should begin with lower-case letter
#pragma warning disable SA1649 // File name should match first type name
namespace <#= Namespace #>
{
- using System;
- using System.Buffers;
- using MessagePack;
-
public class <#= ResolverName #> : global::MessagePack.IFormatterResolver
{
public static readonly global::MessagePack.IFormatterResolver Instance = new <#= ResolverName #>();
@@ -52,11 +47,11 @@ namespace <#= Namespace #>
internal static class <#= ResolverName #>GetFormatterHelper
{
- private static readonly global::System.Collections.Generic.Dictionary<Type, int> lookup;
+ private static readonly global::System.Collections.Generic.Dictionary<global::System.Type, int> lookup;
static <#= ResolverName #>GetFormatterHelper()
{
- lookup = new global::System.Collections.Generic.Dictionary<Type, int>(<#= RegisterInfos.Length #>)
+ lookup = new global::System.Collections.Generic.Dictionary<global::System.Type, int>(<#= RegisterInfos.Length #>)
{
<# for(var i = 0; i < RegisterInfos.Length; i++) { var x = RegisterInfos[i]; #>
{ typeof(<#= x.FullName #>), <#= i #> },
@@ -64,7 +59,7 @@ namespace <#= Namespace #>
};
}
- internal static object GetFormatter(Type t)
+ internal static object GetFormatter(global::System.Type t)
{
int key;
if (!lookup.TryGetValue(t, out key))
@@ -75,7 +70,7 @@ namespace <#= Namespace #>
switch (key)
{
<# for(var i = 0; i < RegisterInfos.Length; i++) { var x = RegisterInfos[i]; #>
- case <#= i #>: return new <#= x.FormatterName.StartsWith("global::") ? x.FormatterName: (!string.IsNullOrEmpty(FormatterNamespace) ? FormatterNamespace + "." : FormatterNamespace) + x.FormatterName#>();
+ case <#= i #>: return new <#= x.FormatterName.StartsWith("global::") ? x.FormatterName: (!string.IsNullOrEmpty(FormatterNamespace) ? FormatterNamespace + "." : FormatterNamespace) + x.FormatterName #>();
<# } #>
default: return null;
}
@@ -89,5 +84,4 @@ namespace <#= Namespace #>
#pragma warning restore 612
#pragma warning restore SA1312 // Variable names should begin with lower-case letter
-#pragma warning restore SA1200 // Using directives should be placed correctly
#pragma warning restore SA1649 // File name should match first type name
diff --git a/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterTemplate.cs b/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterTemplate.cs
index a3df9f44..d598c202 100644
--- a/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterTemplate.cs
+++ b/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterTemplate.cs
@@ -35,7 +35,6 @@ namespace MessagePackCompiler.Generator
#pragma warning disable 168
#pragma warning disable SA1129 // Do not use default value type constructor
-#pragma warning disable SA1200 // Using directives should be placed correctly
#pragma warning disable SA1309 // Field names should not begin with underscore
#pragma warning disable SA1312 // Variable names should begin with lower-case letter
#pragma warning disable SA1403 // File may only contain a single namespace
@@ -43,7 +42,7 @@ namespace MessagePackCompiler.Generator
namespace ");
this.Write(this.ToStringHelper.ToStringWithCulture(Namespace));
- this.Write("\r\n{\r\n using global::System.Buffers;\r\n using global::MessagePack;\r\n");
+ this.Write("\r\n{\r\n");
var list = new List<ValueTuple<MemberSerializationInfo, byte[]>>();
foreach (var objInfo in ObjectSerializationInfos) {
list.Clear();
@@ -53,7 +52,7 @@ foreach (var objInfo in ObjectSerializationInfos) {
}
bool isFormatterResolverNecessary = ShouldUseFormatterResolverHelper.ShouldUseFormatterResolver(objInfo.Members);
- this.Write("\r\n public sealed class ");
+ this.Write(" public sealed class ");
this.Write(this.ToStringHelper.ToStringWithCulture(objInfo.FormatterNameWithoutNameSpace));
this.Write(" : global::MessagePack.Formatters.IMessagePackFormatter<");
this.Write(this.ToStringHelper.ToStringWithCulture(objInfo.FullName));
@@ -191,9 +190,21 @@ foreach (var objInfo in ObjectSerializationInfos) {
if (objInfo.Members.Length != 0) {
this.Write(" reader.Depth--;\r\n");
}
- this.Write(" return ____result;\r\n }\r\n }\r\n");
+ this.Write(" return ____result;\r\n }\r\n }\r\n\r\n");
}
- this.Write("}\r\n");
+ this.Write(@"}
+
+#pragma warning restore 168
+#pragma warning restore 414
+#pragma warning restore 618
+#pragma warning restore 612
+
+#pragma warning restore SA1129 // Do not use default value type constructor
+#pragma warning restore SA1309 // Field names should not begin with underscore
+#pragma warning restore SA1312 // Variable names should begin with lower-case letter
+#pragma warning restore SA1403 // File may only contain a single namespace
+#pragma warning restore SA1649 // File name should match first type name
+");
return this.GenerationEnvironment.ToString();
}
}
diff --git a/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterTemplate.tt b/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterTemplate.tt
index 9bc3e4d8..296ef454 100644
--- a/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterTemplate.tt
+++ b/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterTemplate.tt
@@ -14,7 +14,6 @@
#pragma warning disable 168
#pragma warning disable SA1129 // Do not use default value type constructor
-#pragma warning disable SA1200 // Using directives should be placed correctly
#pragma warning disable SA1309 // Field names should not begin with underscore
#pragma warning disable SA1312 // Variable names should begin with lower-case letter
#pragma warning disable SA1403 // File may only contain a single namespace
@@ -22,8 +21,6 @@
namespace <#= Namespace #>
{
- using global::System.Buffers;
- using global::MessagePack;
<# var list = new List<ValueTuple<MemberSerializationInfo, byte[]>>();
foreach (var objInfo in ObjectSerializationInfos) {
list.Clear();
@@ -33,7 +30,6 @@ foreach (var objInfo in ObjectSerializationInfos) {
}
bool isFormatterResolverNecessary = ShouldUseFormatterResolverHelper.ShouldUseFormatterResolver(objInfo.Members); #>
-
public sealed class <#= objInfo.FormatterNameWithoutNameSpace #> : global::MessagePack.Formatters.IMessagePackFormatter<<#= objInfo.FullName #>>
<# foreach (var typeArg in objInfo.GenericTypeParameters.Where(x => x.HasConstraints)) {#>
where <#= typeArg.Name #> : <#= typeArg.Constraints #>
@@ -147,5 +143,16 @@ foreach (var objInfo in ObjectSerializationInfos) {
return ____result;
}
}
-<# } #>
-}
+
+<# } #>}
+
+#pragma warning restore 168
+#pragma warning restore 414
+#pragma warning restore 618
+#pragma warning restore 612
+
+#pragma warning restore SA1129 // Do not use default value type constructor
+#pragma warning restore SA1309 // Field names should not begin with underscore
+#pragma warning restore SA1312 // Variable names should begin with lower-case letter
+#pragma warning restore SA1403 // File may only contain a single namespace
+#pragma warning restore SA1649 // File name should match first type name
diff --git a/src/MessagePack.GeneratorCore/Generator/UnionTemplate.cs b/src/MessagePack.GeneratorCore/Generator/UnionTemplate.cs
index 1106f1cb..6ea73cff 100644
--- a/src/MessagePack.GeneratorCore/Generator/UnionTemplate.cs
+++ b/src/MessagePack.GeneratorCore/Generator/UnionTemplate.cs
@@ -34,38 +34,41 @@ namespace MessagePackCompiler.Generator
#pragma warning disable 414
#pragma warning disable 168
-#pragma warning disable SA1200 // Using directives should be placed correctly
#pragma warning disable SA1403 // File may only contain a single namespace
#pragma warning disable SA1649 // File name should match first type name
namespace ");
this.Write(this.ToStringHelper.ToStringWithCulture(Namespace));
- this.Write("\r\n{\r\n using System;\r\n using System.Buffers;\r\n using System.Collections.G" +
- "eneric;\r\n using MessagePack;\r\n\r\n");
+ this.Write("\r\n{\r\n");
foreach(var info in UnionSerializationInfos) {
this.Write(" public sealed class ");
this.Write(this.ToStringHelper.ToStringWithCulture(info.Name));
this.Write("Formatter : global::MessagePack.Formatters.IMessagePackFormatter<");
this.Write(this.ToStringHelper.ToStringWithCulture(info.FullName));
- this.Write(">\r\n {\r\n private readonly Dictionary<RuntimeTypeHandle, KeyValuePair<int" +
- ", int>> typeToKeyAndJumpMap;\r\n private readonly Dictionary<int, int> keyT" +
- "oJumpMap;\r\n\r\n public ");
+ this.Write(@">
+ {
+ private readonly global::System.Collections.Generic.Dictionary<global::System.RuntimeTypeHandle, global::System.Collections.Generic.KeyValuePair<int, int>> typeToKeyAndJumpMap;
+ private readonly global::System.Collections.Generic.Dictionary<int, int> keyToJumpMap;
+
+ public ");
this.Write(this.ToStringHelper.ToStringWithCulture(info.Name));
- this.Write("Formatter()\r\n {\r\n this.typeToKeyAndJumpMap = new Dictionary<Run" +
- "timeTypeHandle, KeyValuePair<int, int>>(");
+ this.Write("Formatter()\r\n {\r\n this.typeToKeyAndJumpMap = new global::System" +
+ ".Collections.Generic.Dictionary<global::System.RuntimeTypeHandle, global::System" +
+ ".Collections.Generic.KeyValuePair<int, int>>(");
this.Write(this.ToStringHelper.ToStringWithCulture(info.SubTypes.Length));
this.Write(", global::MessagePack.Internal.RuntimeTypeHandleEqualityComparer.Default)\r\n " +
" {\r\n");
for(var i = 0; i < info.SubTypes.Length; i++) { var item = info.SubTypes[i];
this.Write(" { typeof(");
this.Write(this.ToStringHelper.ToStringWithCulture(item.Type));
- this.Write(").TypeHandle, new KeyValuePair<int, int>(");
+ this.Write(").TypeHandle, new global::System.Collections.Generic.KeyValuePair<int, int>(");
this.Write(this.ToStringHelper.ToStringWithCulture(item.Key));
this.Write(", ");
this.Write(this.ToStringHelper.ToStringWithCulture(i));
this.Write(") },\r\n");
}
- this.Write(" };\r\n this.keyToJumpMap = new Dictionary<int, int>(");
+ this.Write(" };\r\n this.keyToJumpMap = new global::System.Collections.Ge" +
+ "neric.Dictionary<int, int>(");
this.Write(this.ToStringHelper.ToStringWithCulture(info.SubTypes.Length));
this.Write(")\r\n {\r\n");
for(var i = 0; i < info.SubTypes.Length; i++) { var item = info.SubTypes[i];
@@ -75,12 +78,12 @@ namespace ");
this.Write(this.ToStringHelper.ToStringWithCulture(i));
this.Write(" },\r\n");
}
- this.Write(" };\r\n }\r\n\r\n public void Serialize(ref MessagePackWriter " +
- "writer, ");
+ this.Write(" };\r\n }\r\n\r\n public void Serialize(ref global::MessagePac" +
+ "k.MessagePackWriter writer, ");
this.Write(this.ToStringHelper.ToStringWithCulture(info.FullName));
this.Write(@" value, global::MessagePack.MessagePackSerializerOptions options)
{
- KeyValuePair<int, int> keyValuePair;
+ global::System.Collections.Generic.KeyValuePair<int, int> keyValuePair;
if (value != null && this.typeToKeyAndJumpMap.TryGetValue(value.GetType().TypeHandle, out keyValuePair))
{
writer.WriteArrayHeader(2);
@@ -101,7 +104,7 @@ namespace ");
"\r\n return;\r\n }\r\n\r\n writer.WriteNil();\r\n " +
" }\r\n\r\n public ");
this.Write(this.ToStringHelper.ToStringWithCulture(info.FullName));
- this.Write(@" Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options)
+ this.Write(@" Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options)
{
if (reader.TryReadNil())
{
@@ -110,7 +113,7 @@ namespace ");
if (reader.ReadArrayHeader() != 2)
{
- throw new InvalidOperationException(""Invalid Union data was detected. Type:");
+ throw new global::System.InvalidOperationException(""Invalid Union data was detected. Type:");
this.Write(this.ToStringHelper.ToStringWithCulture(info.FullName));
this.Write("\");\r\n }\r\n\r\n options.Security.DepthStep(ref reader);\r\n " +
" var key = reader.ReadInt32();\r\n\r\n if (!this.keyToJumpMap.TryGet" +
@@ -139,7 +142,6 @@ namespace ");
#pragma warning restore 618
#pragma warning restore 612
-#pragma warning restore SA1200 // Using directives should be placed correctly
#pragma warning restore SA1403 // File may only contain a single namespace
#pragma warning restore SA1649 // File name should match first type name
");
diff --git a/src/MessagePack.GeneratorCore/Generator/UnionTemplate.tt b/src/MessagePack.GeneratorCore/Generator/UnionTemplate.tt
index 216cf3c3..174dd3d2 100644
--- a/src/MessagePack.GeneratorCore/Generator/UnionTemplate.tt
+++ b/src/MessagePack.GeneratorCore/Generator/UnionTemplate.tt
@@ -12,32 +12,26 @@
#pragma warning disable 414
#pragma warning disable 168
-#pragma warning disable SA1200 // Using directives should be placed correctly
#pragma warning disable SA1403 // File may only contain a single namespace
#pragma warning disable SA1649 // File name should match first type name
namespace <#= Namespace #>
{
- using System;
- using System.Buffers;
- using System.Collections.Generic;
- using MessagePack;
-
<# foreach(var info in UnionSerializationInfos) { #>
public sealed class <#= info.Name #>Formatter : global::MessagePack.Formatters.IMessagePackFormatter<<#= info.FullName #>>
{
- private readonly Dictionary<RuntimeTypeHandle, KeyValuePair<int, int>> typeToKeyAndJumpMap;
- private readonly Dictionary<int, int> keyToJumpMap;
+ private readonly global::System.Collections.Generic.Dictionary<global::System.RuntimeTypeHandle, global::System.Collections.Generic.KeyValuePair<int, int>> typeToKeyAndJumpMap;
+ private readonly global::System.Collections.Generic.Dictionary<int, int> keyToJumpMap;
public <#= info.Name #>Formatter()
{
- this.typeToKeyAndJumpMap = new Dictionary<RuntimeTypeHandle, KeyValuePair<int, int>>(<#= info.SubTypes.Length #>, global::MessagePack.Internal.RuntimeTypeHandleEqualityComparer.Default)
+ this.typeToKeyAndJumpMap = new global::System.Collections.Generic.Dictionary<global::System.RuntimeTypeHandle, global::System.Collections.Generic.KeyValuePair<int, int>>(<#= info.SubTypes.Length #>, global::MessagePack.Internal.RuntimeTypeHandleEqualityComparer.Default)
{
<# for(var i = 0; i < info.SubTypes.Length; i++) { var item = info.SubTypes[i]; #>
- { typeof(<#= item.Type #>).TypeHandle, new KeyValuePair<int, int>(<#= item.Key #>, <#= i #>) },
+ { typeof(<#= item.Type #>).TypeHandle, new global::System.Collections.Generic.KeyValuePair<int, int>(<#= item.Key #>, <#= i #>) },
<# } #>
};
- this.keyToJumpMap = new Dictionary<int, int>(<#= info.SubTypes.Length #>)
+ this.keyToJumpMap = new global::System.Collections.Generic.Dictionary<int, int>(<#= info.SubTypes.Length #>)
{
<# for(var i = 0; i < info.SubTypes.Length; i++) { var item = info.SubTypes[i]; #>
{ <#= item.Key #>, <#= i #> },
@@ -45,9 +39,9 @@ namespace <#= Namespace #>
};
}
- public void Serialize(ref MessagePackWriter writer, <#= info.FullName #> value, global::MessagePack.MessagePackSerializerOptions options)
+ public void Serialize(ref global::MessagePack.MessagePackWriter writer, <#= info.FullName #> value, global::MessagePack.MessagePackSerializerOptions options)
{
- KeyValuePair<int, int> keyValuePair;
+ global::System.Collections.Generic.KeyValuePair<int, int> keyValuePair;
if (value != null && this.typeToKeyAndJumpMap.TryGetValue(value.GetType().TypeHandle, out keyValuePair))
{
writer.WriteArrayHeader(2);
@@ -69,7 +63,7 @@ namespace <#= Namespace #>
writer.WriteNil();
}
- public <#= info.FullName #> Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options)
+ public <#= info.FullName #> Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options)
{
if (reader.TryReadNil())
{
@@ -78,7 +72,7 @@ namespace <#= Namespace #>
if (reader.ReadArrayHeader() != 2)
{
- throw new InvalidOperationException("Invalid Union data was detected. Type:<#= info.FullName #>");
+ throw new global::System.InvalidOperationException("Invalid Union data was detected. Type:<#= info.FullName #>");
}
options.Security.DepthStep(ref reader);
@@ -116,6 +110,5 @@ namespace <#= Namespace #>
#pragma warning restore 618
#pragma warning restore 612
-#pragma warning restore SA1200 // Using directives should be placed correctly
#pragma warning restore SA1403 // File may only contain a single namespace
#pragma warning restore SA1649 // File name should match first type name
diff --git a/src/MessagePack.GeneratorCore/MessagePack.GeneratorCore.csproj b/src/MessagePack.GeneratorCore/MessagePack.GeneratorCore.csproj
index 526615e5..df4755e2 100644
--- a/src/MessagePack.GeneratorCore/MessagePack.GeneratorCore.csproj
+++ b/src/MessagePack.GeneratorCore/MessagePack.GeneratorCore.csproj
@@ -11,9 +11,8 @@
</PropertyGroup>
<ItemGroup>
- <PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="3.10.0" />
- <PackageReference Include="Microsoft.Build" Version="15.9.20" />
- <PackageReference Include="System.CodeDom" Version="4.7.0" />
+ <PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.0.1" />
+ <PackageReference Include="System.CodeDom" Version="6.0.0" />
</ItemGroup>
<ItemGroup>
diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/StringInterningFormatter.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/StringInterningFormatter.cs
new file mode 100644
index 00000000..9e07521b
--- /dev/null
+++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/StringInterningFormatter.cs
@@ -0,0 +1,61 @@
+// Copyright (c) All contributors. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using System;
+using Microsoft.NET.StringTools;
+
+namespace MessagePack.Formatters
+{
+ /// <summary>
+ /// A <see cref="string" /> formatter that interns strings on deserialization.
+ /// </summary>
+ public sealed class StringInterningFormatter : IMessagePackFormatter<string>
+ {
+ /// <inheritdoc/>
+ public string Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
+ {
+ if (reader.TryReadNil())
+ {
+ return null;
+ }
+
+ MessagePackReader retryReader = reader;
+ if (reader.TryReadStringSpan(out ReadOnlySpan<byte> bytes))
+ {
+ if (bytes.Length < 4096)
+ {
+ if (bytes.Length == 0)
+ {
+ return string.Empty;
+ }
+
+ Span<char> chars = stackalloc char[bytes.Length];
+ int charLength;
+#if SPAN_BUILTIN
+ charLength = StringEncoding.UTF8.GetChars(bytes, chars);
+#else
+ unsafe
+ {
+ fixed (byte* pBytes = bytes)
+ fixed (char* pChars = chars)
+ {
+ charLength = StringEncoding.UTF8.GetChars(pBytes, bytes.Length, pChars, chars.Length);
+ }
+ }
+#endif
+ return Strings.WeakIntern(chars.Slice(0, charLength));
+ }
+ else
+ {
+ // Rewind the reader to the start of the string because we're taking the slow path.
+ reader = retryReader;
+ }
+ }
+
+ return Strings.WeakIntern(reader.ReadString());
+ }
+
+ /// <inheritdoc/>
+ public void Serialize(ref MessagePackWriter writer, string value, MessagePackSerializerOptions options) => writer.Write(value);
+ }
+}
diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePack.asmdef b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePack.asmdef
index f1e851eb..ff7f5b38 100644
--- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePack.asmdef
+++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePack.asmdef
@@ -13,9 +13,10 @@
"System.Buffers.dll",
"System.Threading.Tasks.Extensions.dll",
"System.Runtime.CompilerServices.Unsafe.dll",
+ "Microsoft.NET.StringTools.dll",
"System.Runtime.Extensions.dll"
],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": []
-} \ No newline at end of file
+}
diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSecurity.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSecurity.cs
index 2136d125..2b743afa 100644
--- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSecurity.cs
+++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSecurity.cs
@@ -334,8 +334,8 @@ namespace MessagePack
value = float.NaN;
}
- long l = *(long*)&value;
- return HashCode.Combine((int)(l >> 32), unchecked((int)l));
+ int l = *(int*)&value;
+ return l;
}
}
diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.cs
index e5992be7..24b5373c 100644
--- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.cs
+++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.cs
@@ -19,6 +19,7 @@ namespace MessagePack
public static partial class MessagePackSerializer
{
private const int MaxHintSize = 1024 * 1024;
+ private static MessagePackSerializerOptions defaultOptions;
/// <summary>
/// Gets or sets the default set of options to use when not explicitly specified for a method call.
@@ -32,7 +33,20 @@ namespace MessagePack
/// If you are an app author, realize that setting this property impacts the entire application so it should only be
/// set once, and before any use of <see cref="MessagePackSerializer"/> occurs.
/// </remarks>
- public static MessagePackSerializerOptions DefaultOptions { get; set; } = MessagePackSerializerOptions.Standard;
+ public static MessagePackSerializerOptions DefaultOptions
+ {
+ get
+ {
+ if (defaultOptions is null)
+ {
+ defaultOptions = MessagePackSerializerOptions.Standard;
+ }
+
+ return defaultOptions;
+ }
+
+ set => defaultOptions = value;
+ }
/// <summary>
/// A thread-local, recyclable array that may be used for short bursts of code.
diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs
index 7d41720e..771aa25f 100644
--- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs
+++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs
@@ -38,7 +38,7 @@ namespace MessagePack
/// <summary>
/// Initializes a new instance of the <see cref="MessagePackSerializerOptions"/> class.
/// </summary>
- protected internal MessagePackSerializerOptions(IFormatterResolver resolver)
+ public MessagePackSerializerOptions(IFormatterResolver resolver)
{
this.Resolver = resolver ?? throw new ArgumentNullException(nameof(resolver));
}
diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/package.json b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/package.json
index 677cba61..5e7b60bd 100644
--- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/package.json
+++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/package.json
@@ -1,7 +1,7 @@
{
"name": "com.neuecc.messagepack",
"displayName": "MessagePack",
- "version": "2.3.74",
+ "version": "2.4.1-alpha",
"unity": "2018.4",
"description": "Extremely Fast MessagePack Serializer for C#.",
"keywords": [
diff --git a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/StringInterningTests.cs b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/StringInterningTests.cs
new file mode 100644
index 00000000..d4e98f77
--- /dev/null
+++ b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/StringInterningTests.cs
@@ -0,0 +1,107 @@
+// Copyright (c) All contributors. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using MessagePack.Formatters;
+using MessagePack.Resolvers;
+using Nerdbank.Streams;
+using Xunit;
+
+namespace MessagePack.Tests
+{
+ public class StringInterningTests
+ {
+ [Fact]
+ public void NullString()
+ {
+ var seq = new Sequence<byte>();
+ var writer = new MessagePackWriter(seq);
+ writer.WriteNil();
+ writer.Flush();
+
+ var reader = new MessagePackReader(seq);
+ string result = StandardResolver.Instance.GetFormatter<string>().Deserialize(ref reader, MessagePackSerializerOptions.Standard);
+ Assert.Null(result);
+ }
+
+ [Fact]
+ public void EmptyString()
+ {
+ var seq = new Sequence<byte>();
+ var writer = new MessagePackWriter(seq);
+ writer.Write(string.Empty);
+ writer.Flush();
+
+ var reader = new MessagePackReader(seq);
+ string result = StandardResolver.Instance.GetFormatter<string>().Deserialize(ref reader, MessagePackSerializerOptions.Standard);
+ Assert.Same(string.Empty, result);
+ }
+
+ [Theory]
+ [InlineData(3)]
+ [InlineData(1024 * 1024)]
+ public void EquivalentStringsGetSharedInstance(int length)
+ {
+ string originalValue1 = new string('a', length);
+ string originalValue3 = new string('b', length);
+ var seq = new Sequence<byte>();
+ var writer = new MessagePackWriter(seq);
+ writer.Write(originalValue1);
+ writer.Write(originalValue1);
+ writer.Write(originalValue3);
+ writer.Flush();
+
+ var reader = new MessagePackReader(seq);
+ var formatter = new StringInterningFormatter();
+ string value1 = formatter.Deserialize(ref reader, MessagePackSerializerOptions.Standard);
+ string value2 = formatter.Deserialize(ref reader, MessagePackSerializerOptions.Standard);
+ string value3 = formatter.Deserialize(ref reader, MessagePackSerializerOptions.Standard);
+
+ Assert.Equal(originalValue1, value1);
+ Assert.Equal(originalValue3, value3);
+
+ Assert.Same(value1, value2);
+ }
+
+ [Fact]
+ public void StringMemberInterning()
+ {
+ ClassOfStrings before = new ClassOfStrings { InternedString = "abc", OrdinaryString = "def" };
+ ClassOfStrings after1 = MessagePackSerializer.Deserialize<ClassOfStrings>(MessagePackSerializer.Serialize(before, MessagePackSerializerOptions.Standard), MessagePackSerializerOptions.Standard);
+ ClassOfStrings after2 = MessagePackSerializer.Deserialize<ClassOfStrings>(MessagePackSerializer.Serialize(before, MessagePackSerializerOptions.Standard), MessagePackSerializerOptions.Standard);
+ Assert.Equal(after1.InternedString, after2.InternedString);
+ Assert.Equal(after1.OrdinaryString, after2.OrdinaryString);
+
+ Assert.Same(after1.InternedString, after2.InternedString);
+ Assert.NotSame(after1.OrdinaryString, after2.OrdinaryString);
+ }
+
+ [Fact]
+ public void StringMemberInterning_CustomResolver()
+ {
+ var options = MessagePackSerializerOptions.Standard.WithResolver(
+ CompositeResolver.Create(
+ new IMessagePackFormatter[] { new StringInterningFormatter() },
+ new IFormatterResolver[] { StandardResolver.Instance }));
+
+ ClassOfStrings before = new ClassOfStrings { InternedString = "abc", OrdinaryString = "def" };
+ ClassOfStrings after1 = MessagePackSerializer.Deserialize<ClassOfStrings>(MessagePackSerializer.Serialize(before, options), options);
+ ClassOfStrings after2 = MessagePackSerializer.Deserialize<ClassOfStrings>(MessagePackSerializer.Serialize(before, options), options);
+ Assert.Equal(after1.InternedString, after2.InternedString);
+ Assert.Equal(after1.OrdinaryString, after2.OrdinaryString);
+
+ Assert.Same(after1.InternedString, after2.InternedString);
+ Assert.Same(after1.OrdinaryString, after2.OrdinaryString);
+ }
+
+ [MessagePackObject]
+ public class ClassOfStrings
+ {
+ [Key(0)]
+ [MessagePackFormatter(typeof(StringInterningFormatter))]
+ public string InternedString { get; set; }
+
+ [Key(1)]
+ public string OrdinaryString { get; set; }
+ }
+ }
+}
diff --git a/src/MessagePack.UnityClient/Assets/Scripts/Tests/Shims/XUnit.cs b/src/MessagePack.UnityClient/Assets/Scripts/Tests/Shims/XUnit.cs
index c83b4d51..f1eee269 100644
--- a/src/MessagePack.UnityClient/Assets/Scripts/Tests/Shims/XUnit.cs
+++ b/src/MessagePack.UnityClient/Assets/Scripts/Tests/Shims/XUnit.cs
@@ -130,6 +130,11 @@ namespace Xunit
{
NUnit.Framework.Assert.AreSame(expected, actual);
}
+
+ public static void NotSame(object expected, object actual)
+ {
+ NUnit.Framework.Assert.AreNotSame(expected, actual);
+ }
}
[Serializable]
diff --git a/src/MessagePack.UnityClient/copy_assets.bat b/src/MessagePack.UnityClient/copy_assets.bat
index bb7232df..c2b03f0e 100644
--- a/src/MessagePack.UnityClient/copy_assets.bat
+++ b/src/MessagePack.UnityClient/copy_assets.bat
@@ -11,6 +11,7 @@
echo F | xcopy "..\..\bin\MessagePack\release\netstandard2.0\publish\System.Buffers.dll" ".\Assets\Plugins\System.Buffers.dll" /Y /I
echo F | xcopy "..\..\bin\MessagePack\release\netstandard2.0\publish\System.Memory.dll" ".\Assets\Plugins\System.Memory.dll" /Y /I
echo F | xcopy "..\..\bin\MessagePack\release\netstandard2.0\publish\System.Runtime.CompilerServices.Unsafe.dll" ".\Assets\Plugins\System.Runtime.CompilerServices.Unsafe.dll" /Y /I
+echo F | xcopy "..\..\bin\MessagePack\release\netstandard2.0\publish\Microsoft.NET.StringTools.dll" ".\Assets\Plugins\Microsoft.NET.StringTools.dll" /Y /I
echo F | xcopy "..\..\bin\MessagePack\release\netstandard2.0\publish\System.Threading.Tasks.Extensions.dll" ".\Assets\Plugins\System.Threading.Tasks.Extensions.dll" /Y /I
@popd
diff --git a/src/MessagePack.UnityClient/copy_assets.sh b/src/MessagePack.UnityClient/copy_assets.sh
index 9912ab97..7743fd66 100755
--- a/src/MessagePack.UnityClient/copy_assets.sh
+++ b/src/MessagePack.UnityClient/copy_assets.sh
@@ -21,4 +21,5 @@ fi
cp ${SCRIPT_DIR}/../../bin/MessagePack/${BUILDCONFIGURATION}/netstandard2.0/publish/System.Buffers.dll ${SCRIPT_DIR}/Assets/Plugins/System.Buffers.dll
cp ${SCRIPT_DIR}/../../bin/MessagePack/${BUILDCONFIGURATION}/netstandard2.0/publish/System.Memory.dll ${SCRIPT_DIR}/Assets/Plugins/System.Memory.dll
cp ${SCRIPT_DIR}/../../bin/MessagePack/${BUILDCONFIGURATION}/netstandard2.0/publish/System.Runtime.CompilerServices.Unsafe.dll ${SCRIPT_DIR}/Assets/Plugins/System.Runtime.CompilerServices.Unsafe.dll
+cp ${SCRIPT_DIR}/../../bin/MessagePack/${BUILDCONFIGURATION}/netstandard2.0/publish/Microsoft.NET.StringTools.dll ${SCRIPT_DIR}/Assets/Plugins/Microsoft.NET.StringTools.dll
cp ${SCRIPT_DIR}/../../bin/MessagePack/${BUILDCONFIGURATION}/netstandard2.0/publish/System.Threading.Tasks.Extensions.dll ${SCRIPT_DIR}/Assets/Plugins/System.Threading.Tasks.Extensions.dll
diff --git a/src/MessagePack/MessagePack.csproj b/src/MessagePack/MessagePack.csproj
index bffdded8..cb24047a 100644
--- a/src/MessagePack/MessagePack.csproj
+++ b/src/MessagePack/MessagePack.csproj
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
- <TargetFrameworks>netstandard2.0;netcoreapp3.1;net5.0</TargetFrameworks>
+ <TargetFrameworks>netstandard2.0;netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
<NoWarn>$(NoWarn);CS0649</NoWarn>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<DefineConstants Condition=" '$(TargetFramework)' != 'netstandard2.0' ">$(DefineConstants);SPAN_BUILTIN</DefineConstants>
@@ -33,16 +33,15 @@
</ItemGroup>
<ItemGroup>
- <PackageReference Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" Version="3.3.2" PrivateAssets="all" />
+ <PackageReference Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" Version="3.3.3" PrivateAssets="all" />
+ <PackageReference Include="Microsoft.NET.StringTools" Version="1.0.0" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
- <PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="1.0.0" />
- <PackageReference Include="System.Collections.Immutable" Version="1.5.0" />
- <PackageReference Include="System.Reflection.Emit" Version="4.6.0" />
- <PackageReference Include="System.Reflection.Emit.Lightweight" Version="4.6.0" />
- <PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.3" />
- <PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.5.2" />
- <PackageReference Include="System.Memory" Version="4.5.3" />
+ <PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="6.0.0" />
+ <PackageReference Include="System.Collections.Immutable" Version="1.7.1" />
+ <PackageReference Include="System.Reflection.Emit" Version="4.7.0" />
+ <PackageReference Include="System.Reflection.Emit.Lightweight" Version="4.7.0" />
+ <PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.4" />
</ItemGroup>
<ItemGroup>
diff --git a/src/MessagePack/net5.0/PublicAPI.Shipped.txt b/src/MessagePack/net5.0/PublicAPI.Shipped.txt
index 25b01a77..b0a1a3dc 100644
--- a/src/MessagePack/net5.0/PublicAPI.Shipped.txt
+++ b/src/MessagePack/net5.0/PublicAPI.Shipped.txt
@@ -1150,3 +1150,31 @@ static readonly MessagePack.ImmutableCollection.ImmutableCollectionResolver.Inst
static readonly MessagePack.Resolvers.ExpandoObjectResolver.Instance -> MessagePack.IFormatterResolver
static readonly MessagePack.Resolvers.ExpandoObjectResolver.Options -> MessagePack.MessagePackSerializerOptions
virtual MessagePack.Formatters.PrimitiveObjectFormatter.DeserializeMap(ref MessagePack.MessagePackReader reader, int length, MessagePack.MessagePackSerializerOptions options) -> object
+MessagePack.ExtensionHeader.ExtensionHeader() -> void
+MessagePack.ExtensionResult.ExtensionResult() -> void
+MessagePack.FormatterNotRegisteredException.FormatterNotRegisteredException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) -> void
+MessagePack.Formatters.HalfFormatter
+MessagePack.Formatters.HalfFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Half
+MessagePack.Formatters.HalfFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Half value, MessagePack.MessagePackSerializerOptions options) -> void
+MessagePack.Formatters.InterfaceReadOnlySetFormatter<T>
+MessagePack.Formatters.InterfaceReadOnlySetFormatter<T>.InterfaceReadOnlySetFormatter() -> void
+MessagePack.MessagePackReader.MessagePackReader() -> void
+MessagePack.MessagePackSerializerOptions.SequencePool.get -> MessagePack.SequencePool
+MessagePack.MessagePackSerializerOptions.WithPool(MessagePack.SequencePool pool) -> MessagePack.MessagePackSerializerOptions
+MessagePack.MessagePackStreamReader.MessagePackStreamReader(System.IO.Stream stream, bool leaveOpen, MessagePack.SequencePool sequencePool) -> void
+MessagePack.MessagePackStreamReader.ReadArrayHeaderAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask<int>
+MessagePack.MessagePackStreamReader.ReadMapHeaderAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask<int>
+MessagePack.MessagePackWriter.MessagePackWriter() -> void
+MessagePack.SequencePool
+MessagePack.SequencePool.SequencePool() -> void
+MessagePack.SequencePool.SequencePool(int maxSize) -> void
+MessagePack.SequencePool.SequencePool(int maxSize, System.Buffers.ArrayPool<byte> arrayPool) -> void
+MessagePack.TinyJsonException.TinyJsonException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) -> void
+static MessagePack.Nil.operator !=(MessagePack.Nil left, MessagePack.Nil right) -> bool
+static MessagePack.Nil.operator ==(MessagePack.Nil left, MessagePack.Nil right) -> bool
+static readonly MessagePack.Formatters.HalfFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter<System.Half>
+virtual MessagePack.MessagePackStreamReader.Dispose(bool disposing) -> void
+MessagePack.Formatters.GenericEnumerableFormatter<TElement, TCollection>
+MessagePack.Formatters.GenericEnumerableFormatter<TElement, TCollection>.GenericEnumerableFormatter() -> void
+MessagePack.Formatters.GenericReadOnlyDictionaryFormatter<TKey, TValue, TDictionary>
+MessagePack.Formatters.GenericReadOnlyDictionaryFormatter<TKey, TValue, TDictionary>.GenericReadOnlyDictionaryFormatter() -> void
diff --git a/src/MessagePack/net5.0/PublicAPI.Unshipped.txt b/src/MessagePack/net5.0/PublicAPI.Unshipped.txt
index dca33bb1..49e84ad1 100644
--- a/src/MessagePack/net5.0/PublicAPI.Unshipped.txt
+++ b/src/MessagePack/net5.0/PublicAPI.Unshipped.txt
@@ -1,30 +1,6 @@
-MessagePack.ExtensionHeader.ExtensionHeader() -> void
-MessagePack.ExtensionResult.ExtensionResult() -> void
-MessagePack.FormatterNotRegisteredException.FormatterNotRegisteredException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) -> void
-MessagePack.Formatters.HalfFormatter
-MessagePack.Formatters.HalfFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Half
-MessagePack.Formatters.HalfFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Half value, MessagePack.MessagePackSerializerOptions options) -> void
-MessagePack.Formatters.InterfaceReadOnlySetFormatter<T>
-MessagePack.Formatters.InterfaceReadOnlySetFormatter<T>.InterfaceReadOnlySetFormatter() -> void
-MessagePack.MessagePackReader.MessagePackReader() -> void
-MessagePack.MessagePackSerializerOptions.SequencePool.get -> MessagePack.SequencePool
-MessagePack.MessagePackSerializerOptions.WithPool(MessagePack.SequencePool pool) -> MessagePack.MessagePackSerializerOptions
-MessagePack.MessagePackSerializerOptions.WithCompressionMinLength(int compressionMinLength) -> MessagePack.MessagePackSerializerOptions
+MessagePack.Formatters.StringInterningFormatter
+MessagePack.Formatters.StringInterningFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> string
+MessagePack.Formatters.StringInterningFormatter.Serialize(ref MessagePack.MessagePackWriter writer, string value, MessagePack.MessagePackSerializerOptions options) -> void
+MessagePack.Formatters.StringInterningFormatter.StringInterningFormatter() -> void
MessagePack.MessagePackSerializerOptions.CompressionMinLength.get -> int
-MessagePack.MessagePackStreamReader.MessagePackStreamReader(System.IO.Stream stream, bool leaveOpen, MessagePack.SequencePool sequencePool) -> void
-MessagePack.MessagePackStreamReader.ReadArrayHeaderAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask<int>
-MessagePack.MessagePackStreamReader.ReadMapHeaderAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask<int>
-MessagePack.MessagePackWriter.MessagePackWriter() -> void
-MessagePack.SequencePool
-MessagePack.SequencePool.SequencePool() -> void
-MessagePack.SequencePool.SequencePool(int maxSize) -> void
-MessagePack.SequencePool.SequencePool(int maxSize, System.Buffers.ArrayPool<byte> arrayPool) -> void
-MessagePack.TinyJsonException.TinyJsonException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) -> void
-static MessagePack.Nil.operator !=(MessagePack.Nil left, MessagePack.Nil right) -> bool
-static MessagePack.Nil.operator ==(MessagePack.Nil left, MessagePack.Nil right) -> bool
-static readonly MessagePack.Formatters.HalfFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter<System.Half>
-virtual MessagePack.MessagePackStreamReader.Dispose(bool disposing) -> void
-MessagePack.Formatters.GenericEnumerableFormatter<TElement, TCollection>
-MessagePack.Formatters.GenericEnumerableFormatter<TElement, TCollection>.GenericEnumerableFormatter() -> void
-MessagePack.Formatters.GenericReadOnlyDictionaryFormatter<TKey, TValue, TDictionary>
-MessagePack.Formatters.GenericReadOnlyDictionaryFormatter<TKey, TValue, TDictionary>.GenericReadOnlyDictionaryFormatter() -> void
+MessagePack.MessagePackSerializerOptions.WithCompressionMinLength(int compressionMinLength) -> MessagePack.MessagePackSerializerOptions \ No newline at end of file
diff --git a/src/MessagePack/netcoreapp2.1/PublicAPI.Shipped.txt b/src/MessagePack/net6.0/PublicAPI.Shipped.txt
index 8aabf5dc..b0a1a3dc 100644
--- a/src/MessagePack/netcoreapp2.1/PublicAPI.Shipped.txt
+++ b/src/MessagePack/net6.0/PublicAPI.Shipped.txt
@@ -1,4 +1,4 @@
-MessagePack.ExtensionHeader
+MessagePack.ExtensionHeader
MessagePack.ExtensionHeader.ExtensionHeader(sbyte typeCode, int length) -> void
MessagePack.ExtensionHeader.ExtensionHeader(sbyte typeCode, uint length) -> void
MessagePack.ExtensionHeader.Length.get -> uint
@@ -1015,9 +1015,7 @@ MessagePack.MessagePackSerializerOptions.Security.get -> MessagePack.MessagePack
MessagePack.MessagePackSerializerOptions.WithSecurity(MessagePack.MessagePackSecurity security) -> MessagePack.MessagePackSerializerOptions
MessagePack.MessagePackStreamReader.DiscardBufferedData() -> void
MessagePack.MessagePackStreamReader.MessagePackStreamReader(System.IO.Stream stream, bool leaveOpen) -> void
-MessagePack.MessagePackStreamReader.ReadArrayHeaderAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask<int>
MessagePack.MessagePackStreamReader.ReadArrayAsync(System.Threading.CancellationToken cancellationToken) -> System.Collections.Generic.IAsyncEnumerable<System.Buffers.ReadOnlySequence<byte>>
-MessagePack.MessagePackStreamReader.ReadMapHeaderAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask<int>
MessagePack.MessagePackWriter.WriteBinHeader(int length) -> void
MessagePack.MessagePackWriter.WriteStringHeader(int byteCount) -> void
static readonly MessagePack.MessagePackSecurity.TrustedData -> MessagePack.MessagePackSecurity
@@ -1152,3 +1150,31 @@ static readonly MessagePack.ImmutableCollection.ImmutableCollectionResolver.Inst
static readonly MessagePack.Resolvers.ExpandoObjectResolver.Instance -> MessagePack.IFormatterResolver
static readonly MessagePack.Resolvers.ExpandoObjectResolver.Options -> MessagePack.MessagePackSerializerOptions
virtual MessagePack.Formatters.PrimitiveObjectFormatter.DeserializeMap(ref MessagePack.MessagePackReader reader, int length, MessagePack.MessagePackSerializerOptions options) -> object
+MessagePack.ExtensionHeader.ExtensionHeader() -> void
+MessagePack.ExtensionResult.ExtensionResult() -> void
+MessagePack.FormatterNotRegisteredException.FormatterNotRegisteredException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) -> void
+MessagePack.Formatters.HalfFormatter
+MessagePack.Formatters.HalfFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Half
+MessagePack.Formatters.HalfFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Half value, MessagePack.MessagePackSerializerOptions options) -> void
+MessagePack.Formatters.InterfaceReadOnlySetFormatter<T>
+MessagePack.Formatters.InterfaceReadOnlySetFormatter<T>.InterfaceReadOnlySetFormatter() -> void
+MessagePack.MessagePackReader.MessagePackReader() -> void
+MessagePack.MessagePackSerializerOptions.SequencePool.get -> MessagePack.SequencePool
+MessagePack.MessagePackSerializerOptions.WithPool(MessagePack.SequencePool pool) -> MessagePack.MessagePackSerializerOptions
+MessagePack.MessagePackStreamReader.MessagePackStreamReader(System.IO.Stream stream, bool leaveOpen, MessagePack.SequencePool sequencePool) -> void
+MessagePack.MessagePackStreamReader.ReadArrayHeaderAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask<int>
+MessagePack.MessagePackStreamReader.ReadMapHeaderAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask<int>
+MessagePack.MessagePackWriter.MessagePackWriter() -> void
+MessagePack.SequencePool
+MessagePack.SequencePool.SequencePool() -> void
+MessagePack.SequencePool.SequencePool(int maxSize) -> void
+MessagePack.SequencePool.SequencePool(int maxSize, System.Buffers.ArrayPool<byte> arrayPool) -> void
+MessagePack.TinyJsonException.TinyJsonException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) -> void
+static MessagePack.Nil.operator !=(MessagePack.Nil left, MessagePack.Nil right) -> bool
+static MessagePack.Nil.operator ==(MessagePack.Nil left, MessagePack.Nil right) -> bool
+static readonly MessagePack.Formatters.HalfFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter<System.Half>
+virtual MessagePack.MessagePackStreamReader.Dispose(bool disposing) -> void
+MessagePack.Formatters.GenericEnumerableFormatter<TElement, TCollection>
+MessagePack.Formatters.GenericEnumerableFormatter<TElement, TCollection>.GenericEnumerableFormatter() -> void
+MessagePack.Formatters.GenericReadOnlyDictionaryFormatter<TKey, TValue, TDictionary>
+MessagePack.Formatters.GenericReadOnlyDictionaryFormatter<TKey, TValue, TDictionary>.GenericReadOnlyDictionaryFormatter() -> void
diff --git a/src/MessagePack/net6.0/PublicAPI.Unshipped.txt b/src/MessagePack/net6.0/PublicAPI.Unshipped.txt
new file mode 100644
index 00000000..9ba64088
--- /dev/null
+++ b/src/MessagePack/net6.0/PublicAPI.Unshipped.txt
@@ -0,0 +1,6 @@
+MessagePack.Formatters.StringInterningFormatter
+MessagePack.Formatters.StringInterningFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> string
+MessagePack.Formatters.StringInterningFormatter.Serialize(ref MessagePack.MessagePackWriter writer, string value, MessagePack.MessagePackSerializerOptions options) -> void
+MessagePack.Formatters.StringInterningFormatter.StringInterningFormatter() -> void
+MessagePack.MessagePackSerializerOptions.CompressionMinLength.get -> int
+MessagePack.MessagePackSerializerOptions.WithCompressionMinLength(int compressionMinLength) -> MessagePack.MessagePackSerializerOptions
diff --git a/src/MessagePack/netcoreapp2.1/PublicAPI.Unshipped.txt b/src/MessagePack/netcoreapp2.1/PublicAPI.Unshipped.txt
deleted file mode 100644
index b2746b1b..00000000
--- a/src/MessagePack/netcoreapp2.1/PublicAPI.Unshipped.txt
+++ /dev/null
@@ -1,22 +0,0 @@
-MessagePack.ExtensionHeader.ExtensionHeader() -> void
-MessagePack.ExtensionResult.ExtensionResult() -> void
-MessagePack.FormatterNotRegisteredException.FormatterNotRegisteredException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) -> void
-MessagePack.MessagePackReader.MessagePackReader() -> void
-MessagePack.MessagePackSerializerOptions.SequencePool.get -> MessagePack.SequencePool
-MessagePack.MessagePackSerializerOptions.WithPool(MessagePack.SequencePool pool) -> MessagePack.MessagePackSerializerOptions
-MessagePack.MessagePackSerializerOptions.WithCompressionMinLength(int compressionMinLength) -> MessagePack.MessagePackSerializerOptions
-MessagePack.MessagePackSerializerOptions.CompressionMinLength.get -> int
-MessagePack.MessagePackStreamReader.MessagePackStreamReader(System.IO.Stream stream, bool leaveOpen, MessagePack.SequencePool sequencePool) -> void
-MessagePack.MessagePackWriter.MessagePackWriter() -> void
-MessagePack.SequencePool
-MessagePack.SequencePool.SequencePool() -> void
-MessagePack.SequencePool.SequencePool(int maxSize) -> void
-MessagePack.SequencePool.SequencePool(int maxSize, System.Buffers.ArrayPool<byte> arrayPool) -> void
-MessagePack.TinyJsonException.TinyJsonException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) -> void
-static MessagePack.Nil.operator !=(MessagePack.Nil left, MessagePack.Nil right) -> bool
-static MessagePack.Nil.operator ==(MessagePack.Nil left, MessagePack.Nil right) -> bool
-virtual MessagePack.MessagePackStreamReader.Dispose(bool disposing) -> void
-MessagePack.Formatters.GenericEnumerableFormatter<TElement, TCollection>
-MessagePack.Formatters.GenericEnumerableFormatter<TElement, TCollection>.GenericEnumerableFormatter() -> void
-MessagePack.Formatters.GenericReadOnlyDictionaryFormatter<TKey, TValue, TDictionary>
-MessagePack.Formatters.GenericReadOnlyDictionaryFormatter<TKey, TValue, TDictionary>.GenericReadOnlyDictionaryFormatter() -> void
diff --git a/src/MessagePack/netcoreapp3.1/PublicAPI.Shipped.txt b/src/MessagePack/netcoreapp3.1/PublicAPI.Shipped.txt
index 892718f0..51002a49 100644
--- a/src/MessagePack/netcoreapp3.1/PublicAPI.Shipped.txt
+++ b/src/MessagePack/netcoreapp3.1/PublicAPI.Shipped.txt
@@ -1,4 +1,4 @@
-MessagePack.ExtensionHeader
+MessagePack.ExtensionHeader
MessagePack.ExtensionHeader.ExtensionHeader(sbyte typeCode, int length) -> void
MessagePack.ExtensionHeader.ExtensionHeader(sbyte typeCode, uint length) -> void
MessagePack.ExtensionHeader.Length.get -> uint
@@ -1150,3 +1150,25 @@ static readonly MessagePack.ImmutableCollection.ImmutableCollectionResolver.Inst
static readonly MessagePack.Resolvers.ExpandoObjectResolver.Instance -> MessagePack.IFormatterResolver
static readonly MessagePack.Resolvers.ExpandoObjectResolver.Options -> MessagePack.MessagePackSerializerOptions
virtual MessagePack.Formatters.PrimitiveObjectFormatter.DeserializeMap(ref MessagePack.MessagePackReader reader, int length, MessagePack.MessagePackSerializerOptions options) -> object
+MessagePack.ExtensionHeader.ExtensionHeader() -> void
+MessagePack.ExtensionResult.ExtensionResult() -> void
+MessagePack.FormatterNotRegisteredException.FormatterNotRegisteredException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) -> void
+MessagePack.MessagePackReader.MessagePackReader() -> void
+MessagePack.MessagePackSerializerOptions.SequencePool.get -> MessagePack.SequencePool
+MessagePack.MessagePackSerializerOptions.WithPool(MessagePack.SequencePool pool) -> MessagePack.MessagePackSerializerOptions
+MessagePack.MessagePackStreamReader.MessagePackStreamReader(System.IO.Stream stream, bool leaveOpen, MessagePack.SequencePool sequencePool) -> void
+MessagePack.MessagePackStreamReader.ReadArrayHeaderAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask<int>
+MessagePack.MessagePackStreamReader.ReadMapHeaderAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask<int>
+MessagePack.MessagePackWriter.MessagePackWriter() -> void
+MessagePack.SequencePool
+MessagePack.SequencePool.SequencePool() -> void
+MessagePack.SequencePool.SequencePool(int maxSize) -> void
+MessagePack.SequencePool.SequencePool(int maxSize, System.Buffers.ArrayPool<byte> arrayPool) -> void
+MessagePack.TinyJsonException.TinyJsonException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) -> void
+static MessagePack.Nil.operator !=(MessagePack.Nil left, MessagePack.Nil right) -> bool
+static MessagePack.Nil.operator ==(MessagePack.Nil left, MessagePack.Nil right) -> bool
+virtual MessagePack.MessagePackStreamReader.Dispose(bool disposing) -> void
+MessagePack.Formatters.GenericEnumerableFormatter<TElement, TCollection>
+MessagePack.Formatters.GenericEnumerableFormatter<TElement, TCollection>.GenericEnumerableFormatter() -> void
+MessagePack.Formatters.GenericReadOnlyDictionaryFormatter<TKey, TValue, TDictionary>
+MessagePack.Formatters.GenericReadOnlyDictionaryFormatter<TKey, TValue, TDictionary>.GenericReadOnlyDictionaryFormatter() -> void
diff --git a/src/MessagePack/netcoreapp3.1/PublicAPI.Unshipped.txt b/src/MessagePack/netcoreapp3.1/PublicAPI.Unshipped.txt
index 8b63c2e9..9ba64088 100644
--- a/src/MessagePack/netcoreapp3.1/PublicAPI.Unshipped.txt
+++ b/src/MessagePack/netcoreapp3.1/PublicAPI.Unshipped.txt
@@ -1,24 +1,6 @@
-MessagePack.ExtensionHeader.ExtensionHeader() -> void
-MessagePack.ExtensionResult.ExtensionResult() -> void
-MessagePack.FormatterNotRegisteredException.FormatterNotRegisteredException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) -> void
-MessagePack.MessagePackReader.MessagePackReader() -> void
-MessagePack.MessagePackSerializerOptions.SequencePool.get -> MessagePack.SequencePool
-MessagePack.MessagePackSerializerOptions.WithPool(MessagePack.SequencePool pool) -> MessagePack.MessagePackSerializerOptions
-MessagePack.MessagePackSerializerOptions.WithCompressionMinLength(int compressionMinLength) -> MessagePack.MessagePackSerializerOptions
+MessagePack.Formatters.StringInterningFormatter
+MessagePack.Formatters.StringInterningFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> string
+MessagePack.Formatters.StringInterningFormatter.Serialize(ref MessagePack.MessagePackWriter writer, string value, MessagePack.MessagePackSerializerOptions options) -> void
+MessagePack.Formatters.StringInterningFormatter.StringInterningFormatter() -> void
MessagePack.MessagePackSerializerOptions.CompressionMinLength.get -> int
-MessagePack.MessagePackStreamReader.MessagePackStreamReader(System.IO.Stream stream, bool leaveOpen, MessagePack.SequencePool sequencePool) -> void
-MessagePack.MessagePackStreamReader.ReadArrayHeaderAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask<int>
-MessagePack.MessagePackStreamReader.ReadMapHeaderAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask<int>
-MessagePack.MessagePackWriter.MessagePackWriter() -> void
-MessagePack.SequencePool
-MessagePack.SequencePool.SequencePool() -> void
-MessagePack.SequencePool.SequencePool(int maxSize) -> void
-MessagePack.SequencePool.SequencePool(int maxSize, System.Buffers.ArrayPool<byte> arrayPool) -> void
-MessagePack.TinyJsonException.TinyJsonException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) -> void
-static MessagePack.Nil.operator !=(MessagePack.Nil left, MessagePack.Nil right) -> bool
-static MessagePack.Nil.operator ==(MessagePack.Nil left, MessagePack.Nil right) -> bool
-virtual MessagePack.MessagePackStreamReader.Dispose(bool disposing) -> void
-MessagePack.Formatters.GenericEnumerableFormatter<TElement, TCollection>
-MessagePack.Formatters.GenericEnumerableFormatter<TElement, TCollection>.GenericEnumerableFormatter() -> void
-MessagePack.Formatters.GenericReadOnlyDictionaryFormatter<TKey, TValue, TDictionary>
-MessagePack.Formatters.GenericReadOnlyDictionaryFormatter<TKey, TValue, TDictionary>.GenericReadOnlyDictionaryFormatter() -> void
+MessagePack.MessagePackSerializerOptions.WithCompressionMinLength(int compressionMinLength) -> MessagePack.MessagePackSerializerOptions
diff --git a/src/MessagePack/netstandard2.0/PublicAPI.Shipped.txt b/src/MessagePack/netstandard2.0/PublicAPI.Shipped.txt
index 892718f0..51002a49 100644
--- a/src/MessagePack/netstandard2.0/PublicAPI.Shipped.txt
+++ b/src/MessagePack/netstandard2.0/PublicAPI.Shipped.txt
@@ -1,4 +1,4 @@
-MessagePack.ExtensionHeader
+MessagePack.ExtensionHeader
MessagePack.ExtensionHeader.ExtensionHeader(sbyte typeCode, int length) -> void
MessagePack.ExtensionHeader.ExtensionHeader(sbyte typeCode, uint length) -> void
MessagePack.ExtensionHeader.Length.get -> uint
@@ -1150,3 +1150,25 @@ static readonly MessagePack.ImmutableCollection.ImmutableCollectionResolver.Inst
static readonly MessagePack.Resolvers.ExpandoObjectResolver.Instance -> MessagePack.IFormatterResolver
static readonly MessagePack.Resolvers.ExpandoObjectResolver.Options -> MessagePack.MessagePackSerializerOptions
virtual MessagePack.Formatters.PrimitiveObjectFormatter.DeserializeMap(ref MessagePack.MessagePackReader reader, int length, MessagePack.MessagePackSerializerOptions options) -> object
+MessagePack.ExtensionHeader.ExtensionHeader() -> void
+MessagePack.ExtensionResult.ExtensionResult() -> void
+MessagePack.FormatterNotRegisteredException.FormatterNotRegisteredException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) -> void
+MessagePack.MessagePackReader.MessagePackReader() -> void
+MessagePack.MessagePackSerializerOptions.SequencePool.get -> MessagePack.SequencePool
+MessagePack.MessagePackSerializerOptions.WithPool(MessagePack.SequencePool pool) -> MessagePack.MessagePackSerializerOptions
+MessagePack.MessagePackStreamReader.MessagePackStreamReader(System.IO.Stream stream, bool leaveOpen, MessagePack.SequencePool sequencePool) -> void
+MessagePack.MessagePackStreamReader.ReadArrayHeaderAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask<int>
+MessagePack.MessagePackStreamReader.ReadMapHeaderAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask<int>
+MessagePack.MessagePackWriter.MessagePackWriter() -> void
+MessagePack.SequencePool
+MessagePack.SequencePool.SequencePool() -> void
+MessagePack.SequencePool.SequencePool(int maxSize) -> void
+MessagePack.SequencePool.SequencePool(int maxSize, System.Buffers.ArrayPool<byte> arrayPool) -> void
+MessagePack.TinyJsonException.TinyJsonException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) -> void
+static MessagePack.Nil.operator !=(MessagePack.Nil left, MessagePack.Nil right) -> bool
+static MessagePack.Nil.operator ==(MessagePack.Nil left, MessagePack.Nil right) -> bool
+virtual MessagePack.MessagePackStreamReader.Dispose(bool disposing) -> void
+MessagePack.Formatters.GenericEnumerableFormatter<TElement, TCollection>
+MessagePack.Formatters.GenericEnumerableFormatter<TElement, TCollection>.GenericEnumerableFormatter() -> void
+MessagePack.Formatters.GenericReadOnlyDictionaryFormatter<TKey, TValue, TDictionary>
+MessagePack.Formatters.GenericReadOnlyDictionaryFormatter<TKey, TValue, TDictionary>.GenericReadOnlyDictionaryFormatter() -> void
diff --git a/src/MessagePack/netstandard2.0/PublicAPI.Unshipped.txt b/src/MessagePack/netstandard2.0/PublicAPI.Unshipped.txt
index 8b63c2e9..49e84ad1 100644
--- a/src/MessagePack/netstandard2.0/PublicAPI.Unshipped.txt
+++ b/src/MessagePack/netstandard2.0/PublicAPI.Unshipped.txt
@@ -1,24 +1,6 @@
-MessagePack.ExtensionHeader.ExtensionHeader() -> void
-MessagePack.ExtensionResult.ExtensionResult() -> void
-MessagePack.FormatterNotRegisteredException.FormatterNotRegisteredException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) -> void
-MessagePack.MessagePackReader.MessagePackReader() -> void
-MessagePack.MessagePackSerializerOptions.SequencePool.get -> MessagePack.SequencePool
-MessagePack.MessagePackSerializerOptions.WithPool(MessagePack.SequencePool pool) -> MessagePack.MessagePackSerializerOptions
-MessagePack.MessagePackSerializerOptions.WithCompressionMinLength(int compressionMinLength) -> MessagePack.MessagePackSerializerOptions
+MessagePack.Formatters.StringInterningFormatter
+MessagePack.Formatters.StringInterningFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> string
+MessagePack.Formatters.StringInterningFormatter.Serialize(ref MessagePack.MessagePackWriter writer, string value, MessagePack.MessagePackSerializerOptions options) -> void
+MessagePack.Formatters.StringInterningFormatter.StringInterningFormatter() -> void
MessagePack.MessagePackSerializerOptions.CompressionMinLength.get -> int
-MessagePack.MessagePackStreamReader.MessagePackStreamReader(System.IO.Stream stream, bool leaveOpen, MessagePack.SequencePool sequencePool) -> void
-MessagePack.MessagePackStreamReader.ReadArrayHeaderAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask<int>
-MessagePack.MessagePackStreamReader.ReadMapHeaderAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask<int>
-MessagePack.MessagePackWriter.MessagePackWriter() -> void
-MessagePack.SequencePool
-MessagePack.SequencePool.SequencePool() -> void
-MessagePack.SequencePool.SequencePool(int maxSize) -> void
-MessagePack.SequencePool.SequencePool(int maxSize, System.Buffers.ArrayPool<byte> arrayPool) -> void
-MessagePack.TinyJsonException.TinyJsonException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) -> void
-static MessagePack.Nil.operator !=(MessagePack.Nil left, MessagePack.Nil right) -> bool
-static MessagePack.Nil.operator ==(MessagePack.Nil left, MessagePack.Nil right) -> bool
-virtual MessagePack.MessagePackStreamReader.Dispose(bool disposing) -> void
-MessagePack.Formatters.GenericEnumerableFormatter<TElement, TCollection>
-MessagePack.Formatters.GenericEnumerableFormatter<TElement, TCollection>.GenericEnumerableFormatter() -> void
-MessagePack.Formatters.GenericReadOnlyDictionaryFormatter<TKey, TValue, TDictionary>
-MessagePack.Formatters.GenericReadOnlyDictionaryFormatter<TKey, TValue, TDictionary>.GenericReadOnlyDictionaryFormatter() -> void
+MessagePack.MessagePackSerializerOptions.WithCompressionMinLength(int compressionMinLength) -> MessagePack.MessagePackSerializerOptions \ No newline at end of file
diff --git a/src/MessagePackAnalyzer/MessagePackAnalyzer.csproj b/src/MessagePackAnalyzer/MessagePackAnalyzer.csproj
index 51952963..5a5a18f8 100644
--- a/src/MessagePackAnalyzer/MessagePackAnalyzer.csproj
+++ b/src/MessagePackAnalyzer/MessagePackAnalyzer.csproj
@@ -11,6 +11,7 @@
<TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);PackBuildOutputs</TargetsForTfmSpecificContentInPackage>
<SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
<IncludeSymbols>false</IncludeSymbols>
+ <DevelopmentDependency>true</DevelopmentDependency>
</PropertyGroup>
<ItemGroup>
<Content Include="tools\*.ps1" Pack="true" PackagePath="tools\" />
diff --git a/tests/MessagePack.Tests/MessagePack.Tests.csproj b/tests/MessagePack.Tests/MessagePack.Tests.csproj
index 2e5229df..9f7d9832 100644
--- a/tests/MessagePack.Tests/MessagePack.Tests.csproj
+++ b/tests/MessagePack.Tests/MessagePack.Tests.csproj
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
- <TargetFrameworks>net472;netcoreapp3.1;net5.0</TargetFrameworks>
+ <TargetFrameworks>net472;netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- <LangVersion>9.0</LangVersion>
+ <LangVersion>10</LangVersion>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
<NoWarn>$(NoWarn);CS1701</NoWarn>
diff --git a/tools/Install-DotNetSdk.ps1 b/tools/Install-DotNetSdk.ps1
index fac05df7..0606d802 100755
--- a/tools/Install-DotNetSdk.ps1
+++ b/tools/Install-DotNetSdk.ps1
@@ -29,6 +29,12 @@ $DotNetInstallScriptRoot = Resolve-Path $DotNetInstallScriptRoot
# Look up actual required .NET Core SDK version from global.json
$sdkVersion = & "$PSScriptRoot/../azure-pipelines/variables/DotNetSdkVersion.ps1"
+$arch = [System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture
+if (!$arch) { # Windows Powershell leaves this blank
+ $arch = 'x64'
+ if ($env:PROCESSOR_ARCHITECTURE -eq 'ARM64') { $arch = 'ARM64' }
+}
+
# Search for all .NET Core runtime versions referenced from MSBuild projects and arrange to install them.
$runtimeVersions = @()
$windowsDesktopRuntimeVersions = @()
@@ -44,13 +50,22 @@ Get-ChildItem "$PSScriptRoot\..\src\*.*proj","$PSScriptRoot\..\tests\*.*proj","$
}
}
}
- $targetFrameworks |? { $_ -match 'netcoreapp(\d+\.\d+)' } |% {
+ $targetFrameworks |? { $_ -match 'net(?:coreapp)?(\d+\.\d+)' } |% {
$v = $Matches[1]
$runtimeVersions += $v
if ($v -ge '3.0' -and -not ($IsMacOS -or $IsLinux)) {
$windowsDesktopRuntimeVersions += $v
}
}
+
+ # Add target frameworks of the form: netXX
+ $targetFrameworks |? { $_ -match 'net(\d+\.\d+)' } |% {
+ $v = $Matches[1]
+ $runtimeVersions += $v
+ if (-not ($IsMacOS -or $IsLinux)) {
+ $windowsDesktopRuntimeVersions += $v
+ }
+ }
}
Function Get-FileFromWeb([Uri]$Uri, $OutDir) {
@@ -77,7 +92,7 @@ Function Get-InstallerExe($Version, [switch]$Runtime) {
$Version = $versionInfo[-1]
}
- Get-FileFromWeb -Uri "https://dotnetcli.blob.core.windows.net/dotnet/$sdkOrRuntime/$Version/dotnet-$($sdkOrRuntime.ToLowerInvariant())-$Version-win-x64.exe" -OutDir "$DotNetInstallScriptRoot"
+ Get-FileFromWeb -Uri "https://dotnetcli.blob.core.windows.net/dotnet/$sdkOrRuntime/$Version/dotnet-$($sdkOrRuntime.ToLowerInvariant())-$Version-win-$arch.exe" -OutDir "$DotNetInstallScriptRoot"
}
Function Install-DotNet($Version, [switch]$Runtime) {
@@ -94,7 +109,7 @@ Function Install-DotNet($Version, [switch]$Runtime) {
}
$switches = @(
- '-Architecture','x64'
+ '-Architecture',$arch
)
$envVars = @{
# For locally installed dotnet, skip first time experience which takes a long time
@@ -142,10 +157,10 @@ if ($DotNetInstallDir) {
}
if ($IsMacOS -or $IsLinux) {
- $DownloadUri = "https://raw.githubusercontent.com/dotnet/install-scripts/49d5da7f7d313aa65d24fe95cc29767faef553fd/src/dotnet-install.sh"
+ $DownloadUri = "https://raw.githubusercontent.com/dotnet/install-scripts/781752509a890ca7520f1182e8bae71f9a53d754/src/dotnet-install.sh"
$DotNetInstallScriptPath = "$DotNetInstallScriptRoot/dotnet-install.sh"
} else {
- $DownloadUri = "https://raw.githubusercontent.com/dotnet/install-scripts/49d5da7f7d313aa65d24fe95cc29767faef553fd/src/dotnet-install.ps1"
+ $DownloadUri = "https://raw.githubusercontent.com/dotnet/install-scripts/781752509a890ca7520f1182e8bae71f9a53d754/src/dotnet-install.ps1"
$DotNetInstallScriptPath = "$DotNetInstallScriptRoot/dotnet-install.ps1"
}
diff --git a/version.json b/version.json
index 5d063bf1..6fc917f3 100644
--- a/version.json
+++ b/version.json
@@ -1,6 +1,6 @@
{
"$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
- "version": "2.3",
+ "version": "2.4-alpha",
"publicReleaseRefSpec": [
"^refs/heads/master$",
"^refs/heads/v1\\.x$",