diff --git a/.editorconfig b/.editorconfig
index 93780010d..e84d0f554 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -246,5 +246,20 @@ dotnet_diagnostic.SA1618.severity = suggestion
# CA2016: Forward the CancellationToken parameter
dotnet_diagnostic.CA2016.severity = warning
+# SA1005: Single line comments should begin with single space
+dotnet_diagnostic.SA1005.severity = none
+
+# SA1507: Code should not contain multiple blank lines in a row
+dotnet_diagnostic.SA1507.severity = none
+
+# SA1508: Closing braces should not be preceded by blank line
+dotnet_diagnostic.SA1508.severity = none
+
+# SA1512: Single-line comments should not be followed by blank line
+dotnet_diagnostic.SA1512.severity = none
+
+# SA1515: Single-line comment should be preceded by blank line
+dotnet_diagnostic.SA1515.severity = none
+
[*.sln]
indent_style = tab
diff --git a/Directory.Build.props b/Directory.Build.props
index 45f9074ea..2c647f7e6 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -40,9 +40,4 @@
-
-
- $(PackageProjectUrl)/releases/tag/v$(Version)
-
-
diff --git a/Directory.Packages.props b/Directory.Packages.props
index 5226cce82..a6460ff45 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -56,7 +56,6 @@
-
@@ -74,8 +73,7 @@
-
-
+
diff --git a/MessagePack.sln b/MessagePack.sln
index 20bb730cd..77756e3c0 100644
--- a/MessagePack.sln
+++ b/MessagePack.sln
@@ -56,7 +56,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{301F812B
global.json = global.json
nuget.config = nuget.config
stylecop.json = stylecop.json
- version.json = version.json
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MessagePack.AspNetCoreMvcFormatter.Tests", "tests\MessagePack.AspNetCoreMvcFormatter.Tests\MessagePack.AspNetCoreMvcFormatter.Tests.csproj", "{79C2B2CB-872A-4BA9-82DC-60F6DD77F940}"
diff --git a/bin/MessagePack.SourceGenerator/Debug/netstandard2.0/package.json b/bin/MessagePack.SourceGenerator/Debug/netstandard2.0/package.json
deleted file mode 100644
index f0b521b78..000000000
--- a/bin/MessagePack.SourceGenerator/Debug/netstandard2.0/package.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "name": "com.github.messagepack.sourcegenerator.internal",
- "displayName": "MessagePack Source Generator Internal",
- "author": {
- "name": "MessagePack-CSharp",
- "url": "https://github.com/MessagePack-CSharp/MessagePack-CSharp"
- },
- "version": "1.0.0",
- "unity": "2021.3",
- "description": "Internal Package of MessagePack Source Generator for development time.",
- "keywords": [
- "Serialization"
- ],
- "license": "MIT",
- "category": "Scripting",
- "dependencies": {}
-}
diff --git a/bin/MessagePack/Debug/netstandard2.1/MessagePack.Analyzers.CodeFixes.dll.meta b/bin/MessagePack/Debug/netstandard2.1/MessagePack.Analyzers.CodeFixes.dll.meta
new file mode 100644
index 000000000..0b2f22a5e
--- /dev/null
+++ b/bin/MessagePack/Debug/netstandard2.1/MessagePack.Analyzers.CodeFixes.dll.meta
@@ -0,0 +1,71 @@
+fileFormatVersion: 2
+guid: 891c05d4b21294248acbe7e80ae1a4fb
+labels:
+- RoslynAnalyzer
+PluginImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ iconMap: {}
+ executionOrder: {}
+ defineConstraints: []
+ isPreloaded: 0
+ isOverridable: 1
+ isExplicitlyReferenced: 1
+ validateReferences: 0
+ platformData:
+ - first:
+ : Any
+ second:
+ enabled: 0
+ settings:
+ Exclude Editor: 1
+ Exclude Linux64: 1
+ Exclude OSXUniversal: 1
+ Exclude Win: 1
+ Exclude Win64: 1
+ - first:
+ Any:
+ second:
+ enabled: 0
+ settings: {}
+ - first:
+ Editor: Editor
+ second:
+ enabled: 0
+ settings:
+ CPU: AnyCPU
+ DefaultValueInitialized: true
+ OS: AnyOS
+ - first:
+ Standalone: Linux64
+ second:
+ enabled: 0
+ settings:
+ CPU: None
+ - first:
+ Standalone: OSXUniversal
+ second:
+ enabled: 0
+ settings:
+ CPU: None
+ - first:
+ Standalone: Win
+ second:
+ enabled: 0
+ settings:
+ CPU: None
+ - first:
+ Standalone: Win64
+ second:
+ enabled: 0
+ settings:
+ CPU: None
+ - first:
+ Windows Store Apps: WindowsStoreApps
+ second:
+ enabled: 0
+ settings:
+ CPU: AnyCPU
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/src/MessagePack.UnityClient/Assets/Scripts/Tests/csc.rsp.meta b/bin/MessagePack/Debug/netstandard2.1/MessagePack.Analyzers.CodeFixes.xml.meta
similarity index 62%
rename from src/MessagePack.UnityClient/Assets/Scripts/Tests/csc.rsp.meta
rename to bin/MessagePack/Debug/netstandard2.1/MessagePack.Analyzers.CodeFixes.xml.meta
index 54f13a60a..7ab33553f 100644
--- a/src/MessagePack.UnityClient/Assets/Scripts/Tests/csc.rsp.meta
+++ b/bin/MessagePack/Debug/netstandard2.1/MessagePack.Analyzers.CodeFixes.xml.meta
@@ -1,6 +1,6 @@
fileFormatVersion: 2
-guid: a5089cf55e6b95e41af4f6d06b4c4f47
-DefaultImporter:
+guid: 4f2de8ccc64b20e4c9a0396761e4833a
+TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
diff --git a/bin/MessagePack/Debug/netstandard2.1/MessagePack.Analyzers.dll.meta b/bin/MessagePack/Debug/netstandard2.1/MessagePack.Analyzers.dll.meta
new file mode 100644
index 000000000..3f2b25b6c
--- /dev/null
+++ b/bin/MessagePack/Debug/netstandard2.1/MessagePack.Analyzers.dll.meta
@@ -0,0 +1,45 @@
+fileFormatVersion: 2
+guid: 892214273c923364eb684f3d7859fe0b
+labels:
+- RoslynAnalyzer
+PluginImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ iconMap: {}
+ executionOrder: {}
+ defineConstraints: []
+ isPreloaded: 0
+ isOverridable: 1
+ isExplicitlyReferenced: 1
+ validateReferences: 0
+ platformData:
+ - first:
+ : Any
+ second:
+ enabled: 0
+ settings:
+ Exclude Editor: 1
+ Exclude Linux64: 1
+ Exclude OSXUniversal: 1
+ Exclude Win: 1
+ Exclude Win64: 1
+ - first:
+ Any:
+ second:
+ enabled: 0
+ settings: {}
+ - first:
+ Editor: Editor
+ second:
+ enabled: 0
+ settings:
+ DefaultValueInitialized: true
+ - first:
+ Windows Store Apps: WindowsStoreApps
+ second:
+ enabled: 0
+ settings:
+ CPU: AnyCPU
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/bin/MessagePack.SourceGenerator/Debug/netstandard2.0/package.json.meta b/bin/MessagePack/Debug/netstandard2.1/MessagePack.Analyzers.xml.meta
similarity index 60%
rename from bin/MessagePack.SourceGenerator/Debug/netstandard2.0/package.json.meta
rename to bin/MessagePack/Debug/netstandard2.1/MessagePack.Analyzers.xml.meta
index 0f3652560..40a2450ee 100644
--- a/bin/MessagePack.SourceGenerator/Debug/netstandard2.0/package.json.meta
+++ b/bin/MessagePack/Debug/netstandard2.1/MessagePack.Analyzers.xml.meta
@@ -1,6 +1,6 @@
fileFormatVersion: 2
-guid: b69d955db27568847bd720f7392dbd0c
-PackageManifestImporter:
+guid: 88463aa60e4b9b441adcbe51a85df913
+TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
diff --git a/bin/MessagePack/Debug/netstandard2.1/MessagePack.Annotations.xml.meta b/bin/MessagePack/Debug/netstandard2.1/MessagePack.Annotations.xml.meta
new file mode 100644
index 000000000..3807f7c74
--- /dev/null
+++ b/bin/MessagePack/Debug/netstandard2.1/MessagePack.Annotations.xml.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 540772e8d33295746891820d923d6eff
+TextScriptImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/bin/MessagePack.SourceGenerator/Debug/netstandard2.0/MessagePack.SourceGenerator.dll.meta b/bin/MessagePack/Debug/netstandard2.1/MessagePack.SourceGenerator.dll.meta
similarity index 52%
rename from bin/MessagePack.SourceGenerator/Debug/netstandard2.0/MessagePack.SourceGenerator.dll.meta
rename to bin/MessagePack/Debug/netstandard2.1/MessagePack.SourceGenerator.dll.meta
index d69780839..c0b1f55ec 100644
--- a/bin/MessagePack.SourceGenerator/Debug/netstandard2.0/MessagePack.SourceGenerator.dll.meta
+++ b/bin/MessagePack/Debug/netstandard2.1/MessagePack.SourceGenerator.dll.meta
@@ -10,35 +10,19 @@ PluginImporter:
defineConstraints: []
isPreloaded: 0
isOverridable: 1
- isExplicitlyReferenced: 0
- validateReferences: 1
+ isExplicitlyReferenced: 1
+ validateReferences: 0
platformData:
- first:
: Any
second:
enabled: 0
settings:
- 'Exclude ': 0
- Exclude Android: 0
- Exclude CloudRendering: 0
- Exclude EmbeddedLinux: 0
- Exclude GameCoreScarlett: 0
- Exclude GameCoreXboxOne: 0
- Exclude Linux64: 0
- Exclude OSXUniversal: 0
- Exclude PS4: 0
- Exclude PS5: 0
- Exclude QNX: 0
- Exclude Stadia: 0
- Exclude Switch: 0
- Exclude VisionOS: 0
- Exclude WebGL: 0
- Exclude Win: 0
- Exclude Win64: 0
- Exclude WindowsStoreApps: 0
- Exclude XboxOne: 0
- Exclude iOS: 0
- Exclude tvOS: 0
+ Exclude Editor: 1
+ Exclude Linux64: 1
+ Exclude OSXUniversal: 1
+ Exclude Win: 1
+ Exclude Win64: 1
- first:
Any:
second:
diff --git a/bin/MessagePack/Debug/netstandard2.1/MessagePack.SourceGenerator.xml.meta b/bin/MessagePack/Debug/netstandard2.1/MessagePack.SourceGenerator.xml.meta
new file mode 100644
index 000000000..5e478298d
--- /dev/null
+++ b/bin/MessagePack/Debug/netstandard2.1/MessagePack.SourceGenerator.xml.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 5b419071c2e21e9469fa6971585b48f3
+TextScriptImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/bin/MessagePack/Debug/netstandard2.1/MessagePack.deps.json.meta b/bin/MessagePack/Debug/netstandard2.1/MessagePack.deps.json.meta
new file mode 100644
index 000000000..c56c26511
--- /dev/null
+++ b/bin/MessagePack/Debug/netstandard2.1/MessagePack.deps.json.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 2aa609d1a0a772b4791a8bfabc13df17
+TextScriptImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/bin/MessagePack/Debug/netstandard2.1/MessagePack.xml.meta b/bin/MessagePack/Debug/netstandard2.1/MessagePack.xml.meta
new file mode 100644
index 000000000..f717945b2
--- /dev/null
+++ b/bin/MessagePack/Debug/netstandard2.1/MessagePack.xml.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 7fb1b483dd594c143bfd6495d9e9b234
+TextScriptImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/global.json b/global.json
index 1f0eafb45..088f23e11 100644
--- a/global.json
+++ b/global.json
@@ -1,6 +1,6 @@
{
"sdk": {
- "version": "8.0.402",
+ "version": "9.0.100",
"rollForward": "patch",
"allowPrerelease": false
}
diff --git a/sandbox/Sandbox/Program.cs b/sandbox/Sandbox/Program.cs
index f07327ad9..e2112ff14 100644
--- a/sandbox/Sandbox/Program.cs
+++ b/sandbox/Sandbox/Program.cs
@@ -6,6 +6,7 @@
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
+using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.IO.Compression;
@@ -27,854 +28,851 @@
#pragma warning disable SA1402 // File may only contain a single type
#pragma warning disable SA1649 // File name should match first type name
-namespace Sandbox
-{
- [ZeroFormattable]
- [ProtoBuf.ProtoContract]
- [MessagePackObject]
- public class Person : IEquatable
- {
- [Index(0)]
- [Key(0)]
- [MsgPack.Serialization.MessagePackMember(0)]
- [ProtoMember(1)]
- public virtual int Age { get; set; }
+namespace Sandbox;
- [Index(1)]
- [Key(1)]
- [MsgPack.Serialization.MessagePackMember(1)]
- [ProtoMember(2)]
- public virtual string FirstName { get; set; }
+internal class Program
+{
+ private static readonly MessagePackSerializerOptions LZ4Standard = MessagePackSerializerOptions.Standard.WithCompression(MessagePackCompression.Lz4Block);
- [Index(2)]
- [Key(2)]
- [MsgPack.Serialization.MessagePackMember(2)]
- [ProtoMember(3)]
- public virtual string LastName { get; set; }
+ private static void Main(string[] args)
+ {
+ // MessagePackSerializer.Serialize(i);
- [Index(3)]
- [MsgPack.Serialization.MessagePackMember(3)]
- [Key(3)]
- [ProtoMember(4)]
- public virtual Sex Sex { get; set; }
- public bool Equals(Person other)
- {
- return this.Age == other.Age && this.FirstName == other.FirstName && this.LastName == other.LastName && this.Sex == other.Sex;
- }
}
- public enum Sex : sbyte
+ private static void Benchmark(T target)
{
- Unknown,
- Male,
- Female,
- }
+ const int Iteration = 10000; // 10000
- public class TestCollection : ICollection
- {
- public List internalCollection = new List();
+ var jsonSerializer = new JsonSerializer();
+ MsgPack.Serialization.SerializationContext msgpack = MsgPack.Serialization.SerializationContext.Default;
+ msgpack.GetSerializer().PackSingleObject(target);
+ MessagePackSerializer.Serialize(target);
+ MessagePackSerializer.Serialize(target, LZ4Standard);
+ ZeroFormatter.ZeroFormatterSerializer.Serialize(target);
+ ProtoBuf.Serializer.Serialize(new MemoryStream(), target);
+ jsonSerializer.Serialize(new JsonTextWriter(new StringWriter()), target);
- public int Count => this.internalCollection.Count;
+ Console.WriteLine(typeof(T).Name + " serialization test");
+ Console.WriteLine();
- public bool IsReadOnly => throw new NotImplementedException();
+ Console.WriteLine("Serialize::");
+ byte[] data = null;
+ byte[] data0 = null;
+ byte[] data1 = null;
+ byte[] data2 = null;
+ byte[] data3 = null;
+ byte[] dataJson = null;
+ byte[] dataGzipJson = null;
+ using (new Measure("MsgPack-Cli"))
+ {
+ for (int i = 0; i < Iteration; i++)
+ {
+ data = msgpack.GetSerializer().PackSingleObject(target);
+ }
+ }
- public void Add(T item)
+ using (new Measure("MessagePack-CSharp"))
{
- this.internalCollection.Add(item);
+ for (int i = 0; i < Iteration; i++)
+ {
+ data0 = MessagePackSerializer.Serialize(target);
+ }
}
- public void Clear()
+ using (new Measure("MessagePack(LZ4)"))
{
- throw new NotImplementedException();
+ for (int i = 0; i < Iteration; i++)
+ {
+ data3 = MessagePackSerializer.Serialize(target, LZ4Standard);
+ }
}
- public bool Contains(T item)
+ using (new Measure("ZeroFormatter"))
{
- throw new NotImplementedException();
+ for (int i = 0; i < Iteration; i++)
+ {
+ data1 = ZeroFormatter.ZeroFormatterSerializer.Serialize(target);
+ }
}
- public void CopyTo(T[] array, int arrayIndex)
+ using (new Measure("JsonNet"))
{
- throw new NotImplementedException();
+ for (int i = 0; i < Iteration; i++)
+ {
+ using (var ms = new MemoryStream())
+ using (var sw = new StreamWriter(ms, Encoding.UTF8, 1024, true))
+ using (var jw = new JsonTextWriter(sw))
+ {
+ jsonSerializer.Serialize(jw, target);
+ }
+ }
}
- public IEnumerator GetEnumerator()
+ using (new Measure("JsonNet+Gzip"))
{
- return this.internalCollection.GetEnumerator();
+ for (int i = 0; i < Iteration; i++)
+ {
+ using (var ms = new MemoryStream())
+ using (var gzip = new GZipStream(ms, CompressionLevel.Fastest))
+ using (var sw = new StreamWriter(gzip, Encoding.UTF8, 1024, true))
+ using (var jw = new JsonTextWriter(sw))
+ {
+ jsonSerializer.Serialize(jw, target);
+ }
+ }
}
- public bool Remove(T item)
+ using (new Measure("protobuf-net"))
{
- throw new NotImplementedException();
+ for (int i = 0; i < Iteration; i++)
+ {
+ using (var ms = new MemoryStream())
+ {
+ ProtoBuf.Serializer.Serialize(ms, target);
+ }
+ }
}
- IEnumerator IEnumerable.GetEnumerator()
+ using (var ms = new MemoryStream())
{
- throw new NotImplementedException();
+ ProtoBuf.Serializer.Serialize(ms, target);
+ data2 = ms.ToArray();
}
- }
- [MessagePackObject(true)]
- public class Takox
- {
-#pragma warning disable SA1300 // Element should begin with upper-case letter
- public int hoga { get; set; }
+ using (var ms = new MemoryStream())
+ {
+ using (var sw = new StreamWriter(ms, Encoding.UTF8, 1024, true))
+ using (var jw = new JsonTextWriter(sw))
+ {
+ jsonSerializer.Serialize(jw, target);
+ }
- public int huga { get; set; }
+ dataJson = ms.ToArray();
+ }
- public int tako { get; set; }
-#pragma warning restore SA1300 // Element should begin with upper-case letter
- }
+ using (var ms = new MemoryStream())
+ {
+ using (var gzip = new GZipStream(ms, CompressionLevel.Fastest))
+ using (var sw = new StreamWriter(gzip, Encoding.UTF8, 1024, true))
+ using (var jw = new JsonTextWriter(sw))
+ {
+ jsonSerializer.Serialize(jw, target);
+ }
- [MessagePackObject]
- public class MyClass
- {
- // Key is serialization index, it is important for versioning.
- [Key(0)]
- public int Age { get; set; }
+ dataGzipJson = ms.ToArray();
+ }
- [Key(1)]
- public string FirstName { get; set; }
+ msgpack.GetSerializer().UnpackSingleObject(data);
+ MessagePackSerializer.Deserialize(data0);
+ ZeroFormatterSerializer.Deserialize(data1);
+ ProtoBuf.Serializer.Deserialize(new MemoryStream(data2));
+ MessagePackSerializer.Deserialize(data3, LZ4Standard);
+ jsonSerializer.Deserialize(new JsonTextReader(new StreamReader(new MemoryStream(dataJson))));
- [Key(2)]
- public string LastName { get; set; }
+ Console.WriteLine();
+ Console.WriteLine("Deserialize::");
- // public members and does not serialize target, mark IgnoreMemberttribute
- [IgnoreMember]
- public string FullName => this.FirstName + this.LastName;
- }
+ using (new Measure("MsgPack-Cli"))
+ {
+ for (int i = 0; i < Iteration; i++)
+ {
+ msgpack.GetSerializer().UnpackSingleObject(data);
+ }
+ }
- [MessagePackObject(keyAsPropertyName: true)]
- public class Sample1
- {
- [Key(0)]
- public int Foo { get; set; }
+ using (new Measure("MessagePack-CSharp"))
+ {
+ for (int i = 0; i < Iteration; i++)
+ {
+ MessagePackSerializer.Deserialize(data0);
+ }
+ }
- [Key(1)]
- public int Bar { get; set; }
- }
+ using (new Measure("MessagePack(LZ4)"))
+ {
+ for (int i = 0; i < Iteration; i++)
+ {
+ MessagePackSerializer.Deserialize(data3, LZ4Standard);
+ }
+ }
- [MessagePackObject]
- public class Sample2
- {
- [Key("foo")]
- public int Foo { get; set; }
+ using (new Measure("ZeroFormatter"))
+ {
+ for (int i = 0; i < Iteration; i++)
+ {
+ ZeroFormatterSerializer.Deserialize(data1);
+ }
+ }
- [Key("bar")]
- public int Bar { get; set; }
- }
+ using (new Measure("JsonNet"))
+ {
+ for (int i = 0; i < Iteration; i++)
+ {
+ using (var ms = new MemoryStream(dataJson))
+ using (var sr = new StreamReader(ms, Encoding.UTF8))
+ using (var jr = new JsonTextReader(sr))
+ {
+ jsonSerializer.Deserialize(jr);
+ }
+ }
+ }
- [MessagePackObject]
- public class IntKeySample
- {
- [Key(3)]
- public int A { get; set; }
+ using (new Measure("JsonNet+Gzip"))
+ {
+ for (int i = 0; i < Iteration; i++)
+ {
+ using (var ms = new MemoryStream(dataGzipJson))
+ using (var gzip = new GZipStream(ms, CompressionMode.Decompress))
+ using (var sr = new StreamReader(gzip, Encoding.UTF8))
+ using (var jr = new JsonTextReader(sr))
+ {
+ jsonSerializer.Deserialize(jr);
+ }
+ }
+ }
+
+ using (new Measure("protobuf-net"))
+ {
+ for (int i = 0; i < Iteration; i++)
+ {
+ using (var ms = new MemoryStream(data2))
+ {
+ ProtoBuf.Serializer.Deserialize(ms);
+ }
+ }
+ }
- [Key(10)]
- public int B { get; set; }
+ Console.WriteLine();
+ Console.WriteLine("FileSize::");
+ var label = string.Empty;
+ label = "MsgPack-Cli";
+ Console.WriteLine($"{label,20} {data.Length} Byte");
+ label = "MessagePack-CSharp";
+ Console.WriteLine($"{label,20} {data0.Length} Byte");
+ label = "MessagePack(LZ4)";
+ Console.WriteLine($"{label,20} {data3.Length} Byte");
+ label = "ZeroFormatter";
+ Console.WriteLine($"{label,20} {data1.Length} Byte");
+ label = "protobuf-net";
+ Console.WriteLine($"{label,20} {data2.Length} Byte");
+ label = "JsonNet";
+ Console.WriteLine($"{label,20} {dataJson.Length} Byte");
+ label = "JsonNet+GZip";
+ Console.WriteLine($"{label,20} {dataGzipJson.Length} Byte");
+
+ Console.WriteLine();
+ Console.WriteLine();
}
- public class ContractlessSample
+ private static string ToHumanReadableSize(long size)
{
- public int MyProperty1 { get; set; }
-
- public int MyProperty2 { get; set; }
+ return ToHumanReadableSize(new long?(size));
}
- [MessagePackObject]
- public class SampleCallback : IMessagePackSerializationCallbackReceiver
+ private static string ToHumanReadableSize(long? size)
{
- [Key(0)]
- public int Key { get; set; }
+ if (size == null)
+ {
+ return "NULL";
+ }
+
+ double bytes = size.Value;
- public void OnBeforeSerialize()
+ if (bytes <= 1024)
{
- Console.WriteLine("OnBefore");
+ return bytes.ToString("f2") + " B";
}
- public void OnAfterDeserialize()
+ bytes = bytes / 1024;
+ if (bytes <= 1024)
{
- Console.WriteLine("OnAfter");
+ return bytes.ToString("f2") + " KB";
}
- }
- [MessagePackObject]
- public struct Point
- {
- [Key(0)]
- public readonly int X;
- [Key(1)]
- public readonly int Y;
+ bytes = bytes / 1024;
+ if (bytes <= 1024)
+ {
+ return bytes.ToString("f2") + " MB";
+ }
- // can't find matched constructor parameter, parameterType mismatch. type:Point parameterIndex:0 parameterType:ValueTuple`2
- public Point((int, int) p)
+ bytes = bytes / 1024;
+ if (bytes <= 1024)
{
- this.X = p.Item1;
- this.Y = p.Item2;
+ return bytes.ToString("f2") + " GB";
}
- [SerializationConstructor]
- public Point(int x, int y)
+ bytes = bytes / 1024;
+ if (bytes <= 1024)
{
- this.X = x;
- this.Y = y;
+ return bytes.ToString("f2") + " TB";
}
- }
- // mark inheritance types
- [MessagePack.Union(0, typeof(FooClass))]
- [MessagePack.Union(100, typeof(BarClass))]
- public interface IUnionSample
- {
- }
+ bytes = bytes / 1024;
+ if (bytes <= 1024)
+ {
+ return bytes.ToString("f2") + " PB";
+ }
- [MessagePackObject]
- public class FooClass : IUnionSample
- {
- [Key(0)]
- public int XYZ { get; set; }
+ bytes = bytes / 1024;
+ if (bytes <= 1024)
+ {
+ return bytes.ToString("f2") + " EB";
+ }
+
+ bytes = bytes / 1024;
+ return bytes + " ZB";
}
+}
- [MessagePackObject]
- public class BarClass : IUnionSample
+[ZeroFormattable]
+[ProtoBuf.ProtoContract]
+[MessagePackObject]
+public class Person : IEquatable
+{
+ [Index(0)]
+ [Key(0)]
+ [MsgPack.Serialization.MessagePackMember(0)]
+ [ProtoMember(1)]
+ public virtual int Age { get; set; }
+
+ [Index(1)]
+ [Key(1)]
+ [MsgPack.Serialization.MessagePackMember(1)]
+ [ProtoMember(2)]
+ public virtual string FirstName { get; set; }
+
+ [Index(2)]
+ [Key(2)]
+ [MsgPack.Serialization.MessagePackMember(2)]
+ [ProtoMember(3)]
+ public virtual string LastName { get; set; }
+
+ [Index(3)]
+ [MsgPack.Serialization.MessagePackMember(3)]
+ [Key(3)]
+ [ProtoMember(4)]
+ public virtual Sex Sex { get; set; }
+
+ public bool Equals(Person other)
{
- [Key(0)]
- public string OPQ { get; set; }
+ return this.Age == other.Age && this.FirstName == other.FirstName && this.LastName == other.LastName && this.Sex == other.Sex;
}
+}
- [MessagePackFormatter(typeof(CustomObjectFormatter))]
- public class CustomObject
- {
- private string internalId;
+public enum Sex : sbyte
+{
+ Unknown,
+ Male,
+ Female,
+}
- public CustomObject()
- {
- this.internalId = Guid.NewGuid().ToString();
- }
+public class TestCollection : ICollection
+{
+ public List internalCollection = new List();
- // serialize/deserialize private field.
- internal class CustomObjectFormatter : IMessagePackFormatter
- {
- public void Serialize(ref MessagePackWriter writer, CustomObject value, MessagePackSerializerOptions options)
- {
- options.Resolver.GetFormatterWithVerify().Serialize(ref writer, value.internalId, options);
- }
+ public int Count => this.internalCollection.Count;
- public CustomObject Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
- {
- var id = options.Resolver.GetFormatterWithVerify().Deserialize(ref reader, options);
- return new CustomObject { internalId = id };
- }
- }
- }
+ public bool IsReadOnly => throw new NotImplementedException();
- public interface IEntity
+ public void Add(T item)
{
- string Name { get; }
+ this.internalCollection.Add(item);
}
- public class Event : IEntity
+ public void Clear()
{
- public Event(string name)
- {
- this.Name = name;
- }
+ throw new NotImplementedException();
+ }
- public string Name { get; }
+ public bool Contains(T item)
+ {
+ throw new NotImplementedException();
}
- public class Holder
+ public void CopyTo(T[] array, int arrayIndex)
{
- public Holder(IEntity entity)
- {
- this.Entity = entity;
- }
+ throw new NotImplementedException();
+ }
- public IEntity Entity { get; }
+ public IEnumerator GetEnumerator()
+ {
+ return this.internalCollection.GetEnumerator();
}
- public class Dummy___
+ public bool Remove(T item)
{
- public MethodBase MyProperty { get; set; }
+ throw new NotImplementedException();
}
- [MessagePackObject]
- public class Callback1 : IMessagePackSerializationCallbackReceiver
+ IEnumerator IEnumerable.GetEnumerator()
{
- [Key(0)]
- public int X { get; set; }
+ throw new NotImplementedException();
+ }
+}
- [IgnoreMember]
- public bool CalledBefore { get; private set; }
+[MessagePackObject(true)]
+public class Takox
+{
+#pragma warning disable SA1300 // Element should begin with upper-case letter
+ public int hoga { get; set; }
- [IgnoreMember]
- public bool CalledAfter { get; private set; }
+ public int huga { get; set; }
- public Callback1(int x)
- {
- }
+ public int tako { get; set; }
+#pragma warning restore SA1300 // Element should begin with upper-case letter
+}
- public void OnBeforeSerialize()
- {
- this.CalledBefore = true;
- }
+[MessagePackObject]
+public class MyClass
+{
+ // Key is serialization index, it is important for versioning.
+ [Key(0)]
+ public int Age { get; set; }
- public void OnAfterDeserialize()
- {
- this.CalledAfter = true;
- }
- }
+ [Key(1)]
+ public string FirstName { get; set; }
- [MessagePackObject]
- public class SimpleIntKeyData
- {
- [Key(0)]
- ////[MessagePackFormatter(typeof(OreOreFormatter))]
- public int Prop1 { get; set; }
+ [Key(2)]
+ public string LastName { get; set; }
- [Key(1)]
- public ByteEnum Prop2 { get; set; }
+ // public members and does not serialize target, mark IgnoreMemberttribute
+ [IgnoreMember]
+ public string FullName => this.FirstName + this.LastName;
+}
- [Key(2)]
- public string Prop3 { get; set; }
+[MessagePackObject(keyAsPropertyName: true)]
+public class Sample1
+{
+ [Key(0)]
+ public int Foo { get; set; }
- [Key(3)]
- public SimpleStringKeyData Prop4 { get; set; }
+ [Key(1)]
+ public int Bar { get; set; }
+}
+
+[MessagePackObject]
+public class Sample2
+{
+ [Key("foo")]
+ public int Foo { get; set; }
+
+ [Key("bar")]
+ public int Bar { get; set; }
+}
- [Key(4)]
- public SimpleStructIntKeyData Prop5 { get; set; }
+[MessagePackObject]
+public class IntKeySample
+{
+ [Key(3)]
+ public int A { get; set; }
- [Key(5)]
- public SimpleStructStringKeyData Prop6 { get; set; }
+ [Key(10)]
+ public int B { get; set; }
+}
- [Key(6)]
- public byte[] BytesSpecial { get; set; }
+public class ContractlessSample
+{
+ public int MyProperty1 { get; set; }
- ////[Key(7)]
- ////[MessagePackFormatter(typeof(OreOreFormatter2), 100, "hogehoge")]
- ////[MessagePackFormatter(typeof(OreOreFormatter))]
- ////public int Prop7 { get; set; }
+ public int MyProperty2 { get; set; }
+}
+
+[MessagePackObject]
+public class SampleCallback : IMessagePackSerializationCallbackReceiver
+{
+ [Key(0)]
+ public int Key { get; set; }
+
+ public void OnBeforeSerialize()
+ {
+ Console.WriteLine("OnBefore");
}
- [MessagePack.MessagePackObject(true)]
- public class StringKeySerializerTarget2
+ public void OnAfterDeserialize()
{
- public int TotalQuestions { get; set; }
+ Console.WriteLine("OnAfter");
+ }
+}
- public int TotalUnanswered { get; set; }
+[MessagePackObject]
+public struct Point
+{
+ [Key(0)]
+ public readonly int X;
+ [Key(1)]
+ public readonly int Y;
- public int QuestionsPerMinute { get; set; }
+ // can't find matched constructor parameter, parameterType mismatch. type:Point parameterIndex:0 parameterType:ValueTuple`2
+ public Point((int, int) p)
+ {
+ this.X = p.Item1;
+ this.Y = p.Item2;
+ }
- public int AnswersPerMinute { get; set; }
+ [SerializationConstructor]
+ public Point(int x, int y)
+ {
+ this.X = x;
+ this.Y = y;
+ }
+}
- public int TotalVotes { get; set; }
+// mark inheritance types
+[MessagePack.Union(0, typeof(FooClass))]
+[MessagePack.Union(100, typeof(BarClass))]
+public interface IUnionSample
+{
+}
- public int BadgesPerMinute { get; set; }
+[MessagePackObject]
+public class FooClass : IUnionSample
+{
+ [Key(0)]
+ public int XYZ { get; set; }
+}
- public int NewActiveUsers { get; set; }
+[MessagePackObject]
+public class BarClass : IUnionSample
+{
+ [Key(0)]
+ public string OPQ { get; set; }
+}
- public int ApiRevision { get; set; }
+[MessagePackFormatter(typeof(CustomObjectFormatter))]
+public class CustomObject
+{
+ private string internalId;
- public int Site { get; set; }
+ public CustomObject()
+ {
+ this.internalId = Guid.NewGuid().ToString();
}
- internal class Program
+ // serialize/deserialize private field.
+ internal class CustomObjectFormatter : IMessagePackFormatter
{
- private static readonly MessagePackSerializerOptions LZ4Standard = MessagePackSerializerOptions.Standard.WithCompression(MessagePackCompression.Lz4Block);
-
- private static void Main(string[] args)
+ public void Serialize(ref MessagePackWriter writer, CustomObject value, MessagePackSerializerOptions options)
{
- var option = MessagePackSerializerOptions.Standard.WithCompression(MessagePackCompression.Lz4BlockArray);
- var data = Enumerable.Range(0, 10000).Select(x => new StringKeySerializerTarget2()).ToArray();
-
- var bin = MessagePackSerializer.Serialize(data, option);
- Console.WriteLine(bin.Length);
+ options.Resolver.GetFormatterWithVerify().Serialize(ref writer, value.internalId, options);
}
- private static void Benchmark(T target)
+ public CustomObject Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
{
- const int Iteration = 10000; // 10000
-
- var jsonSerializer = new JsonSerializer();
- MsgPack.Serialization.SerializationContext msgpack = MsgPack.Serialization.SerializationContext.Default;
- msgpack.GetSerializer().PackSingleObject(target);
- MessagePackSerializer.Serialize(target);
- MessagePackSerializer.Serialize(target, LZ4Standard);
- ZeroFormatter.ZeroFormatterSerializer.Serialize(target);
- ProtoBuf.Serializer.Serialize(new MemoryStream(), target);
- jsonSerializer.Serialize(new JsonTextWriter(new StringWriter()), target);
-
- Console.WriteLine(typeof(T).Name + " serialization test");
- Console.WriteLine();
-
- Console.WriteLine("Serialize::");
- byte[] data = null;
- byte[] data0 = null;
- byte[] data1 = null;
- byte[] data2 = null;
- byte[] data3 = null;
- byte[] dataJson = null;
- byte[] dataGzipJson = null;
- using (new Measure("MsgPack-Cli"))
- {
- for (int i = 0; i < Iteration; i++)
- {
- data = msgpack.GetSerializer().PackSingleObject(target);
- }
- }
-
- using (new Measure("MessagePack-CSharp"))
- {
- for (int i = 0; i < Iteration; i++)
- {
- data0 = MessagePackSerializer.Serialize(target);
- }
- }
-
- using (new Measure("MessagePack(LZ4)"))
- {
- for (int i = 0; i < Iteration; i++)
- {
- data3 = MessagePackSerializer.Serialize(target, LZ4Standard);
- }
- }
+ var id = options.Resolver.GetFormatterWithVerify().Deserialize(ref reader, options);
+ return new CustomObject { internalId = id };
+ }
+ }
+}
- using (new Measure("ZeroFormatter"))
- {
- for (int i = 0; i < Iteration; i++)
- {
- data1 = ZeroFormatter.ZeroFormatterSerializer.Serialize(target);
- }
- }
+public interface IEntity
+{
+ string Name { get; }
+}
- using (new Measure("JsonNet"))
- {
- for (int i = 0; i < Iteration; i++)
- {
- using (var ms = new MemoryStream())
- using (var sw = new StreamWriter(ms, Encoding.UTF8, 1024, true))
- using (var jw = new JsonTextWriter(sw))
- {
- jsonSerializer.Serialize(jw, target);
- }
- }
- }
+public class Event : IEntity
+{
+ public Event(string name)
+ {
+ this.Name = name;
+ }
- using (new Measure("JsonNet+Gzip"))
- {
- for (int i = 0; i < Iteration; i++)
- {
- using (var ms = new MemoryStream())
- using (var gzip = new GZipStream(ms, CompressionLevel.Fastest))
- using (var sw = new StreamWriter(gzip, Encoding.UTF8, 1024, true))
- using (var jw = new JsonTextWriter(sw))
- {
- jsonSerializer.Serialize(jw, target);
- }
- }
- }
+ public string Name { get; }
+}
- using (new Measure("protobuf-net"))
- {
- for (int i = 0; i < Iteration; i++)
- {
- using (var ms = new MemoryStream())
- {
- ProtoBuf.Serializer.Serialize(ms, target);
- }
- }
- }
+public class Holder
+{
+ public Holder(IEntity entity)
+ {
+ this.Entity = entity;
+ }
- using (var ms = new MemoryStream())
- {
- ProtoBuf.Serializer.Serialize(ms, target);
- data2 = ms.ToArray();
- }
+ public IEntity Entity { get; }
+}
- using (var ms = new MemoryStream())
- {
- using (var sw = new StreamWriter(ms, Encoding.UTF8, 1024, true))
- using (var jw = new JsonTextWriter(sw))
- {
- jsonSerializer.Serialize(jw, target);
- }
+public class Dummy___
+{
+ public MethodBase MyProperty { get; set; }
+}
- dataJson = ms.ToArray();
- }
+[MessagePackObject]
+public class Callback1 : IMessagePackSerializationCallbackReceiver
+{
+ [Key(0)]
+ public int X { get; set; }
- using (var ms = new MemoryStream())
- {
- using (var gzip = new GZipStream(ms, CompressionLevel.Fastest))
- using (var sw = new StreamWriter(gzip, Encoding.UTF8, 1024, true))
- using (var jw = new JsonTextWriter(sw))
- {
- jsonSerializer.Serialize(jw, target);
- }
+ [IgnoreMember]
+ public bool CalledBefore { get; private set; }
- dataGzipJson = ms.ToArray();
- }
+ [IgnoreMember]
+ public bool CalledAfter { get; private set; }
- msgpack.GetSerializer().UnpackSingleObject(data);
- MessagePackSerializer.Deserialize(data0);
- ZeroFormatterSerializer.Deserialize(data1);
- ProtoBuf.Serializer.Deserialize(new MemoryStream(data2));
- MessagePackSerializer.Deserialize(data3, LZ4Standard);
- jsonSerializer.Deserialize(new JsonTextReader(new StreamReader(new MemoryStream(dataJson))));
+ public Callback1(int x)
+ {
+ }
- Console.WriteLine();
- Console.WriteLine("Deserialize::");
+ public void OnBeforeSerialize()
+ {
+ this.CalledBefore = true;
+ }
- using (new Measure("MsgPack-Cli"))
- {
- for (int i = 0; i < Iteration; i++)
- {
- msgpack.GetSerializer().UnpackSingleObject(data);
- }
- }
+ public void OnAfterDeserialize()
+ {
+ this.CalledAfter = true;
+ }
+}
- using (new Measure("MessagePack-CSharp"))
- {
- for (int i = 0; i < Iteration; i++)
- {
- MessagePackSerializer.Deserialize(data0);
- }
- }
+[MessagePackObject]
+public class SimpleIntKeyData
+{
+ [Key(0)]
+ ////[MessagePackFormatter(typeof(OreOreFormatter))]
+ public int Prop1 { get; set; }
- using (new Measure("MessagePack(LZ4)"))
- {
- for (int i = 0; i < Iteration; i++)
- {
- MessagePackSerializer.Deserialize(data3, LZ4Standard);
- }
- }
+ [Key(1)]
+ public ByteEnum Prop2 { get; set; }
- using (new Measure("ZeroFormatter"))
- {
- for (int i = 0; i < Iteration; i++)
- {
- ZeroFormatterSerializer.Deserialize(data1);
- }
- }
+ [Key(2)]
+ public string Prop3 { get; set; }
- using (new Measure("JsonNet"))
- {
- for (int i = 0; i < Iteration; i++)
- {
- using (var ms = new MemoryStream(dataJson))
- using (var sr = new StreamReader(ms, Encoding.UTF8))
- using (var jr = new JsonTextReader(sr))
- {
- jsonSerializer.Deserialize(jr);
- }
- }
- }
+ [Key(3)]
+ public SimpleStringKeyData Prop4 { get; set; }
- using (new Measure("JsonNet+Gzip"))
- {
- for (int i = 0; i < Iteration; i++)
- {
- using (var ms = new MemoryStream(dataGzipJson))
- using (var gzip = new GZipStream(ms, CompressionMode.Decompress))
- using (var sr = new StreamReader(gzip, Encoding.UTF8))
- using (var jr = new JsonTextReader(sr))
- {
- jsonSerializer.Deserialize(jr);
- }
- }
- }
+ [Key(4)]
+ public SimpleStructIntKeyData Prop5 { get; set; }
- using (new Measure("protobuf-net"))
- {
- for (int i = 0; i < Iteration; i++)
- {
- using (var ms = new MemoryStream(data2))
- {
- ProtoBuf.Serializer.Deserialize(ms);
- }
- }
- }
+ [Key(5)]
+ public SimpleStructStringKeyData Prop6 { get; set; }
- Console.WriteLine();
- Console.WriteLine("FileSize::");
- var label = string.Empty;
- label = "MsgPack-Cli";
- Console.WriteLine($"{label,20} {data.Length} Byte");
- label = "MessagePack-CSharp";
- Console.WriteLine($"{label,20} {data0.Length} Byte");
- label = "MessagePack(LZ4)";
- Console.WriteLine($"{label,20} {data3.Length} Byte");
- label = "ZeroFormatter";
- Console.WriteLine($"{label,20} {data1.Length} Byte");
- label = "protobuf-net";
- Console.WriteLine($"{label,20} {data2.Length} Byte");
- label = "JsonNet";
- Console.WriteLine($"{label,20} {dataJson.Length} Byte");
- label = "JsonNet+GZip";
- Console.WriteLine($"{label,20} {dataGzipJson.Length} Byte");
+ [Key(6)]
+ public byte[] BytesSpecial { get; set; }
- Console.WriteLine();
- Console.WriteLine();
- }
+ ////[Key(7)]
+ ////[MessagePackFormatter(typeof(OreOreFormatter2), 100, "hogehoge")]
+ ////[MessagePackFormatter(typeof(OreOreFormatter))]
+ ////public int Prop7 { get; set; }
+}
- private static string ToHumanReadableSize(long size)
- {
- return ToHumanReadableSize(new long?(size));
- }
+[MessagePack.MessagePackObject(true)]
+public class StringKeySerializerTarget2
+{
+ public int TotalQuestions { get; set; }
- private static string ToHumanReadableSize(long? size)
- {
- if (size == null)
- {
- return "NULL";
- }
+ public int TotalUnanswered { get; set; }
- double bytes = size.Value;
+ public int QuestionsPerMinute { get; set; }
- if (bytes <= 1024)
- {
- return bytes.ToString("f2") + " B";
- }
+ public int AnswersPerMinute { get; set; }
- bytes = bytes / 1024;
- if (bytes <= 1024)
- {
- return bytes.ToString("f2") + " KB";
- }
+ public int TotalVotes { get; set; }
- bytes = bytes / 1024;
- if (bytes <= 1024)
- {
- return bytes.ToString("f2") + " MB";
- }
+ public int BadgesPerMinute { get; set; }
- bytes = bytes / 1024;
- if (bytes <= 1024)
- {
- return bytes.ToString("f2") + " GB";
- }
+ public int NewActiveUsers { get; set; }
- bytes = bytes / 1024;
- if (bytes <= 1024)
- {
- return bytes.ToString("f2") + " TB";
- }
+ public int ApiRevision { get; set; }
- bytes = bytes / 1024;
- if (bytes <= 1024)
- {
- return bytes.ToString("f2") + " PB";
- }
+ public int Site { get; set; }
+}
- bytes = bytes / 1024;
- if (bytes <= 1024)
- {
- return bytes.ToString("f2") + " EB";
- }
+internal struct Measure : IDisposable
+{
+ private string label;
+ private Stopwatch sw;
- bytes = bytes / 1024;
- return bytes + " ZB";
- }
+ public Measure(string label)
+ {
+ this.label = label;
+ System.GC.Collect(2, GCCollectionMode.Forced, blocking: true);
+ this.sw = Stopwatch.StartNew();
}
- internal struct Measure : IDisposable
+ public void Dispose()
{
- private string label;
- private Stopwatch sw;
-
- public Measure(string label)
- {
- this.label = label;
- System.GC.Collect(2, GCCollectionMode.Forced, blocking: true);
- this.sw = Stopwatch.StartNew();
- }
+ this.sw.Stop();
+ Console.WriteLine($"{this.label,20} {this.sw.Elapsed.TotalMilliseconds} ms");
- public void Dispose()
- {
- this.sw.Stop();
- Console.WriteLine($"{this.label,20} {this.sw.Elapsed.TotalMilliseconds} ms");
-
- System.GC.Collect(2, GCCollectionMode.Forced, blocking: true);
- }
+ System.GC.Collect(2, GCCollectionMode.Forced, blocking: true);
}
+}
- public class SerializerTarget
- {
- public int MyProperty1 { get; set; }
+public class SerializerTarget
+{
+ public int MyProperty1 { get; set; }
- public int MyProperty2 { get; set; }
+ public int MyProperty2 { get; set; }
- public int MyProperty3 { get; set; }
+ public int MyProperty3 { get; set; }
- public int MyProperty4 { get; set; }
+ public int MyProperty4 { get; set; }
- public int MyProperty5 { get; set; }
+ public int MyProperty5 { get; set; }
- public int MyProperty6 { get; set; }
+ public int MyProperty6 { get; set; }
- public int MyProperty7 { get; set; }
+ public int MyProperty7 { get; set; }
- public int MyProperty8 { get; set; }
+ public int MyProperty8 { get; set; }
- public int MyProperty9 { get; set; }
- }
+ public int MyProperty9 { get; set; }
+}
- // design concept sketch of Union.
- [MessagePack.Union(0, typeof(HogeMoge1))]
- [MessagePack.Union(1, typeof(HogeMoge2))]
- public interface IHogeMoge
- {
- }
+// design concept sketch of Union.
+[MessagePack.Union(0, typeof(HogeMoge1))]
+[MessagePack.Union(1, typeof(HogeMoge2))]
+public interface IHogeMoge
+{
+}
- public class HogeMoge1
- {
- }
+public class HogeMoge1
+{
+}
- public class HogeMoge2
- {
- }
+public class HogeMoge2
+{
+}
+[MessagePackObject]
+public class TestObject
+{
[MessagePackObject]
- public class TestObject
+ public class PrimitiveObject
{
- [MessagePackObject]
- public class PrimitiveObject
- {
#pragma warning disable SA1310 // Field names should not contain underscore
- [Key(0)]
- public int v_int;
+ [Key(0)]
+ public int v_int;
- [Key(1)]
- public string v_str;
+ [Key(1)]
+ public string v_str;
- [Key(2)]
- public float v_float;
+ [Key(2)]
+ public float v_float;
- [Key(3)]
- public bool v_bool;
+ [Key(3)]
+ public bool v_bool;
#pragma warning restore SA1310 // Field names should not contain underscore
- public PrimitiveObject(int vi, string vs, float vf, bool vb)
- {
- this.v_int = vi;
- this.v_str = vs;
- this.v_float = vf;
- this.v_bool = vb;
- }
+ public PrimitiveObject(int vi, string vs, float vf, bool vb)
+ {
+ this.v_int = vi;
+ this.v_str = vs;
+ this.v_float = vf;
+ this.v_bool = vb;
}
+ }
- [Key(0)]
- public PrimitiveObject[] objectArray;
+ [Key(0)]
+ public PrimitiveObject[] objectArray;
- [Key(1)]
- public List objectList;
+ [Key(1)]
+ public List objectList;
- [Key(2)]
- public Dictionary objectMap;
+ [Key(2)]
+ public Dictionary objectMap;
- public void CreateArray(int num)
+ public void CreateArray(int num)
+ {
+ this.objectArray = new PrimitiveObject[num];
+ for (int i = 0; i < num; i++)
{
- this.objectArray = new PrimitiveObject[num];
- for (int i = 0; i < num; i++)
- {
- this.objectArray[i] = new PrimitiveObject(i, i.ToString(), (float)i, i % 2 == 0 ? true : false);
- }
+ this.objectArray[i] = new PrimitiveObject(i, i.ToString(), (float)i, i % 2 == 0 ? true : false);
}
+ }
- public void CreateList(int num)
+ public void CreateList(int num)
+ {
+ this.objectList = new List(num);
+ for (int i = 0; i < num; i++)
{
- this.objectList = new List(num);
- for (int i = 0; i < num; i++)
- {
- this.objectList.Add(new PrimitiveObject(i, i.ToString(), (float)i, i % 2 == 0 ? true : false));
- }
+ this.objectList.Add(new PrimitiveObject(i, i.ToString(), (float)i, i % 2 == 0 ? true : false));
}
+ }
- public void CreateMap(int num)
+ public void CreateMap(int num)
+ {
+ this.objectMap = new Dictionary(num);
+ for (int i = 0; i < num; i++)
{
- this.objectMap = new Dictionary(num);
- for (int i = 0; i < num; i++)
- {
- this.objectMap.Add(i.ToString(), new PrimitiveObject(i, i.ToString(), (float)i, i % 2 == 0 ? true : false));
- }
+ this.objectMap.Add(i.ToString(), new PrimitiveObject(i, i.ToString(), (float)i, i % 2 == 0 ? true : false));
}
+ }
- // I only tested with array
- public static TestObject TestBuild()
- {
- TestObject to = new TestObject();
- to.CreateArray(1000000);
+ // I only tested with array
+ public static TestObject TestBuild()
+ {
+ TestObject to = new TestObject();
+ to.CreateArray(1000000);
- return to;
- }
+ return to;
}
+}
- public class HogeMogeFormatter : IMessagePackFormatter
+public class HogeMogeFormatter : IMessagePackFormatter
+{
+ // Type to Key...
+ private static readonly Dictionary> Map = new Dictionary>
{
- // Type to Key...
- private static readonly Dictionary> Map = new Dictionary>
- {
- { typeof(HogeMoge1), new KeyValuePair(0, 0) },
- { typeof(HogeMoge2), new KeyValuePair(1, 1) },
- };
+ { typeof(HogeMoge1), new KeyValuePair(0, 0) },
+ { typeof(HogeMoge2), new KeyValuePair(1, 1) },
+ };
- // If 0~10 don't need it.
- private static readonly Dictionary KeyToJumpTable = new Dictionary
- {
- { 0, 0 },
- { 1, 1 },
- };
+ // If 0~10 don't need it.
+ private static readonly Dictionary KeyToJumpTable = new Dictionary
+ {
+ { 0, 0 },
+ { 1, 1 },
+ };
- public void Serialize(ref MessagePackWriter writer, IHogeMoge value, MessagePackSerializerOptions options)
+ public void Serialize(ref MessagePackWriter writer, IHogeMoge value, MessagePackSerializerOptions options)
+ {
+ KeyValuePair key;
+ if (Map.TryGetValue(value.GetType(), out key))
{
- KeyValuePair key;
- if (Map.TryGetValue(value.GetType(), out key))
- {
- writer.WriteArrayHeader(2);
- writer.WriteInt32(key.Key);
+ writer.WriteArrayHeader(2);
+ writer.WriteInt32(key.Key);
- switch (key.Value)
- {
- case 0:
- options.Resolver.GetFormatterWithVerify().Serialize(ref writer, (HogeMoge1)value, options);
- break;
- case 1:
- options.Resolver.GetFormatterWithVerify().Serialize(ref writer, (HogeMoge2)value, options);
- break;
- default:
- break;
- }
-
- return;
+ switch (key.Value)
+ {
+ case 0:
+ options.Resolver.GetFormatterWithVerify().Serialize(ref writer, (HogeMoge1)value, options);
+ break;
+ case 1:
+ options.Resolver.GetFormatterWithVerify().Serialize(ref writer, (HogeMoge2)value, options);
+ break;
+ default:
+ break;
}
- writer.WriteNil();
+ return;
}
- public IHogeMoge Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
- {
- // TODO:array header...
- var key = reader.ReadInt32();
+ writer.WriteNil();
+ }
- switch (key)
- {
- case 0:
- {
- HogeMoge1 result = options.Resolver.GetFormatterWithVerify().Deserialize(ref reader, options);
- return (IHogeMoge)result;
- }
+ public IHogeMoge Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
+ {
+ // TODO:array header...
+ var key = reader.ReadInt32();
- case 1:
- {
- HogeMoge2 result = options.Resolver.GetFormatterWithVerify().Deserialize(ref reader, options);
- return (IHogeMoge)result;
- }
+ switch (key)
+ {
+ case 0:
+ {
+ HogeMoge1 result = options.Resolver.GetFormatterWithVerify().Deserialize(ref reader, options);
+ return (IHogeMoge)result;
+ }
- default:
- {
- throw new NotImplementedException();
- }
- }
+ case 1:
+ {
+ HogeMoge2 result = options.Resolver.GetFormatterWithVerify().Deserialize(ref reader, options);
+ return (IHogeMoge)result;
+ }
+
+ default:
+ {
+ throw new NotImplementedException();
+ }
}
}
}
diff --git a/sandbox/Sandbox/Sandbox.csproj b/sandbox/Sandbox/Sandbox.csproj
index 243615375..fbb77ee6a 100644
--- a/sandbox/Sandbox/Sandbox.csproj
+++ b/sandbox/Sandbox/Sandbox.csproj
@@ -3,7 +3,7 @@
Exe
- net8.0
+ net9.0
True
diff --git a/src/Directory.Build.props b/src/Directory.Build.props
index df4ddcb4f..1cde74815 100644
--- a/src/Directory.Build.props
+++ b/src/Directory.Build.props
@@ -3,6 +3,7 @@
enable
True
+ 13
$(MSBuildThisFileDirectory)..\opensource.snk
true
diff --git a/src/MessagePack.Analyzers.CodeFixes/version.json b/src/MessagePack.Analyzers.CodeFixes/version.json
deleted file mode 100644
index 7142e661f..000000000
--- a/src/MessagePack.Analyzers.CodeFixes/version.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
- "inherit": true,
- "assemblyVersion": {
- "precision": "revision"
- }
-}
diff --git a/src/MessagePack.AspNetCoreMvcFormatter/MessagePack.AspNetCoreMvcFormatter.csproj b/src/MessagePack.AspNetCoreMvcFormatter/MessagePack.AspNetCoreMvcFormatter.csproj
index 057235a8b..3945212df 100644
--- a/src/MessagePack.AspNetCoreMvcFormatter/MessagePack.AspNetCoreMvcFormatter.csproj
+++ b/src/MessagePack.AspNetCoreMvcFormatter/MessagePack.AspNetCoreMvcFormatter.csproj
@@ -1,6 +1,6 @@
- netstandard2.0;net8.0
+ netstandard2.0;net8.0;net9.0
Codestin Search App
ASP.NET Core MVC Input/Output MessagePack formatter.
MsgPack;MessagePack;Serialization;Formatter;Serializer;aspnetcore;aspnetcoremvc
diff --git a/src/MessagePack.Experimental/MessagePack.Experimental.csproj b/src/MessagePack.Experimental/MessagePack.Experimental.csproj
index bcd48e6de..34f38f883 100644
--- a/src/MessagePack.Experimental/MessagePack.Experimental.csproj
+++ b/src/MessagePack.Experimental/MessagePack.Experimental.csproj
@@ -1,7 +1,7 @@
- net8.0
+ net8.0;net9.0
true
Codestin Search App
diff --git a/src/MessagePack.SourceGenerator/Analyzers/MsgPack00xMessagePackAnalyzer.cs b/src/MessagePack.SourceGenerator/Analyzers/MsgPack00xMessagePackAnalyzer.cs
index 7ab75357f..b1e68ddb6 100644
--- a/src/MessagePack.SourceGenerator/Analyzers/MsgPack00xMessagePackAnalyzer.cs
+++ b/src/MessagePack.SourceGenerator/Analyzers/MsgPack00xMessagePackAnalyzer.cs
@@ -369,11 +369,12 @@ private static void SymbolStartAction(SymbolStartAnalysisContext context, Refere
if (options.KnownFormattersByName.TryGetValue(typeName, out FormatterDescriptor? formatter))
{
// Call out any formattable reference types that are not nullable.
- INamedTypeSymbol[] missing = (
- from iface in declaredSymbol.Interfaces
- where SymbolEqualityComparer.Default.Equals(iface.ConstructUnboundGenericType(), typeReferences.MessagePackFormatterOfT) &&
- iface.TypeArguments is [INamedTypeSymbol { IsReferenceType: true, NullableAnnotation: NullableAnnotation.NotAnnotated } a]
- select (INamedTypeSymbol)iface.TypeArguments[0]).ToArray();
+ INamedTypeSymbol[] missing = declaredSymbol.Interfaces
+ .Where(iface => iface.IsGenericType)
+ .Where(iface => SymbolEqualityComparer.Default.Equals(iface.ConstructUnboundGenericType(), typeReferences.MessagePackFormatterOfT)
+ && iface.TypeArguments is [INamedTypeSymbol { IsReferenceType: true, NullableAnnotation: NullableAnnotation.NotAnnotated } a])
+ .Select(iface => (INamedTypeSymbol)iface.TypeArguments[0])
+ .ToArray();
if (missing.Length > 0)
{
diff --git a/src/MessagePack.SourceGenerator/CodeAnalysis/TypeCollector.cs b/src/MessagePack.SourceGenerator/CodeAnalysis/TypeCollector.cs
index e121773da..c742bd8d4 100644
--- a/src/MessagePack.SourceGenerator/CodeAnalysis/TypeCollector.cs
+++ b/src/MessagePack.SourceGenerator/CodeAnalysis/TypeCollector.cs
@@ -610,7 +610,7 @@ private void CollectGeneric(INamedTypeSymbol type, ISymbol? callerSymbol)
return;
}
- if (type.AllInterfaces.FirstOrDefault(x => !x.IsUnboundGenericType && x.ConstructUnboundGenericType() is { Name: nameof(ICollection) }) is INamedTypeSymbol collectionIface
+ if (type.AllInterfaces.FirstOrDefault(x => x.IsGenericType && !x.IsUnboundGenericType && x.ConstructUnboundGenericType() is { Name: nameof(ICollection) }) is INamedTypeSymbol collectionIface
&& type.InstanceConstructors.Any(ctor => ctor.Parameters.Length == 0))
{
this.CollectCore(collectionIface.TypeArguments[0], callerSymbol);
diff --git a/src/MessagePack.SourceGenerator/MessagePack.SourceGenerator.csproj b/src/MessagePack.SourceGenerator/MessagePack.SourceGenerator.csproj
index d11e36837..e3c4c5e90 100644
--- a/src/MessagePack.SourceGenerator/MessagePack.SourceGenerator.csproj
+++ b/src/MessagePack.SourceGenerator/MessagePack.SourceGenerator.csproj
@@ -8,6 +8,7 @@
cs
embedded
false
+ true
@@ -92,7 +93,6 @@
-
diff --git a/src/MessagePack.SourceGenerator/ThisAssembly.cs b/src/MessagePack.SourceGenerator/ThisAssembly.cs
new file mode 100644
index 000000000..f0ebece07
--- /dev/null
+++ b/src/MessagePack.SourceGenerator/ThisAssembly.cs
@@ -0,0 +1,26 @@
+// Copyright (c) All contributors. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+namespace MessagePack.SourceGenerator
+{
+ public static class ThisAssembly
+ {
+ public static string AssemblyFileVersion
+ {
+ get
+ {
+ var version = typeof(ThisAssembly).Assembly.GetName().Version.ToString();
+ return version;
+ }
+ }
+
+ public static Version Version
+ {
+ get
+ {
+ var version = typeof(ThisAssembly).Assembly.GetName().Version;
+ return version;
+ }
+ }
+ }
+}
diff --git a/src/MessagePack.SourceGenerator/version.json b/src/MessagePack.SourceGenerator/version.json
deleted file mode 100644
index 7142e661f..000000000
--- a/src/MessagePack.SourceGenerator/version.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
- "inherit": true,
- "assemblyVersion": {
- "precision": "revision"
- }
-}
diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/package.json b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/package.json
index e01d2852c..3458dec54 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.github.messagepack-csharp",
"displayName": "MessagePack",
- "version": "3.0.301",
+ "version": "3.1.0",
"unity": "2021.3",
"description": "Extremely Fast MessagePack Serializer for C#.",
"keywords": [
diff --git a/src/MessagePack.UnityClient/Assets/Scripts/Tests/IL2CPPTest.cs b/src/MessagePack.UnityClient/Assets/Scripts/Tests/IL2CPPTest.cs
index 1393f0851..472639af1 100644
--- a/src/MessagePack.UnityClient/Assets/Scripts/Tests/IL2CPPTest.cs
+++ b/src/MessagePack.UnityClient/Assets/Scripts/Tests/IL2CPPTest.cs
@@ -13,6 +13,13 @@ namespace Assets.Scripts.Tests
{
public class IL2CPPTest
{
+ //In CI, failing?
+ //[Test]
+ //public void CheckGeneraterMessagePackResolverExists()
+ //{
+ // _ = GeneratedMessagePackResolver.Instance;
+ //}
+
[Test]
public void SimpleSerializeAndDeserialize()
{
diff --git a/src/MessagePack.UnityClient/Packages/manifest.json b/src/MessagePack.UnityClient/Packages/manifest.json
index feff66f2b..aa093c60a 100644
--- a/src/MessagePack.UnityClient/Packages/manifest.json
+++ b/src/MessagePack.UnityClient/Packages/manifest.json
@@ -3,7 +3,6 @@
"com.cysharp.runtimeunittesttoolkit": "https://github.com/Cysharp/RuntimeUnitTestToolkit.git?path=RuntimeUnitTestToolkit/Assets/RuntimeUnitTestToolkit",
"com.github-glitchenzo.nugetforunity": "https://github.com/GlitchEnzo/NuGetForUnity.git?path=/src/NuGetForUnity",
"com.github.messagepack.internal": "file:../../../bin/MessagePack/Debug/netstandard2.1",
- "com.github.messagepack.sourcegenerator.internal": "file:../../../bin/MessagePack.SourceGenerator/Debug/netstandard2.0",
"com.unity.ai.navigation": "1.1.5",
"com.unity.ide.rider": "3.0.28",
"com.unity.ide.visualstudio": "2.0.22",
diff --git a/src/MessagePack.UnityClient/Packages/packages-lock.json b/src/MessagePack.UnityClient/Packages/packages-lock.json
index a1a0670b4..f90f5d376 100644
--- a/src/MessagePack.UnityClient/Packages/packages-lock.json
+++ b/src/MessagePack.UnityClient/Packages/packages-lock.json
@@ -20,12 +20,6 @@
"source": "local",
"dependencies": {}
},
- "com.github.messagepack.sourcegenerator.internal": {
- "version": "file:../../../bin/MessagePack.SourceGenerator/Debug/netstandard2.0",
- "depth": 0,
- "source": "local",
- "dependencies": {}
- },
"com.unity.ai.navigation": {
"version": "1.1.5",
"depth": 0,
diff --git a/src/MessagePack/Formatters/CollectionFormatter.cs b/src/MessagePack/Formatters/CollectionFormatter.cs
index 1d7863fd8..623d3745e 100644
--- a/src/MessagePack/Formatters/CollectionFormatter.cs
+++ b/src/MessagePack/Formatters/CollectionFormatter.cs
@@ -1417,6 +1417,28 @@ protected override HashSet Create(int count, MessagePackSerializerOptions opt
}
}
+#endif
+
+#if NET9_0_OR_GREATER
+
+ public sealed class ReadOnlySetFormatter : CollectionFormatterBase, ReadOnlySet>
+ {
+ protected override void Add(HashSet collection, int index, T value, MessagePackSerializerOptions options)
+ {
+ collection.Add(value);
+ }
+
+ protected override ReadOnlySet Complete(HashSet intermediateCollection)
+ {
+ return new ReadOnlySet(intermediateCollection);
+ }
+
+ protected override HashSet Create(int count, MessagePackSerializerOptions options)
+ {
+ return new HashSet(options.Security.GetEqualityComparer());
+ }
+ }
+
#endif
public sealed class ConcurrentBagFormatter : CollectionFormatterBase>
diff --git a/src/MessagePack/Formatters/DictionaryFormatter.cs b/src/MessagePack/Formatters/DictionaryFormatter.cs
index f1550a985..b4a9041d8 100644
--- a/src/MessagePack/Formatters/DictionaryFormatter.cs
+++ b/src/MessagePack/Formatters/DictionaryFormatter.cs
@@ -309,4 +309,22 @@ protected override ConcurrentDictionary Create(int count, MessageP
return new ConcurrentDictionary(options.Security.GetEqualityComparer());
}
}
+
+#if NET9_0_OR_GREATER
+
+ public sealed class OrderedDictionaryFormatter : DictionaryFormatterBase>
+ where TKey : notnull
+ {
+ protected override void Add(OrderedDictionary collection, int index, TKey key, TValue value, MessagePackSerializerOptions options)
+ {
+ collection.TryAdd(key, value);
+ }
+
+ protected override OrderedDictionary Create(int count, MessagePackSerializerOptions options)
+ {
+ return new OrderedDictionary(options.Security.GetEqualityComparer());
+ }
+ }
+
+#endif
}
diff --git a/src/MessagePack/Formatters/FrozenCollectionFormatters.cs b/src/MessagePack/Formatters/FrozenCollectionFormatters.cs
index f757b5597..41247853d 100644
--- a/src/MessagePack/Formatters/FrozenCollectionFormatters.cs
+++ b/src/MessagePack/Formatters/FrozenCollectionFormatters.cs
@@ -10,6 +10,8 @@
#pragma warning disable SA1402 // File may only contain a single type
#pragma warning disable SA1649 // File name should match first type name
+// namespace is wrong, but for compatibility, keep it.
+// https://github.com/MessagePack-CSharp/MessagePack-CSharp/issues/2089
namespace MessagePack.ImmutableCollection
{
public sealed class FrozenDictionaryFormatter : IMessagePackFormatter?>
diff --git a/src/MessagePack/Formatters/ImmutableCollectionFormatters.cs b/src/MessagePack/Formatters/ImmutableCollectionFormatters.cs
index e0d4b83ba..e3b61bec0 100644
--- a/src/MessagePack/Formatters/ImmutableCollectionFormatters.cs
+++ b/src/MessagePack/Formatters/ImmutableCollectionFormatters.cs
@@ -12,6 +12,8 @@
#pragma warning disable SA1402 // File may only contain a single type
#pragma warning disable SA1649 // File name should match first type name
+// namespace is wrong, but for compatibility, keep it.
+// https://github.com/MessagePack-CSharp/MessagePack-CSharp/issues/2089
namespace MessagePack.ImmutableCollection
{
// Immutablearray.Enumerator is 'not' IEnumerator, can't use abstraction layer.
diff --git a/src/MessagePack/Formatters/StandardClassLibraryFormatter.cs b/src/MessagePack/Formatters/StandardClassLibraryFormatter.cs
index da99bee5c..9d497a766 100644
--- a/src/MessagePack/Formatters/StandardClassLibraryFormatter.cs
+++ b/src/MessagePack/Formatters/StandardClassLibraryFormatter.cs
@@ -7,6 +7,8 @@
using System.Collections.Generic;
using System.Globalization;
using System.Numerics;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
using System.Text;
using MessagePack.Internal;
@@ -856,6 +858,121 @@ public Half Deserialize(ref MessagePackReader reader, MessagePackSerializerOptio
}
}
+ public sealed class RuneFormatter : IMessagePackFormatter
+ {
+ public static readonly IMessagePackFormatter Instance = new RuneFormatter();
+
+ private RuneFormatter()
+ {
+ }
+
+ public void Serialize(ref MessagePackWriter writer, Rune value, MessagePackSerializerOptions options)
+ {
+ writer.Write(value.Value);
+ }
+
+ public Rune Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
+ {
+ return new Rune(reader.ReadInt32());
+ }
+ }
+
+#endif
+
+#if NET7_0_OR_GREATER
+
+ public sealed class Int128Formatter : IMessagePackFormatter
+ {
+ public static readonly IMessagePackFormatter Instance = new Int128Formatter();
+
+ private const int Size = 16; // always bytes-written is 16
+
+ private Int128Formatter()
+ {
+ }
+
+ public void Serialize(ref MessagePackWriter writer, Int128 value, MessagePackSerializerOptions options)
+ {
+ // When it comes to serialization methods, one could consider a pattern where numbers within the long range are serialized as Integers, while anything beyond that is serialized as binary.
+ // However, since having the result format itself change is not desirable, we opted to always serialize as binary.
+
+ writer.WriteBinHeader(Size);
+ var span = writer.GetSpan(Size);
+ ((IBinaryInteger)value).TryWriteLittleEndian(span, out _);
+ writer.Advance(Size);
+ }
+
+ public Int128 Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
+ {
+ var sequence = reader.ReadBytes().GetValueOrDefault();
+ if (sequence.Length != Size)
+ {
+ throw new MessagePackSerializationException("Invalid Int128 data.");
+ }
+
+ if (sequence.IsSingleSegment)
+ {
+ TryReadLittleEndian(sequence.FirstSpan, out var value);
+ return value;
+ }
+ else
+ {
+ Span bytes = stackalloc byte[Size];
+ sequence.CopyTo(bytes);
+ TryReadLittleEndian(bytes, out var value);
+ return value;
+ }
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ private static bool TryReadLittleEndian(ReadOnlySpan source, out T value)
+ where T : IBinaryInteger => T.TryReadLittleEndian(source, isUnsigned: false, out value);
+ }
+
+ public sealed class UInt128Formatter : IMessagePackFormatter
+ {
+ public static readonly IMessagePackFormatter Instance = new UInt128Formatter();
+
+ private const int Size = 16; // always bytes-written is 16
+
+ private UInt128Formatter()
+ {
+ }
+
+ public void Serialize(ref MessagePackWriter writer, UInt128 value, MessagePackSerializerOptions options)
+ {
+ writer.WriteBinHeader(Size);
+ var span = writer.GetSpan(Size);
+ ((IBinaryInteger)value).TryWriteLittleEndian(span, out _);
+ writer.Advance(Size);
+ }
+
+ public UInt128 Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
+ {
+ var sequence = reader.ReadBytes().GetValueOrDefault();
+ if (sequence.Length != Size)
+ {
+ throw new MessagePackSerializationException("Invalid UInt128 data.");
+ }
+
+ if (sequence.IsSingleSegment)
+ {
+ TryReadLittleEndian(sequence.FirstSpan, out var value);
+ return value;
+ }
+ else
+ {
+ Span bytes = stackalloc byte[Size];
+ sequence.CopyTo(bytes);
+ TryReadLittleEndian(bytes, out var value);
+ return value;
+ }
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ private static bool TryReadLittleEndian(ReadOnlySpan source, out T value)
+ where T : IBinaryInteger => T.TryReadLittleEndian(source, isUnsigned: true, out value);
+ }
#endif
}
diff --git a/src/MessagePack/Internal/Sequence`1.cs b/src/MessagePack/Internal/Sequence`1.cs
index af99211af..9d4ff862c 100644
--- a/src/MessagePack/Internal/Sequence`1.cs
+++ b/src/MessagePack/Internal/Sequence`1.cs
@@ -18,7 +18,7 @@
#pragma warning disable SA1402 // File may only contain a single type
-namespace Nerdbank.Streams
+namespace Nerdbank.Streams // NOTE: invalid namespace, should modify
{
///
/// Manages a sequence of elements, readily castable as a .
diff --git a/src/MessagePack/MessagePack.csproj b/src/MessagePack/MessagePack.csproj
index a7beaaea7..20cfaebd3 100644
--- a/src/MessagePack/MessagePack.csproj
+++ b/src/MessagePack/MessagePack.csproj
@@ -1,10 +1,10 @@
- netstandard2.0;netstandard2.1;net8.0;net472
+ netstandard2.0;netstandard2.1;net8.0;net9.0;net472
$(NoWarn);CS0649
True
- $(DefineConstants);SPAN_BUILTIN
+ $(DefineConstants);SPAN_BUILTIN
True
Codestin Search App
diff --git a/src/MessagePack/MessagePackSerializer.Json.cs b/src/MessagePack/MessagePackSerializer.Json.cs
index 1d0d1f009..39e9e4113 100644
--- a/src/MessagePack/MessagePackSerializer.Json.cs
+++ b/src/MessagePack/MessagePackSerializer.Json.cs
@@ -8,7 +8,6 @@
using System.Text;
using System.Threading;
using MessagePack.Formatters;
-using Nerdbank.Streams;
namespace MessagePack
{
diff --git a/src/MessagePack/MessagePackSerializer.cs b/src/MessagePack/MessagePackSerializer.cs
index 316bf7b05..3cbb44cec 100644
--- a/src/MessagePack/MessagePackSerializer.cs
+++ b/src/MessagePack/MessagePackSerializer.cs
@@ -9,7 +9,6 @@
using System.Threading;
using System.Threading.Tasks;
using MessagePack.LZ4;
-using Nerdbank.Streams;
namespace MessagePack
{
diff --git a/src/MessagePack/Resolvers/BuiltinResolver.cs b/src/MessagePack/Resolvers/BuiltinResolver.cs
index 9da05ea6d..00ba57521 100644
--- a/src/MessagePack/Resolvers/BuiltinResolver.cs
+++ b/src/MessagePack/Resolvers/BuiltinResolver.cs
@@ -65,10 +65,6 @@ internal static class BuiltinResolverGetFormatterHelper
{ typeof(byte), ByteFormatter.Instance },
{ typeof(sbyte), SByteFormatter.Instance },
{ typeof(DateTime), DateTimeFormatter.Instance },
-#if NET6_0_OR_GREATER
- { typeof(DateOnly), DateOnlyFormatter.Instance },
- { typeof(TimeOnly), TimeOnlyFormatter.Instance },
-#endif
{ typeof(char), CharFormatter.Instance },
// Nullable Primitive
@@ -186,6 +182,15 @@ internal static class BuiltinResolverGetFormatterHelper
#if NET5_0_OR_GREATER
{ typeof(System.Half), HalfFormatter.Instance },
+ { typeof(System.Text.Rune), RuneFormatter.Instance },
+#endif
+#if NET6_0_OR_GREATER
+ { typeof(DateOnly), DateOnlyFormatter.Instance },
+ { typeof(TimeOnly), TimeOnlyFormatter.Instance },
+#endif
+#if NET7_0_OR_GREATER
+ { typeof(Int128), Int128Formatter.Instance },
+ { typeof(UInt128), UInt128Formatter.Instance },
#endif
};
diff --git a/src/MessagePack/Resolvers/DynamicGenericResolver.cs b/src/MessagePack/Resolvers/DynamicGenericResolver.cs
index 9fce0415c..cb1a2248a 100644
--- a/src/MessagePack/Resolvers/DynamicGenericResolver.cs
+++ b/src/MessagePack/Resolvers/DynamicGenericResolver.cs
@@ -54,9 +54,6 @@ internal static class DynamicGenericResolverGetFormatterHelper
{ typeof(List<>), typeof(ListFormatter<>) },
{ typeof(LinkedList<>), typeof(LinkedListFormatter<>) },
{ typeof(Queue<>), typeof(QueueFormatter<>) },
-#if NET6_0_OR_GREATER
- { typeof(PriorityQueue<,>), typeof(PriorityQueueFormatter<,>) },
-#endif
{ typeof(Stack<>), typeof(StackFormatter<>) },
{ typeof(HashSet<>), typeof(HashSetFormatter<>) },
{ typeof(ReadOnlyCollection<>), typeof(ReadOnlyCollectionFormatter<>) },
@@ -74,9 +71,6 @@ internal static class DynamicGenericResolverGetFormatterHelper
{ typeof(IReadOnlyList<>), typeof(InterfaceReadOnlyListFormatter<>) },
{ typeof(IReadOnlyCollection<>), typeof(InterfaceReadOnlyCollectionFormatter<>) },
{ typeof(ISet<>), typeof(InterfaceSetFormatter<>) },
-#if NET5_0_OR_GREATER
- { typeof(IReadOnlySet<>), typeof(InterfaceReadOnlySetFormatter<>) },
-#endif
{ typeof(System.Collections.Concurrent.ConcurrentBag<>), typeof(ConcurrentBagFormatter<>) },
{ typeof(System.Collections.Concurrent.ConcurrentQueue<>), typeof(ConcurrentQueueFormatter<>) },
{ typeof(System.Collections.Concurrent.ConcurrentStack<>), typeof(ConcurrentStackFormatter<>) },
@@ -84,6 +78,16 @@ internal static class DynamicGenericResolverGetFormatterHelper
{ typeof(IReadOnlyDictionary<,>), typeof(InterfaceReadOnlyDictionaryFormatter<,>) },
{ typeof(System.Collections.Concurrent.ConcurrentDictionary<,>), typeof(ConcurrentDictionaryFormatter<,>) },
{ typeof(Lazy<>), typeof(LazyFormatter<>) },
+#if NET5_0_OR_GREATER
+ { typeof(IReadOnlySet<>), typeof(InterfaceReadOnlySetFormatter<>) },
+#endif
+#if NET6_0_OR_GREATER
+ { typeof(PriorityQueue<,>), typeof(PriorityQueueFormatter<,>) },
+#endif
+#if NET9_0_OR_GREATER
+ { typeof(OrderedDictionary<,>), typeof(OrderedDictionaryFormatter<,>) },
+ { typeof(ReadOnlySet<>), typeof(ReadOnlySetFormatter<>) },
+#endif
};
// Reduce IL2CPP code generate size(don't write long code in )
diff --git a/src/MessagePack/Resolvers/SkipClrVisibilityChecks.cs b/src/MessagePack/Resolvers/SkipClrVisibilityChecks.cs
index 608fc469e..e3c982eec 100644
--- a/src/MessagePack/Resolvers/SkipClrVisibilityChecks.cs
+++ b/src/MessagePack/Resolvers/SkipClrVisibilityChecks.cs
@@ -14,7 +14,6 @@
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
-using Nerdbank.Streams;
namespace MessagePack;
diff --git a/src/MessagePack/net472/PublicAPI.Shipped.txt b/src/MessagePack/net472/PublicAPI.Shipped.txt
index 412e24a9d..28bbb5f11 100644
--- a/src/MessagePack/net472/PublicAPI.Shipped.txt
+++ b/src/MessagePack/net472/PublicAPI.Shipped.txt
@@ -1184,3 +1184,116 @@ MessagePack.MessagePackSerializerOptions.WithCompressionMinLength(int compressio
MessagePack.MessagePackSerializerOptions.WithSuggestedContiguousMemorySize(int suggestedContiguousMemorySize) -> MessagePack.MessagePackSerializerOptions!
static MessagePack.MessagePackWriter.GetEncodedLength(long value) -> int
static MessagePack.MessagePackWriter.GetEncodedLength(ulong value) -> int
+const MessagePack.ReservedExtensionTypeCodes.Lz4Block = 99 -> sbyte
+const MessagePack.ReservedExtensionTypeCodes.Lz4BlockArray = 98 -> sbyte
+const MessagePack.ReservedExtensionTypeCodes.TypelessFormatter = 100 -> sbyte
+const MessagePack.ReservedExtensionTypeCodes.UnityBounds = 35 -> sbyte
+const MessagePack.ReservedExtensionTypeCodes.UnityColor = 34 -> sbyte
+const MessagePack.ReservedExtensionTypeCodes.UnityDouble = 39 -> sbyte
+const MessagePack.ReservedExtensionTypeCodes.UnityFloat = 38 -> sbyte
+const MessagePack.ReservedExtensionTypeCodes.UnityInt = 37 -> sbyte
+const MessagePack.ReservedExtensionTypeCodes.UnityQuaternion = 33 -> sbyte
+const MessagePack.ReservedExtensionTypeCodes.UnityRect = 36 -> sbyte
+const MessagePack.ReservedExtensionTypeCodes.UnityVector2 = 30 -> sbyte
+const MessagePack.ReservedExtensionTypeCodes.UnityVector3 = 31 -> sbyte
+const MessagePack.ReservedExtensionTypeCodes.UnityVector4 = 32 -> sbyte
+MessagePack.CompositeResolverAttribute
+MessagePack.CompositeResolverAttribute.CompositeResolverAttribute(params System.Type![]! formattersAndResolvers) -> void
+MessagePack.CompositeResolverAttribute.IncludeLocalFormatters.get -> bool
+MessagePack.CompositeResolverAttribute.IncludeLocalFormatters.set -> void
+MessagePack.Formatters.EnumAsStringFormatter.EnumAsStringFormatter(bool ignoreCase) -> void
+MessagePack.Formatters.Matrix3x2Formatter
+MessagePack.Formatters.Matrix3x2Formatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions! options) -> System.Numerics.Matrix3x2
+MessagePack.Formatters.Matrix3x2Formatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Numerics.Matrix3x2 value, MessagePack.MessagePackSerializerOptions! options) -> void
+MessagePack.Formatters.Matrix4x4Formatter
+MessagePack.Formatters.Matrix4x4Formatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions! options) -> System.Numerics.Matrix4x4
+MessagePack.Formatters.Matrix4x4Formatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Numerics.Matrix4x4 value, MessagePack.MessagePackSerializerOptions! options) -> void
+MessagePack.Formatters.QuaternionFormatter
+MessagePack.Formatters.QuaternionFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions! options) -> System.Numerics.Quaternion
+MessagePack.Formatters.QuaternionFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Numerics.Quaternion value, MessagePack.MessagePackSerializerOptions! options) -> void
+MessagePack.Formatters.Vector2Formatter
+MessagePack.Formatters.Vector2Formatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions! options) -> System.Numerics.Vector2
+MessagePack.Formatters.Vector2Formatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Numerics.Vector2 value, MessagePack.MessagePackSerializerOptions! options) -> void
+MessagePack.Formatters.Vector3Formatter
+MessagePack.Formatters.Vector3Formatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions! options) -> System.Numerics.Vector3
+MessagePack.Formatters.Vector3Formatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Numerics.Vector3 value, MessagePack.MessagePackSerializerOptions! options) -> void
+MessagePack.Formatters.Vector4Formatter
+MessagePack.Formatters.Vector4Formatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions! options) -> System.Numerics.Vector4
+MessagePack.Formatters.Vector4Formatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Numerics.Vector4 value, MessagePack.MessagePackSerializerOptions! options) -> void
+MessagePack.GeneratedMessagePackResolverAttribute
+MessagePack.GeneratedMessagePackResolverAttribute.GeneratedMessagePackResolverAttribute() -> void
+MessagePack.GeneratedMessagePackResolverAttribute.UseMapMode.get -> bool
+MessagePack.GeneratedMessagePackResolverAttribute.UseMapMode.set -> void
+MessagePack.Internal.GeneratedAssemblyMessagePackResolverAttribute
+MessagePack.Internal.GeneratedAssemblyMessagePackResolverAttribute.GeneratedAssemblyMessagePackResolverAttribute(System.Type! resolverType, int majorVersion, int minorVersion) -> void
+MessagePack.Internal.GeneratedAssemblyMessagePackResolverAttribute.MajorVersion.get -> int
+MessagePack.Internal.GeneratedAssemblyMessagePackResolverAttribute.MinorVersion.get -> int
+MessagePack.Internal.GeneratedAssemblyMessagePackResolverAttribute.ResolverType.get -> System.Type!
+MessagePack.MessagePackPrimitives
+MessagePack.MessagePackPrimitives.DecodeResult
+MessagePack.MessagePackPrimitives.DecodeResult.EmptyBuffer = 2 -> MessagePack.MessagePackPrimitives.DecodeResult
+MessagePack.MessagePackPrimitives.DecodeResult.InsufficientBuffer = 3 -> MessagePack.MessagePackPrimitives.DecodeResult
+MessagePack.MessagePackPrimitives.DecodeResult.Success = 0 -> MessagePack.MessagePackPrimitives.DecodeResult
+MessagePack.MessagePackPrimitives.DecodeResult.TokenMismatch = 1 -> MessagePack.MessagePackPrimitives.DecodeResult
+MessagePack.ReservedExtensionTypeCodes
+MessagePack.Resolvers.DynamicEnumAsStringIgnoreCaseResolver
+MessagePack.Resolvers.DynamicEnumAsStringIgnoreCaseResolver.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter?
+MessagePack.Resolvers.SourceGeneratedFormatterResolver
+MessagePack.Resolvers.SourceGeneratedFormatterResolver.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter?
+MessagePack.SequencePool.Clear() -> void
+static MessagePack.MessagePackPrimitives.TryReadArrayHeader(System.ReadOnlySpan source, out uint count, out int tokenSize) -> MessagePack.MessagePackPrimitives.DecodeResult
+static MessagePack.MessagePackPrimitives.TryReadBinHeader(System.ReadOnlySpan source, out uint length, out int tokenSize) -> MessagePack.MessagePackPrimitives.DecodeResult
+static MessagePack.MessagePackPrimitives.TryReadBool(System.ReadOnlySpan source, out bool value, out int tokenSize) -> MessagePack.MessagePackPrimitives.DecodeResult
+static MessagePack.MessagePackPrimitives.TryReadByte(System.ReadOnlySpan source, out byte value, out int tokenSize) -> MessagePack.MessagePackPrimitives.DecodeResult
+static MessagePack.MessagePackPrimitives.TryReadChar(System.ReadOnlySpan source, out char value, out int tokenSize) -> MessagePack.MessagePackPrimitives.DecodeResult
+static MessagePack.MessagePackPrimitives.TryReadDateTime(System.ReadOnlySpan source, MessagePack.ExtensionHeader header, out System.DateTime value, out int tokenSize) -> MessagePack.MessagePackPrimitives.DecodeResult
+static MessagePack.MessagePackPrimitives.TryReadDateTime(System.ReadOnlySpan source, out System.DateTime value, out int tokenSize) -> MessagePack.MessagePackPrimitives.DecodeResult
+static MessagePack.MessagePackPrimitives.TryReadDouble(System.ReadOnlySpan source, out double value, out int tokenSize) -> MessagePack.MessagePackPrimitives.DecodeResult
+static MessagePack.MessagePackPrimitives.TryReadExtensionHeader(System.ReadOnlySpan source, out MessagePack.ExtensionHeader extensionHeader, out int tokenSize) -> MessagePack.MessagePackPrimitives.DecodeResult
+static MessagePack.MessagePackPrimitives.TryReadInt16(System.ReadOnlySpan source, out short value, out int tokenSize) -> MessagePack.MessagePackPrimitives.DecodeResult
+static MessagePack.MessagePackPrimitives.TryReadInt32(System.ReadOnlySpan source, out int value, out int tokenSize) -> MessagePack.MessagePackPrimitives.DecodeResult
+static MessagePack.MessagePackPrimitives.TryReadInt64(System.ReadOnlySpan source, out long value, out int tokenSize) -> MessagePack.MessagePackPrimitives.DecodeResult
+static MessagePack.MessagePackPrimitives.TryReadMapHeader(System.ReadOnlySpan source, out uint count, out int tokenSize) -> MessagePack.MessagePackPrimitives.DecodeResult
+static MessagePack.MessagePackPrimitives.TryReadNil(System.ReadOnlySpan source, out int tokenSize) -> MessagePack.MessagePackPrimitives.DecodeResult
+static MessagePack.MessagePackPrimitives.TryReadSByte(System.ReadOnlySpan source, out sbyte value, out int tokenSize) -> MessagePack.MessagePackPrimitives.DecodeResult
+static MessagePack.MessagePackPrimitives.TryReadSingle(System.ReadOnlySpan source, out float value, out int tokenSize) -> MessagePack.MessagePackPrimitives.DecodeResult
+static MessagePack.MessagePackPrimitives.TryReadStringHeader(System.ReadOnlySpan source, out uint length, out int tokenSize) -> MessagePack.MessagePackPrimitives.DecodeResult
+static MessagePack.MessagePackPrimitives.TryReadUInt16(System.ReadOnlySpan source, out ushort value, out int tokenSize) -> MessagePack.MessagePackPrimitives.DecodeResult
+static MessagePack.MessagePackPrimitives.TryReadUInt32(System.ReadOnlySpan source, out uint value, out int tokenSize) -> MessagePack.MessagePackPrimitives.DecodeResult
+static MessagePack.MessagePackPrimitives.TryReadUInt64(System.ReadOnlySpan source, out ulong value, out int tokenSize) -> MessagePack.MessagePackPrimitives.DecodeResult
+static MessagePack.MessagePackPrimitives.TryWrite(System.Span destination, bool value, out int bytesWritten) -> bool
+static MessagePack.MessagePackPrimitives.TryWrite(System.Span destination, byte value, out int bytesWritten) -> bool
+static MessagePack.MessagePackPrimitives.TryWrite(System.Span destination, char value, out int bytesWritten) -> bool
+static MessagePack.MessagePackPrimitives.TryWrite(System.Span destination, double value, out int bytesWritten) -> bool
+static MessagePack.MessagePackPrimitives.TryWrite(System.Span destination, float value, out int bytesWritten) -> bool
+static MessagePack.MessagePackPrimitives.TryWrite(System.Span destination, int value, out int bytesWritten) -> bool
+static MessagePack.MessagePackPrimitives.TryWrite(System.Span destination, long value, out int bytesWritten) -> bool
+static MessagePack.MessagePackPrimitives.TryWrite(System.Span destination, sbyte value, out int bytesWritten) -> bool
+static MessagePack.MessagePackPrimitives.TryWrite(System.Span destination, short value, out int bytesWritten) -> bool
+static MessagePack.MessagePackPrimitives.TryWrite(System.Span destination, System.DateTime value, out int bytesWritten) -> bool
+static MessagePack.MessagePackPrimitives.TryWrite(System.Span destination, uint value, out int bytesWritten) -> bool
+static MessagePack.MessagePackPrimitives.TryWrite(System.Span destination, ulong value, out int bytesWritten) -> bool
+static MessagePack.MessagePackPrimitives.TryWrite(System.Span destination, ushort value, out int bytesWritten) -> bool
+static MessagePack.MessagePackPrimitives.TryWriteArrayHeader(System.Span destination, uint count, out int bytesWritten) -> bool
+static MessagePack.MessagePackPrimitives.TryWriteBinHeader(System.Span destination, uint length, out int bytesWritten) -> bool
+static MessagePack.MessagePackPrimitives.TryWriteExtensionFormatHeader(System.Span destination, MessagePack.ExtensionHeader extensionHeader, out int bytesWritten) -> bool
+static MessagePack.MessagePackPrimitives.TryWriteInt16(System.Span destination, short value, out int bytesWritten) -> bool
+static MessagePack.MessagePackPrimitives.TryWriteInt32(System.Span destination, int value, out int bytesWritten) -> bool
+static MessagePack.MessagePackPrimitives.TryWriteInt64(System.Span destination, long value, out int bytesWritten) -> bool
+static MessagePack.MessagePackPrimitives.TryWriteInt8(System.Span destination, sbyte value, out int bytesWritten) -> bool
+static MessagePack.MessagePackPrimitives.TryWriteMapHeader(System.Span destination, uint count, out int bytesWritten) -> bool
+static MessagePack.MessagePackPrimitives.TryWriteNil(System.Span destination, out int bytesWritten) -> bool
+static MessagePack.MessagePackPrimitives.TryWriteStringHeader(System.Span destination, uint byteCount, out int bytesWritten) -> bool
+static MessagePack.MessagePackPrimitives.TryWriteUInt16(System.Span destination, ushort value, out int bytesWritten) -> bool
+static MessagePack.MessagePackPrimitives.TryWriteUInt32(System.Span destination, uint value, out int bytesWritten) -> bool
+static MessagePack.MessagePackPrimitives.TryWriteUInt64(System.Span destination, ulong value, out int bytesWritten) -> bool
+static MessagePack.MessagePackPrimitives.TryWriteUInt8(System.Span destination, byte value, out int bytesWritten) -> bool
+static readonly MessagePack.Formatters.Matrix3x2Formatter.Instance -> MessagePack.Formatters.IMessagePackFormatter!
+static readonly MessagePack.Formatters.Matrix4x4Formatter.Instance -> MessagePack.Formatters.IMessagePackFormatter!
+static readonly MessagePack.Formatters.QuaternionFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter!
+static readonly MessagePack.Formatters.Vector2Formatter.Instance -> MessagePack.Formatters.IMessagePackFormatter!
+static readonly MessagePack.Formatters.Vector3Formatter.Instance -> MessagePack.Formatters.IMessagePackFormatter!
+static readonly MessagePack.Formatters.Vector4Formatter.Instance -> MessagePack.Formatters.IMessagePackFormatter!
+static readonly MessagePack.Resolvers.DynamicEnumAsStringIgnoreCaseResolver.Instance -> MessagePack.Resolvers.DynamicEnumAsStringIgnoreCaseResolver!
+static readonly MessagePack.Resolvers.SourceGeneratedFormatterResolver.Instance -> MessagePack.Resolvers.SourceGeneratedFormatterResolver!
+static MessagePack.MessagePackSerializer.Typeless.Deserialize(System.ReadOnlyMemory bytes, MessagePack.MessagePackSerializerOptions? options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> object?
diff --git a/src/MessagePack/net472/PublicAPI.Unshipped.txt b/src/MessagePack/net472/PublicAPI.Unshipped.txt
index 66a5058b4..e69de29bb 100644
--- a/src/MessagePack/net472/PublicAPI.Unshipped.txt
+++ b/src/MessagePack/net472/PublicAPI.Unshipped.txt
@@ -1,113 +0,0 @@
-const MessagePack.ReservedExtensionTypeCodes.Lz4Block = 99 -> sbyte
-const MessagePack.ReservedExtensionTypeCodes.Lz4BlockArray = 98 -> sbyte
-const MessagePack.ReservedExtensionTypeCodes.TypelessFormatter = 100 -> sbyte
-const MessagePack.ReservedExtensionTypeCodes.UnityBounds = 35 -> sbyte
-const MessagePack.ReservedExtensionTypeCodes.UnityColor = 34 -> sbyte
-const MessagePack.ReservedExtensionTypeCodes.UnityDouble = 39 -> sbyte
-const MessagePack.ReservedExtensionTypeCodes.UnityFloat = 38 -> sbyte
-const MessagePack.ReservedExtensionTypeCodes.UnityInt = 37 -> sbyte
-const MessagePack.ReservedExtensionTypeCodes.UnityQuaternion = 33 -> sbyte
-const MessagePack.ReservedExtensionTypeCodes.UnityRect = 36 -> sbyte
-const MessagePack.ReservedExtensionTypeCodes.UnityVector2 = 30 -> sbyte
-const MessagePack.ReservedExtensionTypeCodes.UnityVector3 = 31 -> sbyte
-const MessagePack.ReservedExtensionTypeCodes.UnityVector4 = 32 -> sbyte
-MessagePack.CompositeResolverAttribute
-MessagePack.CompositeResolverAttribute.CompositeResolverAttribute(params System.Type![]! formattersAndResolvers) -> void
-MessagePack.CompositeResolverAttribute.IncludeLocalFormatters.get -> bool
-MessagePack.CompositeResolverAttribute.IncludeLocalFormatters.set -> void
-MessagePack.Formatters.EnumAsStringFormatter.EnumAsStringFormatter(bool ignoreCase) -> void
-MessagePack.Formatters.Matrix3x2Formatter
-MessagePack.Formatters.Matrix3x2Formatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions! options) -> System.Numerics.Matrix3x2
-MessagePack.Formatters.Matrix3x2Formatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Numerics.Matrix3x2 value, MessagePack.MessagePackSerializerOptions! options) -> void
-MessagePack.Formatters.Matrix4x4Formatter
-MessagePack.Formatters.Matrix4x4Formatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions! options) -> System.Numerics.Matrix4x4
-MessagePack.Formatters.Matrix4x4Formatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Numerics.Matrix4x4 value, MessagePack.MessagePackSerializerOptions! options) -> void
-MessagePack.Formatters.QuaternionFormatter
-MessagePack.Formatters.QuaternionFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions! options) -> System.Numerics.Quaternion
-MessagePack.Formatters.QuaternionFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Numerics.Quaternion value, MessagePack.MessagePackSerializerOptions! options) -> void
-MessagePack.Formatters.Vector2Formatter
-MessagePack.Formatters.Vector2Formatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions! options) -> System.Numerics.Vector2
-MessagePack.Formatters.Vector2Formatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Numerics.Vector2 value, MessagePack.MessagePackSerializerOptions! options) -> void
-MessagePack.Formatters.Vector3Formatter
-MessagePack.Formatters.Vector3Formatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions! options) -> System.Numerics.Vector3
-MessagePack.Formatters.Vector3Formatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Numerics.Vector3 value, MessagePack.MessagePackSerializerOptions! options) -> void
-MessagePack.Formatters.Vector4Formatter
-MessagePack.Formatters.Vector4Formatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions! options) -> System.Numerics.Vector4
-MessagePack.Formatters.Vector4Formatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Numerics.Vector4 value, MessagePack.MessagePackSerializerOptions! options) -> void
-MessagePack.GeneratedMessagePackResolverAttribute
-MessagePack.GeneratedMessagePackResolverAttribute.GeneratedMessagePackResolverAttribute() -> void
-MessagePack.GeneratedMessagePackResolverAttribute.UseMapMode.get -> bool
-MessagePack.GeneratedMessagePackResolverAttribute.UseMapMode.set -> void
-MessagePack.Internal.GeneratedAssemblyMessagePackResolverAttribute
-MessagePack.Internal.GeneratedAssemblyMessagePackResolverAttribute.GeneratedAssemblyMessagePackResolverAttribute(System.Type! resolverType, int majorVersion, int minorVersion) -> void
-MessagePack.Internal.GeneratedAssemblyMessagePackResolverAttribute.MajorVersion.get -> int
-MessagePack.Internal.GeneratedAssemblyMessagePackResolverAttribute.MinorVersion.get -> int
-MessagePack.Internal.GeneratedAssemblyMessagePackResolverAttribute.ResolverType.get -> System.Type!
-MessagePack.MessagePackPrimitives
-MessagePack.MessagePackPrimitives.DecodeResult
-MessagePack.MessagePackPrimitives.DecodeResult.EmptyBuffer = 2 -> MessagePack.MessagePackPrimitives.DecodeResult
-MessagePack.MessagePackPrimitives.DecodeResult.InsufficientBuffer = 3 -> MessagePack.MessagePackPrimitives.DecodeResult
-MessagePack.MessagePackPrimitives.DecodeResult.Success = 0 -> MessagePack.MessagePackPrimitives.DecodeResult
-MessagePack.MessagePackPrimitives.DecodeResult.TokenMismatch = 1 -> MessagePack.MessagePackPrimitives.DecodeResult
-MessagePack.ReservedExtensionTypeCodes
-MessagePack.Resolvers.DynamicEnumAsStringIgnoreCaseResolver
-MessagePack.Resolvers.DynamicEnumAsStringIgnoreCaseResolver.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter?
-MessagePack.Resolvers.SourceGeneratedFormatterResolver
-MessagePack.Resolvers.SourceGeneratedFormatterResolver.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter?
-MessagePack.SequencePool.Clear() -> void
-static MessagePack.MessagePackPrimitives.TryReadArrayHeader(System.ReadOnlySpan source, out uint count, out int tokenSize) -> MessagePack.MessagePackPrimitives.DecodeResult
-static MessagePack.MessagePackPrimitives.TryReadBinHeader(System.ReadOnlySpan source, out uint length, out int tokenSize) -> MessagePack.MessagePackPrimitives.DecodeResult
-static MessagePack.MessagePackPrimitives.TryReadBool(System.ReadOnlySpan source, out bool value, out int tokenSize) -> MessagePack.MessagePackPrimitives.DecodeResult
-static MessagePack.MessagePackPrimitives.TryReadByte(System.ReadOnlySpan source, out byte value, out int tokenSize) -> MessagePack.MessagePackPrimitives.DecodeResult
-static MessagePack.MessagePackPrimitives.TryReadChar(System.ReadOnlySpan source, out char value, out int tokenSize) -> MessagePack.MessagePackPrimitives.DecodeResult
-static MessagePack.MessagePackPrimitives.TryReadDateTime(System.ReadOnlySpan source, MessagePack.ExtensionHeader header, out System.DateTime value, out int tokenSize) -> MessagePack.MessagePackPrimitives.DecodeResult
-static MessagePack.MessagePackPrimitives.TryReadDateTime(System.ReadOnlySpan source, out System.DateTime value, out int tokenSize) -> MessagePack.MessagePackPrimitives.DecodeResult
-static MessagePack.MessagePackPrimitives.TryReadDouble(System.ReadOnlySpan source, out double value, out int tokenSize) -> MessagePack.MessagePackPrimitives.DecodeResult
-static MessagePack.MessagePackPrimitives.TryReadExtensionHeader(System.ReadOnlySpan source, out MessagePack.ExtensionHeader extensionHeader, out int tokenSize) -> MessagePack.MessagePackPrimitives.DecodeResult
-static MessagePack.MessagePackPrimitives.TryReadInt16(System.ReadOnlySpan source, out short value, out int tokenSize) -> MessagePack.MessagePackPrimitives.DecodeResult
-static MessagePack.MessagePackPrimitives.TryReadInt32(System.ReadOnlySpan source, out int value, out int tokenSize) -> MessagePack.MessagePackPrimitives.DecodeResult
-static MessagePack.MessagePackPrimitives.TryReadInt64(System.ReadOnlySpan source, out long value, out int tokenSize) -> MessagePack.MessagePackPrimitives.DecodeResult
-static MessagePack.MessagePackPrimitives.TryReadMapHeader(System.ReadOnlySpan source, out uint count, out int tokenSize) -> MessagePack.MessagePackPrimitives.DecodeResult
-static MessagePack.MessagePackPrimitives.TryReadNil(System.ReadOnlySpan source, out int tokenSize) -> MessagePack.MessagePackPrimitives.DecodeResult
-static MessagePack.MessagePackPrimitives.TryReadSByte(System.ReadOnlySpan source, out sbyte value, out int tokenSize) -> MessagePack.MessagePackPrimitives.DecodeResult
-static MessagePack.MessagePackPrimitives.TryReadSingle(System.ReadOnlySpan source, out float value, out int tokenSize) -> MessagePack.MessagePackPrimitives.DecodeResult
-static MessagePack.MessagePackPrimitives.TryReadStringHeader(System.ReadOnlySpan source, out uint length, out int tokenSize) -> MessagePack.MessagePackPrimitives.DecodeResult
-static MessagePack.MessagePackPrimitives.TryReadUInt16(System.ReadOnlySpan source, out ushort value, out int tokenSize) -> MessagePack.MessagePackPrimitives.DecodeResult
-static MessagePack.MessagePackPrimitives.TryReadUInt32(System.ReadOnlySpan source, out uint value, out int tokenSize) -> MessagePack.MessagePackPrimitives.DecodeResult
-static MessagePack.MessagePackPrimitives.TryReadUInt64(System.ReadOnlySpan source, out ulong value, out int tokenSize) -> MessagePack.MessagePackPrimitives.DecodeResult
-static MessagePack.MessagePackPrimitives.TryWrite(System.Span destination, bool value, out int bytesWritten) -> bool
-static MessagePack.MessagePackPrimitives.TryWrite(System.Span destination, byte value, out int bytesWritten) -> bool
-static MessagePack.MessagePackPrimitives.TryWrite(System.Span destination, char value, out int bytesWritten) -> bool
-static MessagePack.MessagePackPrimitives.TryWrite(System.Span destination, double value, out int bytesWritten) -> bool
-static MessagePack.MessagePackPrimitives.TryWrite(System.Span destination, float value, out int bytesWritten) -> bool
-static MessagePack.MessagePackPrimitives.TryWrite(System.Span destination, int value, out int bytesWritten) -> bool
-static MessagePack.MessagePackPrimitives.TryWrite(System.Span destination, long value, out int bytesWritten) -> bool
-static MessagePack.MessagePackPrimitives.TryWrite(System.Span destination, sbyte value, out int bytesWritten) -> bool
-static MessagePack.MessagePackPrimitives.TryWrite(System.Span destination, short value, out int bytesWritten) -> bool
-static MessagePack.MessagePackPrimitives.TryWrite(System.Span destination, System.DateTime value, out int bytesWritten) -> bool
-static MessagePack.MessagePackPrimitives.TryWrite(System.Span destination, uint value, out int bytesWritten) -> bool
-static MessagePack.MessagePackPrimitives.TryWrite(System.Span destination, ulong value, out int bytesWritten) -> bool
-static MessagePack.MessagePackPrimitives.TryWrite(System.Span destination, ushort value, out int bytesWritten) -> bool
-static MessagePack.MessagePackPrimitives.TryWriteArrayHeader(System.Span destination, uint count, out int bytesWritten) -> bool
-static MessagePack.MessagePackPrimitives.TryWriteBinHeader(System.Span destination, uint length, out int bytesWritten) -> bool
-static MessagePack.MessagePackPrimitives.TryWriteExtensionFormatHeader(System.Span destination, MessagePack.ExtensionHeader extensionHeader, out int bytesWritten) -> bool
-static MessagePack.MessagePackPrimitives.TryWriteInt16(System.Span destination, short value, out int bytesWritten) -> bool
-static MessagePack.MessagePackPrimitives.TryWriteInt32(System.Span destination, int value, out int bytesWritten) -> bool
-static MessagePack.MessagePackPrimitives.TryWriteInt64(System.Span destination, long value, out int bytesWritten) -> bool
-static MessagePack.MessagePackPrimitives.TryWriteInt8(System.Span destination, sbyte value, out int bytesWritten) -> bool
-static MessagePack.MessagePackPrimitives.TryWriteMapHeader(System.Span destination, uint count, out int bytesWritten) -> bool
-static MessagePack.MessagePackPrimitives.TryWriteNil(System.Span destination, out int bytesWritten) -> bool
-static MessagePack.MessagePackPrimitives.TryWriteStringHeader(System.Span destination, uint byteCount, out int bytesWritten) -> bool
-static MessagePack.MessagePackPrimitives.TryWriteUInt16(System.Span destination, ushort value, out int bytesWritten) -> bool
-static MessagePack.MessagePackPrimitives.TryWriteUInt32(System.Span destination, uint value, out int bytesWritten) -> bool
-static MessagePack.MessagePackPrimitives.TryWriteUInt64(System.Span destination, ulong value, out int bytesWritten) -> bool
-static MessagePack.MessagePackPrimitives.TryWriteUInt8(System.Span destination, byte value, out int bytesWritten) -> bool
-static readonly MessagePack.Formatters.Matrix3x2Formatter.Instance -> MessagePack.Formatters.IMessagePackFormatter!
-static readonly MessagePack.Formatters.Matrix4x4Formatter.Instance -> MessagePack.Formatters.IMessagePackFormatter!
-static readonly MessagePack.Formatters.QuaternionFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter!
-static readonly MessagePack.Formatters.Vector2Formatter.Instance -> MessagePack.Formatters.IMessagePackFormatter!
-static readonly MessagePack.Formatters.Vector3Formatter.Instance -> MessagePack.Formatters.IMessagePackFormatter!
-static readonly MessagePack.Formatters.Vector4Formatter.Instance -> MessagePack.Formatters.IMessagePackFormatter!
-static readonly MessagePack.Resolvers.DynamicEnumAsStringIgnoreCaseResolver.Instance -> MessagePack.Resolvers.DynamicEnumAsStringIgnoreCaseResolver!
-static readonly MessagePack.Resolvers.SourceGeneratedFormatterResolver.Instance -> MessagePack.Resolvers.SourceGeneratedFormatterResolver!
-static MessagePack.MessagePackSerializer.Typeless.Deserialize(System.ReadOnlyMemory