From f4d9667e90f767685d9762a4e0ab11df1419cc05 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 28 Sep 2020 07:51:41 -0600 Subject: [PATCH 001/161] Start work on 2.3-alpha --- version.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.json b/version.json index 007bf56e1..6b4d79f3c 100644 --- a/version.json +++ b/version.json @@ -1,6 +1,6 @@ { "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", - "version": "2.2", + "version": "2.3-alpha", "publicReleaseRefSpec": [ "^refs/heads/master$", "^refs/heads/v1\\.x$", From fcd6b3267427914a1d00f25d88a17469f96031e6 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 28 Sep 2020 07:55:16 -0600 Subject: [PATCH 002/161] Bump unity package to 2.3 --- .../Assets/Scripts/MessagePack/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/package.json b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/package.json index 369e37739..b25f689a9 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/package.json +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/package.json @@ -1,7 +1,7 @@ { "name": "com.neuecc.messagepack", "displayName": "MessagePack", - "version": "2.2.60", + "version": "2.3", "unity": "2018.4", "description": "Extremely Fast MessagePack Serializer for C#.", "keywords": [ "Serializer" ], From 0ce3c92c357d4524531d78b1b98a23cab5088ba9 Mon Sep 17 00:00:00 2001 From: pCYSl5EDgo <31692496+pCYSl5EDgo@users.noreply.github.com> Date: Sun, 18 Oct 2020 13:45:35 +0900 Subject: [PATCH 003/161] Prepare for C# Source Generator (#1082) --- .../CodeGenerator.cs | 241 ++++++++++-------- 1 file changed, 132 insertions(+), 109 deletions(-) diff --git a/src/MessagePack.GeneratorCore/CodeGenerator.cs b/src/MessagePack.GeneratorCore/CodeGenerator.cs index f4dd3d35c..a48528a04 100644 --- a/src/MessagePack.GeneratorCore/CodeGenerator.cs +++ b/src/MessagePack.GeneratorCore/CodeGenerator.cs @@ -73,127 +73,22 @@ public async Task GenerateFileAsync( if (Path.GetExtension(output) == ".cs") { // SingleFile Output - var objectFormatterTemplates = objectInfo - .GroupBy(x => (x.Namespace, x.IsStringKey)) - .Select(x => - { - var (nameSpace, isStringKey) = x.Key; - var objectSerializationInfos = x.ToArray(); - var template = isStringKey ? new StringKeyFormatterTemplate() : (IFormatterTemplate)new FormatterTemplate(); - - template.Namespace = namespaceDot + "Formatters" + (nameSpace is null ? string.Empty : "." + nameSpace); - template.ObjectSerializationInfos = objectSerializationInfos; - - return template; - }) - .ToArray(); - - var enumFormatterTemplates = enumInfo - .GroupBy(x => x.Namespace) - .Select(x => new EnumTemplate() - { - Namespace = namespaceDot + "Formatters" + ((x.Key == null) ? string.Empty : "." + x.Key), - EnumSerializationInfos = x.ToArray(), - }) - .ToArray(); - - var unionFormatterTemplates = unionInfo - .GroupBy(x => x.Namespace) - .Select(x => new UnionTemplate() - { - Namespace = namespaceDot + "Formatters" + ((x.Key == null) ? string.Empty : "." + x.Key), - UnionSerializationInfos = x.ToArray(), - }) - .ToArray(); - - var resolverTemplate = new ResolverTemplate() - { - Namespace = namespaceDot + "Resolvers", - FormatterNamespace = namespaceDot + "Formatters", - ResolverName = resolverName, - RegisterInfos = genericInfo.Where(x => !x.IsOpenGenericType).Cast().Concat(enumInfo).Concat(unionInfo).Concat(objectInfo.Where(x => !x.IsOpenGenericType)).ToArray(), - }; - - var sb = new StringBuilder(); - sb.AppendLine(resolverTemplate.TransformText()); - sb.AppendLine(); - foreach (var item in enumFormatterTemplates) - { - var text = item.TransformText(); - sb.AppendLine(text); - } - - sb.AppendLine(); - foreach (var item in unionFormatterTemplates) - { - var text = item.TransformText(); - sb.AppendLine(text); - } - - sb.AppendLine(); - foreach (var item in objectFormatterTemplates) - { - var text = item.TransformText(); - sb.AppendLine(text); - } - + var fullGeneratedProgramText = GenerateSingleFileSync(resolverName, namespaceDot, objectInfo, enumInfo, unionInfo, genericInfo); if (multioutSymbol == string.Empty) { - await OutputAsync(output, sb.ToString(), cancellationToken); + await OutputAsync(output, fullGeneratedProgramText, cancellationToken); } else { var fname = Path.GetFileNameWithoutExtension(output) + "." + MultiSymbolToSafeFilePath(multioutSymbol) + ".cs"; - var text = $"#if {multioutSymbol}" + Environment.NewLine + sb.ToString() + Environment.NewLine + "#endif"; + var text = $"#if {multioutSymbol}" + Environment.NewLine + fullGeneratedProgramText + Environment.NewLine + "#endif"; await OutputAsync(Path.Combine(Path.GetDirectoryName(output), fname), text, cancellationToken); } } else { // Multiple File output - foreach (var x in objectInfo) - { - var template = x.IsStringKey ? new StringKeyFormatterTemplate() : (IFormatterTemplate)new FormatterTemplate(); - template.Namespace = namespaceDot + "Formatters" + (x.Namespace is null ? string.Empty : "." + x.Namespace); - template.ObjectSerializationInfos = new[] { x }; - - var text = template.TransformText(); - await OutputToDirAsync(output, template.Namespace, x.Name + "Formatter", multioutSymbol, text, cancellationToken); - } - - foreach (var x in enumInfo) - { - var template = new EnumTemplate() - { - Namespace = namespaceDot + "Formatters" + ((x.Namespace == null) ? string.Empty : "." + x.Namespace), - EnumSerializationInfos = new[] { x }, - }; - - var text = template.TransformText(); - await OutputToDirAsync(output, template.Namespace, x.Name + "Formatter", multioutSymbol, text, cancellationToken); - } - - foreach (var x in unionInfo) - { - var template = new UnionTemplate() - { - Namespace = namespaceDot + "Formatters" + ((x.Namespace == null) ? string.Empty : "." + x.Namespace), - UnionSerializationInfos = new[] { x }, - }; - - var text = template.TransformText(); - await OutputToDirAsync(output, template.Namespace, x.Name + "Formatter", multioutSymbol, text, cancellationToken); - } - - var resolverTemplate = new ResolverTemplate() - { - Namespace = namespaceDot + "Resolvers", - FormatterNamespace = namespaceDot + "Formatters", - ResolverName = resolverName, - RegisterInfos = genericInfo.Where(x => !x.IsOpenGenericType).Cast().Concat(enumInfo).Concat(unionInfo).Concat(objectInfo.Where(x => !x.IsOpenGenericType)).ToArray(), - }; - - await OutputToDirAsync(output, resolverTemplate.Namespace, resolverTemplate.ResolverName, multioutSymbol, resolverTemplate.TransformText(), cancellationToken); + await GenerateMultipleFileAsync(output, resolverName, objectInfo, enumInfo, unionInfo, namespaceDot, multioutSymbol, genericInfo); } if (objectInfo.Length == 0 && enumInfo.Length == 0 && genericInfo.Length == 0 && unionInfo.Length == 0) @@ -205,6 +100,134 @@ public async Task GenerateFileAsync( logger("Output Generation Complete:" + sw.Elapsed.ToString()); } + /// + /// Generates the specialized resolver and formatters for the types that require serialization in a given compilation. + /// + /// The resolver name. + /// The namespace for the generated type to be created in. + /// The ObjectSerializationInfo array which TypeCollector.Collect returns. + /// The EnumSerializationInfo array which TypeCollector.Collect returns. + /// The UnionSerializationInfo array which TypeCollector.Collect returns. + /// The GenericSerializationInfo array which TypeCollector.Collect returns. + public static string GenerateSingleFileSync(string resolverName, string namespaceDot, ObjectSerializationInfo[] objectInfo, EnumSerializationInfo[] enumInfo, UnionSerializationInfo[] unionInfo, GenericSerializationInfo[] genericInfo) + { + var objectFormatterTemplates = objectInfo + .GroupBy(x => (x.Namespace, x.IsStringKey)) + .Select(x => + { + var (nameSpace, isStringKey) = x.Key; + var objectSerializationInfos = x.ToArray(); + var template = isStringKey ? new StringKeyFormatterTemplate() : (IFormatterTemplate)new FormatterTemplate(); + + template.Namespace = namespaceDot + "Formatters" + (nameSpace is null ? string.Empty : "." + nameSpace); + template.ObjectSerializationInfos = objectSerializationInfos; + + return template; + }) + .ToArray(); + + var enumFormatterTemplates = enumInfo + .GroupBy(x => x.Namespace) + .Select(x => new EnumTemplate() + { + Namespace = namespaceDot + "Formatters" + ((x.Key == null) ? string.Empty : "." + x.Key), + EnumSerializationInfos = x.ToArray(), + }) + .ToArray(); + + var unionFormatterTemplates = unionInfo + .GroupBy(x => x.Namespace) + .Select(x => new UnionTemplate() + { + Namespace = namespaceDot + "Formatters" + ((x.Key == null) ? string.Empty : "." + x.Key), + UnionSerializationInfos = x.ToArray(), + }) + .ToArray(); + + var resolverTemplate = new ResolverTemplate() + { + Namespace = namespaceDot + "Resolvers", + FormatterNamespace = namespaceDot + "Formatters", + ResolverName = resolverName, + RegisterInfos = genericInfo.Where(x => !x.IsOpenGenericType).Cast().Concat(enumInfo).Concat(unionInfo).Concat(objectInfo.Where(x => !x.IsOpenGenericType)).ToArray(), + }; + + var sb = new StringBuilder(); + sb.AppendLine(resolverTemplate.TransformText()); + sb.AppendLine(); + foreach (var item in enumFormatterTemplates) + { + var text = item.TransformText(); + sb.AppendLine(text); + } + + sb.AppendLine(); + foreach (var item in unionFormatterTemplates) + { + var text = item.TransformText(); + sb.AppendLine(text); + } + + sb.AppendLine(); + foreach (var item in objectFormatterTemplates) + { + var text = item.TransformText(); + sb.AppendLine(text); + } + + return sb.ToString(); + } + + private Task GenerateMultipleFileAsync(string output, string resolverName, ObjectSerializationInfo[] objectInfo, EnumSerializationInfo[] enumInfo, UnionSerializationInfo[] unionInfo, string namespaceDot, string multioutSymbol, GenericSerializationInfo[] genericInfo) + { + var waitingTasks = new Task[objectInfo.Length + enumInfo.Length + unionInfo.Length + 1]; + var waitingIndex = 0; + foreach (var x in objectInfo) + { + var template = x.IsStringKey ? new StringKeyFormatterTemplate() : (IFormatterTemplate)new FormatterTemplate(); + template.Namespace = namespaceDot + "Formatters" + (x.Namespace is null ? string.Empty : "." + x.Namespace); + template.ObjectSerializationInfos = new[] { x }; + + var text = template.TransformText(); + waitingTasks[waitingIndex++] = OutputToDirAsync(output, template.Namespace, x.Name + "Formatter", multioutSymbol, text, cancellationToken); + } + + foreach (var x in enumInfo) + { + var template = new EnumTemplate() + { + Namespace = namespaceDot + "Formatters" + ((x.Namespace == null) ? string.Empty : "." + x.Namespace), + EnumSerializationInfos = new[] { x }, + }; + + var text = template.TransformText(); + waitingTasks[waitingIndex++] = OutputToDirAsync(output, template.Namespace, x.Name + "Formatter", multioutSymbol, text, cancellationToken); + } + + foreach (var x in unionInfo) + { + var template = new UnionTemplate() + { + Namespace = namespaceDot + "Formatters" + ((x.Namespace == null) ? string.Empty : "." + x.Namespace), + UnionSerializationInfos = new[] { x }, + }; + + var text = template.TransformText(); + waitingTasks[waitingIndex++] = OutputToDirAsync(output, template.Namespace, x.Name + "Formatter", multioutSymbol, text, cancellationToken); + } + + var resolverTemplate = new ResolverTemplate() + { + Namespace = namespaceDot + "Resolvers", + FormatterNamespace = namespaceDot + "Formatters", + ResolverName = resolverName, + RegisterInfos = genericInfo.Where(x => !x.IsOpenGenericType).Cast().Concat(enumInfo).Concat(unionInfo).Concat(objectInfo.Where(x => !x.IsOpenGenericType)).ToArray(), + }; + + waitingTasks[waitingIndex] = OutputToDirAsync(output, resolverTemplate.Namespace, resolverTemplate.ResolverName, multioutSymbol, resolverTemplate.TransformText(), cancellationToken); + return Task.WhenAll(waitingTasks); + } + private Task OutputToDirAsync(string dir, string ns, string name, string multipleOutSymbol, string text, CancellationToken cancellationToken) { if (multipleOutSymbol == string.Empty) From f86ec028bed41905412a2e06325cb95b780e68d5 Mon Sep 17 00:00:00 2001 From: pCYSl5EDgo <31692496+pCYSl5EDgo@users.noreply.github.com> Date: Mon, 26 Oct 2020 01:14:39 +0900 Subject: [PATCH 004/161] Refactoring of int-key mpc.exe tt file (#1088) * This is a cherry-pick of #1074. This is a refactoring of int-key mpc.exe tt file. * Change the format to decrease template part lines. Change the iterator `i` type from `int` to `var`. * fix CRLF * Change: var to globall:: Revert: DepthStep position Revert: }#> -> } #> * Fix: space * Fix: Line Feed * Fix: var -> global::MessagePack.IFormatterResolver --- sandbox/Sandbox/Generated.cs | 291 +++++++++--------- .../Generator/FormatterTemplate.cs | 94 +++--- .../Generator/FormatterTemplate.tt | 78 +++-- 3 files changed, 242 insertions(+), 221 deletions(-) diff --git a/sandbox/Sandbox/Generated.cs b/sandbox/Sandbox/Generated.cs index 06700c51a..8d08192aa 100644 --- a/sandbox/Sandbox/Generated.cs +++ b/sandbox/Sandbox/Generated.cs @@ -908,14 +908,13 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.RootUnion namespace MessagePack.Formatters.Abcdefg.Efcdigjl.Ateatatea.Hgfagfafgad { - using System; - using System.Buffers; - using MessagePack; + using global::System.Buffers; + using global::MessagePack; public sealed class TnonodsfarnoiuAtatqagaFormatter : global::MessagePack.Formatters.IMessagePackFormatter { - public void Serialize(ref MessagePackWriter writer, global::Abcdefg.Efcdigjl.Ateatatea.Hgfagfafgad.TnonodsfarnoiuAtatqaga value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::Abcdefg.Efcdigjl.Ateatatea.Hgfagfafgad.TnonodsfarnoiuAtatqaga value, global::MessagePack.MessagePackSerializerOptions options) { if (value == null) { @@ -927,7 +926,7 @@ public void Serialize(ref MessagePackWriter writer, global::Abcdefg.Efcdigjl.Ate writer.Write(value.MyProperty); } - public global::Abcdefg.Efcdigjl.Ateatatea.Hgfagfafgad.TnonodsfarnoiuAtatqaga Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::Abcdefg.Efcdigjl.Ateatatea.Hgfagfafgad.TnonodsfarnoiuAtatqaga Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { @@ -989,14 +988,13 @@ public void Serialize(ref MessagePackWriter writer, global::Abcdefg.Efcdigjl.Ate namespace MessagePack.Formatters { - using System; - using System.Buffers; - using MessagePack; + using global::System.Buffers; + using global::MessagePack; public sealed class ArrayTestTestFormatter : global::MessagePack.Formatters.IMessagePackFormatter { - public void Serialize(ref MessagePackWriter writer, global::ArrayTestTest value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::ArrayTestTest value, global::MessagePack.MessagePackSerializerOptions options) { if (value == null) { @@ -1004,7 +1002,7 @@ public void Serialize(ref MessagePackWriter writer, global::ArrayTestTest value, return; } - IFormatterResolver formatterResolver = options.Resolver; + global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; writer.WriteArrayHeader(7); formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.MyProperty0, options); formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.MyProperty1, options); @@ -1015,7 +1013,7 @@ public void Serialize(ref MessagePackWriter writer, global::ArrayTestTest value, formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.MyProperty6, options); } - public global::ArrayTestTest Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::ArrayTestTest Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { @@ -1023,7 +1021,7 @@ public void Serialize(ref MessagePackWriter writer, global::ArrayTestTest value, } options.Security.DepthStep(ref reader); - IFormatterResolver formatterResolver = options.Resolver; + global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; var length = reader.ReadArrayHeader(); var __MyProperty0__ = default(int[]); var __MyProperty1__ = default(int[,]); @@ -1080,7 +1078,7 @@ public void Serialize(ref MessagePackWriter writer, global::ArrayTestTest value, public sealed class GlobalManFormatter : global::MessagePack.Formatters.IMessagePackFormatter { - public void Serialize(ref MessagePackWriter writer, global::GlobalMan value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::GlobalMan value, global::MessagePack.MessagePackSerializerOptions options) { if (value == null) { @@ -1092,7 +1090,7 @@ public void Serialize(ref MessagePackWriter writer, global::GlobalMan value, glo writer.Write(value.MyProperty); } - public global::GlobalMan Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::GlobalMan Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { @@ -1126,7 +1124,7 @@ public void Serialize(ref MessagePackWriter writer, global::GlobalMan value, glo public sealed class MessageFormatter : global::MessagePack.Formatters.IMessagePackFormatter { - public void Serialize(ref MessagePackWriter writer, global::Message value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::Message value, global::MessagePack.MessagePackSerializerOptions options) { if (value == null) { @@ -1134,7 +1132,7 @@ public void Serialize(ref MessagePackWriter writer, global::Message value, globa return; } - IFormatterResolver formatterResolver = options.Resolver; + global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; writer.WriteArrayHeader(4); writer.Write(value.UserId); writer.Write(value.RoomId); @@ -1142,7 +1140,7 @@ public void Serialize(ref MessagePackWriter writer, global::Message value, globa formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.Body, options); } - public global::Message Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::Message Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { @@ -1150,7 +1148,7 @@ public void Serialize(ref MessagePackWriter writer, global::Message value, globa } options.Security.DepthStep(ref reader); - IFormatterResolver formatterResolver = options.Resolver; + global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; var length = reader.ReadArrayHeader(); var __UserId__ = default(int); var __RoomId__ = default(int); @@ -1192,7 +1190,7 @@ public void Serialize(ref MessagePackWriter writer, global::Message value, globa public sealed class QuestMessageBodyFormatter : global::MessagePack.Formatters.IMessagePackFormatter { - public void Serialize(ref MessagePackWriter writer, global::QuestMessageBody value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::QuestMessageBody value, global::MessagePack.MessagePackSerializerOptions options) { if (value == null) { @@ -1200,13 +1198,13 @@ public void Serialize(ref MessagePackWriter writer, global::QuestMessageBody val return; } - IFormatterResolver formatterResolver = options.Resolver; + global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; writer.WriteArrayHeader(2); writer.Write(value.QuestId); formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.Text, options); } - public global::QuestMessageBody Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::QuestMessageBody Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { @@ -1214,7 +1212,7 @@ public void Serialize(ref MessagePackWriter writer, global::QuestMessageBody val } options.Security.DepthStep(ref reader); - IFormatterResolver formatterResolver = options.Resolver; + global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; var length = reader.ReadArrayHeader(); var __QuestId__ = default(int); var __Text__ = default(string); @@ -1246,7 +1244,7 @@ public void Serialize(ref MessagePackWriter writer, global::QuestMessageBody val public sealed class StampMessageBodyFormatter : global::MessagePack.Formatters.IMessagePackFormatter { - public void Serialize(ref MessagePackWriter writer, global::StampMessageBody value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::StampMessageBody value, global::MessagePack.MessagePackSerializerOptions options) { if (value == null) { @@ -1258,7 +1256,7 @@ public void Serialize(ref MessagePackWriter writer, global::StampMessageBody val writer.Write(value.StampId); } - public global::StampMessageBody Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::StampMessageBody Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { @@ -1292,7 +1290,7 @@ public void Serialize(ref MessagePackWriter writer, global::StampMessageBody val public sealed class TextMessageBodyFormatter : global::MessagePack.Formatters.IMessagePackFormatter { - public void Serialize(ref MessagePackWriter writer, global::TextMessageBody value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::TextMessageBody value, global::MessagePack.MessagePackSerializerOptions options) { if (value == null) { @@ -1300,12 +1298,12 @@ public void Serialize(ref MessagePackWriter writer, global::TextMessageBody valu return; } - IFormatterResolver formatterResolver = options.Resolver; + global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; writer.WriteArrayHeader(1); formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.Text, options); } - public global::TextMessageBody Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::TextMessageBody Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { @@ -1313,7 +1311,7 @@ public void Serialize(ref MessagePackWriter writer, global::TextMessageBody valu } options.Security.DepthStep(ref reader); - IFormatterResolver formatterResolver = options.Resolver; + global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; var length = reader.ReadArrayHeader(); var __Text__ = default(string); @@ -1793,14 +1791,13 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: namespace MessagePack.Formatters.SharedData { - using System; - using System.Buffers; - using MessagePack; + using global::System.Buffers; + using global::MessagePack; public sealed class ArrayOptimizeClassFormatter : global::MessagePack.Formatters.IMessagePackFormatter { - public void Serialize(ref MessagePackWriter writer, global::SharedData.ArrayOptimizeClass value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.ArrayOptimizeClass value, global::MessagePack.MessagePackSerializerOptions options) { if (value == null) { @@ -1827,7 +1824,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.ArrayOpti writer.Write(value.MyProperty15); } - public global::SharedData.ArrayOptimizeClass Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::SharedData.ArrayOptimizeClass Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { @@ -1936,7 +1933,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.ArrayOpti public sealed class BarClassFormatter : global::MessagePack.Formatters.IMessagePackFormatter { - public void Serialize(ref MessagePackWriter writer, global::SharedData.BarClass value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.BarClass value, global::MessagePack.MessagePackSerializerOptions options) { if (value == null) { @@ -1944,12 +1941,12 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.BarClass return; } - IFormatterResolver formatterResolver = options.Resolver; + global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; writer.WriteArrayHeader(1); formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.OPQ, options); } - public global::SharedData.BarClass Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::SharedData.BarClass Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { @@ -1957,7 +1954,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.BarClass } options.Security.DepthStep(ref reader); - IFormatterResolver formatterResolver = options.Resolver; + global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; var length = reader.ReadArrayHeader(); var __OPQ__ = default(string); @@ -1984,7 +1981,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.BarClass public sealed class Callback1Formatter : global::MessagePack.Formatters.IMessagePackFormatter { - public void Serialize(ref MessagePackWriter writer, global::SharedData.Callback1 value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.Callback1 value, global::MessagePack.MessagePackSerializerOptions options) { if (value == null) { @@ -1997,7 +1994,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.Callback1 writer.Write(value.X); } - public global::SharedData.Callback1 Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::SharedData.Callback1 Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { @@ -2032,7 +2029,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.Callback1 public sealed class Callback1_2Formatter : global::MessagePack.Formatters.IMessagePackFormatter { - public void Serialize(ref MessagePackWriter writer, global::SharedData.Callback1_2 value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.Callback1_2 value, global::MessagePack.MessagePackSerializerOptions options) { if (value == null) { @@ -2040,12 +2037,12 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.Callback1 return; } - ((IMessagePackSerializationCallbackReceiver)value).OnBeforeSerialize(); + ((global::MessagePack.IMessagePackSerializationCallbackReceiver)value).OnBeforeSerialize(); writer.WriteArrayHeader(1); writer.Write(value.X); } - public global::SharedData.Callback1_2 Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::SharedData.Callback1_2 Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { @@ -2071,18 +2068,18 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.Callback1 var ____result = new global::SharedData.Callback1_2(__X__); ____result.X = __X__; - ((IMessagePackSerializationCallbackReceiver)____result).OnAfterDeserialize(); + ((global::MessagePack.IMessagePackSerializationCallbackReceiver)____result).OnAfterDeserialize(); reader.Depth--; return ____result; } } - public sealed class DynamicArgumentTupleFormatter : global::MessagePack.Formatters.IMessagePackFormatter> + public sealed class DynamicArgumentTupleFormatter : global::MessagePack.Formatters.IMessagePackFormatter> { - public void Serialize(ref MessagePackWriter writer, global::SharedData.DynamicArgumentTuple value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.DynamicArgumentTuple value, global::MessagePack.MessagePackSerializerOptions options) { - IFormatterResolver formatterResolver = options.Resolver; + global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; writer.WriteArrayHeader(9); formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.Item1, options); formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.Item2, options); @@ -2095,15 +2092,15 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.DynamicAr formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.Item9, options); } - public global::SharedData.DynamicArgumentTuple Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::SharedData.DynamicArgumentTuple Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { - throw new InvalidOperationException("typecode is null, struct not supported"); + throw new global::System.InvalidOperationException("typecode is null, struct not supported"); } options.Security.DepthStep(ref reader); - IFormatterResolver formatterResolver = options.Resolver; + global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; var length = reader.ReadArrayHeader(); var __Item1__ = default(T1); var __Item2__ = default(T2); @@ -2161,7 +2158,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.DynamicAr public sealed class Empty1Formatter : global::MessagePack.Formatters.IMessagePackFormatter { - public void Serialize(ref MessagePackWriter writer, global::SharedData.Empty1 value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.Empty1 value, global::MessagePack.MessagePackSerializerOptions options) { if (value == null) { @@ -2172,7 +2169,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.Empty1 va writer.WriteArrayHeader(0); } - public global::SharedData.Empty1 Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::SharedData.Empty1 Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { @@ -2201,7 +2198,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.Empty1 va public sealed class EmptyClassFormatter : global::MessagePack.Formatters.IMessagePackFormatter { - public void Serialize(ref MessagePackWriter writer, global::SharedData.EmptyClass value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.EmptyClass value, global::MessagePack.MessagePackSerializerOptions options) { if (value == null) { @@ -2212,7 +2209,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.EmptyClas writer.WriteArrayHeader(0); } - public global::SharedData.EmptyClass Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::SharedData.EmptyClass Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { @@ -2241,16 +2238,16 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.EmptyClas public sealed class EmptyStructFormatter : global::MessagePack.Formatters.IMessagePackFormatter { - public void Serialize(ref MessagePackWriter writer, global::SharedData.EmptyStruct value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.EmptyStruct value, global::MessagePack.MessagePackSerializerOptions options) { writer.WriteArrayHeader(0); } - public global::SharedData.EmptyStruct Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::SharedData.EmptyStruct Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { - throw new InvalidOperationException("typecode is null, struct not supported"); + throw new global::System.InvalidOperationException("typecode is null, struct not supported"); } options.Security.DepthStep(ref reader); @@ -2275,7 +2272,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.EmptyStru public sealed class FirstSimpleDataFormatter : global::MessagePack.Formatters.IMessagePackFormatter { - public void Serialize(ref MessagePackWriter writer, global::SharedData.FirstSimpleData value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.FirstSimpleData value, global::MessagePack.MessagePackSerializerOptions options) { if (value == null) { @@ -2283,14 +2280,14 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.FirstSimp return; } - IFormatterResolver formatterResolver = options.Resolver; + global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; writer.WriteArrayHeader(3); writer.Write(value.Prop1); formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.Prop2, options); writer.Write(value.Prop3); } - public global::SharedData.FirstSimpleData Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::SharedData.FirstSimpleData Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { @@ -2298,7 +2295,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.FirstSimp } options.Security.DepthStep(ref reader); - IFormatterResolver formatterResolver = options.Resolver; + global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; var length = reader.ReadArrayHeader(); var __Prop1__ = default(int); var __Prop2__ = default(string); @@ -2335,7 +2332,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.FirstSimp public sealed class FooClassFormatter : global::MessagePack.Formatters.IMessagePackFormatter { - public void Serialize(ref MessagePackWriter writer, global::SharedData.FooClass value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.FooClass value, global::MessagePack.MessagePackSerializerOptions options) { if (value == null) { @@ -2347,7 +2344,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.FooClass writer.Write(value.XYZ); } - public global::SharedData.FooClass Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::SharedData.FooClass Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { @@ -2378,10 +2375,10 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.FooClass } } - public sealed class GenericClassFormatter : global::MessagePack.Formatters.IMessagePackFormatter> + public sealed class GenericClassFormatter : global::MessagePack.Formatters.IMessagePackFormatter> { - public void Serialize(ref MessagePackWriter writer, global::SharedData.GenericClass value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.GenericClass value, global::MessagePack.MessagePackSerializerOptions options) { if (value == null) { @@ -2389,13 +2386,13 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.GenericCl return; } - IFormatterResolver formatterResolver = options.Resolver; + global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; writer.WriteArrayHeader(2); formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.MyProperty0, options); formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.MyProperty1, options); } - public global::SharedData.GenericClass Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::SharedData.GenericClass Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { @@ -2403,7 +2400,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.GenericCl } options.Security.DepthStep(ref reader); - IFormatterResolver formatterResolver = options.Resolver; + global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; var length = reader.ReadArrayHeader(); var __MyProperty0__ = default(T1); var __MyProperty1__ = default(T2); @@ -2432,26 +2429,26 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.GenericCl } } - public sealed class GenericStructFormatter : global::MessagePack.Formatters.IMessagePackFormatter> + public sealed class GenericStructFormatter : global::MessagePack.Formatters.IMessagePackFormatter> { - public void Serialize(ref MessagePackWriter writer, global::SharedData.GenericStruct value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.GenericStruct value, global::MessagePack.MessagePackSerializerOptions options) { - IFormatterResolver formatterResolver = options.Resolver; + global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; writer.WriteArrayHeader(2); formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.MyProperty0, options); formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.MyProperty1, options); } - public global::SharedData.GenericStruct Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::SharedData.GenericStruct Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { - throw new InvalidOperationException("typecode is null, struct not supported"); + throw new global::System.InvalidOperationException("typecode is null, struct not supported"); } options.Security.DepthStep(ref reader); - IFormatterResolver formatterResolver = options.Resolver; + global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; var length = reader.ReadArrayHeader(); var __MyProperty0__ = default(T1); var __MyProperty1__ = default(T2); @@ -2483,7 +2480,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.GenericSt public sealed class HolderV0Formatter : global::MessagePack.Formatters.IMessagePackFormatter { - public void Serialize(ref MessagePackWriter writer, global::SharedData.HolderV0 value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.HolderV0 value, global::MessagePack.MessagePackSerializerOptions options) { if (value == null) { @@ -2491,13 +2488,13 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.HolderV0 return; } - IFormatterResolver formatterResolver = options.Resolver; + global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; writer.WriteArrayHeader(2); formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.MyProperty1, options); writer.Write(value.After); } - public global::SharedData.HolderV0 Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::SharedData.HolderV0 Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { @@ -2505,7 +2502,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.HolderV0 } options.Security.DepthStep(ref reader); - IFormatterResolver formatterResolver = options.Resolver; + global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; var length = reader.ReadArrayHeader(); var __MyProperty1__ = default(global::SharedData.Version0); var __After__ = default(int); @@ -2537,7 +2534,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.HolderV0 public sealed class HolderV1Formatter : global::MessagePack.Formatters.IMessagePackFormatter { - public void Serialize(ref MessagePackWriter writer, global::SharedData.HolderV1 value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.HolderV1 value, global::MessagePack.MessagePackSerializerOptions options) { if (value == null) { @@ -2545,13 +2542,13 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.HolderV1 return; } - IFormatterResolver formatterResolver = options.Resolver; + global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; writer.WriteArrayHeader(2); formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.MyProperty1, options); writer.Write(value.After); } - public global::SharedData.HolderV1 Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::SharedData.HolderV1 Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { @@ -2559,7 +2556,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.HolderV1 } options.Security.DepthStep(ref reader); - IFormatterResolver formatterResolver = options.Resolver; + global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; var length = reader.ReadArrayHeader(); var __MyProperty1__ = default(global::SharedData.Version1); var __After__ = default(int); @@ -2591,7 +2588,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.HolderV1 public sealed class HolderV2Formatter : global::MessagePack.Formatters.IMessagePackFormatter { - public void Serialize(ref MessagePackWriter writer, global::SharedData.HolderV2 value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.HolderV2 value, global::MessagePack.MessagePackSerializerOptions options) { if (value == null) { @@ -2599,13 +2596,13 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.HolderV2 return; } - IFormatterResolver formatterResolver = options.Resolver; + global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; writer.WriteArrayHeader(2); formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.MyProperty1, options); writer.Write(value.After); } - public global::SharedData.HolderV2 Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::SharedData.HolderV2 Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { @@ -2613,7 +2610,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.HolderV2 } options.Security.DepthStep(ref reader); - IFormatterResolver formatterResolver = options.Resolver; + global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; var length = reader.ReadArrayHeader(); var __MyProperty1__ = default(global::SharedData.Version2); var __After__ = default(int); @@ -2645,7 +2642,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.HolderV2 public sealed class MyClassFormatter : global::MessagePack.Formatters.IMessagePackFormatter { - public void Serialize(ref MessagePackWriter writer, global::SharedData.MyClass value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.MyClass value, global::MessagePack.MessagePackSerializerOptions options) { if (value == null) { @@ -2659,7 +2656,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.MyClass v writer.Write(value.MyProperty3); } - public global::SharedData.MyClass Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::SharedData.MyClass Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { @@ -2703,7 +2700,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.MyClass v public sealed class MySubUnion1Formatter : global::MessagePack.Formatters.IMessagePackFormatter { - public void Serialize(ref MessagePackWriter writer, global::SharedData.MySubUnion1 value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.MySubUnion1 value, global::MessagePack.MessagePackSerializerOptions options) { if (value == null) { @@ -2718,7 +2715,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.MySubUnio writer.Write(value.One); } - public global::SharedData.MySubUnion1 Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::SharedData.MySubUnion1 Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { @@ -2752,7 +2749,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.MySubUnio public sealed class MySubUnion2Formatter : global::MessagePack.Formatters.IMessagePackFormatter { - public void Serialize(ref MessagePackWriter writer, global::SharedData.MySubUnion2 value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.MySubUnion2 value, global::MessagePack.MessagePackSerializerOptions options) { writer.WriteArrayHeader(6); writer.WriteNil(); @@ -2763,11 +2760,11 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.MySubUnio writer.Write(value.Two); } - public global::SharedData.MySubUnion2 Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::SharedData.MySubUnion2 Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { - throw new InvalidOperationException("typecode is null, struct not supported"); + throw new global::System.InvalidOperationException("typecode is null, struct not supported"); } options.Security.DepthStep(ref reader); @@ -2797,7 +2794,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.MySubUnio public sealed class MySubUnion3Formatter : global::MessagePack.Formatters.IMessagePackFormatter { - public void Serialize(ref MessagePackWriter writer, global::SharedData.MySubUnion3 value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.MySubUnion3 value, global::MessagePack.MessagePackSerializerOptions options) { if (value == null) { @@ -2811,7 +2808,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.MySubUnio writer.Write(value.Three); } - public global::SharedData.MySubUnion3 Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::SharedData.MySubUnion3 Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { @@ -2845,7 +2842,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.MySubUnio public sealed class MySubUnion4Formatter : global::MessagePack.Formatters.IMessagePackFormatter { - public void Serialize(ref MessagePackWriter writer, global::SharedData.MySubUnion4 value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.MySubUnion4 value, global::MessagePack.MessagePackSerializerOptions options) { writer.WriteArrayHeader(8); writer.WriteNil(); @@ -2858,11 +2855,11 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.MySubUnio writer.Write(value.Four); } - public global::SharedData.MySubUnion4 Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::SharedData.MySubUnion4 Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { - throw new InvalidOperationException("typecode is null, struct not supported"); + throw new global::System.InvalidOperationException("typecode is null, struct not supported"); } options.Security.DepthStep(ref reader); @@ -2892,7 +2889,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.MySubUnio public sealed class NestParent_NestContractFormatter : global::MessagePack.Formatters.IMessagePackFormatter { - public void Serialize(ref MessagePackWriter writer, global::SharedData.NestParent.NestContract value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.NestParent.NestContract value, global::MessagePack.MessagePackSerializerOptions options) { if (value == null) { @@ -2904,7 +2901,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.NestParen writer.Write(value.MyProperty); } - public global::SharedData.NestParent.NestContract Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::SharedData.NestParent.NestContract Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { @@ -2938,7 +2935,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.NestParen public sealed class NonEmpty1Formatter : global::MessagePack.Formatters.IMessagePackFormatter { - public void Serialize(ref MessagePackWriter writer, global::SharedData.NonEmpty1 value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.NonEmpty1 value, global::MessagePack.MessagePackSerializerOptions options) { if (value == null) { @@ -2950,7 +2947,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.NonEmpty1 writer.Write(value.MyProperty); } - public global::SharedData.NonEmpty1 Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::SharedData.NonEmpty1 Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { @@ -2984,7 +2981,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.NonEmpty1 public sealed class SimpleIntKeyDataFormatter : global::MessagePack.Formatters.IMessagePackFormatter { - public void Serialize(ref MessagePackWriter writer, global::SharedData.SimpleIntKeyData value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.SimpleIntKeyData value, global::MessagePack.MessagePackSerializerOptions options) { if (value == null) { @@ -2992,7 +2989,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.SimpleInt return; } - IFormatterResolver formatterResolver = options.Resolver; + global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; writer.WriteArrayHeader(7); writer.Write(value.Prop1); formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.Prop2, options); @@ -3003,7 +3000,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.SimpleInt writer.Write(value.BytesSpecial); } - public global::SharedData.SimpleIntKeyData Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::SharedData.SimpleIntKeyData Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { @@ -3011,7 +3008,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.SimpleInt } options.Security.DepthStep(ref reader); - IFormatterResolver formatterResolver = options.Resolver; + global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; var length = reader.ReadArrayHeader(); var __Prop1__ = default(int); var __Prop2__ = default(global::SharedData.ByteEnum); @@ -3068,7 +3065,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.SimpleInt public sealed class SimpleStructIntKeyDataFormatter : global::MessagePack.Formatters.IMessagePackFormatter { - public void Serialize(ref MessagePackWriter writer, global::SharedData.SimpleStructIntKeyData value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.SimpleStructIntKeyData value, global::MessagePack.MessagePackSerializerOptions options) { writer.WriteArrayHeader(3); writer.Write(value.X); @@ -3076,11 +3073,11 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.SimpleStr writer.Write(value.BytesSpecial); } - public global::SharedData.SimpleStructIntKeyData Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::SharedData.SimpleStructIntKeyData Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { - throw new InvalidOperationException("typecode is null, struct not supported"); + throw new global::System.InvalidOperationException("typecode is null, struct not supported"); } options.Security.DepthStep(ref reader); @@ -3120,7 +3117,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.SimpleStr public sealed class SubUnionType1Formatter : global::MessagePack.Formatters.IMessagePackFormatter { - public void Serialize(ref MessagePackWriter writer, global::SharedData.SubUnionType1 value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.SubUnionType1 value, global::MessagePack.MessagePackSerializerOptions options) { if (value == null) { @@ -3133,7 +3130,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.SubUnionT writer.Write(value.MyProperty1); } - public global::SharedData.SubUnionType1 Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::SharedData.SubUnionType1 Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { @@ -3149,12 +3146,12 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.SubUnionT { switch (i) { - case 1: - __MyProperty1__ = reader.ReadInt32(); - break; case 0: __MyProperty__ = reader.ReadInt32(); break; + case 1: + __MyProperty1__ = reader.ReadInt32(); + break; default: reader.Skip(); break; @@ -3162,8 +3159,8 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.SubUnionT } var ____result = new global::SharedData.SubUnionType1(); - ____result.MyProperty1 = __MyProperty1__; ____result.MyProperty = __MyProperty__; + ____result.MyProperty1 = __MyProperty1__; reader.Depth--; return ____result; } @@ -3172,7 +3169,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.SubUnionT public sealed class SubUnionType2Formatter : global::MessagePack.Formatters.IMessagePackFormatter { - public void Serialize(ref MessagePackWriter writer, global::SharedData.SubUnionType2 value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.SubUnionType2 value, global::MessagePack.MessagePackSerializerOptions options) { if (value == null) { @@ -3185,7 +3182,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.SubUnionT writer.Write(value.MyProperty2); } - public global::SharedData.SubUnionType2 Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::SharedData.SubUnionType2 Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { @@ -3201,12 +3198,12 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.SubUnionT { switch (i) { - case 1: - __MyProperty2__ = reader.ReadInt32(); - break; case 0: __MyProperty__ = reader.ReadInt32(); break; + case 1: + __MyProperty2__ = reader.ReadInt32(); + break; default: reader.Skip(); break; @@ -3214,8 +3211,8 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.SubUnionT } var ____result = new global::SharedData.SubUnionType2(); - ____result.MyProperty2 = __MyProperty2__; ____result.MyProperty = __MyProperty__; + ____result.MyProperty2 = __MyProperty2__; reader.Depth--; return ____result; } @@ -3224,7 +3221,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.SubUnionT public sealed class UnVersionBlockTestFormatter : global::MessagePack.Formatters.IMessagePackFormatter { - public void Serialize(ref MessagePackWriter writer, global::SharedData.UnVersionBlockTest value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.UnVersionBlockTest value, global::MessagePack.MessagePackSerializerOptions options) { if (value == null) { @@ -3238,7 +3235,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.UnVersion writer.Write(value.MyProperty2); } - public global::SharedData.UnVersionBlockTest Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::SharedData.UnVersionBlockTest Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { @@ -3277,18 +3274,18 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.UnVersion public sealed class Vector2Formatter : global::MessagePack.Formatters.IMessagePackFormatter { - public void Serialize(ref MessagePackWriter writer, global::SharedData.Vector2 value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.Vector2 value, global::MessagePack.MessagePackSerializerOptions options) { writer.WriteArrayHeader(2); writer.Write(value.X); writer.Write(value.Y); } - public global::SharedData.Vector2 Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::SharedData.Vector2 Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { - throw new InvalidOperationException("typecode is null, struct not supported"); + throw new global::System.InvalidOperationException("typecode is null, struct not supported"); } options.Security.DepthStep(ref reader); @@ -3321,7 +3318,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.Vector2 v public sealed class Vector3LikeFormatter : global::MessagePack.Formatters.IMessagePackFormatter { - public void Serialize(ref MessagePackWriter writer, global::SharedData.Vector3Like value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.Vector3Like value, global::MessagePack.MessagePackSerializerOptions options) { writer.WriteArrayHeader(3); writer.Write(value.x); @@ -3329,11 +3326,11 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.Vector3Li writer.Write(value.z); } - public global::SharedData.Vector3Like Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::SharedData.Vector3Like Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { - throw new InvalidOperationException("typecode is null, struct not supported"); + throw new global::System.InvalidOperationException("typecode is null, struct not supported"); } options.Security.DepthStep(ref reader); @@ -3373,18 +3370,18 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.Vector3Li public sealed class VectorLike2Formatter : global::MessagePack.Formatters.IMessagePackFormatter { - public void Serialize(ref MessagePackWriter writer, global::SharedData.VectorLike2 value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.VectorLike2 value, global::MessagePack.MessagePackSerializerOptions options) { writer.WriteArrayHeader(2); writer.Write(value.x); writer.Write(value.y); } - public global::SharedData.VectorLike2 Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::SharedData.VectorLike2 Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { - throw new InvalidOperationException("typecode is null, struct not supported"); + throw new global::System.InvalidOperationException("typecode is null, struct not supported"); } options.Security.DepthStep(ref reader); @@ -3419,7 +3416,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.VectorLik public sealed class Version0Formatter : global::MessagePack.Formatters.IMessagePackFormatter { - public void Serialize(ref MessagePackWriter writer, global::SharedData.Version0 value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.Version0 value, global::MessagePack.MessagePackSerializerOptions options) { if (value == null) { @@ -3434,7 +3431,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.Version0 writer.Write(value.MyProperty1); } - public global::SharedData.Version0 Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::SharedData.Version0 Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { @@ -3468,7 +3465,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.Version0 public sealed class Version1Formatter : global::MessagePack.Formatters.IMessagePackFormatter { - public void Serialize(ref MessagePackWriter writer, global::SharedData.Version1 value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.Version1 value, global::MessagePack.MessagePackSerializerOptions options) { if (value == null) { @@ -3485,7 +3482,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.Version1 writer.Write(value.MyProperty3); } - public global::SharedData.Version1 Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::SharedData.Version1 Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { @@ -3529,7 +3526,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.Version1 public sealed class Version2Formatter : global::MessagePack.Formatters.IMessagePackFormatter { - public void Serialize(ref MessagePackWriter writer, global::SharedData.Version2 value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.Version2 value, global::MessagePack.MessagePackSerializerOptions options) { if (value == null) { @@ -3548,7 +3545,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.Version2 writer.Write(value.MyProperty5); } - public global::SharedData.Version2 Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::SharedData.Version2 Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { @@ -3597,7 +3594,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.Version2 public sealed class VersionBlockTestFormatter : global::MessagePack.Formatters.IMessagePackFormatter { - public void Serialize(ref MessagePackWriter writer, global::SharedData.VersionBlockTest value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.VersionBlockTest value, global::MessagePack.MessagePackSerializerOptions options) { if (value == null) { @@ -3605,14 +3602,14 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.VersionBl return; } - IFormatterResolver formatterResolver = options.Resolver; + global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; writer.WriteArrayHeader(3); writer.Write(value.MyProperty); formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.UnknownBlock, options); writer.Write(value.MyProperty2); } - public global::SharedData.VersionBlockTest Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::SharedData.VersionBlockTest Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { @@ -3620,7 +3617,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.VersionBl } options.Security.DepthStep(ref reader); - IFormatterResolver formatterResolver = options.Resolver; + global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; var length = reader.ReadArrayHeader(); var __MyProperty__ = default(int); var __UnknownBlock__ = default(global::SharedData.MyClass); @@ -3657,7 +3654,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.VersionBl public sealed class VersioningUnionFormatter : global::MessagePack.Formatters.IMessagePackFormatter { - public void Serialize(ref MessagePackWriter writer, global::SharedData.VersioningUnion value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.VersioningUnion value, global::MessagePack.MessagePackSerializerOptions options) { if (value == null) { @@ -3676,7 +3673,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.Versionin writer.Write(value.FV); } - public global::SharedData.VersioningUnion Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::SharedData.VersioningUnion Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { @@ -3710,7 +3707,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.Versionin public sealed class WithIndexerFormatter : global::MessagePack.Formatters.IMessagePackFormatter { - public void Serialize(ref MessagePackWriter writer, global::SharedData.WithIndexer value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.WithIndexer value, global::MessagePack.MessagePackSerializerOptions options) { if (value == null) { @@ -3718,13 +3715,13 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.WithIndex return; } - IFormatterResolver formatterResolver = options.Resolver; + global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; writer.WriteArrayHeader(2); writer.Write(value.Data1); formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.Data2, options); } - public global::SharedData.WithIndexer Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::SharedData.WithIndexer Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { @@ -3732,7 +3729,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.WithIndex } options.Security.DepthStep(ref reader); - IFormatterResolver formatterResolver = options.Resolver; + global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; var length = reader.ReadArrayHeader(); var __Data1__ = default(int); var __Data2__ = default(string); diff --git a/src/MessagePack.GeneratorCore/Generator/FormatterTemplate.cs b/src/MessagePack.GeneratorCore/Generator/FormatterTemplate.cs index 121b17f4e..ca7434af0 100644 --- a/src/MessagePack.GeneratorCore/Generator/FormatterTemplate.cs +++ b/src/MessagePack.GeneratorCore/Generator/FormatterTemplate.cs @@ -43,17 +43,17 @@ public virtual string TransformText() namespace "); this.Write(this.ToStringHelper.ToStringWithCulture(Namespace)); - this.Write("\r\n{\r\n using System;\r\n using System.Buffers;\r\n using MessagePack;\r\n"); - foreach(var objInfo in ObjectSerializationInfos) { + this.Write("\r\n{\r\n using global::System.Buffers;\r\n using global::MessagePack;\r\n"); + foreach (var objInfo in ObjectSerializationInfos) { bool isFormatterResolverNecessary = ShouldUseFormatterResolverHelper.ShouldUseFormatterResolver(objInfo.Members); this.Write("\r\n public sealed class "); this.Write(this.ToStringHelper.ToStringWithCulture(objInfo.Name)); this.Write("Formatter"); - this.Write(this.ToStringHelper.ToStringWithCulture((objInfo.IsOpenGenericType ? $"<{string.Join(",", objInfo.GenericTypeParameters.Select(x => x.Name))}>" : ""))); + this.Write(this.ToStringHelper.ToStringWithCulture((objInfo.IsOpenGenericType ? $"<{string.Join(", ", objInfo.GenericTypeParameters.Select(x => x.Name))}>" : ""))); this.Write(" : global::MessagePack.Formatters.IMessagePackFormatter<"); this.Write(this.ToStringHelper.ToStringWithCulture(objInfo.FullName)); this.Write(">\r\n"); - foreach(var typeArg in objInfo.GenericTypeParameters.Where(x => x.HasConstraints)) { + foreach (var typeArg in objInfo.GenericTypeParameters.Where(x => x.HasConstraints)) { this.Write(" where "); this.Write(this.ToStringHelper.ToStringWithCulture(typeArg.Name)); this.Write(" : "); @@ -61,9 +61,9 @@ namespace "); this.Write("\r\n"); } this.Write(" {\r\n"); - foreach(var item in objInfo.Members) { - if(item.CustomFormatterTypeName != null) { - this.Write(" "); + foreach (var item in objInfo.Members) { + if (item.CustomFormatterTypeName != null) { + this.Write(" private readonly "); this.Write(this.ToStringHelper.ToStringWithCulture(item.CustomFormatterTypeName)); this.Write(" __"); this.Write(this.ToStringHelper.ToStringWithCulture(item.Name)); @@ -72,67 +72,76 @@ namespace "); this.Write("();\r\n"); } } - this.Write("\r\n public void Serialize(ref MessagePackWriter writer, "); + this.Write("\r\n public void Serialize(ref global::MessagePack.MessagePackWriter writer," + + " "); this.Write(this.ToStringHelper.ToStringWithCulture(objInfo.FullName)); this.Write(" value, global::MessagePack.MessagePackSerializerOptions options)\r\n {\r\n"); - if( objInfo.IsClass) { + if (objInfo.IsClass) { this.Write(" if (value == null)\r\n {\r\n writer.WriteNil();" + "\r\n return;\r\n }\r\n\r\n"); } if (isFormatterResolverNecessary) { - this.Write(" IFormatterResolver formatterResolver = options.Resolver;\r\n"); -} + this.Write(" global::MessagePack.IFormatterResolver formatterResolver = options.Re" + + "solver;\r\n"); + } - if(objInfo.HasIMessagePackSerializationCallbackReceiver && objInfo.NeedsCastOnBefore) { - this.Write(" ((IMessagePackSerializationCallbackReceiver)value).OnBeforeSerialize(" + - ");\r\n"); - } else if(objInfo.HasIMessagePackSerializationCallbackReceiver) { + if (objInfo.HasIMessagePackSerializationCallbackReceiver) { + if (objInfo.NeedsCastOnBefore) { + this.Write(" ((global::MessagePack.IMessagePackSerializationCallbackReceiver)value" + + ").OnBeforeSerialize();\r\n"); + } else { this.Write(" value.OnBeforeSerialize();\r\n"); + } } this.Write(" writer.WriteArrayHeader("); this.Write(this.ToStringHelper.ToStringWithCulture(objInfo.MaxKey + 1)); this.Write(");\r\n"); - for(var i =0; i<= objInfo.MaxKey; i++) { var member = objInfo.GetMember(i); - if( member == null) { + for (var i = 0; i <= objInfo.MaxKey; i++) { + var member = objInfo.GetMember(i); + if (member == null) { this.Write(" writer.WriteNil();\r\n"); } else { this.Write(" "); this.Write(this.ToStringHelper.ToStringWithCulture(member.GetSerializeMethodString())); this.Write(";\r\n"); - } } + } + } this.Write(" }\r\n\r\n public "); this.Write(this.ToStringHelper.ToStringWithCulture(objInfo.FullName)); - this.Write(" Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSeriali" + - "zerOptions options)\r\n {\r\n if (reader.TryReadNil())\r\n " + - " {\r\n"); - if( objInfo.IsClass) { + this.Write(" Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePac" + + "k.MessagePackSerializerOptions options)\r\n {\r\n if (reader.TryRe" + + "adNil())\r\n {\r\n"); + if (objInfo.IsClass) { this.Write(" return null;\r\n"); } else { - this.Write(" throw new InvalidOperationException(\"typecode is null, struct not" + - " supported\");\r\n"); + this.Write(" throw new global::System.InvalidOperationException(\"typecode is n" + + "ull, struct not supported\");\r\n"); } this.Write(" }\r\n\r\n options.Security.DepthStep(ref reader);\r\n"); if (isFormatterResolverNecessary) { - this.Write(" IFormatterResolver formatterResolver = options.Resolver;\r\n"); + this.Write(" global::MessagePack.IFormatterResolver formatterResolver = options.Re" + + "solver;\r\n"); } this.Write(" var length = reader.ReadArrayHeader();\r\n"); - foreach(var x in objInfo.Members) { + foreach (var member in objInfo.Members) { this.Write(" var __"); - this.Write(this.ToStringHelper.ToStringWithCulture(x.Name)); + this.Write(this.ToStringHelper.ToStringWithCulture(member.Name)); this.Write("__ = default("); - this.Write(this.ToStringHelper.ToStringWithCulture(x.Type)); + this.Write(this.ToStringHelper.ToStringWithCulture(member.Type)); this.Write(");\r\n"); } this.Write("\r\n for (int i = 0; i < length; i++)\r\n {\r\n sw" + "itch (i)\r\n {\r\n"); - foreach(var x in objInfo.Members) { + for (var memberIndex = 0; memberIndex <= objInfo.MaxKey; memberIndex++) { + var member = objInfo.GetMember(memberIndex); + if (member == null) { continue; } this.Write(" case "); - this.Write(this.ToStringHelper.ToStringWithCulture(x.IntKey)); + this.Write(this.ToStringHelper.ToStringWithCulture(member.IntKey)); this.Write(":\r\n __"); - this.Write(this.ToStringHelper.ToStringWithCulture(x.Name)); + this.Write(this.ToStringHelper.ToStringWithCulture(member.Name)); this.Write("__ = "); - this.Write(this.ToStringHelper.ToStringWithCulture(x.GetDeserializeMethodString())); + this.Write(this.ToStringHelper.ToStringWithCulture(member.GetDeserializeMethodString())); this.Write(";\r\n break;\r\n"); } this.Write(" default:\r\n reader.Skip();\r\n " + @@ -140,18 +149,23 @@ namespace "); "ult = new "); this.Write(this.ToStringHelper.ToStringWithCulture(objInfo.GetConstructorString())); this.Write(";\r\n"); - foreach(var x in objInfo.Members.Where(x => x.IsWritable)) { + for (var memberIndex = 0; memberIndex <= objInfo.MaxKey; memberIndex++) { + var member = objInfo.GetMember(memberIndex); + if (member == null || !member.IsWritable) { continue; } this.Write(" ____result."); - this.Write(this.ToStringHelper.ToStringWithCulture(x.Name)); + this.Write(this.ToStringHelper.ToStringWithCulture(member.Name)); this.Write(" = __"); - this.Write(this.ToStringHelper.ToStringWithCulture(x.Name)); + this.Write(this.ToStringHelper.ToStringWithCulture(member.Name)); this.Write("__;\r\n"); - } -if(objInfo.HasIMessagePackSerializationCallbackReceiver && objInfo.NeedsCastOnAfter) { - this.Write(" ((IMessagePackSerializationCallbackReceiver)____result).OnAfterDeseri" + - "alize();\r\n"); - } else if(objInfo.HasIMessagePackSerializationCallbackReceiver) { + } + + if (objInfo.HasIMessagePackSerializationCallbackReceiver) { + if (objInfo.NeedsCastOnAfter) { + this.Write(" ((global::MessagePack.IMessagePackSerializationCallbackReceiver)____r" + + "esult).OnAfterDeserialize();\r\n"); + } else { this.Write(" ____result.OnAfterDeserialize();\r\n"); + } } this.Write(" reader.Depth--;\r\n return ____result;\r\n }\r\n }\r\n"); } diff --git a/src/MessagePack.GeneratorCore/Generator/FormatterTemplate.tt b/src/MessagePack.GeneratorCore/Generator/FormatterTemplate.tt index 8c285c010..a8dd0885a 100644 --- a/src/MessagePack.GeneratorCore/Generator/FormatterTemplate.tt +++ b/src/MessagePack.GeneratorCore/Generator/FormatterTemplate.tt @@ -21,26 +21,25 @@ namespace <#= Namespace #> { - using System; - using System.Buffers; - using MessagePack; -<# foreach(var objInfo in ObjectSerializationInfos) { + using global::System.Buffers; + using global::MessagePack; +<# foreach (var objInfo in ObjectSerializationInfos) { bool isFormatterResolverNecessary = ShouldUseFormatterResolverHelper.ShouldUseFormatterResolver(objInfo.Members);#> - public sealed class <#= objInfo.Name #>Formatter<#= (objInfo.IsOpenGenericType ? $"<{string.Join(",", objInfo.GenericTypeParameters.Select(x => x.Name))}>" : "") #> : global::MessagePack.Formatters.IMessagePackFormatter<<#= objInfo.FullName #>> -<# foreach(var typeArg in objInfo.GenericTypeParameters.Where(x => x.HasConstraints)) { #> + public sealed class <#= objInfo.Name #>Formatter<#= (objInfo.IsOpenGenericType ? $"<{string.Join(", ", objInfo.GenericTypeParameters.Select(x => x.Name))}>" : "") #> : global::MessagePack.Formatters.IMessagePackFormatter<<#= objInfo.FullName #>> +<# foreach (var typeArg in objInfo.GenericTypeParameters.Where(x => x.HasConstraints)) { #> where <#= typeArg.Name #> : <#= typeArg.Constraints #> <# } #> { -<# foreach(var item in objInfo.Members) { #> -<# if(item.CustomFormatterTypeName != null) { #> - <#= item.CustomFormatterTypeName #> __<#= item.Name #>CustomFormatter__ = new <#= item.CustomFormatterTypeName #>(); +<# foreach (var item in objInfo.Members) { #> +<# if (item.CustomFormatterTypeName != null) { #> + private readonly <#= item.CustomFormatterTypeName #> __<#= item.Name #>CustomFormatter__ = new <#= item.CustomFormatterTypeName #>(); <# } #> <# } #> - public void Serialize(ref MessagePackWriter writer, <#= objInfo.FullName #> value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, <#= objInfo.FullName #> value, global::MessagePack.MessagePackSerializerOptions options) { -<# if( objInfo.IsClass) { #> +<# if (objInfo.IsClass) { #> if (value == null) { writer.WriteNil(); @@ -50,50 +49,56 @@ namespace <#= Namespace #> <# } if (isFormatterResolverNecessary) { #> - IFormatterResolver formatterResolver = options.Resolver; -<#} + global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; +<# } - if(objInfo.HasIMessagePackSerializationCallbackReceiver && objInfo.NeedsCastOnBefore) { #> - ((IMessagePackSerializationCallbackReceiver)value).OnBeforeSerialize(); -<# } else if(objInfo.HasIMessagePackSerializationCallbackReceiver) { #> + if (objInfo.HasIMessagePackSerializationCallbackReceiver) { + if (objInfo.NeedsCastOnBefore) { #> + ((global::MessagePack.IMessagePackSerializationCallbackReceiver)value).OnBeforeSerialize(); +<# } else { #> value.OnBeforeSerialize(); +<# } #> <# } #> writer.WriteArrayHeader(<#= objInfo.MaxKey + 1 #>); -<# for(var i =0; i<= objInfo.MaxKey; i++) { var member = objInfo.GetMember(i); #> -<# if( member == null) { #> +<# for (var i = 0; i <= objInfo.MaxKey; i++) { + var member = objInfo.GetMember(i); + if (member == null) { #> writer.WriteNil(); <# } else { #> <#= member.GetSerializeMethodString() #>; -<# } } #> +<# } #> +<# } #> } - public <#= objInfo.FullName #> Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public <#= objInfo.FullName #> Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { -<# if( objInfo.IsClass) { #> +<# if (objInfo.IsClass) { #> return null; <# } else { #> - throw new InvalidOperationException("typecode is null, struct not supported"); + throw new global::System.InvalidOperationException("typecode is null, struct not supported"); <# } #> } options.Security.DepthStep(ref reader); <# if (isFormatterResolverNecessary) { #> - IFormatterResolver formatterResolver = options.Resolver; + global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; <# } #> var length = reader.ReadArrayHeader(); -<# foreach(var x in objInfo.Members) { #> - var __<#= x.Name #>__ = default(<#= x.Type #>); +<# foreach (var member in objInfo.Members) { #> + var __<#= member.Name #>__ = default(<#= member.Type #>); <# } #> for (int i = 0; i < length; i++) { switch (i) { -<# foreach(var x in objInfo.Members) { #> - case <#= x.IntKey #>: - __<#= x.Name #>__ = <#= x.GetDeserializeMethodString() #>; +<# for (var memberIndex = 0; memberIndex <= objInfo.MaxKey; memberIndex++) { + var member = objInfo.GetMember(memberIndex); + if (member == null) { continue; } #> + case <#= member.IntKey #>: + __<#= member.Name #>__ = <#= member.GetDeserializeMethodString() #>; break; <# } #> default: @@ -103,13 +108,18 @@ namespace <#= Namespace #> } var ____result = new <#= objInfo.GetConstructorString() #>; -<# foreach(var x in objInfo.Members.Where(x => x.IsWritable)) { #> - ____result.<#= x.Name #> = __<#= x.Name #>__; -<# } #> -<#if(objInfo.HasIMessagePackSerializationCallbackReceiver && objInfo.NeedsCastOnAfter) { #> - ((IMessagePackSerializationCallbackReceiver)____result).OnAfterDeserialize(); -<# } else if(objInfo.HasIMessagePackSerializationCallbackReceiver) { #> +<# for (var memberIndex = 0; memberIndex <= objInfo.MaxKey; memberIndex++) { + var member = objInfo.GetMember(memberIndex); + if (member == null || !member.IsWritable) { continue; } #> + ____result.<#= member.Name #> = __<#= member.Name #>__; +<# } + + if (objInfo.HasIMessagePackSerializationCallbackReceiver) { + if (objInfo.NeedsCastOnAfter) { #> + ((global::MessagePack.IMessagePackSerializationCallbackReceiver)____result).OnAfterDeserialize(); +<# } else { #> ____result.OnAfterDeserialize(); +<# } #> <# } #> reader.Depth--; return ____result; From 1fba6ccb5723e15aa8d83e8a3cacf3971c4d64cc Mon Sep 17 00:00:00 2001 From: pCYSl5EDgo Date: Tue, 27 Oct 2020 20:27:47 +0900 Subject: [PATCH 005/161] Partial solution of #1085: mpc.exe #1092 commit d7a50b9d9a8de447a4dec61219fd584e862095a3 Merge: 02ae418 5a6cda6 Author: pCYSl5EDgo Date: Mon Oct 26 09:33:45 2020 +0900 Merge remote-tracking branch 'upstream/develop' into solution#1085-mpc commit 02ae418a39cdd6d5bbdab7b900eb5169d80fa7e9 Author: pCYSl5EDgo Date: Mon Oct 26 09:25:20 2020 +0900 Update: Loop demonstration commit d84ae759892b2ab9fc10d8d434902fca10ee88c1 Author: pCYSl5EDgo Date: Mon Oct 26 09:24:31 2020 +0900 Change: drop deserialized value -> reader.Skip() commit 9b0d4a21a8824dc277a48ac63180e901b6f9890e Author: pCYSl5EDgo Date: Mon Oct 26 00:27:10 2020 +0900 Fix: remove unused boolean local variables commit fdfabeb2f1fc8b87bc41419fb0ccaee2c354b98a Author: pCYSl5EDgo Date: Mon Oct 26 00:00:28 2020 +0900 Update: Make the same as Dynamic commit bef4692e10cc47b137b7c647acb11feffb177206 Author: pCYSl5EDgo Date: Sun Oct 25 19:37:11 2020 +0900 Add test project commit a8fac80ec561f476f122d35ad2cbcd831a955d41 Author: pCYSl5EDgo Date: Sun Oct 25 18:55:27 2020 +0900 Add types to sandbox commit 6ffc3c309b6b47728e927799b574fc23b37fa2c8 Author: pCYSl5EDgo Date: Sun Oct 25 18:45:40 2020 +0900 Update: string-key mpc.exe commit 44819e6d551961598c29fdab5aa0bf65d53ed0e6 Author: pCYSl5EDgo Date: Sun Oct 25 18:05:24 2020 +0900 Update: int-key mpc.exe commit 0a2fef4d2f3ae7f568bd34a554792f006ec31275 Author: pCYSl5EDgo Date: Sun Oct 25 12:12:57 2020 +0900 Fix: var -> global::MessagePack.IFormatterResolver commit 086aa11e7ce4fb0723014c8bda554104b3b38463 Author: pCYSl5EDgo Date: Sun Oct 25 12:05:21 2020 +0900 Fix: Line Feed commit 39d3d0844848f1d742820e2786528baf2bd1627c Author: pCYSl5EDgo Date: Sun Oct 25 12:03:37 2020 +0900 Fix: space commit c57f423a49fed8e1c1b365310017a2ec382b5f07 Author: pCYSl5EDgo Date: Sun Oct 25 12:00:32 2020 +0900 Change: var to globall:: Revert: DepthStep position Revert: }#> -> } #> commit de6fd239491b3fb7aa373644a384a71772d23b43 Author: pCYSl5EDgo Date: Sat Oct 24 11:04:44 2020 +0900 fix CRLF commit 4b6ae7c6089f7d6732691a0af7f1d93424ccaa95 Author: pCYSl5EDgo Date: Sat Oct 24 10:59:50 2020 +0900 Change the format to decrease template part lines. Change the iterator `i` type from `int` to `var`. commit 95f41adff75a0ff605e760d5cdc485de10ee13be Author: pCYSl5EDgo Date: Fri Oct 23 21:03:54 2020 +0900 This is a cherry-pick of #1074. This is a refactoring of int-key mpc.exe tt file. --- MessagePack.sln | 11 + sandbox/Sandbox/Generated.cs | 1269 +++++++++-------- sandbox/TestData2/Generated.cs | 149 +- .../Generator/FormatterTemplate.cs | 60 +- .../Generator/FormatterTemplate.tt | 36 +- .../StringKeyFormatterDeserializeHelper.cs | 65 +- .../StringKey/StringKeyFormatterTemplate.cs | 206 +-- .../StringKey/StringKeyFormatterTemplate.tt | 194 +-- .../Assets/Scripts/Tests/Class1.cs | 102 ++ .../MessagePack.GeneratedCode.Tests.csproj | 21 + .../MissingPropertiesTest.cs | 105 ++ 11 files changed, 1222 insertions(+), 996 deletions(-) create mode 100644 tests/MessagePack.GeneratedCode.Tests/MessagePack.GeneratedCode.Tests.csproj create mode 100644 tests/MessagePack.GeneratedCode.Tests/MissingPropertiesTest.cs diff --git a/MessagePack.sln b/MessagePack.sln index 6157da344..e861de8f1 100644 --- a/MessagePack.sln +++ b/MessagePack.sln @@ -88,6 +88,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MessagePack.Experimental", EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MessagePack.Experimental.Tests", "tests\MessagePack.Experimental.Tests\MessagePack.Experimental.Tests.csproj", "{8AB40D1C-1134-4D77-B39A-19AEDC729450}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MessagePack.GeneratedCode.Tests", "tests\MessagePack.GeneratedCode.Tests\MessagePack.GeneratedCode.Tests.csproj", "{D4CE7347-CEBE-46E5-BD12-1319573B6C5E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -310,6 +312,14 @@ Global {8AB40D1C-1134-4D77-B39A-19AEDC729450}.Release|Any CPU.Build.0 = Release|Any CPU {8AB40D1C-1134-4D77-B39A-19AEDC729450}.Release|NoVSIX.ActiveCfg = Release|Any CPU {8AB40D1C-1134-4D77-B39A-19AEDC729450}.Release|NoVSIX.Build.0 = Release|Any CPU + {D4CE7347-CEBE-46E5-BD12-1319573B6C5E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D4CE7347-CEBE-46E5-BD12-1319573B6C5E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D4CE7347-CEBE-46E5-BD12-1319573B6C5E}.Debug|NoVSIX.ActiveCfg = Debug|Any CPU + {D4CE7347-CEBE-46E5-BD12-1319573B6C5E}.Debug|NoVSIX.Build.0 = Debug|Any CPU + {D4CE7347-CEBE-46E5-BD12-1319573B6C5E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D4CE7347-CEBE-46E5-BD12-1319573B6C5E}.Release|Any CPU.Build.0 = Release|Any CPU + {D4CE7347-CEBE-46E5-BD12-1319573B6C5E}.Release|NoVSIX.ActiveCfg = Release|Any CPU + {D4CE7347-CEBE-46E5-BD12-1319573B6C5E}.Release|NoVSIX.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -342,6 +352,7 @@ Global {4C9BB260-62D8-49CD-9F9C-9AA6A8BFC637} = {51A614B0-E583-4DD2-AC7D-6A65634582E0} {AC2503A7-736D-4AE6-9355-CF35D9DF6139} = {86309CF6-0054-4CE3-BFD3-CA0AA7DB17BC} {8AB40D1C-1134-4D77-B39A-19AEDC729450} = {19FE674A-AC94-4E7E-B24C-2285D1D04CDE} + {D4CE7347-CEBE-46E5-BD12-1319573B6C5E} = {19FE674A-AC94-4E7E-B24C-2285D1D04CDE} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {B3911209-2DBF-47F8-98F6-BBC0EDFE63DE} diff --git a/sandbox/Sandbox/Generated.cs b/sandbox/Sandbox/Generated.cs index aa9789515..6db29c4c3 100644 --- a/sandbox/Sandbox/Generated.cs +++ b/sandbox/Sandbox/Generated.cs @@ -49,7 +49,7 @@ internal static class GeneratedResolverGetFormatterHelper static GeneratedResolverGetFormatterHelper() { - lookup = new global::System.Collections.Generic.Dictionary(65) + lookup = new global::System.Collections.Generic.Dictionary(71) { { typeof(global::GlobalMyEnum[,]), 0 }, { typeof(global::GlobalMyEnum[]), 1 }, @@ -80,42 +80,48 @@ static GeneratedResolverGetFormatterHelper() { typeof(global::SharedData.Callback1_2), 26 }, { typeof(global::SharedData.Callback2), 27 }, { typeof(global::SharedData.Callback2_2), 28 }, - { typeof(global::SharedData.Empty1), 29 }, - { typeof(global::SharedData.Empty2), 30 }, - { typeof(global::SharedData.EmptyClass), 31 }, - { typeof(global::SharedData.EmptyStruct), 32 }, - { typeof(global::SharedData.FirstSimpleData), 33 }, - { typeof(global::SharedData.FooClass), 34 }, - { typeof(global::SharedData.HolderV0), 35 }, - { typeof(global::SharedData.HolderV1), 36 }, - { typeof(global::SharedData.HolderV2), 37 }, - { typeof(global::SharedData.MyClass), 38 }, - { typeof(global::SharedData.MySubUnion1), 39 }, - { typeof(global::SharedData.MySubUnion2), 40 }, - { typeof(global::SharedData.MySubUnion3), 41 }, - { typeof(global::SharedData.MySubUnion4), 42 }, - { typeof(global::SharedData.NestParent.NestContract), 43 }, - { typeof(global::SharedData.NonEmpty1), 44 }, - { typeof(global::SharedData.NonEmpty2), 45 }, - { typeof(global::SharedData.SimpleIntKeyData), 46 }, - { typeof(global::SharedData.SimpleStringKeyData), 47 }, - { typeof(global::SharedData.SimpleStructIntKeyData), 48 }, - { typeof(global::SharedData.SimpleStructStringKeyData), 49 }, - { typeof(global::SharedData.SubUnionType1), 50 }, - { typeof(global::SharedData.SubUnionType2), 51 }, - { typeof(global::SharedData.UnVersionBlockTest), 52 }, - { typeof(global::SharedData.Vector2), 53 }, - { typeof(global::SharedData.Vector3Like), 54 }, - { typeof(global::SharedData.VectorLike2), 55 }, - { typeof(global::SharedData.Version0), 56 }, - { typeof(global::SharedData.Version1), 57 }, - { typeof(global::SharedData.Version2), 58 }, - { typeof(global::SharedData.VersionBlockTest), 59 }, - { typeof(global::SharedData.VersioningUnion), 60 }, - { typeof(global::SharedData.WithIndexer), 61 }, - { typeof(global::SimpleModel), 62 }, - { typeof(global::StampMessageBody), 63 }, - { typeof(global::TextMessageBody), 64 }, + { typeof(global::SharedData.DefaultValueIntKeyClassWithExplicitConstructor), 29 }, + { typeof(global::SharedData.DefaultValueIntKeyClassWithoutExplicitConstructor), 30 }, + { typeof(global::SharedData.DefaultValueIntKeyStructWithExplicitConstructor), 31 }, + { typeof(global::SharedData.DefaultValueStringKeyClassWithExplicitConstructor), 32 }, + { typeof(global::SharedData.DefaultValueStringKeyClassWithoutExplicitConstructor), 33 }, + { typeof(global::SharedData.DefaultValueStringKeyStructWithExplicitConstructor), 34 }, + { typeof(global::SharedData.Empty1), 35 }, + { typeof(global::SharedData.Empty2), 36 }, + { typeof(global::SharedData.EmptyClass), 37 }, + { typeof(global::SharedData.EmptyStruct), 38 }, + { typeof(global::SharedData.FirstSimpleData), 39 }, + { typeof(global::SharedData.FooClass), 40 }, + { typeof(global::SharedData.HolderV0), 41 }, + { typeof(global::SharedData.HolderV1), 42 }, + { typeof(global::SharedData.HolderV2), 43 }, + { typeof(global::SharedData.MyClass), 44 }, + { typeof(global::SharedData.MySubUnion1), 45 }, + { typeof(global::SharedData.MySubUnion2), 46 }, + { typeof(global::SharedData.MySubUnion3), 47 }, + { typeof(global::SharedData.MySubUnion4), 48 }, + { typeof(global::SharedData.NestParent.NestContract), 49 }, + { typeof(global::SharedData.NonEmpty1), 50 }, + { typeof(global::SharedData.NonEmpty2), 51 }, + { typeof(global::SharedData.SimpleIntKeyData), 52 }, + { typeof(global::SharedData.SimpleStringKeyData), 53 }, + { typeof(global::SharedData.SimpleStructIntKeyData), 54 }, + { typeof(global::SharedData.SimpleStructStringKeyData), 55 }, + { typeof(global::SharedData.SubUnionType1), 56 }, + { typeof(global::SharedData.SubUnionType2), 57 }, + { typeof(global::SharedData.UnVersionBlockTest), 58 }, + { typeof(global::SharedData.Vector2), 59 }, + { typeof(global::SharedData.Vector3Like), 60 }, + { typeof(global::SharedData.VectorLike2), 61 }, + { typeof(global::SharedData.Version0), 62 }, + { typeof(global::SharedData.Version1), 63 }, + { typeof(global::SharedData.Version2), 64 }, + { typeof(global::SharedData.VersionBlockTest), 65 }, + { typeof(global::SharedData.VersioningUnion), 66 }, + { typeof(global::SharedData.WithIndexer), 67 }, + { typeof(global::SimpleModel), 68 }, + { typeof(global::StampMessageBody), 69 }, + { typeof(global::TextMessageBody), 70 }, }; } @@ -158,42 +164,48 @@ internal static object GetFormatter(Type t) case 26: return new MessagePack.Formatters.SharedData.Callback1_2Formatter(); case 27: return new MessagePack.Formatters.SharedData.Callback2Formatter(); case 28: return new MessagePack.Formatters.SharedData.Callback2_2Formatter(); - case 29: return new MessagePack.Formatters.SharedData.Empty1Formatter(); - case 30: return new MessagePack.Formatters.SharedData.Empty2Formatter(); - case 31: return new MessagePack.Formatters.SharedData.EmptyClassFormatter(); - case 32: return new MessagePack.Formatters.SharedData.EmptyStructFormatter(); - case 33: return new MessagePack.Formatters.SharedData.FirstSimpleDataFormatter(); - case 34: return new MessagePack.Formatters.SharedData.FooClassFormatter(); - case 35: return new MessagePack.Formatters.SharedData.HolderV0Formatter(); - case 36: return new MessagePack.Formatters.SharedData.HolderV1Formatter(); - case 37: return new MessagePack.Formatters.SharedData.HolderV2Formatter(); - case 38: return new MessagePack.Formatters.SharedData.MyClassFormatter(); - case 39: return new MessagePack.Formatters.SharedData.MySubUnion1Formatter(); - case 40: return new MessagePack.Formatters.SharedData.MySubUnion2Formatter(); - case 41: return new MessagePack.Formatters.SharedData.MySubUnion3Formatter(); - case 42: return new MessagePack.Formatters.SharedData.MySubUnion4Formatter(); - case 43: return new MessagePack.Formatters.SharedData.NestParent_NestContractFormatter(); - case 44: return new MessagePack.Formatters.SharedData.NonEmpty1Formatter(); - case 45: return new MessagePack.Formatters.SharedData.NonEmpty2Formatter(); - case 46: return new MessagePack.Formatters.SharedData.SimpleIntKeyDataFormatter(); - case 47: return new MessagePack.Formatters.SharedData.SimpleStringKeyDataFormatter(); - case 48: return new MessagePack.Formatters.SharedData.SimpleStructIntKeyDataFormatter(); - case 49: return new MessagePack.Formatters.SharedData.SimpleStructStringKeyDataFormatter(); - case 50: return new MessagePack.Formatters.SharedData.SubUnionType1Formatter(); - case 51: return new MessagePack.Formatters.SharedData.SubUnionType2Formatter(); - case 52: return new MessagePack.Formatters.SharedData.UnVersionBlockTestFormatter(); - case 53: return new MessagePack.Formatters.SharedData.Vector2Formatter(); - case 54: return new MessagePack.Formatters.SharedData.Vector3LikeFormatter(); - case 55: return new MessagePack.Formatters.SharedData.VectorLike2Formatter(); - case 56: return new MessagePack.Formatters.SharedData.Version0Formatter(); - case 57: return new MessagePack.Formatters.SharedData.Version1Formatter(); - case 58: return new MessagePack.Formatters.SharedData.Version2Formatter(); - case 59: return new MessagePack.Formatters.SharedData.VersionBlockTestFormatter(); - case 60: return new MessagePack.Formatters.SharedData.VersioningUnionFormatter(); - case 61: return new MessagePack.Formatters.SharedData.WithIndexerFormatter(); - case 62: return new MessagePack.Formatters.SimpleModelFormatter(); - case 63: return new MessagePack.Formatters.StampMessageBodyFormatter(); - case 64: return new MessagePack.Formatters.TextMessageBodyFormatter(); + case 29: return new MessagePack.Formatters.SharedData.DefaultValueIntKeyClassWithExplicitConstructorFormatter(); + case 30: return new MessagePack.Formatters.SharedData.DefaultValueIntKeyClassWithoutExplicitConstructorFormatter(); + case 31: return new MessagePack.Formatters.SharedData.DefaultValueIntKeyStructWithExplicitConstructorFormatter(); + case 32: return new MessagePack.Formatters.SharedData.DefaultValueStringKeyClassWithExplicitConstructorFormatter(); + case 33: return new MessagePack.Formatters.SharedData.DefaultValueStringKeyClassWithoutExplicitConstructorFormatter(); + case 34: return new MessagePack.Formatters.SharedData.DefaultValueStringKeyStructWithExplicitConstructorFormatter(); + case 35: return new MessagePack.Formatters.SharedData.Empty1Formatter(); + case 36: return new MessagePack.Formatters.SharedData.Empty2Formatter(); + case 37: return new MessagePack.Formatters.SharedData.EmptyClassFormatter(); + case 38: return new MessagePack.Formatters.SharedData.EmptyStructFormatter(); + case 39: return new MessagePack.Formatters.SharedData.FirstSimpleDataFormatter(); + case 40: return new MessagePack.Formatters.SharedData.FooClassFormatter(); + case 41: return new MessagePack.Formatters.SharedData.HolderV0Formatter(); + case 42: return new MessagePack.Formatters.SharedData.HolderV1Formatter(); + case 43: return new MessagePack.Formatters.SharedData.HolderV2Formatter(); + case 44: return new MessagePack.Formatters.SharedData.MyClassFormatter(); + case 45: return new MessagePack.Formatters.SharedData.MySubUnion1Formatter(); + case 46: return new MessagePack.Formatters.SharedData.MySubUnion2Formatter(); + case 47: return new MessagePack.Formatters.SharedData.MySubUnion3Formatter(); + case 48: return new MessagePack.Formatters.SharedData.MySubUnion4Formatter(); + case 49: return new MessagePack.Formatters.SharedData.NestParent_NestContractFormatter(); + case 50: return new MessagePack.Formatters.SharedData.NonEmpty1Formatter(); + case 51: return new MessagePack.Formatters.SharedData.NonEmpty2Formatter(); + case 52: return new MessagePack.Formatters.SharedData.SimpleIntKeyDataFormatter(); + case 53: return new MessagePack.Formatters.SharedData.SimpleStringKeyDataFormatter(); + case 54: return new MessagePack.Formatters.SharedData.SimpleStructIntKeyDataFormatter(); + case 55: return new MessagePack.Formatters.SharedData.SimpleStructStringKeyDataFormatter(); + case 56: return new MessagePack.Formatters.SharedData.SubUnionType1Formatter(); + case 57: return new MessagePack.Formatters.SharedData.SubUnionType2Formatter(); + case 58: return new MessagePack.Formatters.SharedData.UnVersionBlockTestFormatter(); + case 59: return new MessagePack.Formatters.SharedData.Vector2Formatter(); + case 60: return new MessagePack.Formatters.SharedData.Vector3LikeFormatter(); + case 61: return new MessagePack.Formatters.SharedData.VectorLike2Formatter(); + case 62: return new MessagePack.Formatters.SharedData.Version0Formatter(); + case 63: return new MessagePack.Formatters.SharedData.Version1Formatter(); + case 64: return new MessagePack.Formatters.SharedData.Version2Formatter(); + case 65: return new MessagePack.Formatters.SharedData.VersionBlockTestFormatter(); + case 66: return new MessagePack.Formatters.SharedData.VersioningUnionFormatter(); + case 67: return new MessagePack.Formatters.SharedData.WithIndexerFormatter(); + case 68: return new MessagePack.Formatters.SimpleModelFormatter(); + case 69: return new MessagePack.Formatters.StampMessageBodyFormatter(); + case 70: return new MessagePack.Formatters.TextMessageBodyFormatter(); default: return null; } } @@ -935,14 +947,14 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: options.Security.DepthStep(ref reader); var length = reader.ReadArrayHeader(); - var __MyProperty__ = default(int); + var ____result = new global::Abcdefg.Efcdigjl.Ateatatea.Hgfagfafgad.TnonodsfarnoiuAtatqaga(); for (int i = 0; i < length; i++) { switch (i) { case 0: - __MyProperty__ = reader.ReadInt32(); + ____result.MyProperty = reader.ReadInt32(); break; default: reader.Skip(); @@ -950,8 +962,6 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } } - var ____result = new global::Abcdefg.Efcdigjl.Ateatatea.Hgfagfafgad.TnonodsfarnoiuAtatqaga(); - ____result.MyProperty = __MyProperty__; reader.Depth--; return ____result; } @@ -1023,38 +1033,32 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: options.Security.DepthStep(ref reader); global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; var length = reader.ReadArrayHeader(); - var __MyProperty0__ = default(int[]); - var __MyProperty1__ = default(int[,]); - var __MyProperty2__ = default(global::GlobalMyEnum[,]); - var __MyProperty3__ = default(int[,,]); - var __MyProperty4__ = default(int[,,,]); - var __MyProperty5__ = default(global::GlobalMyEnum[]); - var __MyProperty6__ = default(global::QuestMessageBody[]); + var ____result = new global::ArrayTestTest(); for (int i = 0; i < length; i++) { switch (i) { case 0: - __MyProperty0__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.MyProperty0 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); break; case 1: - __MyProperty1__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.MyProperty1 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); break; case 2: - __MyProperty2__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.MyProperty2 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); break; case 3: - __MyProperty3__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.MyProperty3 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); break; case 4: - __MyProperty4__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.MyProperty4 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); break; case 5: - __MyProperty5__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.MyProperty5 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); break; case 6: - __MyProperty6__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.MyProperty6 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); break; default: reader.Skip(); @@ -1062,14 +1066,6 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } } - var ____result = new global::ArrayTestTest(); - ____result.MyProperty0 = __MyProperty0__; - ____result.MyProperty1 = __MyProperty1__; - ____result.MyProperty2 = __MyProperty2__; - ____result.MyProperty3 = __MyProperty3__; - ____result.MyProperty4 = __MyProperty4__; - ____result.MyProperty5 = __MyProperty5__; - ____result.MyProperty6 = __MyProperty6__; reader.Depth--; return ____result; } @@ -1099,14 +1095,14 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: options.Security.DepthStep(ref reader); var length = reader.ReadArrayHeader(); - var __MyProperty__ = default(int); + var ____result = new global::GlobalMan(); for (int i = 0; i < length; i++) { switch (i) { case 0: - __MyProperty__ = reader.ReadInt32(); + ____result.MyProperty = reader.ReadInt32(); break; default: reader.Skip(); @@ -1114,8 +1110,6 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } } - var ____result = new global::GlobalMan(); - ____result.MyProperty = __MyProperty__; reader.Depth--; return ____result; } @@ -1150,26 +1144,23 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: options.Security.DepthStep(ref reader); global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; var length = reader.ReadArrayHeader(); - var __UserId__ = default(int); - var __RoomId__ = default(int); - var __PostTime__ = default(global::System.DateTime); - var __Body__ = default(global::IMessageBody); + var ____result = new global::Message(); for (int i = 0; i < length; i++) { switch (i) { case 0: - __UserId__ = reader.ReadInt32(); + ____result.UserId = reader.ReadInt32(); break; case 1: - __RoomId__ = reader.ReadInt32(); + ____result.RoomId = reader.ReadInt32(); break; case 2: - __PostTime__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.PostTime = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); break; case 3: - __Body__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.Body = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); break; default: reader.Skip(); @@ -1177,11 +1168,6 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } } - var ____result = new global::Message(); - ____result.UserId = __UserId__; - ____result.RoomId = __RoomId__; - ____result.PostTime = __PostTime__; - ____result.Body = __Body__; reader.Depth--; return ____result; } @@ -1214,18 +1200,17 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: options.Security.DepthStep(ref reader); global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; var length = reader.ReadArrayHeader(); - var __QuestId__ = default(int); - var __Text__ = default(string); + var ____result = new global::QuestMessageBody(); for (int i = 0; i < length; i++) { switch (i) { case 0: - __QuestId__ = reader.ReadInt32(); + ____result.QuestId = reader.ReadInt32(); break; case 1: - __Text__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.Text = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); break; default: reader.Skip(); @@ -1233,9 +1218,6 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } } - var ____result = new global::QuestMessageBody(); - ____result.QuestId = __QuestId__; - ____result.Text = __Text__; reader.Depth--; return ____result; } @@ -1265,14 +1247,14 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: options.Security.DepthStep(ref reader); var length = reader.ReadArrayHeader(); - var __StampId__ = default(int); + var ____result = new global::StampMessageBody(); for (int i = 0; i < length; i++) { switch (i) { case 0: - __StampId__ = reader.ReadInt32(); + ____result.StampId = reader.ReadInt32(); break; default: reader.Skip(); @@ -1280,8 +1262,6 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } } - var ____result = new global::StampMessageBody(); - ____result.StampId = __StampId__; reader.Depth--; return ____result; } @@ -1313,14 +1293,14 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: options.Security.DepthStep(ref reader); global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; var length = reader.ReadArrayHeader(); - var __Text__ = default(string); + var ____result = new global::TextMessageBody(); for (int i = 0; i < length; i++) { switch (i) { case 0: - __Text__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.Text = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); break; default: reader.Skip(); @@ -1328,8 +1308,6 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } } - var ____result = new global::TextMessageBody(); - ____result.Text = __Text__; reader.Depth--; return ____result; } @@ -1366,10 +1344,8 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: namespace MessagePack.Formatters { - using System; - using System.Buffers; - using System.Runtime.InteropServices; - using MessagePack; + using global::System.Buffers; + using global::MessagePack; public sealed class ComplexModelFormatter : global::MessagePack.Formatters.IMessagePackFormatter { @@ -1394,7 +1370,7 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: return; } - IFormatterResolver formatterResolver = options.Resolver; + var formatterResolver = options.Resolver; writer.WriteMapHeader(6); writer.WriteRaw(GetSpan_AdditionalProperty()); formatterResolver.GetFormatterWithVerify>().Serialize(ref writer, value.AdditionalProperty, options); @@ -1418,18 +1394,13 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } options.Security.DepthStep(ref reader); - IFormatterResolver formatterResolver = options.Resolver; + var formatterResolver = options.Resolver; var length = reader.ReadMapHeader(); - var __AdditionalProperty__ = default(global::System.Collections.Generic.IDictionary); - var __CreatedOn__ = default(global::System.DateTimeOffset); - var __Id__ = default(global::System.Guid); - var __Name__ = default(string); - var __UpdatedOn__ = default(global::System.DateTimeOffset); - var __SimpleModels__ = default(global::System.Collections.Generic.IList); + var ____result = new global::ComplexModel(); for (int i = 0; i < length; i++) { - ReadOnlySpan stringKey = global::MessagePack.Internal.CodeGenHelpers.ReadStringSpan(ref reader); + var stringKey = global::MessagePack.Internal.CodeGenHelpers.ReadStringSpan(ref reader); switch (stringKey.Length) { default: @@ -1439,7 +1410,7 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: case 18: if (!global::System.MemoryExtensions.SequenceEqual(stringKey, GetSpan_AdditionalProperty().Slice(1))) { goto FAIL; } - __AdditionalProperty__ = formatterResolver.GetFormatterWithVerify>().Deserialize(ref reader, options); + reader.Skip(); continue; case 9: switch (global::MessagePack.Internal.AutomataKeyGen.GetKey(ref stringKey)) @@ -1448,43 +1419,35 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: case 5720808977192022595UL: if (stringKey[0] != 110) { goto FAIL; } - __CreatedOn__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.CreatedOn = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); continue; case 5720808977191956565UL: if (stringKey[0] != 110) { goto FAIL; } - __UpdatedOn__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.UpdatedOn = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); continue; } case 2: if (global::MessagePack.Internal.AutomataKeyGen.GetKey(ref stringKey) != 25673UL) { goto FAIL; } - __Id__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.Id = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); continue; case 4: if (global::MessagePack.Internal.AutomataKeyGen.GetKey(ref stringKey) != 1701667150UL) { goto FAIL; } - __Name__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.Name = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); continue; case 12: if (!global::System.MemoryExtensions.SequenceEqual(stringKey, GetSpan_SimpleModels().Slice(1))) { goto FAIL; } - __SimpleModels__ = formatterResolver.GetFormatterWithVerify>().Deserialize(ref reader, options); + reader.Skip(); continue; } } - var ____result = new global::ComplexModel() - { - CreatedOn = __CreatedOn__, - Id = __Id__, - Name = __Name__, - UpdatedOn = __UpdatedOn__, - }; - reader.Depth--; return ____result; } @@ -1513,7 +1476,7 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: return; } - IFormatterResolver formatterResolver = options.Resolver; + var formatterResolver = options.Resolver; writer.WriteMapHeader(6); writer.WriteRaw(GetSpan_Id()); writer.Write(value.Id); @@ -1537,18 +1500,13 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } options.Security.DepthStep(ref reader); - IFormatterResolver formatterResolver = options.Resolver; + var formatterResolver = options.Resolver; var length = reader.ReadMapHeader(); - var __Id__ = default(int); - var __Name__ = default(string); - var __CreatedOn__ = default(global::System.DateTime); - var __Precision__ = default(int); - var __Money__ = default(decimal); - var __Amount__ = default(long); + var ____result = new global::SimpleModel(); for (int i = 0; i < length; i++) { - ReadOnlySpan stringKey = global::MessagePack.Internal.CodeGenHelpers.ReadStringSpan(ref reader); + var stringKey = global::MessagePack.Internal.CodeGenHelpers.ReadStringSpan(ref reader); switch (stringKey.Length) { default: @@ -1558,12 +1516,12 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: case 2: if (global::MessagePack.Internal.AutomataKeyGen.GetKey(ref stringKey) != 25673UL) { goto FAIL; } - __Id__ = reader.ReadInt32(); + ____result.Id = reader.ReadInt32(); continue; case 4: if (global::MessagePack.Internal.AutomataKeyGen.GetKey(ref stringKey) != 1701667150UL) { goto FAIL; } - __Name__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.Name = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); continue; case 9: switch (global::MessagePack.Internal.AutomataKeyGen.GetKey(ref stringKey)) @@ -1572,39 +1530,30 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: case 5720808977192022595UL: if (stringKey[0] != 110) { goto FAIL; } - __CreatedOn__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.CreatedOn = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); continue; case 8028074707240972880UL: if (stringKey[0] != 110) { goto FAIL; } - __Precision__ = reader.ReadInt32(); + ____result.Precision = reader.ReadInt32(); continue; } case 5: if (global::MessagePack.Internal.AutomataKeyGen.GetKey(ref stringKey) != 521392779085UL) { goto FAIL; } - __Money__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.Money = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); continue; case 6: if (global::MessagePack.Internal.AutomataKeyGen.GetKey(ref stringKey) != 128017765461313UL) { goto FAIL; } - __Amount__ = reader.ReadInt64(); + reader.Skip(); continue; } } - var ____result = new global::SimpleModel() - { - Id = __Id__, - Name = __Name__, - CreatedOn = __CreatedOn__, - Precision = __Precision__, - Money = __Money__, - }; - reader.Depth--; return ____result; } @@ -1629,10 +1578,8 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: namespace MessagePack.Formatters.PerfBenchmarkDotNet { - using System; - using System.Buffers; - using System.Runtime.InteropServices; - using MessagePack; + using global::System.Buffers; + using global::MessagePack; public sealed class StringKeySerializerTargetFormatter : global::MessagePack.Formatters.IMessagePackFormatter { @@ -1693,19 +1640,11 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: options.Security.DepthStep(ref reader); var length = reader.ReadMapHeader(); - var __MyProperty1__ = default(int); - var __MyProperty2__ = default(int); - var __MyProperty3__ = default(int); - var __MyProperty4__ = default(int); - var __MyProperty5__ = default(int); - var __MyProperty6__ = default(int); - var __MyProperty7__ = default(int); - var __MyProperty8__ = default(int); - var __MyProperty9__ = default(int); + var ____result = new global::PerfBenchmarkDotNet.StringKeySerializerTarget(); for (int i = 0; i < length; i++) { - ReadOnlySpan stringKey = global::MessagePack.Internal.CodeGenHelpers.ReadStringSpan(ref reader); + var stringKey = global::MessagePack.Internal.CodeGenHelpers.ReadStringSpan(ref reader); switch (stringKey.Length) { default: @@ -1721,31 +1660,31 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: { default: goto FAIL; case 3242356UL: - __MyProperty1__ = reader.ReadInt32(); + ____result.MyProperty1 = reader.ReadInt32(); continue; case 3307892UL: - __MyProperty2__ = reader.ReadInt32(); + ____result.MyProperty2 = reader.ReadInt32(); continue; case 3373428UL: - __MyProperty3__ = reader.ReadInt32(); + ____result.MyProperty3 = reader.ReadInt32(); continue; case 3438964UL: - __MyProperty4__ = reader.ReadInt32(); + ____result.MyProperty4 = reader.ReadInt32(); continue; case 3504500UL: - __MyProperty5__ = reader.ReadInt32(); + ____result.MyProperty5 = reader.ReadInt32(); continue; case 3570036UL: - __MyProperty6__ = reader.ReadInt32(); + ____result.MyProperty6 = reader.ReadInt32(); continue; case 3635572UL: - __MyProperty7__ = reader.ReadInt32(); + ____result.MyProperty7 = reader.ReadInt32(); continue; case 3701108UL: - __MyProperty8__ = reader.ReadInt32(); + ____result.MyProperty8 = reader.ReadInt32(); continue; case 3766644UL: - __MyProperty9__ = reader.ReadInt32(); + ____result.MyProperty9 = reader.ReadInt32(); continue; } @@ -1754,19 +1693,6 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } } - var ____result = new global::PerfBenchmarkDotNet.StringKeySerializerTarget() - { - MyProperty1 = __MyProperty1__, - MyProperty2 = __MyProperty2__, - MyProperty3 = __MyProperty3__, - MyProperty4 = __MyProperty4__, - MyProperty5 = __MyProperty5__, - MyProperty6 = __MyProperty6__, - MyProperty7 = __MyProperty7__, - MyProperty8 = __MyProperty8__, - MyProperty9 = __MyProperty9__, - }; - reader.Depth--; return ____result; } @@ -1833,74 +1759,59 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: options.Security.DepthStep(ref reader); var length = reader.ReadArrayHeader(); - var __MyProperty0__ = default(int); - var __MyProperty1__ = default(int); - var __MyProperty2__ = default(int); - var __MyProperty3__ = default(int); - var __MyProperty4__ = default(int); - var __MyProperty5__ = default(int); - var __MyProperty6__ = default(int); - var __MyProperty7__ = default(int); - var __MyProperty8__ = default(int); - var __MyProvperty9__ = default(int); - var __MyProperty10__ = default(int); - var __MyProperty11__ = default(int); - var __MyPropverty12__ = default(int); - var __MyPropevrty13__ = default(int); - var __MyProperty14__ = default(int); - var __MyProperty15__ = default(int); + var ____result = new global::SharedData.ArrayOptimizeClass(); for (int i = 0; i < length; i++) { switch (i) { case 0: - __MyProperty0__ = reader.ReadInt32(); + ____result.MyProperty0 = reader.ReadInt32(); break; case 1: - __MyProperty1__ = reader.ReadInt32(); + ____result.MyProperty1 = reader.ReadInt32(); break; case 2: - __MyProperty2__ = reader.ReadInt32(); + ____result.MyProperty2 = reader.ReadInt32(); break; case 3: - __MyProperty3__ = reader.ReadInt32(); + ____result.MyProperty3 = reader.ReadInt32(); break; case 4: - __MyProperty4__ = reader.ReadInt32(); + ____result.MyProperty4 = reader.ReadInt32(); break; case 5: - __MyProperty5__ = reader.ReadInt32(); + ____result.MyProperty5 = reader.ReadInt32(); break; case 6: - __MyProperty6__ = reader.ReadInt32(); + ____result.MyProperty6 = reader.ReadInt32(); break; case 7: - __MyProperty7__ = reader.ReadInt32(); + ____result.MyProperty7 = reader.ReadInt32(); break; case 8: - __MyProperty8__ = reader.ReadInt32(); + ____result.MyProperty8 = reader.ReadInt32(); break; case 9: - __MyProvperty9__ = reader.ReadInt32(); + ____result.MyProvperty9 = reader.ReadInt32(); break; case 10: - __MyProperty10__ = reader.ReadInt32(); + ____result.MyProperty10 = reader.ReadInt32(); break; case 11: - __MyProperty11__ = reader.ReadInt32(); + ____result.MyProperty11 = reader.ReadInt32(); break; case 12: - __MyPropverty12__ = reader.ReadInt32(); + ____result.MyPropverty12 = reader.ReadInt32(); break; case 13: - __MyPropevrty13__ = reader.ReadInt32(); + ____result.MyPropevrty13 = reader.ReadInt32(); break; case 14: - __MyProperty14__ = reader.ReadInt32(); + ____result.MyProperty14 = reader.ReadInt32(); break; case 15: - __MyProperty15__ = reader.ReadInt32(); + ____result.MyProperty15 = reader.ReadInt32(); break; default: reader.Skip(); @@ -1908,23 +1819,6 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } } - var ____result = new global::SharedData.ArrayOptimizeClass(); - ____result.MyProperty0 = __MyProperty0__; - ____result.MyProperty1 = __MyProperty1__; - ____result.MyProperty2 = __MyProperty2__; - ____result.MyProperty3 = __MyProperty3__; - ____result.MyProperty4 = __MyProperty4__; - ____result.MyProperty5 = __MyProperty5__; - ____result.MyProperty6 = __MyProperty6__; - ____result.MyProperty7 = __MyProperty7__; - ____result.MyProperty8 = __MyProperty8__; - ____result.MyProvperty9 = __MyProvperty9__; - ____result.MyProperty10 = __MyProperty10__; - ____result.MyProperty11 = __MyProperty11__; - ____result.MyPropverty12 = __MyPropverty12__; - ____result.MyPropevrty13 = __MyPropevrty13__; - ____result.MyProperty14 = __MyProperty14__; - ____result.MyProperty15 = __MyProperty15__; reader.Depth--; return ____result; } @@ -1956,14 +1850,14 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: options.Security.DepthStep(ref reader); global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; var length = reader.ReadArrayHeader(); - var __OPQ__ = default(string); + var ____result = new global::SharedData.BarClass(); for (int i = 0; i < length; i++) { switch (i) { case 0: - __OPQ__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.OPQ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); break; default: reader.Skip(); @@ -1971,8 +1865,6 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } } - var ____result = new global::SharedData.BarClass(); - ____result.OPQ = __OPQ__; reader.Depth--; return ____result; } @@ -2019,7 +1911,6 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } var ____result = new global::SharedData.Callback1(__X__); - ____result.X = __X__; ____result.OnAfterDeserialize(); reader.Depth--; return ____result; @@ -2067,13 +1958,194 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } var ____result = new global::SharedData.Callback1_2(__X__); - ____result.X = __X__; ((global::MessagePack.IMessagePackSerializationCallbackReceiver)____result).OnAfterDeserialize(); reader.Depth--; return ____result; } } + public sealed class DefaultValueIntKeyClassWithExplicitConstructorFormatter : global::MessagePack.Formatters.IMessagePackFormatter + { + + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.DefaultValueIntKeyClassWithExplicitConstructor value, global::MessagePack.MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + return; + } + + global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; + writer.WriteArrayHeader(4); + writer.Write(value.Prop1); + writer.Write(value.Prop2); + formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.Prop3, options); + formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.Prop4, options); + } + + public global::SharedData.DefaultValueIntKeyClassWithExplicitConstructor Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return null; + } + + options.Security.DepthStep(ref reader); + global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; + var length = reader.ReadArrayHeader(); + var __Prop1__ = default(int); + var __Prop2__ = default(int); + var __Prop3__ = default(string); + var __Prop4__ = default(string); + + for (int i = 0; i < length; i++) + { + switch (i) + { + case 0: + __Prop1__ = reader.ReadInt32(); + break; + case 1: + __Prop2__ = reader.ReadInt32(); + break; + case 2: + __Prop3__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 3: + __Prop4__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + default: + reader.Skip(); + break; + } + } + + var ____result = new global::SharedData.DefaultValueIntKeyClassWithExplicitConstructor(__Prop1__); + if (length <= 1) + { + goto MEMBER_ASSIGNMENT_END; + } + + ____result.Prop2 = __Prop2__; + if (length <= 2) + { + goto MEMBER_ASSIGNMENT_END; + } + + ____result.Prop3 = __Prop3__; + if (length <= 3) + { + goto MEMBER_ASSIGNMENT_END; + } + + ____result.Prop4 = __Prop4__; + + MEMBER_ASSIGNMENT_END: + reader.Depth--; + return ____result; + } + } + + public sealed class DefaultValueIntKeyClassWithoutExplicitConstructorFormatter : global::MessagePack.Formatters.IMessagePackFormatter + { + + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.DefaultValueIntKeyClassWithoutExplicitConstructor value, global::MessagePack.MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + return; + } + + writer.WriteArrayHeader(2); + writer.Write(value.Prop1); + writer.Write(value.Prop2); + } + + public global::SharedData.DefaultValueIntKeyClassWithoutExplicitConstructor Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return null; + } + + options.Security.DepthStep(ref reader); + var length = reader.ReadArrayHeader(); + var ____result = new global::SharedData.DefaultValueIntKeyClassWithoutExplicitConstructor(); + + for (int i = 0; i < length; i++) + { + switch (i) + { + case 0: + ____result.Prop1 = reader.ReadInt32(); + break; + case 1: + ____result.Prop2 = reader.ReadInt32(); + break; + default: + reader.Skip(); + break; + } + } + + reader.Depth--; + return ____result; + } + } + + public sealed class DefaultValueIntKeyStructWithExplicitConstructorFormatter : global::MessagePack.Formatters.IMessagePackFormatter + { + + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.DefaultValueIntKeyStructWithExplicitConstructor value, global::MessagePack.MessagePackSerializerOptions options) + { + writer.WriteArrayHeader(2); + writer.Write(value.Prop1); + writer.Write(value.Prop2); + } + + public global::SharedData.DefaultValueIntKeyStructWithExplicitConstructor Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + throw new global::System.InvalidOperationException("typecode is null, struct not supported"); + } + + options.Security.DepthStep(ref reader); + var length = reader.ReadArrayHeader(); + var __Prop1__ = default(int); + var __Prop2__ = default(int); + + for (int i = 0; i < length; i++) + { + switch (i) + { + case 0: + __Prop1__ = reader.ReadInt32(); + break; + case 1: + __Prop2__ = reader.ReadInt32(); + break; + default: + reader.Skip(); + break; + } + } + + var ____result = new global::SharedData.DefaultValueIntKeyStructWithExplicitConstructor(__Prop1__); + if (length <= 1) + { + goto MEMBER_ASSIGNMENT_END; + } + + ____result.Prop2 = __Prop2__; + + MEMBER_ASSIGNMENT_END: + reader.Depth--; + return ____result; + } + } + public sealed class DynamicArgumentTupleFormatter : global::MessagePack.Formatters.IMessagePackFormatter> { @@ -2176,22 +2248,8 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: return null; } - options.Security.DepthStep(ref reader); - var length = reader.ReadArrayHeader(); - - for (int i = 0; i < length; i++) - { - switch (i) - { - default: - reader.Skip(); - break; - } - } - - var ____result = new global::SharedData.Empty1(); - reader.Depth--; - return ____result; + reader.Skip(); + return new global::SharedData.Empty1(); } } @@ -2216,22 +2274,8 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: return null; } - options.Security.DepthStep(ref reader); - var length = reader.ReadArrayHeader(); - - for (int i = 0; i < length; i++) - { - switch (i) - { - default: - reader.Skip(); - break; - } - } - - var ____result = new global::SharedData.EmptyClass(); - reader.Depth--; - return ____result; + reader.Skip(); + return new global::SharedData.EmptyClass(); } } @@ -2250,22 +2294,8 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: throw new global::System.InvalidOperationException("typecode is null, struct not supported"); } - options.Security.DepthStep(ref reader); - var length = reader.ReadArrayHeader(); - - for (int i = 0; i < length; i++) - { - switch (i) - { - default: - reader.Skip(); - break; - } - } - - var ____result = new global::SharedData.EmptyStruct(); - reader.Depth--; - return ____result; + reader.Skip(); + return new global::SharedData.EmptyStruct(); } } @@ -2297,22 +2327,20 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: options.Security.DepthStep(ref reader); global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; var length = reader.ReadArrayHeader(); - var __Prop1__ = default(int); - var __Prop2__ = default(string); - var __Prop3__ = default(int); + var ____result = new global::SharedData.FirstSimpleData(); for (int i = 0; i < length; i++) { switch (i) { case 0: - __Prop1__ = reader.ReadInt32(); + ____result.Prop1 = reader.ReadInt32(); break; case 1: - __Prop2__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.Prop2 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); break; case 2: - __Prop3__ = reader.ReadInt32(); + ____result.Prop3 = reader.ReadInt32(); break; default: reader.Skip(); @@ -2320,10 +2348,6 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } } - var ____result = new global::SharedData.FirstSimpleData(); - ____result.Prop1 = __Prop1__; - ____result.Prop2 = __Prop2__; - ____result.Prop3 = __Prop3__; reader.Depth--; return ____result; } @@ -2353,14 +2377,14 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: options.Security.DepthStep(ref reader); var length = reader.ReadArrayHeader(); - var __XYZ__ = default(int); + var ____result = new global::SharedData.FooClass(); for (int i = 0; i < length; i++) { switch (i) { case 0: - __XYZ__ = reader.ReadInt32(); + ____result.XYZ = reader.ReadInt32(); break; default: reader.Skip(); @@ -2368,8 +2392,6 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } } - var ____result = new global::SharedData.FooClass(); - ____result.XYZ = __XYZ__; reader.Depth--; return ____result; } @@ -2402,18 +2424,17 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: options.Security.DepthStep(ref reader); global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; var length = reader.ReadArrayHeader(); - var __MyProperty0__ = default(T1); - var __MyProperty1__ = default(T2); + var ____result = new global::SharedData.GenericClass(); for (int i = 0; i < length; i++) { switch (i) { case 0: - __MyProperty0__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.MyProperty0 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); break; case 1: - __MyProperty1__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.MyProperty1 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); break; default: reader.Skip(); @@ -2421,9 +2442,6 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } } - var ____result = new global::SharedData.GenericClass(); - ____result.MyProperty0 = __MyProperty0__; - ____result.MyProperty1 = __MyProperty1__; reader.Depth--; return ____result; } @@ -2458,18 +2476,17 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: options.Security.DepthStep(ref reader); global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; var length = reader.ReadArrayHeader(); - var __MyProperty0__ = default(T1); - var __Comparer__ = default(T2); + var ____result = new global::SharedData.GenericConstrainedClassIntKey(); for (int i = 0; i < length; i++) { switch (i) { case 0: - __MyProperty0__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.MyProperty0 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); break; case 1: - __Comparer__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.Comparer = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); break; default: reader.Skip(); @@ -2477,9 +2494,6 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } } - var ____result = new global::SharedData.GenericConstrainedClassIntKey(); - ____result.MyProperty0 = __MyProperty0__; - ____result.Comparer = __Comparer__; reader.Depth--; return ____result; } @@ -2508,18 +2522,17 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: options.Security.DepthStep(ref reader); global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; var length = reader.ReadArrayHeader(); - var __MyProperty0__ = default(T1); - var __Comparer__ = default(T2); + var ____result = new global::SharedData.GenericConstrainedStructIntKey(); for (int i = 0; i < length; i++) { switch (i) { case 0: - __MyProperty0__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.MyProperty0 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); break; case 1: - __Comparer__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.Comparer = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); break; default: reader.Skip(); @@ -2527,9 +2540,6 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } } - var ____result = new global::SharedData.GenericConstrainedStructIntKey(); - ____result.MyProperty0 = __MyProperty0__; - ____result.Comparer = __Comparer__; reader.Depth--; return ____result; } @@ -2556,18 +2566,17 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: options.Security.DepthStep(ref reader); global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; var length = reader.ReadArrayHeader(); - var __MyProperty0__ = default(T1); - var __MyProperty1__ = default(T2); + var ____result = new global::SharedData.GenericStruct(); for (int i = 0; i < length; i++) { switch (i) { case 0: - __MyProperty0__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.MyProperty0 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); break; case 1: - __MyProperty1__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.MyProperty1 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); break; default: reader.Skip(); @@ -2575,9 +2584,6 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } } - var ____result = new global::SharedData.GenericStruct(); - ____result.MyProperty0 = __MyProperty0__; - ____result.MyProperty1 = __MyProperty1__; reader.Depth--; return ____result; } @@ -2610,18 +2616,17 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: options.Security.DepthStep(ref reader); global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; var length = reader.ReadArrayHeader(); - var __MyProperty1__ = default(global::SharedData.Version0); - var __After__ = default(int); + var ____result = new global::SharedData.HolderV0(); for (int i = 0; i < length; i++) { switch (i) { case 0: - __MyProperty1__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.MyProperty1 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); break; case 1: - __After__ = reader.ReadInt32(); + ____result.After = reader.ReadInt32(); break; default: reader.Skip(); @@ -2629,9 +2634,6 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } } - var ____result = new global::SharedData.HolderV0(); - ____result.MyProperty1 = __MyProperty1__; - ____result.After = __After__; reader.Depth--; return ____result; } @@ -2664,18 +2666,17 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: options.Security.DepthStep(ref reader); global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; var length = reader.ReadArrayHeader(); - var __MyProperty1__ = default(global::SharedData.Version1); - var __After__ = default(int); + var ____result = new global::SharedData.HolderV1(); for (int i = 0; i < length; i++) { switch (i) { case 0: - __MyProperty1__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.MyProperty1 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); break; case 1: - __After__ = reader.ReadInt32(); + ____result.After = reader.ReadInt32(); break; default: reader.Skip(); @@ -2683,9 +2684,6 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } } - var ____result = new global::SharedData.HolderV1(); - ____result.MyProperty1 = __MyProperty1__; - ____result.After = __After__; reader.Depth--; return ____result; } @@ -2718,18 +2716,17 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: options.Security.DepthStep(ref reader); global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; var length = reader.ReadArrayHeader(); - var __MyProperty1__ = default(global::SharedData.Version2); - var __After__ = default(int); + var ____result = new global::SharedData.HolderV2(); for (int i = 0; i < length; i++) { switch (i) { case 0: - __MyProperty1__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.MyProperty1 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); break; case 1: - __After__ = reader.ReadInt32(); + ____result.After = reader.ReadInt32(); break; default: reader.Skip(); @@ -2737,9 +2734,6 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } } - var ____result = new global::SharedData.HolderV2(); - ____result.MyProperty1 = __MyProperty1__; - ____result.After = __After__; reader.Depth--; return ____result; } @@ -2771,22 +2765,20 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: options.Security.DepthStep(ref reader); var length = reader.ReadArrayHeader(); - var __MyProperty1__ = default(int); - var __MyProperty2__ = default(int); - var __MyProperty3__ = default(int); + var ____result = new global::SharedData.MyClass(); for (int i = 0; i < length; i++) { switch (i) { case 0: - __MyProperty1__ = reader.ReadInt32(); + ____result.MyProperty1 = reader.ReadInt32(); break; case 1: - __MyProperty2__ = reader.ReadInt32(); + ____result.MyProperty2 = reader.ReadInt32(); break; case 2: - __MyProperty3__ = reader.ReadInt32(); + ____result.MyProperty3 = reader.ReadInt32(); break; default: reader.Skip(); @@ -2794,10 +2786,6 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } } - var ____result = new global::SharedData.MyClass(); - ____result.MyProperty1 = __MyProperty1__; - ____result.MyProperty2 = __MyProperty2__; - ____result.MyProperty3 = __MyProperty3__; reader.Depth--; return ____result; } @@ -2830,14 +2818,14 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: options.Security.DepthStep(ref reader); var length = reader.ReadArrayHeader(); - var __One__ = default(int); + var ____result = new global::SharedData.MySubUnion1(); for (int i = 0; i < length; i++) { switch (i) { case 3: - __One__ = reader.ReadInt32(); + ____result.One = reader.ReadInt32(); break; default: reader.Skip(); @@ -2845,8 +2833,6 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } } - var ____result = new global::SharedData.MySubUnion1(); - ____result.One = __One__; reader.Depth--; return ____result; } @@ -2875,14 +2861,14 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: options.Security.DepthStep(ref reader); var length = reader.ReadArrayHeader(); - var __Two__ = default(int); + var ____result = new global::SharedData.MySubUnion2(); for (int i = 0; i < length; i++) { switch (i) { case 5: - __Two__ = reader.ReadInt32(); + ____result.Two = reader.ReadInt32(); break; default: reader.Skip(); @@ -2890,8 +2876,6 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } } - var ____result = new global::SharedData.MySubUnion2(); - ____result.Two = __Two__; reader.Depth--; return ____result; } @@ -2923,14 +2907,14 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: options.Security.DepthStep(ref reader); var length = reader.ReadArrayHeader(); - var __Three__ = default(int); + var ____result = new global::SharedData.MySubUnion3(); for (int i = 0; i < length; i++) { switch (i) { case 2: - __Three__ = reader.ReadInt32(); + ____result.Three = reader.ReadInt32(); break; default: reader.Skip(); @@ -2938,8 +2922,6 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } } - var ____result = new global::SharedData.MySubUnion3(); - ____result.Three = __Three__; reader.Depth--; return ____result; } @@ -2970,14 +2952,14 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: options.Security.DepthStep(ref reader); var length = reader.ReadArrayHeader(); - var __Four__ = default(int); + var ____result = new global::SharedData.MySubUnion4(); for (int i = 0; i < length; i++) { switch (i) { case 7: - __Four__ = reader.ReadInt32(); + ____result.Four = reader.ReadInt32(); break; default: reader.Skip(); @@ -2985,8 +2967,6 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } } - var ____result = new global::SharedData.MySubUnion4(); - ____result.Four = __Four__; reader.Depth--; return ____result; } @@ -3016,14 +2996,14 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: options.Security.DepthStep(ref reader); var length = reader.ReadArrayHeader(); - var __MyProperty__ = default(int); + var ____result = new global::SharedData.NestParent.NestContract(); for (int i = 0; i < length; i++) { switch (i) { case 0: - __MyProperty__ = reader.ReadInt32(); + ____result.MyProperty = reader.ReadInt32(); break; default: reader.Skip(); @@ -3031,8 +3011,6 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } } - var ____result = new global::SharedData.NestParent.NestContract(); - ____result.MyProperty = __MyProperty__; reader.Depth--; return ____result; } @@ -3062,14 +3040,14 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: options.Security.DepthStep(ref reader); var length = reader.ReadArrayHeader(); - var __MyProperty__ = default(int); + var ____result = new global::SharedData.NonEmpty1(); for (int i = 0; i < length; i++) { switch (i) { case 0: - __MyProperty__ = reader.ReadInt32(); + ____result.MyProperty = reader.ReadInt32(); break; default: reader.Skip(); @@ -3077,8 +3055,6 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } } - var ____result = new global::SharedData.NonEmpty1(); - ____result.MyProperty = __MyProperty__; reader.Depth--; return ____result; } @@ -3116,38 +3092,32 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: options.Security.DepthStep(ref reader); global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; var length = reader.ReadArrayHeader(); - var __Prop1__ = default(int); - var __Prop2__ = default(global::SharedData.ByteEnum); - var __Prop3__ = default(string); - var __Prop4__ = default(global::SharedData.SimpleStringKeyData); - var __Prop5__ = default(global::SharedData.SimpleStructIntKeyData); - var __Prop6__ = default(global::SharedData.SimpleStructStringKeyData); - var __BytesSpecial__ = default(byte[]); + var ____result = new global::SharedData.SimpleIntKeyData(); for (int i = 0; i < length; i++) { switch (i) { case 0: - __Prop1__ = reader.ReadInt32(); + ____result.Prop1 = reader.ReadInt32(); break; case 1: - __Prop2__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.Prop2 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); break; case 2: - __Prop3__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.Prop3 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); break; case 3: - __Prop4__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.Prop4 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); break; case 4: - __Prop5__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.Prop5 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); break; case 5: - __Prop6__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.Prop6 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); break; case 6: - __BytesSpecial__ = reader.ReadBytes()?.ToArray(); + ____result.BytesSpecial = reader.ReadBytes()?.ToArray(); break; default: reader.Skip(); @@ -3155,14 +3125,6 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } } - var ____result = new global::SharedData.SimpleIntKeyData(); - ____result.Prop1 = __Prop1__; - ____result.Prop2 = __Prop2__; - ____result.Prop3 = __Prop3__; - ____result.Prop4 = __Prop4__; - ____result.Prop5 = __Prop5__; - ____result.Prop6 = __Prop6__; - ____result.BytesSpecial = __BytesSpecial__; reader.Depth--; return ____result; } @@ -3188,22 +3150,20 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: options.Security.DepthStep(ref reader); var length = reader.ReadArrayHeader(); - var __X__ = default(int); - var __Y__ = default(int); - var __BytesSpecial__ = default(byte[]); + var ____result = new global::SharedData.SimpleStructIntKeyData(); for (int i = 0; i < length; i++) { switch (i) { case 0: - __X__ = reader.ReadInt32(); + ____result.X = reader.ReadInt32(); break; case 1: - __Y__ = reader.ReadInt32(); + ____result.Y = reader.ReadInt32(); break; case 2: - __BytesSpecial__ = reader.ReadBytes()?.ToArray(); + ____result.BytesSpecial = reader.ReadBytes()?.ToArray(); break; default: reader.Skip(); @@ -3211,10 +3171,6 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } } - var ____result = new global::SharedData.SimpleStructIntKeyData(); - ____result.X = __X__; - ____result.Y = __Y__; - ____result.BytesSpecial = __BytesSpecial__; reader.Depth--; return ____result; } @@ -3245,18 +3201,17 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: options.Security.DepthStep(ref reader); var length = reader.ReadArrayHeader(); - var __MyProperty1__ = default(int); - var __MyProperty__ = default(int); + var ____result = new global::SharedData.SubUnionType1(); for (int i = 0; i < length; i++) { switch (i) { case 0: - __MyProperty__ = reader.ReadInt32(); + ____result.MyProperty = reader.ReadInt32(); break; case 1: - __MyProperty1__ = reader.ReadInt32(); + ____result.MyProperty1 = reader.ReadInt32(); break; default: reader.Skip(); @@ -3264,9 +3219,6 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } } - var ____result = new global::SharedData.SubUnionType1(); - ____result.MyProperty = __MyProperty__; - ____result.MyProperty1 = __MyProperty1__; reader.Depth--; return ____result; } @@ -3297,18 +3249,17 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: options.Security.DepthStep(ref reader); var length = reader.ReadArrayHeader(); - var __MyProperty2__ = default(int); - var __MyProperty__ = default(int); + var ____result = new global::SharedData.SubUnionType2(); for (int i = 0; i < length; i++) { switch (i) { case 0: - __MyProperty__ = reader.ReadInt32(); + ____result.MyProperty = reader.ReadInt32(); break; case 1: - __MyProperty2__ = reader.ReadInt32(); + ____result.MyProperty2 = reader.ReadInt32(); break; default: reader.Skip(); @@ -3316,9 +3267,6 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } } - var ____result = new global::SharedData.SubUnionType2(); - ____result.MyProperty = __MyProperty__; - ____result.MyProperty2 = __MyProperty2__; reader.Depth--; return ____result; } @@ -3350,18 +3298,17 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: options.Security.DepthStep(ref reader); var length = reader.ReadArrayHeader(); - var __MyProperty__ = default(int); - var __MyProperty2__ = default(int); + var ____result = new global::SharedData.UnVersionBlockTest(); for (int i = 0; i < length; i++) { switch (i) { case 0: - __MyProperty__ = reader.ReadInt32(); + ____result.MyProperty = reader.ReadInt32(); break; case 2: - __MyProperty2__ = reader.ReadInt32(); + ____result.MyProperty2 = reader.ReadInt32(); break; default: reader.Skip(); @@ -3369,9 +3316,6 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } } - var ____result = new global::SharedData.UnVersionBlockTest(); - ____result.MyProperty = __MyProperty__; - ____result.MyProperty2 = __MyProperty2__; reader.Depth--; return ____result; } @@ -3465,9 +3409,6 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } var ____result = new global::SharedData.Vector3Like(__x__, __y__, __z__); - ____result.x = __x__; - ____result.y = __y__; - ____result.z = __z__; reader.Depth--; return ____result; } @@ -3512,8 +3453,6 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } var ____result = new global::SharedData.VectorLike2(__x__, __y__); - ____result.x = __x__; - ____result.y = __y__; reader.Depth--; return ____result; } @@ -3546,14 +3485,14 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: options.Security.DepthStep(ref reader); var length = reader.ReadArrayHeader(); - var __MyProperty1__ = default(int); + var ____result = new global::SharedData.Version0(); for (int i = 0; i < length; i++) { switch (i) { case 3: - __MyProperty1__ = reader.ReadInt32(); + ____result.MyProperty1 = reader.ReadInt32(); break; default: reader.Skip(); @@ -3561,8 +3500,6 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } } - var ____result = new global::SharedData.Version0(); - ____result.MyProperty1 = __MyProperty1__; reader.Depth--; return ____result; } @@ -3597,22 +3534,20 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: options.Security.DepthStep(ref reader); var length = reader.ReadArrayHeader(); - var __MyProperty1__ = default(int); - var __MyProperty2__ = default(int); - var __MyProperty3__ = default(int); + var ____result = new global::SharedData.Version1(); for (int i = 0; i < length; i++) { switch (i) { case 3: - __MyProperty1__ = reader.ReadInt32(); + ____result.MyProperty1 = reader.ReadInt32(); break; case 4: - __MyProperty2__ = reader.ReadInt32(); + ____result.MyProperty2 = reader.ReadInt32(); break; case 5: - __MyProperty3__ = reader.ReadInt32(); + ____result.MyProperty3 = reader.ReadInt32(); break; default: reader.Skip(); @@ -3620,10 +3555,6 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } } - var ____result = new global::SharedData.Version1(); - ____result.MyProperty1 = __MyProperty1__; - ____result.MyProperty2 = __MyProperty2__; - ____result.MyProperty3 = __MyProperty3__; reader.Depth--; return ____result; } @@ -3660,26 +3591,23 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: options.Security.DepthStep(ref reader); var length = reader.ReadArrayHeader(); - var __MyProperty1__ = default(int); - var __MyProperty2__ = default(int); - var __MyProperty3__ = default(int); - var __MyProperty5__ = default(int); + var ____result = new global::SharedData.Version2(); for (int i = 0; i < length; i++) { switch (i) { case 3: - __MyProperty1__ = reader.ReadInt32(); + ____result.MyProperty1 = reader.ReadInt32(); break; case 4: - __MyProperty2__ = reader.ReadInt32(); + ____result.MyProperty2 = reader.ReadInt32(); break; case 5: - __MyProperty3__ = reader.ReadInt32(); + ____result.MyProperty3 = reader.ReadInt32(); break; case 7: - __MyProperty5__ = reader.ReadInt32(); + ____result.MyProperty5 = reader.ReadInt32(); break; default: reader.Skip(); @@ -3687,11 +3615,6 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } } - var ____result = new global::SharedData.Version2(); - ____result.MyProperty1 = __MyProperty1__; - ____result.MyProperty2 = __MyProperty2__; - ____result.MyProperty3 = __MyProperty3__; - ____result.MyProperty5 = __MyProperty5__; reader.Depth--; return ____result; } @@ -3725,22 +3648,20 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: options.Security.DepthStep(ref reader); global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; var length = reader.ReadArrayHeader(); - var __MyProperty__ = default(int); - var __UnknownBlock__ = default(global::SharedData.MyClass); - var __MyProperty2__ = default(int); + var ____result = new global::SharedData.VersionBlockTest(); for (int i = 0; i < length; i++) { switch (i) { case 0: - __MyProperty__ = reader.ReadInt32(); + ____result.MyProperty = reader.ReadInt32(); break; case 1: - __UnknownBlock__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.UnknownBlock = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); break; case 2: - __MyProperty2__ = reader.ReadInt32(); + ____result.MyProperty2 = reader.ReadInt32(); break; default: reader.Skip(); @@ -3748,10 +3669,6 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } } - var ____result = new global::SharedData.VersionBlockTest(); - ____result.MyProperty = __MyProperty__; - ____result.UnknownBlock = __UnknownBlock__; - ____result.MyProperty2 = __MyProperty2__; reader.Depth--; return ____result; } @@ -3788,14 +3705,14 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: options.Security.DepthStep(ref reader); var length = reader.ReadArrayHeader(); - var __FV__ = default(int); + var ____result = new global::SharedData.VersioningUnion(); for (int i = 0; i < length; i++) { switch (i) { case 7: - __FV__ = reader.ReadInt32(); + ____result.FV = reader.ReadInt32(); break; default: reader.Skip(); @@ -3803,8 +3720,6 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } } - var ____result = new global::SharedData.VersioningUnion(); - ____result.FV = __FV__; reader.Depth--; return ____result; } @@ -3837,18 +3752,17 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: options.Security.DepthStep(ref reader); global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; var length = reader.ReadArrayHeader(); - var __Data1__ = default(int); - var __Data2__ = default(string); + var ____result = new global::SharedData.WithIndexer(); for (int i = 0; i < length; i++) { switch (i) { case 0: - __Data1__ = reader.ReadInt32(); + ____result.Data1 = reader.ReadInt32(); break; case 1: - __Data2__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.Data2 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); break; default: reader.Skip(); @@ -3856,9 +3770,6 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } } - var ____result = new global::SharedData.WithIndexer(); - ____result.Data1 = __Data1__; - ____result.Data2 = __Data2__; reader.Depth--; return ____result; } @@ -3895,10 +3806,8 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: namespace MessagePack.Formatters.SharedData { - using System; - using System.Buffers; - using System.Runtime.InteropServices; - using MessagePack; + using global::System.Buffers; + using global::MessagePack; public sealed class Callback2Formatter : global::MessagePack.Formatters.IMessagePackFormatter { @@ -3926,7 +3835,7 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: for (int i = 0; i < length; i++) { - ReadOnlySpan stringKey = global::MessagePack.Internal.CodeGenHelpers.ReadStringSpan(ref reader); + var stringKey = global::MessagePack.Internal.CodeGenHelpers.ReadStringSpan(ref reader); switch (stringKey.Length) { default: @@ -3942,11 +3851,7 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } } - var ____result = new global::SharedData.Callback2(__X__) - { - X = __X__, - }; - + var ____result = new global::SharedData.Callback2(__X__); ____result.OnAfterDeserialize(); reader.Depth--; return ____result; @@ -3979,7 +3884,7 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: for (int i = 0; i < length; i++) { - ReadOnlySpan stringKey = global::MessagePack.Internal.CodeGenHelpers.ReadStringSpan(ref reader); + var stringKey = global::MessagePack.Internal.CodeGenHelpers.ReadStringSpan(ref reader); switch (stringKey.Length) { default: @@ -3995,20 +3900,213 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } } - var ____result = new global::SharedData.Callback2_2(__X__) + var ____result = new global::SharedData.Callback2_2(__X__); + ((global::MessagePack.IMessagePackSerializationCallbackReceiver)____result).OnAfterDeserialize(); + reader.Depth--; + return ____result; + } + } + + public sealed class DefaultValueStringKeyClassWithExplicitConstructorFormatter : global::MessagePack.Formatters.IMessagePackFormatter + { + // Prop1 + private static global::System.ReadOnlySpan GetSpan_Prop1() => new byte[1 + 5] { 165, 80, 114, 111, 112, 49 }; + // Prop2 + private static global::System.ReadOnlySpan GetSpan_Prop2() => new byte[1 + 5] { 165, 80, 114, 111, 112, 50 }; + + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.DefaultValueStringKeyClassWithExplicitConstructor value, global::MessagePack.MessagePackSerializerOptions options) + { + if (value is null) { - X = __X__, - }; + writer.WriteNil(); + return; + } + + writer.WriteMapHeader(2); + writer.WriteRaw(GetSpan_Prop1()); + writer.Write(value.Prop1); + writer.WriteRaw(GetSpan_Prop2()); + writer.Write(value.Prop2); + } + + public global::SharedData.DefaultValueStringKeyClassWithExplicitConstructor Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return null; + } + + options.Security.DepthStep(ref reader); + var length = reader.ReadMapHeader(); + var __Prop1__ = default(int); + var __Prop2__IsInitialized = false; + var __Prop2__ = default(int); + + for (int i = 0; i < length; i++) + { + var stringKey = global::MessagePack.Internal.CodeGenHelpers.ReadStringSpan(ref reader); + switch (stringKey.Length) + { + default: + FAIL: + reader.Skip(); + continue; + case 5: + switch (global::MessagePack.Internal.AutomataKeyGen.GetKey(ref stringKey)) + { + default: goto FAIL; + case 212339749456UL: + __Prop1__ = reader.ReadInt32(); + continue; + case 216634716752UL: + __Prop2__IsInitialized = true; + __Prop2__ = reader.ReadInt32(); + continue; + } + + } + } + + var ____result = new global::SharedData.DefaultValueStringKeyClassWithExplicitConstructor(__Prop1__); + if (__Prop2__IsInitialized) + { + ____result.Prop2 = __Prop2__; + } - ((global::MessagePack.IMessagePackSerializationCallbackReceiver)____result).OnAfterDeserialize(); reader.Depth--; return ____result; } } - public sealed class Empty2Formatter : global::MessagePack.Formatters.IMessagePackFormatter + public sealed class DefaultValueStringKeyClassWithoutExplicitConstructorFormatter : global::MessagePack.Formatters.IMessagePackFormatter + { + // Prop1 + private static global::System.ReadOnlySpan GetSpan_Prop1() => new byte[1 + 5] { 165, 80, 114, 111, 112, 49 }; + // Prop2 + private static global::System.ReadOnlySpan GetSpan_Prop2() => new byte[1 + 5] { 165, 80, 114, 111, 112, 50 }; + + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.DefaultValueStringKeyClassWithoutExplicitConstructor value, global::MessagePack.MessagePackSerializerOptions options) + { + if (value is null) + { + writer.WriteNil(); + return; + } + + writer.WriteMapHeader(2); + writer.WriteRaw(GetSpan_Prop1()); + writer.Write(value.Prop1); + writer.WriteRaw(GetSpan_Prop2()); + writer.Write(value.Prop2); + } + + public global::SharedData.DefaultValueStringKeyClassWithoutExplicitConstructor Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return null; + } + + options.Security.DepthStep(ref reader); + var length = reader.ReadMapHeader(); + var ____result = new global::SharedData.DefaultValueStringKeyClassWithoutExplicitConstructor(); + + for (int i = 0; i < length; i++) + { + var stringKey = global::MessagePack.Internal.CodeGenHelpers.ReadStringSpan(ref reader); + switch (stringKey.Length) + { + default: + FAIL: + reader.Skip(); + continue; + case 5: + switch (global::MessagePack.Internal.AutomataKeyGen.GetKey(ref stringKey)) + { + default: goto FAIL; + case 212339749456UL: + ____result.Prop1 = reader.ReadInt32(); + continue; + case 216634716752UL: + ____result.Prop2 = reader.ReadInt32(); + continue; + } + + } + } + + reader.Depth--; + return ____result; + } + } + + public sealed class DefaultValueStringKeyStructWithExplicitConstructorFormatter : global::MessagePack.Formatters.IMessagePackFormatter { + // Prop1 + private static global::System.ReadOnlySpan GetSpan_Prop1() => new byte[1 + 5] { 165, 80, 114, 111, 112, 49 }; + // Prop2 + private static global::System.ReadOnlySpan GetSpan_Prop2() => new byte[1 + 5] { 165, 80, 114, 111, 112, 50 }; + + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.DefaultValueStringKeyStructWithExplicitConstructor value, global::MessagePack.MessagePackSerializerOptions options) + { + writer.WriteMapHeader(2); + writer.WriteRaw(GetSpan_Prop1()); + writer.Write(value.Prop1); + writer.WriteRaw(GetSpan_Prop2()); + writer.Write(value.Prop2); + } + + public global::SharedData.DefaultValueStringKeyStructWithExplicitConstructor Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + throw new global::System.InvalidOperationException("typecode is null, struct not supported"); + } + + options.Security.DepthStep(ref reader); + var length = reader.ReadMapHeader(); + var __Prop1__ = default(int); + var __Prop2__IsInitialized = false; + var __Prop2__ = default(int); + + for (int i = 0; i < length; i++) + { + var stringKey = global::MessagePack.Internal.CodeGenHelpers.ReadStringSpan(ref reader); + switch (stringKey.Length) + { + default: + FAIL: + reader.Skip(); + continue; + case 5: + switch (global::MessagePack.Internal.AutomataKeyGen.GetKey(ref stringKey)) + { + default: goto FAIL; + case 212339749456UL: + __Prop1__ = reader.ReadInt32(); + continue; + case 216634716752UL: + __Prop2__IsInitialized = true; + __Prop2__ = reader.ReadInt32(); + continue; + } + } + } + + var ____result = new global::SharedData.DefaultValueStringKeyStructWithExplicitConstructor(__Prop1__); + if (__Prop2__IsInitialized) + { + ____result.Prop2 = __Prop2__; + } + + reader.Depth--; + return ____result; + } + } + + public sealed class Empty2Formatter : global::MessagePack.Formatters.IMessagePackFormatter + { public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.Empty2 value, global::MessagePack.MessagePackSerializerOptions options) { if (value is null) @@ -4050,7 +4148,7 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: return; } - IFormatterResolver formatterResolver = options.Resolver; + var formatterResolver = options.Resolver; writer.WriteMapHeader(2); writer.WriteRaw(GetSpan_MyProperty0()); formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.MyProperty0, options); @@ -4066,14 +4164,13 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } options.Security.DepthStep(ref reader); - IFormatterResolver formatterResolver = options.Resolver; + var formatterResolver = options.Resolver; var length = reader.ReadMapHeader(); - var __MyProperty0__ = default(T1); - var __Comparer__ = default(T2); + var ____result = new global::SharedData.GenericConstrainedClassStringKey(); for (int i = 0; i < length; i++) { - ReadOnlySpan stringKey = global::MessagePack.Internal.CodeGenHelpers.ReadStringSpan(ref reader); + var stringKey = global::MessagePack.Internal.CodeGenHelpers.ReadStringSpan(ref reader); switch (stringKey.Length) { default: @@ -4083,23 +4180,17 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: case 11: if (!global::System.MemoryExtensions.SequenceEqual(stringKey, GetSpan_MyProperty0().Slice(1))) { goto FAIL; } - __MyProperty0__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.MyProperty0 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); continue; case 8: if (global::MessagePack.Internal.AutomataKeyGen.GetKey(ref stringKey) != 8243120455795175235UL) { goto FAIL; } - __Comparer__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.Comparer = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); continue; } } - var ____result = new global::SharedData.GenericConstrainedClassStringKey() - { - MyProperty0 = __MyProperty0__, - Comparer = __Comparer__, - }; - reader.Depth--; return ____result; } @@ -4116,7 +4207,7 @@ public sealed class GenericConstrainedStructStringKeyFormatter : global: public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.GenericConstrainedStructStringKey value, global::MessagePack.MessagePackSerializerOptions options) { - IFormatterResolver formatterResolver = options.Resolver; + var formatterResolver = options.Resolver; writer.WriteMapHeader(2); writer.WriteRaw(GetSpan_MyProperty0()); formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.MyProperty0, options); @@ -4132,14 +4223,13 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } options.Security.DepthStep(ref reader); - IFormatterResolver formatterResolver = options.Resolver; + var formatterResolver = options.Resolver; var length = reader.ReadMapHeader(); - var __MyProperty0__ = default(T1); - var __Comparer__ = default(T2); + var ____result = new global::SharedData.GenericConstrainedStructStringKey(); for (int i = 0; i < length; i++) { - ReadOnlySpan stringKey = global::MessagePack.Internal.CodeGenHelpers.ReadStringSpan(ref reader); + var stringKey = global::MessagePack.Internal.CodeGenHelpers.ReadStringSpan(ref reader); switch (stringKey.Length) { default: @@ -4149,23 +4239,17 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: case 11: if (!global::System.MemoryExtensions.SequenceEqual(stringKey, GetSpan_MyProperty0().Slice(1))) { goto FAIL; } - __MyProperty0__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.MyProperty0 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); continue; case 8: if (global::MessagePack.Internal.AutomataKeyGen.GetKey(ref stringKey) != 8243120455795175235UL) { goto FAIL; } - __Comparer__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.Comparer = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); continue; } } - var ____result = new global::SharedData.GenericConstrainedStructStringKey() - { - MyProperty0 = __MyProperty0__, - Comparer = __Comparer__, - }; - reader.Depth--; return ____result; } @@ -4198,11 +4282,11 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: options.Security.DepthStep(ref reader); var length = reader.ReadMapHeader(); - var __MyProperty__ = default(int); + var ____result = new global::SharedData.NonEmpty2(); for (int i = 0; i < length; i++) { - ReadOnlySpan stringKey = global::MessagePack.Internal.CodeGenHelpers.ReadStringSpan(ref reader); + var stringKey = global::MessagePack.Internal.CodeGenHelpers.ReadStringSpan(ref reader); switch (stringKey.Length) { default: @@ -4212,17 +4296,12 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: case 10: if (!global::System.MemoryExtensions.SequenceEqual(stringKey, GetSpan_MyProperty().Slice(1))) { goto FAIL; } - __MyProperty__ = reader.ReadInt32(); + ____result.MyProperty = reader.ReadInt32(); continue; } } - var ____result = new global::SharedData.NonEmpty2() - { - MyProperty = __MyProperty__, - }; - reader.Depth--; return ____result; } @@ -4245,7 +4324,7 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: return; } - IFormatterResolver formatterResolver = options.Resolver; + var formatterResolver = options.Resolver; writer.WriteMapHeader(3); writer.WriteRaw(GetSpan_Prop1()); writer.Write(value.Prop1); @@ -4263,15 +4342,13 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } options.Security.DepthStep(ref reader); - IFormatterResolver formatterResolver = options.Resolver; + var formatterResolver = options.Resolver; var length = reader.ReadMapHeader(); - var __Prop1__ = default(int); - var __Prop2__ = default(global::SharedData.ByteEnum); - var __Prop3__ = default(int); + var ____result = new global::SharedData.SimpleStringKeyData(); for (int i = 0; i < length; i++) { - ReadOnlySpan stringKey = global::MessagePack.Internal.CodeGenHelpers.ReadStringSpan(ref reader); + var stringKey = global::MessagePack.Internal.CodeGenHelpers.ReadStringSpan(ref reader); switch (stringKey.Length) { default: @@ -4283,26 +4360,19 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: { default: goto FAIL; case 212339749456UL: - __Prop1__ = reader.ReadInt32(); + ____result.Prop1 = reader.ReadInt32(); continue; case 216634716752UL: - __Prop2__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.Prop2 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); continue; case 220929684048UL: - __Prop3__ = reader.ReadInt32(); + ____result.Prop3 = reader.ReadInt32(); continue; } } } - var ____result = new global::SharedData.SimpleStringKeyData() - { - Prop1 = __Prop1__, - Prop2 = __Prop2__, - Prop3 = __Prop3__, - }; - reader.Depth--; return ____result; } @@ -4317,7 +4387,7 @@ public sealed class SimpleStructStringKeyDataFormatter : global::MessagePack.For public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.SimpleStructStringKeyData value, global::MessagePack.MessagePackSerializerOptions options) { - IFormatterResolver formatterResolver = options.Resolver; + var formatterResolver = options.Resolver; writer.WriteMapHeader(2); writer.WriteRaw(GetSpan_X()); writer.Write(value.X); @@ -4333,14 +4403,13 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } options.Security.DepthStep(ref reader); - IFormatterResolver formatterResolver = options.Resolver; + var formatterResolver = options.Resolver; var length = reader.ReadMapHeader(); - var __X__ = default(int); - var __Y__ = default(int[]); + var ____result = new global::SharedData.SimpleStructStringKeyData(); for (int i = 0; i < length; i++) { - ReadOnlySpan stringKey = global::MessagePack.Internal.CodeGenHelpers.ReadStringSpan(ref reader); + var stringKey = global::MessagePack.Internal.CodeGenHelpers.ReadStringSpan(ref reader); switch (stringKey.Length) { default: @@ -4352,22 +4421,16 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: { default: goto FAIL; case 378720052587UL: - __X__ = reader.ReadInt32(); + ____result.X = reader.ReadInt32(); continue; case 383015019883UL: - __Y__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.Y = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); continue; } } } - var ____result = new global::SharedData.SimpleStructStringKeyData() - { - X = __X__, - Y = __Y__, - }; - reader.Depth--; return ____result; } diff --git a/sandbox/TestData2/Generated.cs b/sandbox/TestData2/Generated.cs index 0d6025a99..752733200 100644 --- a/sandbox/TestData2/Generated.cs +++ b/sandbox/TestData2/Generated.cs @@ -181,10 +181,8 @@ public void Serialize(ref MessagePackWriter writer, global::TestData2.Nest2.Id v namespace MessagePack.Formatters.TestData2 { - using System; - using System.Buffers; - using System.Runtime.InteropServices; - using MessagePack; + using global::System.Buffers; + using global::MessagePack; public sealed class AFormatter : global::MessagePack.Formatters.IMessagePackFormatter { @@ -203,7 +201,7 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: return; } - IFormatterResolver formatterResolver = options.Resolver; + var formatterResolver = options.Resolver; writer.WriteMapHeader(3); writer.WriteRaw(GetSpan_a()); writer.Write(value.a); @@ -221,15 +219,13 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } options.Security.DepthStep(ref reader); - IFormatterResolver formatterResolver = options.Resolver; + var formatterResolver = options.Resolver; var length = reader.ReadMapHeader(); - var __a__ = default(int); - var __bs__ = default(global::System.Collections.Generic.List); - var __c__ = default(global::TestData2.C); + var ____result = new global::TestData2.A(); for (int i = 0; i < length; i++) { - ReadOnlySpan stringKey = global::MessagePack.Internal.CodeGenHelpers.ReadStringSpan(ref reader); + var stringKey = global::MessagePack.Internal.CodeGenHelpers.ReadStringSpan(ref reader); switch (stringKey.Length) { default: @@ -241,28 +237,21 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: { default: goto FAIL; case 97UL: - __a__ = reader.ReadInt32(); + ____result.a = reader.ReadInt32(); continue; case 99UL: - __c__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.c = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); continue; } case 2: if (global::MessagePack.Internal.AutomataKeyGen.GetKey(ref stringKey) != 29538UL) { goto FAIL; } - __bs__ = formatterResolver.GetFormatterWithVerify>().Deserialize(ref reader, options); + ____result.bs = formatterResolver.GetFormatterWithVerify>().Deserialize(ref reader, options); continue; } } - var ____result = new global::TestData2.A() - { - a = __a__, - bs = __bs__, - c = __c__, - }; - reader.Depth--; return ____result; } @@ -285,7 +274,7 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: return; } - IFormatterResolver formatterResolver = options.Resolver; + var formatterResolver = options.Resolver; writer.WriteMapHeader(3); writer.WriteRaw(GetSpan_ass()); formatterResolver.GetFormatterWithVerify>().Serialize(ref writer, value.ass, options); @@ -303,15 +292,13 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } options.Security.DepthStep(ref reader); - IFormatterResolver formatterResolver = options.Resolver; + var formatterResolver = options.Resolver; var length = reader.ReadMapHeader(); - var __ass__ = default(global::System.Collections.Generic.List); - var __c__ = default(global::TestData2.C); - var __a__ = default(int); + var ____result = new global::TestData2.B(); for (int i = 0; i < length; i++) { - ReadOnlySpan stringKey = global::MessagePack.Internal.CodeGenHelpers.ReadStringSpan(ref reader); + var stringKey = global::MessagePack.Internal.CodeGenHelpers.ReadStringSpan(ref reader); switch (stringKey.Length) { default: @@ -321,30 +308,23 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: case 3: if (global::MessagePack.Internal.AutomataKeyGen.GetKey(ref stringKey) != 7566177UL) { goto FAIL; } - __ass__ = formatterResolver.GetFormatterWithVerify>().Deserialize(ref reader, options); + ____result.ass = formatterResolver.GetFormatterWithVerify>().Deserialize(ref reader, options); continue; case 1: switch (global::MessagePack.Internal.AutomataKeyGen.GetKey(ref stringKey)) { default: goto FAIL; case 99UL: - __c__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.c = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); continue; case 97UL: - __a__ = reader.ReadInt32(); + ____result.a = reader.ReadInt32(); continue; } } } - var ____result = new global::TestData2.B() - { - ass = __ass__, - c = __c__, - a = __a__, - }; - reader.Depth--; return ____result; } @@ -365,7 +345,7 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: return; } - IFormatterResolver formatterResolver = options.Resolver; + var formatterResolver = options.Resolver; writer.WriteMapHeader(2); writer.WriteRaw(GetSpan_b()); formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.b, options); @@ -381,14 +361,13 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } options.Security.DepthStep(ref reader); - IFormatterResolver formatterResolver = options.Resolver; + var formatterResolver = options.Resolver; var length = reader.ReadMapHeader(); - var __b__ = default(global::TestData2.B); - var __a__ = default(int); + var ____result = new global::TestData2.C(); for (int i = 0; i < length; i++) { - ReadOnlySpan stringKey = global::MessagePack.Internal.CodeGenHelpers.ReadStringSpan(ref reader); + var stringKey = global::MessagePack.Internal.CodeGenHelpers.ReadStringSpan(ref reader); switch (stringKey.Length) { default: @@ -400,22 +379,16 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: { default: goto FAIL; case 98UL: - __b__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.b = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); continue; case 97UL: - __a__ = reader.ReadInt32(); + ____result.a = reader.ReadInt32(); continue; } } } - var ____result = new global::TestData2.C() - { - b = __b__, - a = __a__, - }; - reader.Depth--; return ____result; } @@ -436,7 +409,7 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: return; } - IFormatterResolver formatterResolver = options.Resolver; + var formatterResolver = options.Resolver; writer.WriteMapHeader(2); writer.WriteRaw(GetSpan_EnumId()); formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.EnumId, options); @@ -452,14 +425,13 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } options.Security.DepthStep(ref reader); - IFormatterResolver formatterResolver = options.Resolver; + var formatterResolver = options.Resolver; var length = reader.ReadMapHeader(); - var __EnumId__ = default(global::TestData2.Nest1.Id); - var __ClassId__ = default(global::TestData2.Nest1.IdType); + var ____result = new global::TestData2.Nest1(); for (int i = 0; i < length; i++) { - ReadOnlySpan stringKey = global::MessagePack.Internal.CodeGenHelpers.ReadStringSpan(ref reader); + var stringKey = global::MessagePack.Internal.CodeGenHelpers.ReadStringSpan(ref reader); switch (stringKey.Length) { default: @@ -469,23 +441,17 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: case 6: if (global::MessagePack.Internal.AutomataKeyGen.GetKey(ref stringKey) != 110266531802693UL) { goto FAIL; } - __EnumId__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.EnumId = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); continue; case 7: if (global::MessagePack.Internal.AutomataKeyGen.GetKey(ref stringKey) != 28228257876896835UL) { goto FAIL; } - __ClassId__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.ClassId = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); continue; } } - var ____result = new global::TestData2.Nest1() - { - EnumId = __EnumId__, - ClassId = __ClassId__, - }; - reader.Depth--; return ____result; } @@ -493,7 +459,6 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: public sealed class Nest1_IdTypeFormatter : global::MessagePack.Formatters.IMessagePackFormatter { - public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::TestData2.Nest1.IdType value, global::MessagePack.MessagePackSerializerOptions options) { if (value is null) @@ -533,7 +498,7 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: return; } - IFormatterResolver formatterResolver = options.Resolver; + var formatterResolver = options.Resolver; writer.WriteMapHeader(2); writer.WriteRaw(GetSpan_EnumId()); formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.EnumId, options); @@ -549,14 +514,13 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } options.Security.DepthStep(ref reader); - IFormatterResolver formatterResolver = options.Resolver; + var formatterResolver = options.Resolver; var length = reader.ReadMapHeader(); - var __EnumId__ = default(global::TestData2.Nest2.Id); - var __ClassId__ = default(global::TestData2.Nest2.IdType); + var ____result = new global::TestData2.Nest2(); for (int i = 0; i < length; i++) { - ReadOnlySpan stringKey = global::MessagePack.Internal.CodeGenHelpers.ReadStringSpan(ref reader); + var stringKey = global::MessagePack.Internal.CodeGenHelpers.ReadStringSpan(ref reader); switch (stringKey.Length) { default: @@ -566,23 +530,17 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: case 6: if (global::MessagePack.Internal.AutomataKeyGen.GetKey(ref stringKey) != 110266531802693UL) { goto FAIL; } - __EnumId__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.EnumId = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); continue; case 7: if (global::MessagePack.Internal.AutomataKeyGen.GetKey(ref stringKey) != 28228257876896835UL) { goto FAIL; } - __ClassId__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.ClassId = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); continue; } } - var ____result = new global::TestData2.Nest2() - { - EnumId = __EnumId__, - ClassId = __ClassId__, - }; - reader.Depth--; return ____result; } @@ -590,7 +548,6 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: public sealed class Nest2_IdTypeFormatter : global::MessagePack.Formatters.IMessagePackFormatter { - public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::TestData2.Nest2.IdType value, global::MessagePack.MessagePackSerializerOptions options) { if (value is null) @@ -630,7 +587,7 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: return; } - IFormatterResolver formatterResolver = options.Resolver; + var formatterResolver = options.Resolver; writer.WriteMapHeader(2); writer.WriteRaw(GetSpan_MyProperty1()); formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.MyProperty1, options); @@ -646,14 +603,13 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } options.Security.DepthStep(ref reader); - IFormatterResolver formatterResolver = options.Resolver; + var formatterResolver = options.Resolver; var length = reader.ReadMapHeader(); - var __MyProperty1__ = default(string); - var __MyProperty2__ = default(string); + var ____result = new global::TestData2.PropNameCheck1(); for (int i = 0; i < length; i++) { - ReadOnlySpan stringKey = global::MessagePack.Internal.CodeGenHelpers.ReadStringSpan(ref reader); + var stringKey = global::MessagePack.Internal.CodeGenHelpers.ReadStringSpan(ref reader); switch (stringKey.Length) { default: @@ -669,10 +625,10 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: { default: goto FAIL; case 3242356UL: - __MyProperty1__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.MyProperty1 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); continue; case 3307892UL: - __MyProperty2__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.MyProperty2 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); continue; } @@ -681,12 +637,6 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } } - var ____result = new global::TestData2.PropNameCheck1() - { - MyProperty1 = __MyProperty1__, - MyProperty2 = __MyProperty2__, - }; - reader.Depth--; return ____result; } @@ -707,7 +657,7 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: return; } - IFormatterResolver formatterResolver = options.Resolver; + var formatterResolver = options.Resolver; writer.WriteMapHeader(2); writer.WriteRaw(GetSpan_MyProperty1()); formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.MyProperty1, options); @@ -723,14 +673,13 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } options.Security.DepthStep(ref reader); - IFormatterResolver formatterResolver = options.Resolver; + var formatterResolver = options.Resolver; var length = reader.ReadMapHeader(); - var __MyProperty1__ = default(string); - var __MyProperty2__ = default(string); + var ____result = new global::TestData2.PropNameCheck2(); for (int i = 0; i < length; i++) { - ReadOnlySpan stringKey = global::MessagePack.Internal.CodeGenHelpers.ReadStringSpan(ref reader); + var stringKey = global::MessagePack.Internal.CodeGenHelpers.ReadStringSpan(ref reader); switch (stringKey.Length) { default: @@ -746,10 +695,10 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: { default: goto FAIL; case 3242356UL: - __MyProperty1__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.MyProperty1 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); continue; case 3307892UL: - __MyProperty2__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.MyProperty2 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); continue; } @@ -758,12 +707,6 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } } - var ____result = new global::TestData2.PropNameCheck2() - { - MyProperty1 = __MyProperty1__, - MyProperty2 = __MyProperty2__, - }; - reader.Depth--; return ____result; } diff --git a/src/MessagePack.GeneratorCore/Generator/FormatterTemplate.cs b/src/MessagePack.GeneratorCore/Generator/FormatterTemplate.cs index ca7434af0..b114ee1ad 100644 --- a/src/MessagePack.GeneratorCore/Generator/FormatterTemplate.cs +++ b/src/MessagePack.GeneratorCore/Generator/FormatterTemplate.cs @@ -118,18 +118,30 @@ namespace "); this.Write(" throw new global::System.InvalidOperationException(\"typecode is n" + "ull, struct not supported\");\r\n"); } - this.Write(" }\r\n\r\n options.Security.DepthStep(ref reader);\r\n"); + this.Write(" }\r\n\r\n"); + if (objInfo.MaxKey == -1 && !objInfo.HasIMessagePackSerializationCallbackReceiver) { + this.Write(" reader.Skip();\r\n return new "); + this.Write(this.ToStringHelper.ToStringWithCulture(objInfo.GetConstructorString())); + this.Write(";\r\n"); + } else { + this.Write(" options.Security.DepthStep(ref reader);\r\n"); if (isFormatterResolverNecessary) { this.Write(" global::MessagePack.IFormatterResolver formatterResolver = options.Re" + "solver;\r\n"); } this.Write(" var length = reader.ReadArrayHeader();\r\n"); - foreach (var member in objInfo.Members) { + var canOverwrite = objInfo.ConstructorParameters.Length == 0; + if (canOverwrite) { + this.Write(" var ____result = new "); + this.Write(this.ToStringHelper.ToStringWithCulture(objInfo.GetConstructorString())); + this.Write(";\r\n"); + } else { foreach (var member in objInfo.Members) { this.Write(" var __"); this.Write(this.ToStringHelper.ToStringWithCulture(member.Name)); this.Write("__ = default("); this.Write(this.ToStringHelper.ToStringWithCulture(member.Type)); this.Write(");\r\n"); + } } this.Write("\r\n for (int i = 0; i < length; i++)\r\n {\r\n sw" + "itch (i)\r\n {\r\n"); @@ -138,25 +150,51 @@ namespace "); if (member == null) { continue; } this.Write(" case "); this.Write(this.ToStringHelper.ToStringWithCulture(member.IntKey)); - this.Write(":\r\n __"); + this.Write(":\r\n"); + if (canOverwrite) { + if (member.IsWritable) { + this.Write(" ____result."); + this.Write(this.ToStringHelper.ToStringWithCulture(member.Name)); + this.Write(" = "); + this.Write(this.ToStringHelper.ToStringWithCulture(member.GetDeserializeMethodString())); + this.Write(";\r\n"); + } else { + this.Write(" "); + this.Write(this.ToStringHelper.ToStringWithCulture(member.GetDeserializeMethodString())); + this.Write(";\r\n"); + } + } else { + this.Write(" __"); this.Write(this.ToStringHelper.ToStringWithCulture(member.Name)); this.Write("__ = "); this.Write(this.ToStringHelper.ToStringWithCulture(member.GetDeserializeMethodString())); - this.Write(";\r\n break;\r\n"); + this.Write(";\r\n"); + } + this.Write(" break;\r\n"); } this.Write(" default:\r\n reader.Skip();\r\n " + - " break;\r\n }\r\n }\r\n\r\n var ____res" + - "ult = new "); + " break;\r\n }\r\n }\r\n\r\n"); + if (!canOverwrite) { + this.Write(" var ____result = new "); this.Write(this.ToStringHelper.ToStringWithCulture(objInfo.GetConstructorString())); this.Write(";\r\n"); - for (var memberIndex = 0; memberIndex <= objInfo.MaxKey; memberIndex++) { + bool memberAssignExists = false; + for (var memberIndex = 0; memberIndex <= objInfo.MaxKey; memberIndex++) { var member = objInfo.GetMember(memberIndex); - if (member == null || !member.IsWritable) { continue; } - this.Write(" ____result."); + if (member == null || !member.IsWritable || objInfo.ConstructorParameters.Any(p => p.Equals(member))) { continue; } + memberAssignExists = true; + this.Write(" if (length <= "); + this.Write(this.ToStringHelper.ToStringWithCulture(memberIndex)); + this.Write(")\r\n {\r\n goto MEMBER_ASSIGNMENT_END;\r\n }\r\n\r\n " + + " ____result."); this.Write(this.ToStringHelper.ToStringWithCulture(member.Name)); this.Write(" = __"); this.Write(this.ToStringHelper.ToStringWithCulture(member.Name)); this.Write("__;\r\n"); + } + if (memberAssignExists) { + this.Write("\r\n MEMBER_ASSIGNMENT_END:\r\n"); + } } if (objInfo.HasIMessagePackSerializationCallbackReceiver) { @@ -167,7 +205,9 @@ namespace "); this.Write(" ____result.OnAfterDeserialize();\r\n"); } } - this.Write(" reader.Depth--;\r\n return ____result;\r\n }\r\n }\r\n"); + this.Write(" reader.Depth--;\r\n return ____result;\r\n"); + } + this.Write(" }\r\n }\r\n"); } this.Write(@"} diff --git a/src/MessagePack.GeneratorCore/Generator/FormatterTemplate.tt b/src/MessagePack.GeneratorCore/Generator/FormatterTemplate.tt index a8dd0885a..d56d1d0af 100644 --- a/src/MessagePack.GeneratorCore/Generator/FormatterTemplate.tt +++ b/src/MessagePack.GeneratorCore/Generator/FormatterTemplate.tt @@ -81,13 +81,21 @@ namespace <#= Namespace #> <# } #> } +<# if (objInfo.MaxKey == -1 && !objInfo.HasIMessagePackSerializationCallbackReceiver) { #> + reader.Skip(); + return new <#= objInfo.GetConstructorString() #>; +<# } else { #> options.Security.DepthStep(ref reader); <# if (isFormatterResolverNecessary) { #> global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; <# } #> var length = reader.ReadArrayHeader(); -<# foreach (var member in objInfo.Members) { #> +<# var canOverwrite = objInfo.ConstructorParameters.Length == 0; + if (canOverwrite) { #> + var ____result = new <#= objInfo.GetConstructorString() #>; +<# } else { foreach (var member in objInfo.Members) { #> var __<#= member.Name #>__ = default(<#= member.Type #>); +<# } #> <# } #> for (int i = 0; i < length; i++) @@ -98,7 +106,15 @@ namespace <#= Namespace #> var member = objInfo.GetMember(memberIndex); if (member == null) { continue; } #> case <#= member.IntKey #>: +<# if (canOverwrite) { + if (member.IsWritable) { #> + ____result.<#= member.Name #> = <#= member.GetDeserializeMethodString() #>; +<# } else { #> + <#= member.GetDeserializeMethodString() #>; +<# } #> +<# } else {#> __<#= member.Name #>__ = <#= member.GetDeserializeMethodString() #>; +<# } #> break; <# } #> default: @@ -107,12 +123,25 @@ namespace <#= Namespace #> } } +<# if (!canOverwrite) { #> var ____result = new <#= objInfo.GetConstructorString() #>; -<# for (var memberIndex = 0; memberIndex <= objInfo.MaxKey; memberIndex++) { +<# bool memberAssignExists = false; + for (var memberIndex = 0; memberIndex <= objInfo.MaxKey; memberIndex++) { var member = objInfo.GetMember(memberIndex); - if (member == null || !member.IsWritable) { continue; } #> + if (member == null || !member.IsWritable || objInfo.ConstructorParameters.Any(p => p.Equals(member))) { continue; } + memberAssignExists = true;#> + if (length <= <#= memberIndex #>) + { + goto MEMBER_ASSIGNMENT_END; + } + ____result.<#= member.Name #> = __<#= member.Name #>__; +<# } #> +<# if (memberAssignExists) { #> + + MEMBER_ASSIGNMENT_END: <# } + } if (objInfo.HasIMessagePackSerializationCallbackReceiver) { if (objInfo.NeedsCastOnAfter) { #> @@ -123,6 +152,7 @@ namespace <#= Namespace #> <# } #> reader.Depth--; return ____result; +<# } #> } } <# } #> diff --git a/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterDeserializeHelper.cs b/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterDeserializeHelper.cs index f8b46ce7f..d9b21677b 100644 --- a/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterDeserializeHelper.cs +++ b/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterDeserializeHelper.cs @@ -12,28 +12,67 @@ namespace MessagePackCompiler.Generator { internal static class StringKeyFormatterDeserializeHelper { - public static string Classify(MemberSerializationInfo[] memberArray, string indent) + public static string Classify(ObjectSerializationInfo objectSerializationInfo, string indent, bool canOverwrite) { + var memberArray = objectSerializationInfo.Members; var buffer = new StringBuilder(); - foreach (var memberInfoTuples in memberArray.Select(member => new MemberInfoTuple(member)).GroupBy(member => member.Binary.Length)) + foreach (var memberInfoTuples in memberArray.Select(member => new MemberInfoTuple(member, IsConstructorParameter(objectSerializationInfo, member))).GroupBy(member => member.Binary.Length)) { var binaryLength = memberInfoTuples.Key; var keyLength = binaryLength >> 3; keyLength += keyLength << 3 == binaryLength ? 0 : 1; buffer.Append(indent).Append("case ").Append(binaryLength).Append(":\r\n"); - ClassifyRecursion(buffer, indent, 1, keyLength, memberInfoTuples); + ClassifyRecursion(buffer, indent, 1, keyLength, memberInfoTuples, canOverwrite); } return buffer.ToString(); } - private static void Assign(StringBuilder buffer, in MemberInfoTuple member) + private static bool IsConstructorParameter(ObjectSerializationInfo objectSerializationInfo, MemberSerializationInfo member) { - buffer.Append("__").Append(member.Info.Name).Append("__ = ").Append(member.Info.GetDeserializeMethodString()).Append(";\r\n"); + foreach (var parameter in objectSerializationInfo.ConstructorParameters) + { + if (parameter.Equals(member)) + { + return true; + } + } + + return false; + } + + private static void Assign(StringBuilder buffer, in MemberInfoTuple member, bool canOverwrite, string indent, string tab, int tabCount) + { + if (member.Info.IsWritable) + { + if (canOverwrite) + { + buffer.Append("____result.").Append(member.Info.Name).Append(" = "); + } + else + { + if (!member.IsConstructorParameter) + { + buffer.Append("__").Append(member.Info.Name).Append("__IsInitialized = true;\r\n").Append(indent); + for (var i = 0; i < tabCount; i++) + { + buffer.Append(tab); + } + } + + buffer.Append("__").Append(member.Info.Name).Append("__ = "); + } + + buffer.Append(member.Info.GetDeserializeMethodString()).Append(";\r\n"); + } + else + { + buffer.Append("reader.Skip();\r\n"); + } } - private static void ClassifyRecursion(StringBuilder buffer, string indent, int tabCount, int keyLength, IEnumerable memberCollection) + private static void ClassifyRecursion(StringBuilder buffer, string indent, int tabCount, int keyLength, IEnumerable memberCollection, bool canOverwrite) { const string Tab = " "; buffer.Append(indent); @@ -46,7 +85,7 @@ private static void ClassifyRecursion(StringBuilder buffer, string indent, int t if (memberArray.Length == 1) { var member = memberArray[0]; - EmbedOne(buffer, indent, tabCount, member); + EmbedOne(buffer, indent, tabCount, member, canOverwrite); return; } @@ -83,7 +122,7 @@ private static void ClassifyRecursion(StringBuilder buffer, string indent, int t } var member = grouping.Single(); - Assign(buffer, member); + Assign(buffer, member, canOverwrite, indent, Tab, tabCount + 2); buffer.Append(Tab + Tab).Append(indent); for (var i = 0; i < tabCount; i++) { @@ -94,7 +133,7 @@ private static void ClassifyRecursion(StringBuilder buffer, string indent, int t continue; } - ClassifyRecursion(buffer, indent + Tab, tabCount + 1, keyLength, grouping); + ClassifyRecursion(buffer, indent + Tab, tabCount + 1, keyLength, grouping, canOverwrite); } buffer.Append("\r\n").Append(indent); @@ -106,7 +145,7 @@ private static void ClassifyRecursion(StringBuilder buffer, string indent, int t buffer.Append("}\r\n"); } - private static void EmbedOne(StringBuilder buffer, string indent, int tabCount, in MemberInfoTuple member) + private static void EmbedOne(StringBuilder buffer, string indent, int tabCount, in MemberInfoTuple member, bool canOverwrite) { const string Tab = " "; var binary = member.Binary.AsSpan((tabCount - 1) << 3); @@ -136,7 +175,7 @@ private static void EmbedOne(StringBuilder buffer, string indent, int tabCount, buffer.Append(Tab); } - Assign(buffer, member); + Assign(buffer, member, canOverwrite, indent, Tab, tabCount); buffer.Append(indent); for (var i = 0; i < tabCount; i++) { @@ -166,12 +205,14 @@ private static void EmbedSequenceEqual(StringBuilder buffer, MemberInfoTuple mem internal readonly struct MemberInfoTuple : IComparable { public readonly MemberSerializationInfo Info; + public readonly bool IsConstructorParameter; public readonly byte[] Binary; public readonly ulong[] Key; - public MemberInfoTuple(MemberSerializationInfo info) + public MemberInfoTuple(MemberSerializationInfo info, bool isConstructorParameter) { Info = info; + IsConstructorParameter = isConstructorParameter; Binary = EmbedStringHelper.Utf8.GetBytes(info.StringKey); ReadOnlySpan span = Binary; var keyLength = Binary.Length >> 3; diff --git a/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterTemplate.cs b/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterTemplate.cs index 40b3e83c5..39fef24af 100644 --- a/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterTemplate.cs +++ b/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterTemplate.cs @@ -43,22 +43,17 @@ public virtual string TransformText() namespace "); this.Write(this.ToStringHelper.ToStringWithCulture(Namespace)); - this.Write("\r\n{\r\n using System;\r\n using System.Buffers;\r\n using System.Runtime.Inter" + - "opServices;\r\n using MessagePack;\r\n"); - -var list = new List>(); -foreach (var objInfo in ObjectSerializationInfos) -{ + this.Write("\r\n{\r\n using global::System.Buffers;\r\n using global::MessagePack;\r\n"); + var list = new List>(); +foreach (var objInfo in ObjectSerializationInfos) { list.Clear(); - foreach (var member in objInfo.Members) - { + foreach (var member in objInfo.Members) { var binary = EmbedStringHelper.Utf8.GetBytes(member.StringKey); list.Add(new ValueTuple(member, binary)); } string formatterName = objInfo.Name + (objInfo.IsOpenGenericType ? $"Formatter<{string.Join(", ", objInfo.GenericTypeParameters.Select(x => x.Name))}>" : "Formatter"); - bool isFormatterResolverNecessary = ShouldUseFormatterResolverHelper.ShouldUseFormatterResolver(objInfo.Members); - + bool isFormatterResolverNecessary = ShouldUseFormatterResolverHelper.ShouldUseFormatterResolver(objInfo.Members); this.Write("\r\n public sealed class "); this.Write(this.ToStringHelper.ToStringWithCulture(formatterName)); this.Write(" : global::MessagePack.Formatters.IMessagePackFormatter<"); @@ -72,12 +67,9 @@ namespace "); this.Write("\r\n"); } this.Write(" {\r\n"); - - foreach (var memberAndBinary in list) - { - var member = memberAndBinary.Item1; - var binary = memberAndBinary.Item2; - + for (var i = 0; i < list.Count; i++) { + var member = list[i].Item1; + var binary = list[i].Item2; this.Write(" // "); this.Write(this.ToStringHelper.ToStringWithCulture(member.StringKey)); this.Write("\r\n private static global::System.ReadOnlySpan GetSpan_"); @@ -85,121 +77,86 @@ namespace "); this.Write("() => "); this.Write(this.ToStringHelper.ToStringWithCulture(EmbedStringHelper.ToByteArrayString(binary))); this.Write(";\r\n"); - - } - - this.Write("\r\n public void Serialize(ref global::MessagePack.MessagePackWriter writer," + - " "); + } + if (list.Count != 0) { + this.Write("\r\n"); + } + this.Write(" public void Serialize(ref global::MessagePack.MessagePackWriter writer, "); this.Write(this.ToStringHelper.ToStringWithCulture(objInfo.FullName)); this.Write(" value, global::MessagePack.MessagePackSerializerOptions options)\r\n {\r\n"); - - if (objInfo.IsClass) - { - + if (objInfo.IsClass) { this.Write(" if (value is null)\r\n {\r\n writer.WriteNil();" + "\r\n return;\r\n }\r\n\r\n"); + } - } - - if (isFormatterResolverNecessary) - { - - this.Write(" IFormatterResolver formatterResolver = options.Resolver;\r\n"); - - } - - if (objInfo.HasIMessagePackSerializationCallbackReceiver) - { - if (objInfo.NeedsCastOnBefore) - { + if (isFormatterResolverNecessary) { + this.Write(" var formatterResolver = options.Resolver;\r\n"); + } + if (objInfo.HasIMessagePackSerializationCallbackReceiver) { + if (objInfo.NeedsCastOnBefore) { this.Write(" ((global::MessagePack.IMessagePackSerializationCallbackReceiver)value" + ").OnBeforeSerialize();\r\n"); - - } - else - { - + } else { this.Write(" value.OnBeforeSerialize();\r\n"); - - } - } - + } + } this.Write(" writer.WriteMapHeader("); this.Write(this.ToStringHelper.ToStringWithCulture(list.Count)); this.Write(");\r\n"); - - foreach (var memberAndBinary in list) - { - var member = memberAndBinary.Item1; - + foreach (var memberAndBinary in list) { + var member = memberAndBinary.Item1; this.Write(" writer.WriteRaw(GetSpan_"); this.Write(this.ToStringHelper.ToStringWithCulture(member.Name)); this.Write("());\r\n "); this.Write(this.ToStringHelper.ToStringWithCulture(member.GetSerializeMethodString())); this.Write(";\r\n"); - - } - + } this.Write(" }\r\n\r\n public "); this.Write(this.ToStringHelper.ToStringWithCulture(objInfo.FullName)); this.Write(" Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePac" + "k.MessagePackSerializerOptions options)\r\n {\r\n if (reader.TryRe" + "adNil())\r\n {\r\n"); - - if (objInfo.IsClass) - { - + if (objInfo.IsClass) { this.Write(" return null;\r\n"); - - } - else - { - + } else { this.Write(" throw new global::System.InvalidOperationException(\"typecode is n" + "ull, struct not supported\");\r\n"); - - } - + } this.Write(" }\r\n\r\n"); - - if (objInfo.Members.Length == 0) - { - + if (objInfo.Members.Length == 0) { this.Write(" reader.Skip();\r\n var ____result = new "); this.Write(this.ToStringHelper.ToStringWithCulture(objInfo.GetConstructorString())); this.Write(";\r\n"); - - } - else - { - + } else { this.Write(" options.Security.DepthStep(ref reader);\r\n"); - - if (isFormatterResolverNecessary) - { - - this.Write(" IFormatterResolver formatterResolver = options.Resolver;\r\n"); - - } - + if (isFormatterResolverNecessary) { + this.Write(" var formatterResolver = options.Resolver;\r\n"); + } this.Write(" var length = reader.ReadMapHeader();\r\n"); - - foreach (var memberInfo in objInfo.Members) - { - + var canOverwrite = objInfo.ConstructorParameters.Length == 0; + if (canOverwrite) { + this.Write(" var ____result = new "); + this.Write(this.ToStringHelper.ToStringWithCulture(objInfo.GetConstructorString())); + this.Write(";\r\n"); + } else { + foreach (var member in objInfo.Members.Where(x => x.IsWritable)) { + if (objInfo.ConstructorParameters.All(p => !p.Equals(member))) { + this.Write(" var __"); + this.Write(this.ToStringHelper.ToStringWithCulture(member.Name)); + this.Write("__IsInitialized = false;\r\n"); + } this.Write(" var __"); - this.Write(this.ToStringHelper.ToStringWithCulture(memberInfo.Name)); + this.Write(this.ToStringHelper.ToStringWithCulture(member.Name)); this.Write("__ = default("); - this.Write(this.ToStringHelper.ToStringWithCulture(memberInfo.Type)); + this.Write(this.ToStringHelper.ToStringWithCulture(member.Type)); this.Write(");\r\n"); - - } - + } + } this.Write(@" for (int i = 0; i < length; i++) { - ReadOnlySpan stringKey = global::MessagePack.Internal.CodeGenHelpers.ReadStringSpan(ref reader); + var stringKey = global::MessagePack.Internal.CodeGenHelpers.ReadStringSpan(ref reader); switch (stringKey.Length) { default: @@ -207,55 +164,36 @@ namespace "); reader.Skip(); continue; "); - this.Write(this.ToStringHelper.ToStringWithCulture(StringKeyFormatterDeserializeHelper.Classify(objInfo.Members, " "))); - this.Write("\r\n }\r\n }\r\n\r\n var ____result = new "); + this.Write(this.ToStringHelper.ToStringWithCulture(StringKeyFormatterDeserializeHelper.Classify(objInfo, " ", canOverwrite))); + this.Write("\r\n }\r\n }\r\n\r\n"); + if (!canOverwrite) { + this.Write(" var ____result = new "); this.Write(this.ToStringHelper.ToStringWithCulture(objInfo.GetConstructorString())); - this.Write("\r\n {\r\n"); - - // Preparation for C#9 Record class - foreach (var member in objInfo.Members.Where(x => x.IsWritable)) - { - - this.Write(" "); + this.Write(";\r\n"); + foreach (var member in objInfo.Members.Where(x => x.IsWritable && !objInfo.ConstructorParameters.Any(p => p.Equals(x)))) { + this.Write(" if (__"); + this.Write(this.ToStringHelper.ToStringWithCulture(member.Name)); + this.Write("__IsInitialized)\r\n {\r\n ____result."); this.Write(this.ToStringHelper.ToStringWithCulture(member.Name)); this.Write(" = __"); this.Write(this.ToStringHelper.ToStringWithCulture(member.Name)); - this.Write("__,\r\n"); - - } - - this.Write(" };\r\n\r\n"); - - } - - if (objInfo.HasIMessagePackSerializationCallbackReceiver) - { - if (objInfo.NeedsCastOnAfter) - { - + this.Write("__;\r\n }\r\n\r\n"); + } + } + } + if (objInfo.HasIMessagePackSerializationCallbackReceiver) { + if (objInfo.NeedsCastOnAfter) { this.Write(" ((global::MessagePack.IMessagePackSerializationCallbackReceiver)____r" + "esult).OnAfterDeserialize();\r\n"); - - } - else - { - + } else { this.Write(" ____result.OnAfterDeserialize();\r\n"); - - } - } - - if (objInfo.Members.Length != 0) - { - + } + } + if (objInfo.Members.Length != 0) { this.Write(" reader.Depth--;\r\n"); - - } - + } this.Write(" return ____result;\r\n }\r\n }\r\n"); - -} - + } this.Write("}\r\n"); return this.GenerationEnvironment.ToString(); } diff --git a/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterTemplate.tt b/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterTemplate.tt index dc146e5b3..a7ce779bf 100644 --- a/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterTemplate.tt +++ b/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterTemplate.tt @@ -22,199 +22,131 @@ namespace <#= Namespace #> { - using System; - using System.Buffers; - using System.Runtime.InteropServices; - using MessagePack; -<# -var list = new List>(); -foreach (var objInfo in ObjectSerializationInfos) -{ + using global::System.Buffers; + using global::MessagePack; +<# var list = new List>(); +foreach (var objInfo in ObjectSerializationInfos) { list.Clear(); - foreach (var member in objInfo.Members) - { + foreach (var member in objInfo.Members) { var binary = EmbedStringHelper.Utf8.GetBytes(member.StringKey); list.Add(new ValueTuple(member, binary)); } string formatterName = objInfo.Name + (objInfo.IsOpenGenericType ? $"Formatter<{string.Join(", ", objInfo.GenericTypeParameters.Select(x => x.Name))}>" : "Formatter"); - bool isFormatterResolverNecessary = ShouldUseFormatterResolverHelper.ShouldUseFormatterResolver(objInfo.Members); -#> + bool isFormatterResolverNecessary = ShouldUseFormatterResolverHelper.ShouldUseFormatterResolver(objInfo.Members); #> public sealed class <#= formatterName #> : global::MessagePack.Formatters.IMessagePackFormatter<<#= objInfo.FullName #>> <# foreach (var typeArg in objInfo.GenericTypeParameters.Where(x => x.HasConstraints)) {#> where <#= typeArg.Name #> : <#= typeArg.Constraints #> <# }#> { -<# - foreach (var memberAndBinary in list) - { - var member = memberAndBinary.Item1; - var binary = memberAndBinary.Item2; -#> +<# for (var i = 0; i < list.Count; i++) { + var member = list[i].Item1; + var binary = list[i].Item2; #> // <#= member.StringKey #> private static global::System.ReadOnlySpan GetSpan_<#= member.Name #>() => <#= EmbedStringHelper.ToByteArrayString(binary) #>; -<# - } -#> +<# } #> +<# if (list.Count != 0) { #> +<# } #> public void Serialize(ref global::MessagePack.MessagePackWriter writer, <#= objInfo.FullName #> value, global::MessagePack.MessagePackSerializerOptions options) { -<# - if (objInfo.IsClass) - { -#> +<# if (objInfo.IsClass) { #> if (value is null) { writer.WriteNil(); return; } -<# - } +<# } - if (isFormatterResolverNecessary) - { -#> - IFormatterResolver formatterResolver = options.Resolver; -<# - } + if (isFormatterResolverNecessary) { #> + var formatterResolver = options.Resolver; +<# } - if (objInfo.HasIMessagePackSerializationCallbackReceiver) - { - if (objInfo.NeedsCastOnBefore) - { -#> + if (objInfo.HasIMessagePackSerializationCallbackReceiver) { + if (objInfo.NeedsCastOnBefore) { #> ((global::MessagePack.IMessagePackSerializationCallbackReceiver)value).OnBeforeSerialize(); -<# - } - else - { -#> +<# } else { #> value.OnBeforeSerialize(); -<# - } - } -#> +<# } #> +<# } #> writer.WriteMapHeader(<#= list.Count #>); -<# - foreach (var memberAndBinary in list) - { - var member = memberAndBinary.Item1; -#> +<# foreach (var memberAndBinary in list) { + var member = memberAndBinary.Item1; #> writer.WriteRaw(GetSpan_<#= member.Name #>()); <#= member.GetSerializeMethodString() #>; -<# - } -#> +<# } #> } public <#= objInfo.FullName #> Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { -<# - if (objInfo.IsClass) - { -#> +<# if (objInfo.IsClass) { #> return null; -<# - } - else - { -#> +<# } else { #> throw new global::System.InvalidOperationException("typecode is null, struct not supported"); -<# - } -#> +<# } #> } -<# - if (objInfo.Members.Length == 0) - { -#> +<# if (objInfo.Members.Length == 0) { #> reader.Skip(); var ____result = new <#= objInfo.GetConstructorString() #>; -<# - } - else - { -#> +<# } else { #> options.Security.DepthStep(ref reader); -<# - if (isFormatterResolverNecessary) - { -#> - IFormatterResolver formatterResolver = options.Resolver; -<# - } -#> +<# if (isFormatterResolverNecessary) { #> + var formatterResolver = options.Resolver; +<# } #> var length = reader.ReadMapHeader(); -<# - foreach (var memberInfo in objInfo.Members) - { -#> - var __<#= memberInfo.Name #>__ = default(<#= memberInfo.Type #>); -<# - } -#> +<# var canOverwrite = objInfo.ConstructorParameters.Length == 0; + if (canOverwrite) { #> + var ____result = new <#= objInfo.GetConstructorString() #>; +<# } else { + foreach (var member in objInfo.Members.Where(x => x.IsWritable)) { #> +<# if (objInfo.ConstructorParameters.All(p => !p.Equals(member))) { #> + var __<#= member.Name #>__IsInitialized = false; +<# } #> + var __<#= member.Name #>__ = default(<#= member.Type #>); +<# } #> +<# } #> for (int i = 0; i < length; i++) { - ReadOnlySpan stringKey = global::MessagePack.Internal.CodeGenHelpers.ReadStringSpan(ref reader); + var stringKey = global::MessagePack.Internal.CodeGenHelpers.ReadStringSpan(ref reader); switch (stringKey.Length) { default: FAIL: reader.Skip(); continue; -<#= StringKeyFormatterDeserializeHelper.Classify(objInfo.Members, " ") #> +<#= StringKeyFormatterDeserializeHelper.Classify(objInfo, " ", canOverwrite) #> } } - var ____result = new <#= objInfo.GetConstructorString() #> +<# if (!canOverwrite) { #> + var ____result = new <#= objInfo.GetConstructorString() #>; +<# foreach (var member in objInfo.Members.Where(x => x.IsWritable && !objInfo.ConstructorParameters.Any(p => p.Equals(x)))) { #> + if (__<#= member.Name #>__IsInitialized) { -<# - // Preparation for C#9 Record class - foreach (var member in objInfo.Members.Where(x => x.IsWritable)) - { -#> - <#= member.Name #> = __<#= member.Name #>__, -<# - } -#> - }; - -<# - } + ____result.<#= member.Name #> = __<#= member.Name #>__; + } - if (objInfo.HasIMessagePackSerializationCallbackReceiver) - { - if (objInfo.NeedsCastOnAfter) - { -#> +<# } #> +<# } #> +<# } #> +<# if (objInfo.HasIMessagePackSerializationCallbackReceiver) { + if (objInfo.NeedsCastOnAfter) { #> ((global::MessagePack.IMessagePackSerializationCallbackReceiver)____result).OnAfterDeserialize(); -<# - } - else - { -#> +<# } else { #> ____result.OnAfterDeserialize(); -<# - } - } - - if (objInfo.Members.Length != 0) - { -#> +<# } #> +<# } #> +<# if (objInfo.Members.Length != 0) { #> reader.Depth--; -<# - } -#> +<# } #> return ____result; } } -<# -} -#> +<# } #> } diff --git a/src/MessagePack.UnityClient/Assets/Scripts/Tests/Class1.cs b/src/MessagePack.UnityClient/Assets/Scripts/Tests/Class1.cs index d25b14f6f..9d95efa39 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/Tests/Class1.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/Tests/Class1.cs @@ -115,6 +115,108 @@ public void Serialize(ref MessagePackWriter writer, int value, MessagePackSerial } } + [MessagePackObject(true)] + public class DefaultValueStringKeyClassWithoutExplicitConstructor + { + public const int Prop1Constant = 11; + public const int Prop2Constant = 45; + + public int Prop1 { get; set; } = Prop1Constant; + + public int Prop2 { get; set; } = Prop2Constant; + } + + [MessagePackObject(true)] + public class DefaultValueStringKeyClassWithExplicitConstructor + { + public const int Prop2Constant = 1419; + + public int Prop1 { get; set; } + + public int Prop2 { get; set; } + + public DefaultValueStringKeyClassWithExplicitConstructor(int prop1) + { + Prop1 = prop1; + Prop2 = Prop2Constant; + } + } + + [MessagePackObject(true)] + public struct DefaultValueStringKeyStructWithExplicitConstructor + { + public const int Prop2Constant = 198; + + public int Prop1 { get; set; } + + public int Prop2 { get; set; } + + public DefaultValueStringKeyStructWithExplicitConstructor(int prop1) + { + Prop1 = prop1; + Prop2 = Prop2Constant; + } + } + + [MessagePackObject] + public class DefaultValueIntKeyClassWithoutExplicitConstructor + { + public const int Prop1Constant = 33; + public const int Prop2Constant = -4; + + [Key(0)] + public int Prop1 { get; set; } = Prop1Constant; + + [Key(1)] + public int Prop2 { get; set; } = Prop2Constant; + } + + [MessagePackObject] + public class DefaultValueIntKeyClassWithExplicitConstructor + { + public const int Prop2Constant = -109; + public const string Prop3Constant = "生命、宇宙、そして万物についての究極の疑問の答え"; + public const string Prop4Constant = "Hello, world! To you, From me."; + + [Key(0)] + public int Prop1 { get; set; } + + [Key(1)] + public int Prop2 { get; set; } + + [Key(2)] + public string Prop3 { get; set; } + + [Key(3)] + public string Prop4 { get; set; } + + public DefaultValueIntKeyClassWithExplicitConstructor(int prop1) + { + Prop1 = prop1; + Prop2 = Prop2Constant; + Prop3 = Prop3Constant; + Prop4 = Prop4Constant; + } + } + + [MessagePackObject] + public struct DefaultValueIntKeyStructWithExplicitConstructor + { + public const int Prop2Constant = 31; + + [Key(0)] + public int Prop1 { get; set; } + + [Key(1)] + public int Prop2 { get; set; } + + public DefaultValueIntKeyStructWithExplicitConstructor(int prop1) + { + Prop1 = prop1; + Prop2 = Prop2Constant; + } + } + [MessagePackObject(true)] public class SimpleStringKeyData { diff --git a/tests/MessagePack.GeneratedCode.Tests/MessagePack.GeneratedCode.Tests.csproj b/tests/MessagePack.GeneratedCode.Tests/MessagePack.GeneratedCode.Tests.csproj new file mode 100644 index 000000000..99ef099c2 --- /dev/null +++ b/tests/MessagePack.GeneratedCode.Tests/MessagePack.GeneratedCode.Tests.csproj @@ -0,0 +1,21 @@ + + + + netcoreapp3.1 + + false + + + + + + + + + + + + + + + diff --git a/tests/MessagePack.GeneratedCode.Tests/MissingPropertiesTest.cs b/tests/MessagePack.GeneratedCode.Tests/MissingPropertiesTest.cs new file mode 100644 index 000000000..0db93add3 --- /dev/null +++ b/tests/MessagePack.GeneratedCode.Tests/MissingPropertiesTest.cs @@ -0,0 +1,105 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using MessagePack.Resolvers; +using Nerdbank.Streams; +using SharedData; +using Xunit; + +namespace MessagePack.GeneratedCode.Tests +{ + public class MissingPropertiesTest + { + private readonly MessagePackSerializerOptions options; + + public MissingPropertiesTest() + { + var resolver = CompositeResolver.Create(GeneratedResolver.Instance, StandardResolver.Instance); + options = MessagePackSerializerOptions.Standard.WithResolver(resolver); + } + + [Fact] + public void DefaultValueStringKeyClassWithoutExplicitConstructorTest() + { + var seq = new Sequence(); + var writer = new MessagePackWriter(seq); + writer.WriteMapHeader(0); + writer.Flush(); + + var instance = MessagePackSerializer.Deserialize(seq, options); + Assert.Equal(DefaultValueStringKeyClassWithoutExplicitConstructor.Prop1Constant, instance.Prop1); + Assert.Equal(DefaultValueStringKeyClassWithoutExplicitConstructor.Prop2Constant, instance.Prop2); + } + + [Fact] + public void DefaultValueStringKeyClassWithExplicitConstructorTest() + { + var seq = new Sequence(); + var writer = new MessagePackWriter(seq); + writer.WriteMapHeader(1); + writer.Write(nameof(DefaultValueStringKeyClassWithExplicitConstructor.Prop1)); + writer.Write(-1); + writer.Flush(); + + var instance = MessagePackSerializer.Deserialize(seq, options); + Assert.Equal(-1, instance.Prop1); + Assert.Equal(DefaultValueStringKeyClassWithExplicitConstructor.Prop2Constant, instance.Prop2); + } + + [Fact] + public void DefaultValueStringKeyStructWithExplicitConstructorTest() + { + var seq = new Sequence(); + var writer = new MessagePackWriter(seq); + writer.WriteMapHeader(1); + writer.Write(nameof(DefaultValueStringKeyStructWithExplicitConstructor.Prop1)); + writer.Write(-1); + writer.Flush(); + + var instance = MessagePackSerializer.Deserialize(seq, options); + Assert.Equal(-1, instance.Prop1); + Assert.Equal(DefaultValueStringKeyStructWithExplicitConstructor.Prop2Constant, instance.Prop2); + } + + [Fact] + public void DefaultValueIntKeyClassWithoutExplicitConstructorTest() + { + var seq = new Sequence(); + var writer = new MessagePackWriter(seq); + writer.WriteArrayHeader(0); + writer.Flush(); + + var instance = MessagePackSerializer.Deserialize(seq, options); + Assert.Equal(DefaultValueIntKeyClassWithoutExplicitConstructor.Prop1Constant, instance.Prop1); + Assert.Equal(DefaultValueIntKeyClassWithoutExplicitConstructor.Prop2Constant, instance.Prop2); + } + + [Fact] + public void DefaultValueIntKeyClassWithExplicitConstructorTest() + { + var seq = new Sequence(); + var writer = new MessagePackWriter(seq); + writer.WriteArrayHeader(1); + writer.Write(-1); + writer.Flush(); + + var instance = MessagePackSerializer.Deserialize(seq, options); + Assert.Equal(-1, instance.Prop1); + Assert.Equal(DefaultValueIntKeyClassWithExplicitConstructor.Prop2Constant, instance.Prop2); + } + + [Fact] + public void DefaultValueIntKeyStructWithExplicitConstructorTest() + { + var seq = new Sequence(); + var writer = new MessagePackWriter(seq); + writer.WriteArrayHeader(1); + writer.Write(-1); + writer.Flush(); + + var instance = MessagePackSerializer.Deserialize(seq, options); + Assert.Equal(-1, instance.Prop1); + Assert.Equal(DefaultValueIntKeyStructWithExplicitConstructor.Prop2Constant, instance.Prop2); + } + } +} From 9b6882b1d8f9fe7ba3bf716efa1e9355ac9a510d Mon Sep 17 00:00:00 2001 From: pCYSl5EDgo Date: Tue, 27 Oct 2020 20:28:15 +0900 Subject: [PATCH 006/161] Partial solution of #1085: Dynamic #1091 commit 5fbf110752916d412a77f2b007ff42491b49e238 Author: pCYSl5EDgo Date: Mon Oct 26 18:12:45 2020 +0900 make BuildDeserialize easy to understand commit 292badc2393e372f805c7f6db68d4a33fedbcba5 Author: pCYSl5EDgo Date: Mon Oct 26 13:47:48 2020 +0900 Update: Rename LocalField -> LocalVariable commit 007e338b78ec2850a3b0a2a0faa7a2f0d3f4f1ea Author: pCYSl5EDgo Date: Mon Oct 26 13:12:38 2020 +0900 Add test code for setter call after explicit constructor commit 5181801930893d654bdc123f4494bf662ab07c66 Merge: 5948fc0 5a6cda6 Author: pCYSl5EDgo Date: Mon Oct 26 12:59:36 2020 +0900 Merge branch 'develop' of https://github.com/neuecc/MessagePack-CSharp into solution#1085-Dynamic commit 5948fc027e342a6efadafc6b5489907c7eb93385 Author: pCYSl5EDgo Date: Sun Oct 25 21:18:12 2020 +0900 Add tests commit 96aaa6ac07de53191f8cb56441e01e515a56621e Author: pCYSl5EDgo Date: Sun Oct 25 20:25:44 2020 +0900 Update: DynamicObjectResolver --- .../Resolvers/DynamicObjectResolver.cs | 816 ++++++++++++------ .../ContractlessStandardResolverTest.cs | 22 + .../ShareTests/DynamicObjectResolverTests.cs | 244 +++++- 3 files changed, 830 insertions(+), 252 deletions(-) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs index 16195088f..37e71ecaa 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs @@ -796,7 +796,7 @@ private static void EmitSerializeValue(ILGenerator il, TypeInfo type, ObjectSeri argOptions.EmitLoad(); il.EmitCall(getSerialize(t)); } - else if (IsOptimizeTargetType(t)) + else if (ObjectSerializationInfo.IsOptimizeTargetType(t)) { if (!t.GetTypeInfo().IsValueType) { @@ -851,263 +851,547 @@ private static void EmitSerializeValue(ILGenerator il, TypeInfo type, ObjectSeri // T Deserialize([arg:1]ref MessagePackReader reader, [arg:2]MessagePackSerializerOptions options); private static void BuildDeserialize(Type type, ObjectSerializationInfo info, ILGenerator il, Func tryEmitLoadCustomFormatter, int firstArgIndex) { - var reader = new ArgumentField(il, firstArgIndex, @ref: true); + var argReader = new ArgumentField(il, firstArgIndex, @ref: true); var argOptions = new ArgumentField(il, firstArgIndex + 1); - // if(reader.TryReadNil()) { return null; } - Label falseLabel = il.DefineLabel(); - reader.EmitLdarg(); - il.EmitCall(MessagePackReaderTypeInfo.TryReadNil); - il.Emit(OpCodes.Brfalse_S, falseLabel); - if (type.GetTypeInfo().IsClass) + // if (reader.TryReadNil()) { throw / return; } + BuildDeserializeInternalTryReadNil(type, il, ref argReader); + + // T ____result; + var localResult = il.DeclareLocal(type); + + // where T : new() + var canOverwrite = info.ConstructorParameters.Length == 0; + if (canOverwrite) { - il.Emit(OpCodes.Ldnull); - il.Emit(OpCodes.Ret); + // ____result = new T(); + BuildDeserializeInternalCreateInstance(type, info, il, localResult); + } + + // options.Security.DepthStep(ref reader); + BuildDeserializeInternalDepthStep(il, ref argReader, ref argOptions); + + // var length = reader.Read(Map|Array)Header(); + var localLength = BuildDeserializeInternalReadHeaderLength(info, il, ref argReader); + + // var resolver = options.Resolver; + var localResolver = BuildDeserializeInternalResolver(info, il, ref argOptions); + + if (info.IsIntKey) + { + // switch (key) { ... } + BuildDeserializeInternalDeserializeEachPropertyIntKey(info, il, tryEmitLoadCustomFormatter, canOverwrite, ref argReader, ref argOptions, localResolver, localResult, localLength); } else { - il.Emit(OpCodes.Ldstr, "typecode is null, struct not supported"); - il.Emit(OpCodes.Newobj, messagePackSerializationExceptionMessageOnlyConstructor); - il.Emit(OpCodes.Throw); + // var span = reader.ReadStringSpan(); + BuildDeserializeInternalDeserializeEachPropertyStringKey(info, il, tryEmitLoadCustomFormatter, canOverwrite, ref argReader, argOptions, localResolver, localResult, localLength); } - il.MarkLabel(falseLabel); + // ____result.OnAfterDeserialize() + BuildDeserializeInternalOnAfterDeserialize(type, info, il, localResult); - // options.Security.DepthStep(ref reader); - argOptions.EmitLoad(); - il.EmitCall(getSecurityFromOptions); - reader.EmitLdarg(); - il.EmitCall(securityDepthStep); + // reader.Depth--; + BuildDeserializeInternalDepthUnStep(il, ref argReader); - // var length = ReadMapHeader(ref byteSequence); - LocalBuilder length = il.DeclareLocal(typeof(int)); // [loc:1] - reader.EmitLdarg(); + // return ____result; + il.Emit(OpCodes.Ldloc, localResult); + il.Emit(OpCodes.Ret); + } - if (info.IsIntKey) + private static void BuildDeserializeInternalDeserializeEachPropertyStringKey(ObjectSerializationInfo info, ILGenerator il, Func tryEmitLoadCustomFormatter, bool canOverwrite, ref ArgumentField argReader, ArgumentField argOptions, LocalBuilder localResolver, LocalBuilder localResult, LocalBuilder localLength) + { + // Prepare local variables or assignment fields/properties + var infoList = BuildDeserializeInternalDeserializationInfoArrayStringKey(info, il, canOverwrite); + + // Read Loop(for var i = 0; i < length; i++) + BuildDeserializeInternalDeserializeLoopStringKey(il, tryEmitLoadCustomFormatter, ref argReader, ref argOptions, infoList, localResolver, localResult, localLength, canOverwrite, info); + + if (canOverwrite) { - il.EmitCall(MessagePackReaderTypeInfo.ReadArrayHeader); + return; } - else + + // ____result = new T(...); + BuildDeserializeInternalCreateInstanceWithArguments(info, il, infoList, localResult); + + // ... if (__field__IsInitialized) { ____result.field = __field__; } ... + BuildDeserializeInternalAssignFieldFromLocalVariableStringKey(info, il, infoList, localResult); + } + + private static void BuildDeserializeInternalDeserializeEachPropertyIntKey(ObjectSerializationInfo info, ILGenerator il, Func tryEmitLoadCustomFormatter, bool canOverwrite, ref ArgumentField argReader, ref ArgumentField argOptions, LocalBuilder localResolver, LocalBuilder localResult, LocalBuilder localLength) + { + // Prepare local variables or assignment fields/properties + var infoList = BuildDeserializeInternalDeserializationInfoArrayIntKey(info, il, canOverwrite, out var gotoDefault, out var maxKey); + + // Read Loop(for var i = 0; i < length; i++) + BuildDeserializeInternalDeserializeLoopIntKey(il, tryEmitLoadCustomFormatter, ref argReader, ref argOptions, infoList, localResolver, localResult, localLength, canOverwrite, gotoDefault); + + if (canOverwrite) { - il.EmitCall(MessagePackReaderTypeInfo.ReadMapHeader); + return; } - il.EmitStloc(length); + // ____result = new T(...); + BuildDeserializeInternalCreateInstanceWithArguments(info, il, infoList, localResult); - // make local fields - Label? gotoDefault = null; - DeserializeInfo[] infoList; - if (info.IsIntKey) + // ... ____result.field = __field__; ... + BuildDeserializeInternalAssignFieldFromLocalVariableIntKey(info, il, infoList, localResult, localLength, maxKey); + } + + private static void BuildDeserializeInternalAssignFieldFromLocalVariableStringKey(ObjectSerializationInfo info, ILGenerator il, DeserializeInfo[] infoList, LocalBuilder localResult) + { + foreach (var item in infoList) { - var maxKey = info.Members.Select(x => x.IntKey).DefaultIfEmpty(-1).Max(); - var len = maxKey + 1; - var intKeyMap = info.Members.ToDictionary(x => x.IntKey); + if (item.MemberInfo == null || item.IsInitializedLocalVariable == null) + { + continue; + } - infoList = Enumerable.Range(0, len) - .Select(x => - { - ObjectSerializationInfo.EmittableMember member; - if (intKeyMap.TryGetValue(x, out member)) - { - return new DeserializeInfo - { - MemberInfo = member, - LocalField = il.DeclareLocal(member.Type), - SwitchLabel = il.DefineLabel(), - }; - } - else - { - // return null MemberInfo, should filter null - if (gotoDefault == null) - { - gotoDefault = il.DefineLabel(); - } + // if (__field__IsInitialized) { ____result.field = __field__; } + var skipLabel = il.DefineLabel(); + il.EmitLdloc(item.IsInitializedLocalVariable); + il.Emit(OpCodes.Brfalse_S, skipLabel); - return new DeserializeInfo - { - MemberInfo = null, - LocalField = null, - SwitchLabel = gotoDefault.Value, - }; - } - }) - .ToArray(); + if (info.IsClass) + { + il.EmitLdloc(localResult); + } + else + { + il.EmitLdloca(localResult); + } + + il.EmitLdloc(item.LocalVariable); + item.MemberInfo.EmitStoreValue(il); + + il.MarkLabel(skipLabel); } - else + } + + private static void BuildDeserializeInternalAssignFieldFromLocalVariableIntKey(ObjectSerializationInfo info, ILGenerator il, DeserializeInfo[] infoList, LocalBuilder localResult, LocalBuilder localLength, int maxKey) + { + if (maxKey == -1) { - infoList = info.Members - .Select(item => new DeserializeInfo - { - MemberInfo = item, - LocalField = il.DeclareLocal(item.Type), - //// SwitchLabel = il.DefineLabel() - }) - .ToArray(); + return; } - // IFormatterResolver resolver = options.Resolver; - LocalBuilder localResolver = il.DeclareLocal(typeof(IFormatterResolver)); - argOptions.EmitLoad(); - il.EmitCall(getResolverFromOptions); - il.EmitStloc(localResolver); + Label? memberAssignmentDoneLabel = null; + var intKeyMap = infoList.Where(x => x.MemberInfo != null && x.MemberInfo.IsWritable).ToDictionary(x => x.MemberInfo.IntKey); + for (var key = 0; key <= maxKey; key++) + { + if (!intKeyMap.TryGetValue(key, out var item)) + { + continue; + } - // Read Loop(for var i = 0; i < length; i++) - if (info.IsStringKey) + // if (length <= key) { goto MEMBER_ASSIGNMENT_DONE; } + il.EmitLdloc(localLength); + il.EmitLdc_I4(key); + if (memberAssignmentDoneLabel == null) + { + memberAssignmentDoneLabel = il.DefineLabel(); + } + + il.Emit(OpCodes.Ble, memberAssignmentDoneLabel.Value); + + // ____result.field = __field__; + if (info.IsClass) + { + il.EmitLdloc(localResult); + } + else + { + il.EmitLdloca(localResult); + } + + il.EmitLdloc(item.LocalVariable); + item.MemberInfo.EmitStoreValue(il); + } + + // MEMBER_ASSIGNMENT_DONE: + if (memberAssignmentDoneLabel != null) + { + il.MarkLabel(memberAssignmentDoneLabel.Value); + } + } + + private static void BuildDeserializeInternalCreateInstanceWithArguments(ObjectSerializationInfo info, ILGenerator il, DeserializeInfo[] infoList, LocalBuilder localResult) + { + foreach (var item in info.ConstructorParameters) { - var automata = new AutomataDictionary(); - for (int i = 0; i < info.Members.Length; i++) + var local = infoList.First(x => x.MemberInfo == item.MemberInfo); + il.EmitLdloc(local.LocalVariable); + + if (!item.ConstructorParameter.ParameterType.IsValueType && local.MemberInfo.IsValueType) { - automata.Add(info.Members[i].StringKey, i); + // When a constructor argument of type object is being provided by a serialized member value that is a value type + // then that value must be boxed in order for the generated code to be valid (see issue #987). This may occur because + // the only requirement when determining whether a member value may be used to populate a constructor argument in an + // IsAssignableFrom check and typeof(object) IsAssignableFrom typeof(int), for example. + il.Emit(OpCodes.Box, local.MemberInfo.Type); } + } - LocalBuilder buffer = il.DeclareLocal(typeof(ReadOnlySpan)); - LocalBuilder longKey = il.DeclareLocal(typeof(ulong)); + il.Emit(OpCodes.Newobj, info.BestmatchConstructor); + il.Emit(OpCodes.Stloc, localResult); + } - // for (int i = 0; i < len; i++) - il.EmitIncrementFor(length, forILocal => + private static DeserializeInfo[] BuildDeserializeInternalDeserializationInfoArrayStringKey(ObjectSerializationInfo info, ILGenerator il, bool canOverwrite) + { + var infoList = new DeserializeInfo[info.Members.Length]; + for (var i = 0; i < infoList.Length; i++) + { + var item = info.Members[i]; + if (canOverwrite && item.IsWritable) { - Label readNext = il.DefineLabel(); - Label loopEnd = il.DefineLabel(); + infoList[i] = new DeserializeInfo + { + MemberInfo = item, + }; + } + else + { + var isConstructorParameter = info.ConstructorParameters.Any(p => p.MemberInfo.Equals(item)); + infoList[i] = new DeserializeInfo + { + MemberInfo = item, + LocalVariable = il.DeclareLocal(item.Type), + IsInitializedLocalVariable = isConstructorParameter ? default : il.DeclareLocal(typeof(bool)), + }; + } + } + + return infoList; + } - reader.EmitLdarg(); - il.EmitCall(ReadStringSpan); - il.EmitStloc(buffer); + private static DeserializeInfo[] BuildDeserializeInternalDeserializationInfoArrayIntKey(ObjectSerializationInfo info, ILGenerator il, bool canOverwrite, out Label? gotoDefault, out int maxKey) + { + maxKey = info.Members.Select(x => x.IntKey).DefaultIfEmpty(-1).Max(); + var len = maxKey + 1; + var intKeyMap = info.Members.ToDictionary(x => x.IntKey); + gotoDefault = null; - // gen automata name lookup - automata.EmitMatch( - il, - buffer, - longKey, - x => + var infoList = new DeserializeInfo[len]; + for (var i = 0; i < infoList.Length; i++) + { + if (intKeyMap.TryGetValue(i, out var member)) + { + if (canOverwrite && member.IsWritable) + { + infoList[i] = new DeserializeInfo { - var i = x.Value; - if (infoList[i].MemberInfo != null) - { - EmitDeserializeValue(il, infoList[i], i, tryEmitLoadCustomFormatter, reader, argOptions, localResolver); - il.Emit(OpCodes.Br, loopEnd); - } - else - { - il.Emit(OpCodes.Br, readNext); - } - }, - () => + MemberInfo = member, + SwitchLabel = il.DefineLabel(), + }; + } + else + { + infoList[i] = new DeserializeInfo { - il.Emit(OpCodes.Br, readNext); - }); - - il.MarkLabel(readNext); - reader.EmitLdarg(); - il.EmitCall(MessagePackReaderTypeInfo.Skip); + MemberInfo = member, + LocalVariable = il.DeclareLocal(member.Type), + SwitchLabel = il.DefineLabel(), + }; + } + } + else + { + // return null MemberInfo, should filter null + if (gotoDefault == null) + { + gotoDefault = il.DefineLabel(); + } - il.MarkLabel(loopEnd); - }); + infoList[i] = new DeserializeInfo + { + SwitchLabel = gotoDefault.Value, + }; + } } - else + + return infoList; + } + + private static void BuildDeserializeInternalDeserializeLoopIntKey(ILGenerator il, Func tryEmitLoadCustomFormatter, ref ArgumentField argReader, ref ArgumentField argOptions, DeserializeInfo[] infoList, LocalBuilder localResolver, LocalBuilder localResult, LocalBuilder localLength, bool canOverwrite, Label? gotoDefault) + { + var key = il.DeclareLocal(typeof(int)); + var switchDefault = il.DefineLabel(); + var reader = argReader; + var options = argOptions; + + void ForBody(LocalBuilder forILocal) { - LocalBuilder key = il.DeclareLocal(typeof(int)); - Label switchDefault = il.DefineLabel(); + var loopEnd = il.DefineLabel(); - il.EmitIncrementFor(length, forILocal => - { - Label loopEnd = il.DefineLabel(); + il.EmitLdloc(forILocal); + il.EmitStloc(key); - il.EmitLdloc(forILocal); - il.EmitStloc(key); + // switch... local = Deserialize + il.EmitLdloc(key); - // switch... local = Deserialize - il.EmitLdloc(key); + il.Emit(OpCodes.Switch, infoList.Select(x => x.SwitchLabel).ToArray()); - il.Emit(OpCodes.Switch, infoList.Select(x => x.SwitchLabel).ToArray()); + il.MarkLabel(switchDefault); - il.MarkLabel(switchDefault); + // default, only read. reader.ReadNextBlock(); + reader.EmitLdarg(); + il.EmitCall(MessagePackReaderTypeInfo.Skip); + il.Emit(OpCodes.Br, loopEnd); - // default, only read. reader.ReadNextBlock(); - reader.EmitLdarg(); - il.EmitCall(MessagePackReaderTypeInfo.Skip); - il.Emit(OpCodes.Br, loopEnd); + if (gotoDefault != null) + { + il.MarkLabel(gotoDefault.Value); + il.Emit(OpCodes.Br, switchDefault); + } - if (gotoDefault != null) + var i = 0; + foreach (var item in infoList) + { + if (item.MemberInfo == null) { - il.MarkLabel(gotoDefault.Value); - il.Emit(OpCodes.Br, switchDefault); + continue; } - var i = 0; - foreach (DeserializeInfo item in infoList) + il.MarkLabel(item.SwitchLabel); + if (canOverwrite) { - if (item.MemberInfo != null) - { - il.MarkLabel(item.SwitchLabel); - EmitDeserializeValue(il, item, i++, tryEmitLoadCustomFormatter, reader, argOptions, localResolver); - il.Emit(OpCodes.Br, loopEnd); - } + BuildDeserializeInternalDeserializeValueAssignDirectly(il, item, i++, tryEmitLoadCustomFormatter, ref reader, ref options, localResolver, localResult); + } + else + { + BuildDeserializeInternalDeserializeValueAssignLocalVariable(il, item, i++, tryEmitLoadCustomFormatter, ref reader, ref options, localResolver, localResult); } - il.MarkLabel(loopEnd); - }); + il.Emit(OpCodes.Br, loopEnd); + } + + il.MarkLabel(loopEnd); } - // create result object - LocalBuilder structLocal = EmitNewObject(il, type, info, infoList); + il.EmitIncrementFor(localLength, ForBody); + } - // IMessagePackSerializationCallbackReceiver.OnAfterDeserialize() - if (type.GetTypeInfo().ImplementedInterfaces.Any(x => x == typeof(IMessagePackSerializationCallbackReceiver))) + private static void BuildDeserializeInternalDeserializeLoopStringKey(ILGenerator il, Func tryEmitLoadCustomFormatter, ref ArgumentField argReader, ref ArgumentField argOptions, DeserializeInfo[] infoList, LocalBuilder localResolver, LocalBuilder localResult, LocalBuilder localLength, bool canOverwrite, ObjectSerializationInfo info) + { + var automata = new AutomataDictionary(); + for (var i = 0; i < info.Members.Length; i++) { - // call directly - MethodInfo[] runtimeMethods = type.GetRuntimeMethods().Where(x => x.Name == "OnAfterDeserialize").ToArray(); - if (runtimeMethods.Length == 1) + automata.Add(info.Members[i].StringKey, i); + } + + var buffer = il.DeclareLocal(typeof(ReadOnlySpan)); + var longKey = il.DeclareLocal(typeof(ulong)); + var reader = argReader; + var options = argOptions; + + // for (int i = 0; i < len; i++) + void ForBody(LocalBuilder forILocal) + { + var readNext = il.DefineLabel(); + var loopEnd = il.DefineLabel(); + + reader.EmitLdarg(); + il.EmitCall(ReadStringSpan); + il.EmitStloc(buffer); + + // gen automata name lookup + void OnFoundAssignDirect(KeyValuePair x) { - if (info.IsClass) + var i = x.Value; + var item = infoList[i]; + if (item.MemberInfo != null) { - il.Emit(OpCodes.Dup); + BuildDeserializeInternalDeserializeValueAssignDirectly(il, item, i, tryEmitLoadCustomFormatter, ref reader, ref options, localResolver, localResult); + il.Emit(OpCodes.Br, loopEnd); } else { - il.EmitLdloca(structLocal); + il.Emit(OpCodes.Br, readNext); } - - il.Emit(OpCodes.Call, runtimeMethods[0]); // don't use EmitCall helper(must use 'Call') } - else + + void OnFoundAssignLocalVariable(KeyValuePair x) { - if (info.IsStruct) + var i = x.Value; + var item = infoList[i]; + if (item.MemberInfo != null) { - il.EmitLdloc(structLocal); - il.Emit(OpCodes.Box, type); + BuildDeserializeInternalDeserializeValueAssignLocalVariable(il, item, i, tryEmitLoadCustomFormatter, ref reader, ref options, localResolver, localResult); + il.Emit(OpCodes.Br, loopEnd); } else { - il.Emit(OpCodes.Dup); + il.Emit(OpCodes.Br, readNext); } + } + + void OnNotFound() + { + il.Emit(OpCodes.Br, readNext); + } - il.EmitCall(onAfterDeserialize); + if (canOverwrite) + { + automata.EmitMatch(il, buffer, longKey, OnFoundAssignDirect, OnNotFound); + } + else + { + automata.EmitMatch(il, buffer, longKey, OnFoundAssignLocalVariable, OnNotFound); } + + il.MarkLabel(readNext); + reader.EmitLdarg(); + il.EmitCall(MessagePackReaderTypeInfo.Skip); + + il.MarkLabel(loopEnd); } - // reader.Depth--; - reader.EmitLdarg(); + il.EmitIncrementFor(localLength, ForBody); + } + + private static void BuildDeserializeInternalTryReadNil(Type type, ILGenerator il, ref ArgumentField argReader) + { + // if(reader.TryReadNil()) { return null; } + var falseLabel = il.DefineLabel(); + argReader.EmitLdarg(); + il.EmitCall(MessagePackReaderTypeInfo.TryReadNil); + il.Emit(OpCodes.Brfalse_S, falseLabel); + if (type.GetTypeInfo().IsClass) + { + il.Emit(OpCodes.Ldnull); + il.Emit(OpCodes.Ret); + } + else + { + il.Emit(OpCodes.Ldstr, "typecode is null, struct not supported"); + il.Emit(OpCodes.Newobj, messagePackSerializationExceptionMessageOnlyConstructor); + il.Emit(OpCodes.Throw); + } + + il.MarkLabel(falseLabel); + } + + private static void BuildDeserializeInternalDepthUnStep(ILGenerator il, ref ArgumentField argReader) + { + argReader.EmitLdarg(); il.Emit(OpCodes.Dup); il.EmitCall(readerDepthGet); il.Emit(OpCodes.Ldc_I4_1); il.Emit(OpCodes.Sub_Ovf); il.EmitCall(readerDepthSet); + } - if (info.IsStruct) + private static void BuildDeserializeInternalOnAfterDeserialize(Type type, ObjectSerializationInfo info, ILGenerator il, LocalBuilder localResult) + { + if (type.GetTypeInfo().ImplementedInterfaces.All(x => x != typeof(IMessagePackSerializationCallbackReceiver))) { - il.Emit(OpCodes.Ldloc, structLocal); + return; } - il.Emit(OpCodes.Ret); + if (info.IsClass) + { + il.EmitLdloc(localResult); + } + + // call directly + var runtimeMethod = type.GetRuntimeMethods().SingleOrDefault(x => x.Name == "OnAfterDeserialize"); + if (runtimeMethod != null) + { + if (info.IsStruct) + { + il.EmitLdloca(localResult); + } + + il.Emit(OpCodes.Call, runtimeMethod); // don't use EmitCall helper(must use 'Call') + } + else + { + if (info.IsStruct) + { + il.EmitLdloc(localResult); + il.Emit(OpCodes.Box, type); + } + + il.EmitCall(onAfterDeserialize); + } } - private static void EmitDeserializeValue(ILGenerator il, DeserializeInfo info, int index, Func tryEmitLoadCustomFormatter, ArgumentField argReader, ArgumentField argOptions, LocalBuilder localResolver) + private static LocalBuilder BuildDeserializeInternalResolver(ObjectSerializationInfo info, ILGenerator il, ref ArgumentField argOptions) { - Label storeLabel = il.DefineLabel(); - ObjectSerializationInfo.EmittableMember member = info.MemberInfo; - Type t = member.Type; - Action emitter = tryEmitLoadCustomFormatter(index, member); + if (!info.ShouldUseFormatterResolver) + { + return default; + } + + // IFormatterResolver resolver = options.Resolver; + var localResolver = il.DeclareLocal(typeof(IFormatterResolver)); + argOptions.EmitLoad(); + il.EmitCall(getResolverFromOptions); + il.EmitStloc(localResolver); + return localResolver; + } + + private static LocalBuilder BuildDeserializeInternalReadHeaderLength(ObjectSerializationInfo info, ILGenerator il, ref ArgumentField argReader) + { + // var length = ReadMapHeader(ref byteSequence); + var length = il.DeclareLocal(typeof(int)); // [loc:1] + argReader.EmitLdarg(); + + il.EmitCall(info.IsIntKey ? MessagePackReaderTypeInfo.ReadArrayHeader : MessagePackReaderTypeInfo.ReadMapHeader); + + il.EmitStloc(length); + return length; + } + + private static void BuildDeserializeInternalDepthStep(ILGenerator il, ref ArgumentField argReader, ref ArgumentField argOptions) + { + argOptions.EmitLoad(); + il.EmitCall(getSecurityFromOptions); + argReader.EmitLdarg(); + il.EmitCall(securityDepthStep); + } + + // where T : new(); + private static void BuildDeserializeInternalCreateInstance(Type type, ObjectSerializationInfo info, ILGenerator il, LocalBuilder localResult) + { + // var result = new T(); + if (info.IsClass) + { + il.Emit(OpCodes.Newobj, info.BestmatchConstructor); + il.EmitStloc(localResult); + } + else + { + il.Emit(OpCodes.Ldloca, localResult); + il.Emit(OpCodes.Initobj, type); + } + } + + private static void BuildDeserializeInternalDeserializeValueAssignDirectly(ILGenerator il, DeserializeInfo info, int index, Func tryEmitLoadCustomFormatter, ref ArgumentField argReader, ref ArgumentField argOptions, LocalBuilder localResolver, LocalBuilder localResult) + { + var storeLabel = il.DefineLabel(); + var member = info.MemberInfo; + var t = member.Type; + var emitter = tryEmitLoadCustomFormatter(index, member); + + if (member.IsWritable) + { + if (localResult.LocalType.IsClass) + { + il.EmitLdloc(localResult); + } + else + { + il.EmitLdloca(localResult); + } + } + else if (info.IsInitializedLocalVariable != null) + { + il.EmitLdc_I4(1); + il.EmitStloc(info.IsInitializedLocalVariable); + } + if (emitter != null) { emitter(); @@ -1115,13 +1399,13 @@ private static void EmitDeserializeValue(ILGenerator il, DeserializeInfo info, i argOptions.EmitLoad(); il.EmitCall(getDeserialize(t)); } - else if (IsOptimizeTargetType(t)) + else if (ObjectSerializationInfo.IsOptimizeTargetType(t)) { if (!t.GetTypeInfo().IsValueType) { // As a nullable type (e.g. byte[] and string) we need to first call TryReadNil // if (reader.TryReadNil()) - Label readNonNilValueLabel = il.DefineLabel(); + var readNonNilValueLabel = il.DefineLabel(); argReader.EmitLdarg(); il.EmitCall(MessagePackReaderTypeInfo.TryReadNil); il.Emit(OpCodes.Brfalse_S, readNonNilValueLabel); @@ -1134,7 +1418,7 @@ private static void EmitDeserializeValue(ILGenerator il, DeserializeInfo info, i argReader.EmitLdarg(); if (t == typeof(byte[])) { - LocalBuilder local = il.DeclareLocal(typeof(ReadOnlySequence?)); + var local = il.DeclareLocal(typeof(ReadOnlySequence?)); il.EmitCall(MessagePackReaderTypeInfo.ReadBytes); il.EmitStloc(local); il.EmitLdloca(local); @@ -1155,94 +1439,77 @@ private static void EmitDeserializeValue(ILGenerator il, DeserializeInfo info, i } il.MarkLabel(storeLabel); - il.EmitStloc(info.LocalField); + if (member.IsWritable) + { + member.EmitStoreValue(il); + } + else + { + il.Emit(OpCodes.Pop); + } } - private static LocalBuilder EmitNewObject(ILGenerator il, Type type, ObjectSerializationInfo info, DeserializeInfo[] members) + private static void BuildDeserializeInternalDeserializeValueAssignLocalVariable(ILGenerator il, DeserializeInfo info, int index, Func tryEmitLoadCustomFormatter, ref ArgumentField argReader, ref ArgumentField argOptions, LocalBuilder localResolver, LocalBuilder localResult) { - if (info.IsClass) - { - EmitNewObjectConstructorArguments(il, info, members); - - il.Emit(OpCodes.Newobj, info.BestmatchConstructor); + var storeLabel = il.DefineLabel(); + var member = info.MemberInfo; + var t = member.Type; + var emitter = tryEmitLoadCustomFormatter(index, member); - foreach (DeserializeInfo item in members.Where(x => x.MemberInfo != null && x.MemberInfo.IsWritable)) - { - il.Emit(OpCodes.Dup); - il.EmitLdloc(item.LocalField); - item.MemberInfo.EmitStoreValue(il); - } + if (info.IsInitializedLocalVariable != null) + { + il.EmitLdc_I4(1); + il.EmitStloc(info.IsInitializedLocalVariable); + } - return null; + if (emitter != null) + { + emitter(); + argReader.EmitLdarg(); + argOptions.EmitLoad(); + il.EmitCall(getDeserialize(t)); } - else + else if (ObjectSerializationInfo.IsOptimizeTargetType(t)) { - LocalBuilder result = il.DeclareLocal(type); - if (info.BestmatchConstructor == null) - { - il.Emit(OpCodes.Ldloca, result); - il.Emit(OpCodes.Initobj, type); - } - else + if (!t.GetTypeInfo().IsValueType) { - EmitNewObjectConstructorArguments(il, info, members); + // As a nullable type (e.g. byte[] and string) we need to first call TryReadNil + // if (reader.TryReadNil()) + var readNonNilValueLabel = il.DefineLabel(); + argReader.EmitLdarg(); + il.EmitCall(MessagePackReaderTypeInfo.TryReadNil); + il.Emit(OpCodes.Brfalse_S, readNonNilValueLabel); + il.Emit(OpCodes.Ldnull); + il.Emit(OpCodes.Br, storeLabel); - il.Emit(OpCodes.Newobj, info.BestmatchConstructor); - il.Emit(OpCodes.Stloc, result); + il.MarkLabel(readNonNilValueLabel); } - foreach (DeserializeInfo item in members.Where(x => x.MemberInfo != null && x.MemberInfo.IsWritable)) + argReader.EmitLdarg(); + if (t == typeof(byte[])) { - il.EmitLdloca(result); - il.EmitLdloc(item.LocalField); - item.MemberInfo.EmitStoreValue(il); + var local = il.DeclareLocal(typeof(ReadOnlySequence?)); + il.EmitCall(MessagePackReaderTypeInfo.ReadBytes); + il.EmitStloc(local); + il.EmitLdloca(local); + il.EmitCall(ArrayFromNullableReadOnlySequence); } - - return result; // struct returns local result field - } - } - - private static void EmitNewObjectConstructorArguments(ILGenerator il, ObjectSerializationInfo info, DeserializeInfo[] members) - { - foreach (ObjectSerializationInfo.EmittableMemberAndConstructorParameter item in info.ConstructorParameters) - { - DeserializeInfo local = members.First(x => x.MemberInfo == item.MemberInfo); - il.EmitLdloc(local.LocalField); - - if (!item.ConstructorParameter.ParameterType.IsValueType && local.MemberInfo.IsValueType) + else { - // When a constructor argument of type object is being provided by a serialized member value that is a value type - // then that value must be boxed in order for the generated code to be valid (see issue #987). This may occur because - // the only requirement when determining whether a member value may be used to populate a constructor argument in an - // IsAssignableFrom check and typeof(object) IsAssignableFrom typeof(int), for example. - il.Emit(OpCodes.Box, local.MemberInfo.Type); + il.EmitCall(MessagePackReaderTypeInfo.TypeInfo.GetDeclaredMethods("Read" + t.Name).First(x => x.GetParameters().Length == 0)); } } - } + else + { + il.EmitLdloc(localResolver); + il.EmitCall(getFormatterWithVerify.MakeGenericMethod(t)); + argReader.EmitLdarg(); + argOptions.EmitLoad(); + il.EmitCall(getDeserialize(t)); + } - /// - /// Keep this list in sync with ShouldUseFormatterResolverHelper.PrimitiveTypes. - /// - private static bool IsOptimizeTargetType(Type type) - { - return type == typeof(Int16) - || type == typeof(Int32) - || type == typeof(Int64) - || type == typeof(UInt16) - || type == typeof(UInt32) - || type == typeof(UInt64) - || type == typeof(Single) - || type == typeof(Double) - || type == typeof(bool) - || type == typeof(byte) - || type == typeof(sbyte) - || type == typeof(char) - || type == typeof(byte[]) - - // Do not include types that resolvers are allowed to modify. - ////|| type == typeof(DateTime) // OldSpec has no support, so for that and perf reasons a .NET native DateTime resolver exists. - ////|| type == typeof(string) // https://github.com/Cysharp/MasterMemory provides custom formatter for string interning. - ; + il.MarkLabel(storeLabel); + il.EmitStloc(info.LocalVariable); } #pragma warning disable SA1311 // Static readonly fields should begin with upper-case letter @@ -1336,7 +1603,9 @@ private class DeserializeInfo { public ObjectSerializationInfo.EmittableMember MemberInfo { get; set; } - public LocalBuilder LocalField { get; set; } + public LocalBuilder LocalVariable { get; set; } + + public LocalBuilder IsInitializedLocalVariable { get; set; } public Label SwitchLabel { get; set; } } @@ -1402,6 +1671,8 @@ public bool IsStruct get { return !this.IsClass; } } + public bool ShouldUseFormatterResolver { get; private set; } + public ConstructorInfo BestmatchConstructor { get; set; } public EmittableMemberAndConstructorParameter[] ConstructorParameters { get; set; } @@ -1929,17 +2200,62 @@ public static ObjectSerializationInfo CreateOrNull(Type type, bool forceStringKe .ToArray(); } + var shouldUseFormatterResolver = false; + var membersArray = members.Where(m => m.IsExplicitContract || constructorParameters.Any(p => p.MemberInfo.Equals(m)) || m.IsWritable).ToArray(); + foreach (var member in membersArray) + { + if (IsOptimizeTargetType(member.Type)) + { + continue; + } + + var attr = member.GetMessagePackFormatterAttribute(); + if (!(attr is null)) + { + continue; + } + + shouldUseFormatterResolver = true; + break; + } + return new ObjectSerializationInfo { Type = type, IsClass = isClass, + ShouldUseFormatterResolver = shouldUseFormatterResolver, BestmatchConstructor = ctor, ConstructorParameters = constructorParameters.ToArray(), IsIntKey = isIntKey, - Members = members.Where(m => m.IsExplicitContract || constructorParameters.Any(p => p.MemberInfo.Equals(m)) || m.IsWritable).ToArray(), + Members = membersArray, }; } + /// + /// Keep this list in sync with ShouldUseFormatterResolverHelper.PrimitiveTypes. + /// + internal static bool IsOptimizeTargetType(Type type) + { + return type == typeof(Int16) + || type == typeof(Int32) + || type == typeof(Int64) + || type == typeof(UInt16) + || type == typeof(UInt32) + || type == typeof(UInt64) + || type == typeof(Single) + || type == typeof(Double) + || type == typeof(bool) + || type == typeof(byte) + || type == typeof(sbyte) + || type == typeof(char) + || type == typeof(byte[]) + + // Do not include types that resolvers are allowed to modify. + ////|| type == typeof(DateTime) // OldSpec has no support, so for that and perf reasons a .NET native DateTime resolver exists. + ////|| type == typeof(string) // https://github.com/Cysharp/MasterMemory provides custom formatter for string interning. + ; + } + private static IEnumerable GetAllFields(Type type) { if (type.BaseType is object) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/ContractlessStandardResolverTest.cs b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/ContractlessStandardResolverTest.cs index 5fd8c31de..04d5b35ae 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/ContractlessStandardResolverTest.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/ContractlessStandardResolverTest.cs @@ -33,6 +33,16 @@ public class Person public object[] /*Address*/ Addresses { get; set; } } + public class DefaultValueStringKeyClassWithoutExplicitConstructor + { + public const int Prop1Constant = 11; + public const int Prop2Constant = 45; + + public int Prop1 { get; set; } = Prop1Constant; + + public int Prop2 { get; set; } = Prop2Constant; + } + public class V1 { public int ABCDEFG1 { get; set; } @@ -175,6 +185,18 @@ public void SimpleTest() ((string)d2["Street"]).Is("Ave."); } + [Fact] + public void DefaultValueStringKeyClassWithoutExplicitConstructorTest() + { + var dictionary = new Dictionary(); + + var result = MessagePackSerializer.Serialize(dictionary, Resolvers.ContractlessStandardResolver.Options); + + var instance = MessagePackSerializer.Deserialize(result, Resolvers.ContractlessStandardResolver.Options); + instance.Prop1.Is(DefaultValueStringKeyClassWithoutExplicitConstructor.Prop1Constant); + instance.Prop2.Is(DefaultValueStringKeyClassWithoutExplicitConstructor.Prop2Constant); + } + [Fact] public void Versioning() { diff --git a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/DynamicObjectResolverTests.cs b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/DynamicObjectResolverTests.cs index bb17e7ae8..9460d7f34 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/DynamicObjectResolverTests.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/DynamicObjectResolverTests.cs @@ -58,7 +58,7 @@ public void DeserializerSetsMissingPropertiesToDefaultValue() var instance = MessagePackSerializer.Deserialize(seq); Assert.Equal("Set", instance.Prop1); - Assert.Null(instance.Prop2); + Assert.Equal("Uninitialized", instance.Prop2); } [Fact] @@ -72,7 +72,7 @@ public void DeserializerSetsMissingPropertiesToDefaultValue_OrdinalKey() var instance = MessagePackSerializer.Deserialize(seq); Assert.Equal("Set", instance.Prop1); - Assert.Null(instance.Prop2); + Assert.Equal("Uninitialized", instance.Prop2); } /// @@ -155,6 +155,246 @@ private void PrivateMembersInBaseClass_Helper(MessagePackSerializerOptions optio Assert.Equal(obj.Name, obj2.Name); } + [Fact] + public void DefaultValueStringKeyClassWithoutExplicitConstructorTest() + { + var seq = new Sequence(); + var writer = new MessagePackWriter(seq); + writer.WriteMapHeader(0); + writer.Flush(); + + var instance = MessagePackSerializer.Deserialize(seq); + Assert.Equal(DefaultValueStringKeyClassWithoutExplicitConstructor.Prop1Constant, instance.Prop1); + Assert.Equal(DefaultValueStringKeyClassWithoutExplicitConstructor.Prop2Constant, instance.Prop2); + } + + [Fact] + public void DefaultValueStringKeyClassWithExplicitConstructorTest() + { + var seq = new Sequence(); + var writer = new MessagePackWriter(seq); + writer.WriteMapHeader(1); + writer.Write(nameof(DefaultValueStringKeyClassWithExplicitConstructor.Prop1)); + writer.Write(-1); + writer.Flush(); + + var instance = MessagePackSerializer.Deserialize(seq); + Assert.Equal(-1, instance.Prop1); + Assert.Equal(DefaultValueStringKeyClassWithExplicitConstructor.Prop2Constant, instance.Prop2); + } + + [Fact] + public void DefaultValueStringKeyClassWithExplicitConstructorSetPropertyTest() + { + var seq = new Sequence(); + var writer = new MessagePackWriter(seq); + writer.WriteMapHeader(2); + writer.Write(nameof(DefaultValueStringKeyClassWithExplicitConstructor.Prop1)); + writer.Write(-1); + writer.Write(nameof(DefaultValueStringKeyClassWithExplicitConstructor.Prop2)); + writer.Write(int.MaxValue); + writer.Flush(); + + var instance = MessagePackSerializer.Deserialize(seq); + Assert.Equal(-1, instance.Prop1); + Assert.Equal(int.MaxValue, instance.Prop2); + } + + [Fact] + public void DefaultValueStringKeyStructWithExplicitConstructorTest() + { + var seq = new Sequence(); + var writer = new MessagePackWriter(seq); + writer.WriteMapHeader(1); + writer.Write(nameof(DefaultValueStringKeyStructWithExplicitConstructor.Prop1)); + writer.Write(-1); + writer.Flush(); + + var instance = MessagePackSerializer.Deserialize(seq); + Assert.Equal(-1, instance.Prop1); + Assert.Equal(DefaultValueStringKeyStructWithExplicitConstructor.Prop2Constant, instance.Prop2); + } + + [Fact] + public void DefaultValueStringKeyStructWithExplicitConstructorSetPropertyTest() + { + var seq = new Sequence(); + var writer = new MessagePackWriter(seq); + writer.WriteMapHeader(2); + writer.Write(nameof(DefaultValueStringKeyStructWithExplicitConstructor.Prop1)); + writer.Write(-1); + writer.Write(nameof(DefaultValueStringKeyStructWithExplicitConstructor.Prop2)); + writer.Write(int.MinValue); + writer.Flush(); + + var instance = MessagePackSerializer.Deserialize(seq); + Assert.Equal(-1, instance.Prop1); + Assert.Equal(int.MinValue, instance.Prop2); + } + + [Fact] + public void DefaultValueIntKeyClassWithoutExplicitConstructorTest() + { + var seq = new Sequence(); + var writer = new MessagePackWriter(seq); + writer.WriteArrayHeader(0); + writer.Flush(); + + var instance = MessagePackSerializer.Deserialize(seq); + Assert.Equal(DefaultValueIntKeyClassWithoutExplicitConstructor.Prop1Constant, instance.Prop1); + Assert.Equal(DefaultValueIntKeyClassWithoutExplicitConstructor.Prop2Constant, instance.Prop2); + } + + [Fact] + public void DefaultValueIntKeyClassWithExplicitConstructorTest() + { + var seq = new Sequence(); + var writer = new MessagePackWriter(seq); + writer.WriteArrayHeader(1); + writer.Write(-1); + writer.Flush(); + + var instance = MessagePackSerializer.Deserialize(seq); + Assert.Equal(-1, instance.Prop1); + Assert.Equal(DefaultValueIntKeyClassWithExplicitConstructor.Prop2Constant, instance.Prop2); + } + + [Fact] + public void DefaultValueIntKeyClassWithExplicitConstructorSetPropertyTest() + { + var seq = new Sequence(); + var writer = new MessagePackWriter(seq); + writer.WriteArrayHeader(2); + writer.Write(-1); + writer.Write(42); + writer.Flush(); + + var instance = MessagePackSerializer.Deserialize(seq); + Assert.Equal(-1, instance.Prop1); + Assert.Equal(42, instance.Prop2); + } + + [Fact] + public void DefaultValueIntKeyStructWithExplicitConstructorTest() + { + var seq = new Sequence(); + var writer = new MessagePackWriter(seq); + writer.WriteArrayHeader(1); + writer.Write(-1); + writer.Flush(); + + var instance = MessagePackSerializer.Deserialize(seq); + Assert.Equal(-1, instance.Prop1); + Assert.Equal(DefaultValueIntKeyStructWithExplicitConstructor.Prop2Constant, instance.Prop2); + } + + [Fact] + public void DefaultValueIntKeyStructWithExplicitConstructorSetPropertyTest() + { + var seq = new Sequence(); + var writer = new MessagePackWriter(seq); + writer.WriteArrayHeader(2); + writer.Write(-1); + writer.Write(-98); + writer.Flush(); + + var instance = MessagePackSerializer.Deserialize(seq); + Assert.Equal(-1, instance.Prop1); + Assert.Equal(-98, instance.Prop2); + } + + [MessagePackObject(true)] + public class DefaultValueStringKeyClassWithoutExplicitConstructor + { + public const int Prop1Constant = 11; + public const int Prop2Constant = 45; + + public int Prop1 { get; set; } = Prop1Constant; + + public int Prop2 { get; set; } = Prop2Constant; + } + + [MessagePackObject(true)] + public class DefaultValueStringKeyClassWithExplicitConstructor + { + public const int Prop2Constant = 1419; + + public int Prop1 { get; set; } + + public int Prop2 { get; set; } + + public DefaultValueStringKeyClassWithExplicitConstructor(int prop1) + { + Prop1 = prop1; + Prop2 = Prop2Constant; + } + } + + [MessagePackObject(true)] + public struct DefaultValueStringKeyStructWithExplicitConstructor + { + public const int Prop2Constant = 198; + + public int Prop1 { get; set; } + + public int Prop2 { get; set; } + + public DefaultValueStringKeyStructWithExplicitConstructor(int prop1) + { + Prop1 = prop1; + Prop2 = Prop2Constant; + } + } + + [MessagePackObject] + public class DefaultValueIntKeyClassWithoutExplicitConstructor + { + public const int Prop1Constant = 33; + public const int Prop2Constant = -4; + + [Key(0)] + public int Prop1 { get; set; } = Prop1Constant; + + [Key(1)] + public int Prop2 { get; set; } = Prop2Constant; + } + + [MessagePackObject] + public class DefaultValueIntKeyClassWithExplicitConstructor + { + public const int Prop2Constant = -109; + + [Key(0)] + public int Prop1 { get; set; } + + [Key(1)] + public int Prop2 { get; set; } + + public DefaultValueIntKeyClassWithExplicitConstructor(int prop1) + { + Prop1 = prop1; + Prop2 = Prop2Constant; + } + } + + [MessagePackObject] + public struct DefaultValueIntKeyStructWithExplicitConstructor + { + public const int Prop2Constant = 31; + + [Key(0)] + public int Prop1 { get; set; } + + [Key(1)] + public int Prop2 { get; set; } + + public DefaultValueIntKeyStructWithExplicitConstructor(int prop1) + { + Prop1 = prop1; + Prop2 = Prop2Constant; + } + } + [DataContract] public class BaseClassWithVirtualProperty { From 48863092b1c3431ccaf52c29ff297be3ef81554c Mon Sep 17 00:00:00 2001 From: neuecc Date: Wed, 11 Nov 2020 16:01:09 +0900 Subject: [PATCH 007/161] Add HalfFormatter for .NET 5.0 --- .../StandardClassLibraryFormatter.cs | 25 +++++++++++++++++++ .../MessagePack/Resolvers/BuiltinResolver.cs | 4 +++ .../Scripts/Tests/ShareTests/FormatterTest.cs | 11 ++++++++ src/MessagePack/MessagePack.csproj | 2 +- .../MessagePack.Tests.csproj | 2 +- 5 files changed, 42 insertions(+), 2 deletions(-) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/StandardClassLibraryFormatter.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/StandardClassLibraryFormatter.cs index 00c81a28b..31e28d851 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/StandardClassLibraryFormatter.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/StandardClassLibraryFormatter.cs @@ -6,6 +6,7 @@ using System.Collections; using System.Collections.Generic; using System.Globalization; +using System.Runtime.InteropServices; using System.Text; using MessagePack.Internal; @@ -635,4 +636,28 @@ public T Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions return (T)Type.GetType(reader.ReadString(), throwOnError: true); } } + +#if NET5_0 + + public sealed class HalfFormatter : IMessagePackFormatter + { + public static readonly IMessagePackFormatter Instance = new HalfFormatter(); + + private HalfFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, Half value, MessagePackSerializerOptions options) + { + writer.Write((float)value); + } + + public Half Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + return (Half)reader.ReadSingle(); + } + } + +#endif + } diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/BuiltinResolver.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/BuiltinResolver.cs index 8d0316328..050b9bcdd 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/BuiltinResolver.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/BuiltinResolver.cs @@ -151,6 +151,10 @@ internal static class BuiltinResolverGetFormatterHelper { typeof(System.Numerics.BigInteger?), new StaticNullableFormatter(BigIntegerFormatter.Instance) }, { typeof(System.Numerics.Complex), ComplexFormatter.Instance }, { typeof(System.Numerics.Complex?), new StaticNullableFormatter(ComplexFormatter.Instance) }, + +#if NET5_0 + { typeof(System.Half), HalfFormatter.Instance }, +#endif }; internal static object GetFormatter(Type t) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/FormatterTest.cs b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/FormatterTest.cs index d2b18a795..d98e94178 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/FormatterTest.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/FormatterTest.cs @@ -312,5 +312,16 @@ public void UriTest_Relative() var relative = new Uri("/me/", UriKind.Relative); this.Convert(relative).ToString().Is("/me/"); } + +#if NET5_0 + + [Fact] + public void HalfTest() + { + Convert((Half)1.34f).Is((Half)1.34f); + Convert((Half)0).Is((Half)0); + } + +#endif } } diff --git a/src/MessagePack/MessagePack.csproj b/src/MessagePack/MessagePack.csproj index 949e717f1..026259cc7 100644 --- a/src/MessagePack/MessagePack.csproj +++ b/src/MessagePack/MessagePack.csproj @@ -1,7 +1,7 @@  - netstandard2.0;netcoreapp2.1 + netstandard2.0;netcoreapp2.1;net5.0 $(NoWarn);CS0649 True $(DefineConstants);SPAN_BUILTIN diff --git a/tests/MessagePack.Tests/MessagePack.Tests.csproj b/tests/MessagePack.Tests/MessagePack.Tests.csproj index d3b782143..f6cba8772 100644 --- a/tests/MessagePack.Tests/MessagePack.Tests.csproj +++ b/tests/MessagePack.Tests/MessagePack.Tests.csproj @@ -1,6 +1,6 @@  - net472;netcoreapp2.1 + net472;netcoreapp2.1;net5.0 true 8.0 true From 1b8133a3efa9bd04db2664de8fad348d258a4a4d Mon Sep 17 00:00:00 2001 From: neuecc Date: Wed, 11 Nov 2020 16:08:28 +0900 Subject: [PATCH 008/161] remove using --- .../MessagePack/Formatters/StandardClassLibraryFormatter.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/StandardClassLibraryFormatter.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/StandardClassLibraryFormatter.cs index 31e28d851..ec63a89c8 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/StandardClassLibraryFormatter.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/StandardClassLibraryFormatter.cs @@ -6,7 +6,6 @@ using System.Collections; using System.Collections.Generic; using System.Globalization; -using System.Runtime.InteropServices; using System.Text; using MessagePack.Internal; From ba463e65a3adff5a170e1f6c7b980afdb013c6bf Mon Sep 17 00:00:00 2001 From: neuecc Date: Wed, 11 Nov 2020 18:09:43 +0900 Subject: [PATCH 009/161] support Half to ReadMe --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c8cf1f2de..aee68d13d 100644 --- a/README.md +++ b/README.md @@ -183,7 +183,7 @@ These types can serialize by default: * Primitives (`int`, `string`, etc...), `Enum`s, `Nullable<>`, `Lazy<>` * `TimeSpan`, `DateTime`, `DateTimeOffset` * `Guid`, `Uri`, `Version`, `StringBuilder` -* `BigInteger`, `Complex` +* `BigInteger`, `Complex`, `Half` * `Array[]`, `Array[,]`, `Array[,,]`, `Array[,,,]`, `ArraySegment<>`, `BitArray` * `KeyValuePair<,>`, `Tuple<,...>`, `ValueTuple<,...>` * `ArrayList`, `Hashtable` From 851e39288c274631f834f1f990e8c668755bbfca Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 11 Nov 2020 08:21:46 -0700 Subject: [PATCH 010/161] Update .NET SDK to 5.0.100 --- global.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global.json b/global.json index 11833de02..e6e7ee5c0 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "3.1.301", + "version": "5.0.100", "rollForward": "patch", "allowPrerelease": false } From af2d4b3235710cd3ec33b7b5bdc2dff5a06993fe Mon Sep 17 00:00:00 2001 From: pCYSl5EDgo Date: Thu, 12 Nov 2020 13:33:41 +0900 Subject: [PATCH 011/161] Remove not supported target framework. --- sandbox/MessagePack.Internal/MessagePack.Internal.csproj | 2 +- sandbox/PerfBenchmarkDotNet/PerfBenchmarkDotNet.csproj | 2 +- sandbox/PerfNetFramework/PerfNetFramework.csproj | 2 +- .../MessagePack.AspNetCoreMvcFormatter.csproj | 4 ++-- .../MessagePack.Internal.Tests.csproj | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sandbox/MessagePack.Internal/MessagePack.Internal.csproj b/sandbox/MessagePack.Internal/MessagePack.Internal.csproj index d7e5caaad..33fa720e9 100644 --- a/sandbox/MessagePack.Internal/MessagePack.Internal.csproj +++ b/sandbox/MessagePack.Internal/MessagePack.Internal.csproj @@ -1,7 +1,7 @@  - netcoreapp2.2 + netcoreapp2.1 $(DefineConstants);SPAN_BUILTIN;MESSAGEPACK_INTERNAL true True diff --git a/sandbox/PerfBenchmarkDotNet/PerfBenchmarkDotNet.csproj b/sandbox/PerfBenchmarkDotNet/PerfBenchmarkDotNet.csproj index 53bb5949d..2d50eff77 100644 --- a/sandbox/PerfBenchmarkDotNet/PerfBenchmarkDotNet.csproj +++ b/sandbox/PerfBenchmarkDotNet/PerfBenchmarkDotNet.csproj @@ -1,7 +1,7 @@  Exe - net472;netcoreapp2.2 + net472;netcoreapp2.1 true true diff --git a/sandbox/PerfNetFramework/PerfNetFramework.csproj b/sandbox/PerfNetFramework/PerfNetFramework.csproj index a0416f99f..ea9b63dc0 100644 --- a/sandbox/PerfNetFramework/PerfNetFramework.csproj +++ b/sandbox/PerfNetFramework/PerfNetFramework.csproj @@ -1,7 +1,7 @@  Exe - net472;netcoreapp2.2 + net472;netcoreapp2.1 true diff --git a/src/MessagePack.AspNetCoreMvcFormatter/MessagePack.AspNetCoreMvcFormatter.csproj b/src/MessagePack.AspNetCoreMvcFormatter/MessagePack.AspNetCoreMvcFormatter.csproj index 32229c1d7..bd8a06bba 100644 --- a/src/MessagePack.AspNetCoreMvcFormatter/MessagePack.AspNetCoreMvcFormatter.csproj +++ b/src/MessagePack.AspNetCoreMvcFormatter/MessagePack.AspNetCoreMvcFormatter.csproj @@ -1,6 +1,6 @@  - netstandard2.0;netcoreapp3.0 + netstandard2.0;netcoreapp3.1 true ASP.NET Core MVC Input/Output MessagePack formatter ASP.NET Core MVC Input/Output MessagePack formatter. @@ -8,7 +8,7 @@ - + diff --git a/tests/MessagePack.Internal.Tests/MessagePack.Internal.Tests.csproj b/tests/MessagePack.Internal.Tests/MessagePack.Internal.Tests.csproj index f75ede3e1..494885c2d 100644 --- a/tests/MessagePack.Internal.Tests/MessagePack.Internal.Tests.csproj +++ b/tests/MessagePack.Internal.Tests/MessagePack.Internal.Tests.csproj @@ -1,6 +1,6 @@  - netcoreapp2.2 + netcoreapp2.1 ..\MessagePack.Tests\MessagePack.Tests.ruleset From 9e719ff73cd50de6ed6a00d4abca2a29673479f9 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 13 Nov 2020 14:51:13 -0700 Subject: [PATCH 012/161] Remove VSIX and use dotnet build in AzP Closes #1114 --- MessagePack.sln | 121 +----------------- azure-pipelines/build.yml | 10 +- azure-pipelines/build_nonWindows.yml | 2 +- .../MessagePackAnalyzer.Vsix.csproj | 91 ------------- .../source.extension.vsixmanifest | 19 --- 5 files changed, 5 insertions(+), 238 deletions(-) delete mode 100644 src/MessagePackAnalyzer.Vsix/MessagePackAnalyzer.Vsix.csproj delete mode 100644 src/MessagePackAnalyzer.Vsix/source.extension.vsixmanifest diff --git a/MessagePack.sln b/MessagePack.sln index e861de8f1..77d762b8a 100644 --- a/MessagePack.sln +++ b/MessagePack.sln @@ -34,8 +34,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MessagePack.ImmutableCollec EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MessagePackAnalyzer", "src\MessagePackAnalyzer\MessagePackAnalyzer.csproj", "{2F9A6E0C-DE95-4460-96B7-EB72BBEAEE9E}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MessagePackAnalyzer.Vsix", "src\MessagePackAnalyzer.Vsix\MessagePackAnalyzer.Vsix.csproj", "{09B87BEB-D9A3-4EEB-B56A-ED53D27DF1A3}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PerfNetFramework", "sandbox\PerfNetFramework\PerfNetFramework.csproj", "{014A3DCE-50A6-4774-A4C1-C66EEAB67133}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MessagePack.AspNetCoreMvcFormatter", "src\MessagePack.AspNetCoreMvcFormatter\MessagePack.AspNetCoreMvcFormatter.csproj", "{17831017-C29C-4A48-B159-849BCE5079FB}" @@ -88,238 +86,122 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MessagePack.Experimental", EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MessagePack.Experimental.Tests", "tests\MessagePack.Experimental.Tests\MessagePack.Experimental.Tests.csproj", "{8AB40D1C-1134-4D77-B39A-19AEDC729450}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MessagePack.GeneratedCode.Tests", "tests\MessagePack.GeneratedCode.Tests\MessagePack.GeneratedCode.Tests.csproj", "{D4CE7347-CEBE-46E5-BD12-1319573B6C5E}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MessagePack.GeneratedCode.Tests", "tests\MessagePack.GeneratedCode.Tests\MessagePack.GeneratedCode.Tests.csproj", "{D4CE7347-CEBE-46E5-BD12-1319573B6C5E}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU - Debug|NoVSIX = Debug|NoVSIX Release|Any CPU = Release|Any CPU - Release|NoVSIX = Release|NoVSIX EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {7ABB33EE-A2F1-492B-8DAF-5DF89F0F0B79}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7ABB33EE-A2F1-492B-8DAF-5DF89F0F0B79}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7ABB33EE-A2F1-492B-8DAF-5DF89F0F0B79}.Debug|NoVSIX.ActiveCfg = Debug|Any CPU - {7ABB33EE-A2F1-492B-8DAF-5DF89F0F0B79}.Debug|NoVSIX.Build.0 = Debug|Any CPU {7ABB33EE-A2F1-492B-8DAF-5DF89F0F0B79}.Release|Any CPU.ActiveCfg = Release|Any CPU {7ABB33EE-A2F1-492B-8DAF-5DF89F0F0B79}.Release|Any CPU.Build.0 = Release|Any CPU - {7ABB33EE-A2F1-492B-8DAF-5DF89F0F0B79}.Release|NoVSIX.ActiveCfg = Release|Any CPU - {7ABB33EE-A2F1-492B-8DAF-5DF89F0F0B79}.Release|NoVSIX.Build.0 = Release|Any CPU {9E1A55CA-711D-4F58-A332-735960E3434C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9E1A55CA-711D-4F58-A332-735960E3434C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9E1A55CA-711D-4F58-A332-735960E3434C}.Debug|NoVSIX.ActiveCfg = Debug|Any CPU - {9E1A55CA-711D-4F58-A332-735960E3434C}.Debug|NoVSIX.Build.0 = Debug|Any CPU {9E1A55CA-711D-4F58-A332-735960E3434C}.Release|Any CPU.ActiveCfg = Release|Any CPU {9E1A55CA-711D-4F58-A332-735960E3434C}.Release|Any CPU.Build.0 = Release|Any CPU - {9E1A55CA-711D-4F58-A332-735960E3434C}.Release|NoVSIX.ActiveCfg = Release|Any CPU - {9E1A55CA-711D-4F58-A332-735960E3434C}.Release|NoVSIX.Build.0 = Release|Any CPU {ED43BDA5-947C-4769-A47A-F07D3C6142AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {ED43BDA5-947C-4769-A47A-F07D3C6142AE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {ED43BDA5-947C-4769-A47A-F07D3C6142AE}.Debug|NoVSIX.ActiveCfg = Debug|Any CPU - {ED43BDA5-947C-4769-A47A-F07D3C6142AE}.Debug|NoVSIX.Build.0 = Debug|Any CPU {ED43BDA5-947C-4769-A47A-F07D3C6142AE}.Release|Any CPU.ActiveCfg = Release|Any CPU {ED43BDA5-947C-4769-A47A-F07D3C6142AE}.Release|Any CPU.Build.0 = Release|Any CPU - {ED43BDA5-947C-4769-A47A-F07D3C6142AE}.Release|NoVSIX.ActiveCfg = Release|Any CPU - {ED43BDA5-947C-4769-A47A-F07D3C6142AE}.Release|NoVSIX.Build.0 = Release|Any CPU {8E511130-F838-4B47-842B-0FB27AD175B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8E511130-F838-4B47-842B-0FB27AD175B5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8E511130-F838-4B47-842B-0FB27AD175B5}.Debug|NoVSIX.ActiveCfg = Debug|Any CPU - {8E511130-F838-4B47-842B-0FB27AD175B5}.Debug|NoVSIX.Build.0 = Debug|Any CPU {8E511130-F838-4B47-842B-0FB27AD175B5}.Release|Any CPU.ActiveCfg = Release|Any CPU {8E511130-F838-4B47-842B-0FB27AD175B5}.Release|Any CPU.Build.0 = Release|Any CPU - {8E511130-F838-4B47-842B-0FB27AD175B5}.Release|NoVSIX.ActiveCfg = Release|Any CPU - {8E511130-F838-4B47-842B-0FB27AD175B5}.Release|NoVSIX.Build.0 = Release|Any CPU {3ABC5C4C-2CE4-459E-8666-F2B181C3DEF3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3ABC5C4C-2CE4-459E-8666-F2B181C3DEF3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3ABC5C4C-2CE4-459E-8666-F2B181C3DEF3}.Debug|NoVSIX.ActiveCfg = Debug|Any CPU - {3ABC5C4C-2CE4-459E-8666-F2B181C3DEF3}.Debug|NoVSIX.Build.0 = Debug|Any CPU {3ABC5C4C-2CE4-459E-8666-F2B181C3DEF3}.Release|Any CPU.ActiveCfg = Release|Any CPU {3ABC5C4C-2CE4-459E-8666-F2B181C3DEF3}.Release|Any CPU.Build.0 = Release|Any CPU - {3ABC5C4C-2CE4-459E-8666-F2B181C3DEF3}.Release|NoVSIX.ActiveCfg = Release|Any CPU - {3ABC5C4C-2CE4-459E-8666-F2B181C3DEF3}.Release|NoVSIX.Build.0 = Release|Any CPU {C01E1407-7FEC-4C1D-B0B4-74D95A317AA6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C01E1407-7FEC-4C1D-B0B4-74D95A317AA6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C01E1407-7FEC-4C1D-B0B4-74D95A317AA6}.Debug|NoVSIX.ActiveCfg = Debug|Any CPU - {C01E1407-7FEC-4C1D-B0B4-74D95A317AA6}.Debug|NoVSIX.Build.0 = Debug|Any CPU {C01E1407-7FEC-4C1D-B0B4-74D95A317AA6}.Release|Any CPU.ActiveCfg = Release|Any CPU {C01E1407-7FEC-4C1D-B0B4-74D95A317AA6}.Release|Any CPU.Build.0 = Release|Any CPU - {C01E1407-7FEC-4C1D-B0B4-74D95A317AA6}.Release|NoVSIX.ActiveCfg = Release|Any CPU - {C01E1407-7FEC-4C1D-B0B4-74D95A317AA6}.Release|NoVSIX.Build.0 = Release|Any CPU {166A16C0-B89F-41AF-956A-235C6CA62C25}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {166A16C0-B89F-41AF-956A-235C6CA62C25}.Debug|Any CPU.Build.0 = Debug|Any CPU - {166A16C0-B89F-41AF-956A-235C6CA62C25}.Debug|NoVSIX.ActiveCfg = Debug|Any CPU - {166A16C0-B89F-41AF-956A-235C6CA62C25}.Debug|NoVSIX.Build.0 = Debug|Any CPU {166A16C0-B89F-41AF-956A-235C6CA62C25}.Release|Any CPU.ActiveCfg = Release|Any CPU {166A16C0-B89F-41AF-956A-235C6CA62C25}.Release|Any CPU.Build.0 = Release|Any CPU - {166A16C0-B89F-41AF-956A-235C6CA62C25}.Release|NoVSIX.ActiveCfg = Release|Any CPU - {166A16C0-B89F-41AF-956A-235C6CA62C25}.Release|NoVSIX.Build.0 = Release|Any CPU {E066F547-7261-4561-AEFC-E64DBFD874F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E066F547-7261-4561-AEFC-E64DBFD874F8}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E066F547-7261-4561-AEFC-E64DBFD874F8}.Debug|NoVSIX.ActiveCfg = Debug|Any CPU - {E066F547-7261-4561-AEFC-E64DBFD874F8}.Debug|NoVSIX.Build.0 = Debug|Any CPU {E066F547-7261-4561-AEFC-E64DBFD874F8}.Release|Any CPU.ActiveCfg = Release|Any CPU {E066F547-7261-4561-AEFC-E64DBFD874F8}.Release|Any CPU.Build.0 = Release|Any CPU - {E066F547-7261-4561-AEFC-E64DBFD874F8}.Release|NoVSIX.ActiveCfg = Release|Any CPU - {E066F547-7261-4561-AEFC-E64DBFD874F8}.Release|NoVSIX.Build.0 = Release|Any CPU {2F9A6E0C-DE95-4460-96B7-EB72BBEAEE9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2F9A6E0C-DE95-4460-96B7-EB72BBEAEE9E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2F9A6E0C-DE95-4460-96B7-EB72BBEAEE9E}.Debug|NoVSIX.ActiveCfg = Debug|Any CPU - {2F9A6E0C-DE95-4460-96B7-EB72BBEAEE9E}.Debug|NoVSIX.Build.0 = Debug|Any CPU {2F9A6E0C-DE95-4460-96B7-EB72BBEAEE9E}.Release|Any CPU.ActiveCfg = Release|Any CPU {2F9A6E0C-DE95-4460-96B7-EB72BBEAEE9E}.Release|Any CPU.Build.0 = Release|Any CPU - {2F9A6E0C-DE95-4460-96B7-EB72BBEAEE9E}.Release|NoVSIX.ActiveCfg = Release|Any CPU - {2F9A6E0C-DE95-4460-96B7-EB72BBEAEE9E}.Release|NoVSIX.Build.0 = Release|Any CPU - {09B87BEB-D9A3-4EEB-B56A-ED53D27DF1A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {09B87BEB-D9A3-4EEB-B56A-ED53D27DF1A3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {09B87BEB-D9A3-4EEB-B56A-ED53D27DF1A3}.Debug|NoVSIX.ActiveCfg = Debug|Any CPU - {09B87BEB-D9A3-4EEB-B56A-ED53D27DF1A3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {09B87BEB-D9A3-4EEB-B56A-ED53D27DF1A3}.Release|Any CPU.Build.0 = Release|Any CPU - {09B87BEB-D9A3-4EEB-B56A-ED53D27DF1A3}.Release|NoVSIX.ActiveCfg = Release|Any CPU {014A3DCE-50A6-4774-A4C1-C66EEAB67133}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {014A3DCE-50A6-4774-A4C1-C66EEAB67133}.Debug|Any CPU.Build.0 = Debug|Any CPU - {014A3DCE-50A6-4774-A4C1-C66EEAB67133}.Debug|NoVSIX.ActiveCfg = Debug|Any CPU - {014A3DCE-50A6-4774-A4C1-C66EEAB67133}.Debug|NoVSIX.Build.0 = Debug|Any CPU {014A3DCE-50A6-4774-A4C1-C66EEAB67133}.Release|Any CPU.ActiveCfg = Release|Any CPU {014A3DCE-50A6-4774-A4C1-C66EEAB67133}.Release|Any CPU.Build.0 = Release|Any CPU - {014A3DCE-50A6-4774-A4C1-C66EEAB67133}.Release|NoVSIX.ActiveCfg = Release|Any CPU - {014A3DCE-50A6-4774-A4C1-C66EEAB67133}.Release|NoVSIX.Build.0 = Release|Any CPU {17831017-C29C-4A48-B159-849BCE5079FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {17831017-C29C-4A48-B159-849BCE5079FB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {17831017-C29C-4A48-B159-849BCE5079FB}.Debug|NoVSIX.ActiveCfg = Debug|Any CPU - {17831017-C29C-4A48-B159-849BCE5079FB}.Debug|NoVSIX.Build.0 = Debug|Any CPU {17831017-C29C-4A48-B159-849BCE5079FB}.Release|Any CPU.ActiveCfg = Release|Any CPU {17831017-C29C-4A48-B159-849BCE5079FB}.Release|Any CPU.Build.0 = Release|Any CPU - {17831017-C29C-4A48-B159-849BCE5079FB}.Release|NoVSIX.ActiveCfg = Release|Any CPU - {17831017-C29C-4A48-B159-849BCE5079FB}.Release|NoVSIX.Build.0 = Release|Any CPU {814F94D6-1413-4ACB-B1B5-A3488CAA1E6B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {814F94D6-1413-4ACB-B1B5-A3488CAA1E6B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {814F94D6-1413-4ACB-B1B5-A3488CAA1E6B}.Debug|NoVSIX.ActiveCfg = Debug|Any CPU - {814F94D6-1413-4ACB-B1B5-A3488CAA1E6B}.Debug|NoVSIX.Build.0 = Debug|Any CPU {814F94D6-1413-4ACB-B1B5-A3488CAA1E6B}.Release|Any CPU.ActiveCfg = Release|Any CPU {814F94D6-1413-4ACB-B1B5-A3488CAA1E6B}.Release|Any CPU.Build.0 = Release|Any CPU - {814F94D6-1413-4ACB-B1B5-A3488CAA1E6B}.Release|NoVSIX.ActiveCfg = Release|Any CPU - {814F94D6-1413-4ACB-B1B5-A3488CAA1E6B}.Release|NoVSIX.Build.0 = Release|Any CPU {2A32A538-BA26-4D89-85D0-E4249AFA0837}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2A32A538-BA26-4D89-85D0-E4249AFA0837}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2A32A538-BA26-4D89-85D0-E4249AFA0837}.Debug|NoVSIX.ActiveCfg = Debug|Any CPU - {2A32A538-BA26-4D89-85D0-E4249AFA0837}.Debug|NoVSIX.Build.0 = Debug|Any CPU {2A32A538-BA26-4D89-85D0-E4249AFA0837}.Release|Any CPU.ActiveCfg = Release|Any CPU {2A32A538-BA26-4D89-85D0-E4249AFA0837}.Release|Any CPU.Build.0 = Release|Any CPU - {2A32A538-BA26-4D89-85D0-E4249AFA0837}.Release|NoVSIX.ActiveCfg = Release|Any CPU - {2A32A538-BA26-4D89-85D0-E4249AFA0837}.Release|NoVSIX.Build.0 = Release|Any CPU {79C2B2CB-872A-4BA9-82DC-60F6DD77F940}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {79C2B2CB-872A-4BA9-82DC-60F6DD77F940}.Debug|Any CPU.Build.0 = Debug|Any CPU - {79C2B2CB-872A-4BA9-82DC-60F6DD77F940}.Debug|NoVSIX.ActiveCfg = Debug|Any CPU - {79C2B2CB-872A-4BA9-82DC-60F6DD77F940}.Debug|NoVSIX.Build.0 = Debug|Any CPU {79C2B2CB-872A-4BA9-82DC-60F6DD77F940}.Release|Any CPU.ActiveCfg = Release|Any CPU {79C2B2CB-872A-4BA9-82DC-60F6DD77F940}.Release|Any CPU.Build.0 = Release|Any CPU - {79C2B2CB-872A-4BA9-82DC-60F6DD77F940}.Release|NoVSIX.ActiveCfg = Release|Any CPU - {79C2B2CB-872A-4BA9-82DC-60F6DD77F940}.Release|NoVSIX.Build.0 = Release|Any CPU {85763F30-7733-44AB-89AB-D1B64F6E0D93}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {85763F30-7733-44AB-89AB-D1B64F6E0D93}.Debug|Any CPU.Build.0 = Debug|Any CPU - {85763F30-7733-44AB-89AB-D1B64F6E0D93}.Debug|NoVSIX.ActiveCfg = Debug|Any CPU - {85763F30-7733-44AB-89AB-D1B64F6E0D93}.Debug|NoVSIX.Build.0 = Debug|Any CPU {85763F30-7733-44AB-89AB-D1B64F6E0D93}.Release|Any CPU.ActiveCfg = Release|Any CPU {85763F30-7733-44AB-89AB-D1B64F6E0D93}.Release|Any CPU.Build.0 = Release|Any CPU - {85763F30-7733-44AB-89AB-D1B64F6E0D93}.Release|NoVSIX.ActiveCfg = Release|Any CPU - {85763F30-7733-44AB-89AB-D1B64F6E0D93}.Release|NoVSIX.Build.0 = Release|Any CPU {4142EA80-FEF4-44A5-8553-1AE84BEBAFED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4142EA80-FEF4-44A5-8553-1AE84BEBAFED}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4142EA80-FEF4-44A5-8553-1AE84BEBAFED}.Debug|NoVSIX.ActiveCfg = Debug|Any CPU - {4142EA80-FEF4-44A5-8553-1AE84BEBAFED}.Debug|NoVSIX.Build.0 = Debug|Any CPU {4142EA80-FEF4-44A5-8553-1AE84BEBAFED}.Release|Any CPU.ActiveCfg = Release|Any CPU {4142EA80-FEF4-44A5-8553-1AE84BEBAFED}.Release|Any CPU.Build.0 = Release|Any CPU - {4142EA80-FEF4-44A5-8553-1AE84BEBAFED}.Release|NoVSIX.ActiveCfg = Release|Any CPU - {4142EA80-FEF4-44A5-8553-1AE84BEBAFED}.Release|NoVSIX.Build.0 = Release|Any CPU {C100FBA6-4164-4D6A-A532-5984D2B8DCB0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C100FBA6-4164-4D6A-A532-5984D2B8DCB0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C100FBA6-4164-4D6A-A532-5984D2B8DCB0}.Debug|NoVSIX.ActiveCfg = Debug|Any CPU - {C100FBA6-4164-4D6A-A532-5984D2B8DCB0}.Debug|NoVSIX.Build.0 = Debug|Any CPU {C100FBA6-4164-4D6A-A532-5984D2B8DCB0}.Release|Any CPU.ActiveCfg = Release|Any CPU {C100FBA6-4164-4D6A-A532-5984D2B8DCB0}.Release|Any CPU.Build.0 = Release|Any CPU - {C100FBA6-4164-4D6A-A532-5984D2B8DCB0}.Release|NoVSIX.ActiveCfg = Release|Any CPU - {C100FBA6-4164-4D6A-A532-5984D2B8DCB0}.Release|NoVSIX.Build.0 = Release|Any CPU {8D9FD130-7905-47D8-A25C-7FDEE28EA0E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8D9FD130-7905-47D8-A25C-7FDEE28EA0E8}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8D9FD130-7905-47D8-A25C-7FDEE28EA0E8}.Debug|NoVSIX.ActiveCfg = Debug|Any CPU - {8D9FD130-7905-47D8-A25C-7FDEE28EA0E8}.Debug|NoVSIX.Build.0 = Debug|Any CPU {8D9FD130-7905-47D8-A25C-7FDEE28EA0E8}.Release|Any CPU.ActiveCfg = Release|Any CPU {8D9FD130-7905-47D8-A25C-7FDEE28EA0E8}.Release|Any CPU.Build.0 = Release|Any CPU - {8D9FD130-7905-47D8-A25C-7FDEE28EA0E8}.Release|NoVSIX.ActiveCfg = Release|Any CPU - {8D9FD130-7905-47D8-A25C-7FDEE28EA0E8}.Release|NoVSIX.Build.0 = Release|Any CPU {9962132D-A271-4E68-ACC1-18FA93462552}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9962132D-A271-4E68-ACC1-18FA93462552}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9962132D-A271-4E68-ACC1-18FA93462552}.Debug|NoVSIX.ActiveCfg = Debug|Any CPU - {9962132D-A271-4E68-ACC1-18FA93462552}.Debug|NoVSIX.Build.0 = Debug|Any CPU {9962132D-A271-4E68-ACC1-18FA93462552}.Release|Any CPU.ActiveCfg = Release|Any CPU {9962132D-A271-4E68-ACC1-18FA93462552}.Release|Any CPU.Build.0 = Release|Any CPU - {9962132D-A271-4E68-ACC1-18FA93462552}.Release|NoVSIX.ActiveCfg = Release|Any CPU - {9962132D-A271-4E68-ACC1-18FA93462552}.Release|NoVSIX.Build.0 = Release|Any CPU {32C91908-5CAD-4C95-B240-ACBBACAC9476}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {32C91908-5CAD-4C95-B240-ACBBACAC9476}.Debug|Any CPU.Build.0 = Debug|Any CPU - {32C91908-5CAD-4C95-B240-ACBBACAC9476}.Debug|NoVSIX.ActiveCfg = Debug|Any CPU - {32C91908-5CAD-4C95-B240-ACBBACAC9476}.Debug|NoVSIX.Build.0 = Debug|Any CPU {32C91908-5CAD-4C95-B240-ACBBACAC9476}.Release|Any CPU.ActiveCfg = Release|Any CPU {32C91908-5CAD-4C95-B240-ACBBACAC9476}.Release|Any CPU.Build.0 = Release|Any CPU - {32C91908-5CAD-4C95-B240-ACBBACAC9476}.Release|NoVSIX.ActiveCfg = Release|Any CPU - {32C91908-5CAD-4C95-B240-ACBBACAC9476}.Release|NoVSIX.Build.0 = Release|Any CPU {8DB135F5-A6FE-44E4-9853-7B48ED21F21B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8DB135F5-A6FE-44E4-9853-7B48ED21F21B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8DB135F5-A6FE-44E4-9853-7B48ED21F21B}.Debug|NoVSIX.ActiveCfg = Debug|Any CPU - {8DB135F5-A6FE-44E4-9853-7B48ED21F21B}.Debug|NoVSIX.Build.0 = Debug|Any CPU {8DB135F5-A6FE-44E4-9853-7B48ED21F21B}.Release|Any CPU.ActiveCfg = Release|Any CPU {8DB135F5-A6FE-44E4-9853-7B48ED21F21B}.Release|Any CPU.Build.0 = Release|Any CPU - {8DB135F5-A6FE-44E4-9853-7B48ED21F21B}.Release|NoVSIX.ActiveCfg = Release|Any CPU - {8DB135F5-A6FE-44E4-9853-7B48ED21F21B}.Release|NoVSIX.Build.0 = Release|Any CPU {7E5FB4B9-A0F5-4B10-A1F3-03AC0BC8265A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7E5FB4B9-A0F5-4B10-A1F3-03AC0BC8265A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7E5FB4B9-A0F5-4B10-A1F3-03AC0BC8265A}.Debug|NoVSIX.ActiveCfg = Debug|Any CPU - {7E5FB4B9-A0F5-4B10-A1F3-03AC0BC8265A}.Debug|NoVSIX.Build.0 = Debug|Any CPU {7E5FB4B9-A0F5-4B10-A1F3-03AC0BC8265A}.Release|Any CPU.ActiveCfg = Release|Any CPU {7E5FB4B9-A0F5-4B10-A1F3-03AC0BC8265A}.Release|Any CPU.Build.0 = Release|Any CPU - {7E5FB4B9-A0F5-4B10-A1F3-03AC0BC8265A}.Release|NoVSIX.ActiveCfg = Release|Any CPU - {7E5FB4B9-A0F5-4B10-A1F3-03AC0BC8265A}.Release|NoVSIX.Build.0 = Release|Any CPU {6AC51E68-4681-463A-B4B6-BD53517244B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {6AC51E68-4681-463A-B4B6-BD53517244B2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6AC51E68-4681-463A-B4B6-BD53517244B2}.Debug|NoVSIX.ActiveCfg = Debug|Any CPU - {6AC51E68-4681-463A-B4B6-BD53517244B2}.Debug|NoVSIX.Build.0 = Debug|Any CPU {6AC51E68-4681-463A-B4B6-BD53517244B2}.Release|Any CPU.ActiveCfg = Release|Any CPU {6AC51E68-4681-463A-B4B6-BD53517244B2}.Release|Any CPU.Build.0 = Release|Any CPU - {6AC51E68-4681-463A-B4B6-BD53517244B2}.Release|NoVSIX.ActiveCfg = Release|Any CPU - {6AC51E68-4681-463A-B4B6-BD53517244B2}.Release|NoVSIX.Build.0 = Release|Any CPU {4C9BB260-62D8-49CD-9F9C-9AA6A8BFC637}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4C9BB260-62D8-49CD-9F9C-9AA6A8BFC637}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4C9BB260-62D8-49CD-9F9C-9AA6A8BFC637}.Debug|NoVSIX.ActiveCfg = Debug|Any CPU - {4C9BB260-62D8-49CD-9F9C-9AA6A8BFC637}.Debug|NoVSIX.Build.0 = Debug|Any CPU {4C9BB260-62D8-49CD-9F9C-9AA6A8BFC637}.Release|Any CPU.ActiveCfg = Release|Any CPU {4C9BB260-62D8-49CD-9F9C-9AA6A8BFC637}.Release|Any CPU.Build.0 = Release|Any CPU - {4C9BB260-62D8-49CD-9F9C-9AA6A8BFC637}.Release|NoVSIX.ActiveCfg = Release|Any CPU - {4C9BB260-62D8-49CD-9F9C-9AA6A8BFC637}.Release|NoVSIX.Build.0 = Release|Any CPU {AC2503A7-736D-4AE6-9355-CF35D9DF6139}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {AC2503A7-736D-4AE6-9355-CF35D9DF6139}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AC2503A7-736D-4AE6-9355-CF35D9DF6139}.Debug|NoVSIX.ActiveCfg = Debug|Any CPU - {AC2503A7-736D-4AE6-9355-CF35D9DF6139}.Debug|NoVSIX.Build.0 = Debug|Any CPU {AC2503A7-736D-4AE6-9355-CF35D9DF6139}.Release|Any CPU.ActiveCfg = Release|Any CPU {AC2503A7-736D-4AE6-9355-CF35D9DF6139}.Release|Any CPU.Build.0 = Release|Any CPU - {AC2503A7-736D-4AE6-9355-CF35D9DF6139}.Release|NoVSIX.ActiveCfg = Release|Any CPU - {AC2503A7-736D-4AE6-9355-CF35D9DF6139}.Release|NoVSIX.Build.0 = Release|Any CPU {8AB40D1C-1134-4D77-B39A-19AEDC729450}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8AB40D1C-1134-4D77-B39A-19AEDC729450}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8AB40D1C-1134-4D77-B39A-19AEDC729450}.Debug|NoVSIX.ActiveCfg = Debug|Any CPU - {8AB40D1C-1134-4D77-B39A-19AEDC729450}.Debug|NoVSIX.Build.0 = Debug|Any CPU {8AB40D1C-1134-4D77-B39A-19AEDC729450}.Release|Any CPU.ActiveCfg = Release|Any CPU {8AB40D1C-1134-4D77-B39A-19AEDC729450}.Release|Any CPU.Build.0 = Release|Any CPU - {8AB40D1C-1134-4D77-B39A-19AEDC729450}.Release|NoVSIX.ActiveCfg = Release|Any CPU - {8AB40D1C-1134-4D77-B39A-19AEDC729450}.Release|NoVSIX.Build.0 = Release|Any CPU {D4CE7347-CEBE-46E5-BD12-1319573B6C5E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D4CE7347-CEBE-46E5-BD12-1319573B6C5E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D4CE7347-CEBE-46E5-BD12-1319573B6C5E}.Debug|NoVSIX.ActiveCfg = Debug|Any CPU - {D4CE7347-CEBE-46E5-BD12-1319573B6C5E}.Debug|NoVSIX.Build.0 = Debug|Any CPU {D4CE7347-CEBE-46E5-BD12-1319573B6C5E}.Release|Any CPU.ActiveCfg = Release|Any CPU {D4CE7347-CEBE-46E5-BD12-1319573B6C5E}.Release|Any CPU.Build.0 = Release|Any CPU - {D4CE7347-CEBE-46E5-BD12-1319573B6C5E}.Release|NoVSIX.ActiveCfg = Release|Any CPU - {D4CE7347-CEBE-46E5-BD12-1319573B6C5E}.Release|NoVSIX.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -334,7 +216,6 @@ Global {166A16C0-B89F-41AF-956A-235C6CA62C25} = {86309CF6-0054-4CE3-BFD3-CA0AA7DB17BC} {E066F547-7261-4561-AEFC-E64DBFD874F8} = {86309CF6-0054-4CE3-BFD3-CA0AA7DB17BC} {2F9A6E0C-DE95-4460-96B7-EB72BBEAEE9E} = {86309CF6-0054-4CE3-BFD3-CA0AA7DB17BC} - {09B87BEB-D9A3-4EEB-B56A-ED53D27DF1A3} = {86309CF6-0054-4CE3-BFD3-CA0AA7DB17BC} {014A3DCE-50A6-4774-A4C1-C66EEAB67133} = {BF4C4202-5015-4FBD-80E6-D0F36A06F700} {17831017-C29C-4A48-B159-849BCE5079FB} = {86309CF6-0054-4CE3-BFD3-CA0AA7DB17BC} {814F94D6-1413-4ACB-B1B5-A3488CAA1E6B} = {BF4C4202-5015-4FBD-80E6-D0F36A06F700} diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index 7a26369d3..99f5524dd 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -1,12 +1,8 @@ steps: -# Use VSBuild to pack because `dotnet pack` can't build VSIX projects. -- task: VSBuild@1 +- task: DotNetCoreCLI@2 inputs: - vsVersion: 16.0 - solution: MessagePack.sln - msbuildArgs: /t:build,pack /m /v:m /bl:"$(Build.ArtifactStagingDirectory)/build_logs/msbuild.binlog" - platform: $(BuildPlatform) - configuration: $(BuildConfiguration) + command: build + arguments: --configuration $(BuildConfiguration) /t:build,pack /m /v:m /bl:"$(Build.ArtifactStagingDirectory)/build_logs/msbuild.binlog" displayName: Build MessagePack.sln - task: DotNetCoreCLI@2 diff --git a/azure-pipelines/build_nonWindows.yml b/azure-pipelines/build_nonWindows.yml index af79463eb..df0da729f 100644 --- a/azure-pipelines/build_nonWindows.yml +++ b/azure-pipelines/build_nonWindows.yml @@ -3,7 +3,7 @@ steps: displayName: Build MessagePack.sln inputs: command: build - arguments: --no-restore /p:platform=NoVSIX -c $(BuildConfiguration) + arguments: --no-restore -c $(BuildConfiguration) - task: DotNetCoreCLI@2 displayName: Run MessagePack.Tests (netcoreapp2.1) diff --git a/src/MessagePackAnalyzer.Vsix/MessagePackAnalyzer.Vsix.csproj b/src/MessagePackAnalyzer.Vsix/MessagePackAnalyzer.Vsix.csproj deleted file mode 100644 index a6b8cc67e..000000000 --- a/src/MessagePackAnalyzer.Vsix/MessagePackAnalyzer.Vsix.csproj +++ /dev/null @@ -1,91 +0,0 @@ - - - - - 15.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - false - true - - - - Debug - AnyCPU - AnyCPU - 2.0 - {82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - {09B87BEB-D9A3-4EEB-B56A-ED53D27DF1A3} - Library - Properties - MessagePackAnalyzer.Vsix - MessagePackAnalyzer.Vsix - MessagePackAnalyzer.vsix - v4.7.2 - false - false - false - false - false - false - Roslyn - $(BaseOutputPath)$(Configuration)\ - win - false - - - true - full - false - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - TRACE - prompt - 4 - - - Program - $(DevEnvDir)devenv.exe - /rootsuffix Roslyn - - - - Designer - - - - - False - .NET Framework 3.5 SP1 - false - - - - - {2F9A6E0C-DE95-4460-96B7-EB72BBEAEE9E} - MessagePackAnalyzer - BuiltProjectOutputGroup%3bBuiltProjectOutputGroupDependencies%3bGetCopyToOutputDirectoryItems%3bSatelliteDllsProjectOutputGroup%3b - DebugSymbolsProjectOutputGroup%3b - - - - - - diff --git a/src/MessagePackAnalyzer.Vsix/source.extension.vsixmanifest b/src/MessagePackAnalyzer.Vsix/source.extension.vsixmanifest deleted file mode 100644 index 9b6caf57f..000000000 --- a/src/MessagePackAnalyzer.Vsix/source.extension.vsixmanifest +++ /dev/null @@ -1,19 +0,0 @@ - - - - - MessagePackAnalyzer - MessagePack AnalyzerMessagePack Analyzer - - - - - - - - - - - - - From 9ca9abc861ed62cf75e176123bfe38dc261b7a84 Mon Sep 17 00:00:00 2001 From: Nirklav Date: Mon, 16 Nov 2020 14:42:29 +0200 Subject: [PATCH 013/161] SequencePool.Shared was changed to MessagePackSerializerOptions.Pool property. --- .../Formatters/CollectionFormatter.cs | 4 +- .../Formatters/TypelessFormatter.cs | 2 +- .../MessagePack/MessagePackSerializer.Json.cs | 17 +++++--- .../MessagePack/MessagePackSerializer.cs | 23 +++++++--- .../MessagePackSerializerOptions.cs | 24 +++++++++++ .../MessagePack/MessagePackStreamReader.cs | 2 +- .../Scripts/MessagePack/SequencePool.cs | 43 +++++++++++++------ .../Assets/Scripts/MessagePack/Utilities.cs | 8 +++- src/MessagePack/PublicAPI.Unshipped.txt | 6 +++ 9 files changed, 99 insertions(+), 30 deletions(-) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/CollectionFormatter.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/CollectionFormatter.cs index 590719e4e..9bbaee41f 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/CollectionFormatter.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/CollectionFormatter.cs @@ -346,7 +346,7 @@ public void Serialize(ref MessagePackWriter writer, TCollection value, MessagePa } else { - using (var scratchRental = SequencePool.Shared.Rent()) + using (var scratchRental = options.Pool.Rent()) { var scratch = scratchRental.Value; MessagePackWriter scratchWriter = writer.Clone(scratch); @@ -950,7 +950,7 @@ public void Serialize(ref MessagePackWriter writer, IEnumerable value, MessagePa IMessagePackFormatter formatter = options.Resolver.GetFormatterWithVerify(); - using (var scratchRental = SequencePool.Shared.Rent()) + using (var scratchRental = options.Pool.Rent()) { var scratch = scratchRental.Value; MessagePackWriter scratchWriter = writer.Clone(scratch); diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/TypelessFormatter.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/TypelessFormatter.cs index 0d158a355..250546409 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/TypelessFormatter.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/TypelessFormatter.cs @@ -202,7 +202,7 @@ public void Serialize(ref MessagePackWriter writer, object value, MessagePackSer } // mark will be written at the end, when size is known - using (var scratchRental = SequencePool.Shared.Rent()) + using (var scratchRental = options.Pool.Rent()) { MessagePackWriter scratchWriter = writer.Clone(scratchRental.Value); scratchWriter.WriteString(typeName); diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.Json.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.Json.cs index 091e2a950..014c49d99 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.Json.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.Json.cs @@ -21,7 +21,9 @@ public partial class MessagePackSerializer /// Thrown if an error occurs during serialization. public static void SerializeToJson(TextWriter textWriter, T obj, MessagePackSerializerOptions options = null, CancellationToken cancellationToken = default) { - using (var sequenceRental = SequencePool.Shared.Rent()) + options = options ?? DefaultOptions; + + using (var sequenceRental = options.Pool.Rent()) { var msgpackWriter = new MessagePackWriter(sequenceRental.Value) { @@ -85,7 +87,7 @@ public static void ConvertToJson(ref MessagePackReader reader, TextWriter jsonWr { if (options.Compression.IsCompression()) { - using (var scratchRental = SequencePool.Shared.Rent()) + using (var scratchRental = options.Pool.Rent()) { if (TryDecompress(ref reader, scratchRental.Value)) { @@ -133,7 +135,9 @@ public static void ConvertFromJson(string str, ref MessagePackWriter writer, Mes /// public static byte[] ConvertFromJson(string str, MessagePackSerializerOptions options = null, CancellationToken cancellationToken = default) { - using (var scratchRental = SequencePool.Shared.Rent()) + options = options ?? DefaultOptions; + + using (var scratchRental = options.Pool.Rent()) { var writer = new MessagePackWriter(scratchRental.Value) { @@ -155,9 +159,10 @@ public static byte[] ConvertFromJson(string str, MessagePackSerializerOptions op public static void ConvertFromJson(TextReader reader, ref MessagePackWriter writer, MessagePackSerializerOptions options = null) { options = options ?? DefaultOptions; + if (options.Compression.IsCompression()) { - using (var scratchRental = SequencePool.Shared.Rent()) + using (var scratchRental = options.Pool.Rent()) { MessagePackWriter scratchWriter = writer.Clone(scratchRental.Value); using (var jr = new TinyJsonReader(reader, false)) @@ -189,7 +194,7 @@ private static uint FromJsonCore(TinyJsonReader jr, ref MessagePackWriter writer break; case TinyJsonToken.StartObject: // Set up a scratch area to serialize the collection since we don't know its length yet, which must be written first. - using (var scratchRental = SequencePool.Shared.Rent()) + using (var scratchRental = DefaultOptions.Pool.Rent()) { MessagePackWriter scratchWriter = writer.Clone(scratchRental.Value); var mapCount = FromJsonCore(jr, ref scratchWriter); @@ -206,7 +211,7 @@ private static uint FromJsonCore(TinyJsonReader jr, ref MessagePackWriter writer return count; // break case TinyJsonToken.StartArray: // Set up a scratch area to serialize the collection since we don't know its length yet, which must be written first. - using (var scratchRental = SequencePool.Shared.Rent()) + using (var scratchRental = DefaultOptions.Pool.Rent()) { MessagePackWriter scratchWriter = writer.Clone(scratchRental.Value); var arrayCount = FromJsonCore(jr, ref scratchWriter); diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.cs index 973f422f6..372c8f301 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.cs @@ -79,7 +79,7 @@ public static void Serialize(ref MessagePackWriter writer, T value, MessagePa { if (options.Compression.IsCompression() && !PrimitiveChecker.IsMessagePackFixedSizePrimitive) { - using (var scratchRental = SequencePool.Shared.Rent()) + using (var scratchRental = options.Pool.Rent()) { var scratch = scratchRental.Value; MessagePackWriter scratchWriter = writer.Clone(scratch); @@ -119,7 +119,8 @@ public static byte[] Serialize(T value, MessagePackSerializerOptions options scratchArray = array = new byte[65536]; } - var msgpackWriter = new MessagePackWriter(SequencePool.Shared, array) + options = options ?? DefaultOptions; + var msgpackWriter = new MessagePackWriter(options.Pool, array) { CancellationToken = cancellationToken, }; @@ -137,8 +138,10 @@ public static byte[] Serialize(T value, MessagePackSerializerOptions options /// Thrown when any error occurs during serialization. public static void Serialize(Stream stream, T value, MessagePackSerializerOptions options = null, CancellationToken cancellationToken = default) { + options = options ?? DefaultOptions; cancellationToken.ThrowIfCancellationRequested(); - using (SequencePool.Rental sequenceRental = SequencePool.Shared.Rent()) + + using (SequencePool.Rental sequenceRental = options.Pool.Rent()) { Serialize(sequenceRental.Value, value, options, cancellationToken); @@ -168,8 +171,10 @@ public static void Serialize(Stream stream, T value, MessagePackSerializerOpt /// Thrown when any error occurs during serialization. public static async Task SerializeAsync(Stream stream, T value, MessagePackSerializerOptions options = null, CancellationToken cancellationToken = default) { + options = options ?? DefaultOptions; cancellationToken.ThrowIfCancellationRequested(); - using (SequencePool.Rental sequenceRental = SequencePool.Shared.Rent()) + + using (SequencePool.Rental sequenceRental = options.Pool.Rent()) { Serialize(sequenceRental.Value, value, options, cancellationToken); @@ -222,7 +227,7 @@ public static T Deserialize(ref MessagePackReader reader, MessagePackSerializ { if (options.Compression.IsCompression()) { - using (var msgPackUncompressedRental = SequencePool.Shared.Rent()) + using (var msgPackUncompressedRental = options.Pool.Rent()) { var msgPackUncompressed = msgPackUncompressedRental.Value; if (TryDecompress(ref reader, msgPackUncompressed)) @@ -315,12 +320,14 @@ public static T Deserialize(ReadOnlyMemory buffer, MessagePackSerialize /// public static T Deserialize(Stream stream, MessagePackSerializerOptions options = null, CancellationToken cancellationToken = default) { + options = options ?? DefaultOptions; + if (TryDeserializeFromMemoryStream(stream, options, cancellationToken, out T result)) { return result; } - using (var sequenceRental = SequencePool.Shared.Rent()) + using (var sequenceRental = options.Pool.Rent()) { var sequence = sequenceRental.Value; try @@ -362,12 +369,14 @@ public static T Deserialize(Stream stream, MessagePackSerializerOptions optio /// public static async ValueTask DeserializeAsync(Stream stream, MessagePackSerializerOptions options = null, CancellationToken cancellationToken = default) { + options = options ?? DefaultOptions; + if (TryDeserializeFromMemoryStream(stream, options, cancellationToken, out T result)) { return result; } - using (var sequenceRental = SequencePool.Shared.Rent()) + using (var sequenceRental = options.Pool.Rent()) { var sequence = sequenceRental.Value; try diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs index 8eb9835ef..2354e8ef1 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.Text.RegularExpressions; +using Nerdbank.Streams; namespace MessagePack { @@ -60,6 +61,7 @@ protected MessagePackSerializerOptions(MessagePackSerializerOptions copyFrom) this.OmitAssemblyVersion = copyFrom.OmitAssemblyVersion; this.AllowAssemblyVersionMismatch = copyFrom.AllowAssemblyVersionMismatch; this.Security = copyFrom.Security; + this.Pool = copyFrom.Pool; } /// @@ -113,6 +115,11 @@ protected MessagePackSerializerOptions(MessagePackSerializerOptions copyFrom) /// public MessagePackSecurity Security { get; private set; } = MessagePackSecurity.TrustedData; + /// + /// Gets a thread-safe pool of reusable objects. + /// + public SequencePool Pool { get; private set; } = new SequencePool(); + /// /// Gets a type given a string representation of the type. /// @@ -259,6 +266,23 @@ public MessagePackSerializerOptions WithSecurity(MessagePackSecurity security) return result; } + /// + /// Gets a copy of these options with the property set to a new value. + /// + /// The new value for the property. + /// The new instance. + public MessagePackSerializerOptions WithPool(SequencePool pool) + { + if (pool is null) + { + throw new ArgumentNullException(nameof(pool)); + } + + var result = this.Clone(); + result.Pool = pool; + return result; + } + /// /// Creates a clone of this instance with the same properties set. /// diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackStreamReader.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackStreamReader.cs index fb439ddc7..80d1ed38c 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackStreamReader.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackStreamReader.cs @@ -21,7 +21,7 @@ public partial class MessagePackStreamReader : IDisposable { private readonly Stream stream; private readonly bool leaveOpen; - private SequencePool.Rental sequenceRental = SequencePool.Shared.Rent(); + private SequencePool.Rental sequenceRental = MessagePackSerializer.DefaultOptions.Pool.Rent(); private SequencePosition? endOfLastMessage; /// diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/SequencePool.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/SequencePool.cs index bdfc073d3..734e6bed2 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/SequencePool.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/SequencePool.cs @@ -8,20 +8,16 @@ namespace MessagePack { +#if MESSAGEPACK_INTERNAL + internal +#else + public +#endif /// /// A thread-safe, alloc-free reusable object pool. /// - internal class SequencePool + class SequencePool { - /// - /// A thread-safe pool of reusable objects. - /// - /// - /// We use a that allows every processor to be involved in messagepack serialization concurrently, - /// plus one nested serialization per processor (since LZ4 and sometimes other nested serializations may exist). - /// - internal static readonly SequencePool Shared = new SequencePool(Environment.ProcessorCount * 2); - /// /// The value to use for . /// @@ -41,18 +37,41 @@ internal class SequencePool /// /// The array pool which we share with all objects created by this instance. /// + private readonly ArrayPool arrayPool; + + /// + /// Initializes a new instance of the class. + /// + /// + /// We use a that allows every processor to be involved in messagepack serialization concurrently, + /// plus one nested serialization per processor (since LZ4 and sometimes other nested serializations may exist). + /// + public SequencePool() + : this(Environment.ProcessorCount * 2, ArrayPool.Create(80 * 1024, 100)) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// The maximum size to allow the pool to grow. /// /// We allow 100 arrays to be shared (instead of the default 50) and reduce the max array length from the default 1MB to something more reasonable for our expected use. /// - private readonly ArrayPool arrayPool = ArrayPool.Create(80 * 1024, 100); + public SequencePool(int maxSize) + : this(maxSize, ArrayPool.Create(80 * 1024, 100)) + { + } /// /// Initializes a new instance of the class. /// /// The maximum size to allow the pool to grow. - internal SequencePool(int maxSize) + /// Array pool that will be used. + public SequencePool(int maxSize, ArrayPool arrayPool) { this.maxSize = maxSize; + this.arrayPool = arrayPool; } /// diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Utilities.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Utilities.cs index 8d5a4cfe8..0c3b4be02 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Utilities.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Utilities.cs @@ -20,11 +20,17 @@ internal static class Utilities internal static readonly bool IsMono = Type.GetType("Mono.Runtime") is Type; #endif +#if MESSAGEPACK_INTERNAL || DYNAMICCODEDUMPER + internal static SequencePool Pool { get; } = new SequencePool(); +#else + internal static SequencePool Pool => MessagePackSerializer.DefaultOptions.Pool; +#endif + internal delegate void GetWriterBytesAction(ref MessagePackWriter writer, TArg argument); internal static byte[] GetWriterBytes(TArg arg, GetWriterBytesAction action) { - using (var sequenceRental = SequencePool.Shared.Rent()) + using (var sequenceRental = Pool.Rent()) { var writer = new MessagePackWriter(sequenceRental.Value); action(ref writer, arg); diff --git a/src/MessagePack/PublicAPI.Unshipped.txt b/src/MessagePack/PublicAPI.Unshipped.txt index d31186945..30171cf09 100644 --- a/src/MessagePack/PublicAPI.Unshipped.txt +++ b/src/MessagePack/PublicAPI.Unshipped.txt @@ -73,6 +73,12 @@ MessagePack.ImmutableCollection.InterfaceImmutableSetFormatter.InterfaceImmut MessagePack.ImmutableCollection.InterfaceImmutableStackFormatter MessagePack.ImmutableCollection.InterfaceImmutableStackFormatter.InterfaceImmutableStackFormatter() -> void MessagePack.Resolvers.ExpandoObjectResolver +MessagePack.SequencePool +MessagePack.SequencePool.SequencePool() -> void +MessagePack.SequencePool.SequencePool(int maxSize) -> void +MessagePack.SequencePool.SequencePool(int maxSize, System.Buffers.ArrayPool arrayPool) -> void +MessagePack.MessagePackSerializerOptions.Pool.get -> MessagePack.SequencePool +MessagePack.MessagePackSerializerOptions.WithPool(MessagePack.SequencePool pool) -> MessagePack.MessagePackSerializerOptions override MessagePack.ImmutableCollection.ImmutableDictionaryFormatter.Add(System.Collections.Immutable.ImmutableDictionary.Builder collection, int index, TKey key, TValue value, MessagePack.MessagePackSerializerOptions options) -> void override MessagePack.ImmutableCollection.ImmutableDictionaryFormatter.Complete(System.Collections.Immutable.ImmutableDictionary.Builder intermediateCollection) -> System.Collections.Immutable.ImmutableDictionary override MessagePack.ImmutableCollection.ImmutableDictionaryFormatter.Create(int count, MessagePack.MessagePackSerializerOptions options) -> System.Collections.Immutable.ImmutableDictionary.Builder From b539b7b3e32273eb38e0d93192b57e474f8d776d Mon Sep 17 00:00:00 2001 From: Nirklav Date: Mon, 16 Nov 2020 14:57:36 +0200 Subject: [PATCH 014/161] XML comment was fixed; --- .../Assets/Scripts/MessagePack/SequencePool.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/SequencePool.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/SequencePool.cs index 734e6bed2..073d65071 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/SequencePool.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/SequencePool.cs @@ -8,14 +8,14 @@ namespace MessagePack { + /// + /// A thread-safe, alloc-free reusable object pool. + /// #if MESSAGEPACK_INTERNAL internal #else public #endif - /// - /// A thread-safe, alloc-free reusable object pool. - /// class SequencePool { /// From 7de6921cce32cbed933d0341804ee96df5c2d15f Mon Sep 17 00:00:00 2001 From: pCYSl5EDgo Date: Tue, 17 Nov 2020 16:02:16 +0900 Subject: [PATCH 015/161] Unify FormatterName And define FormatterNameWithoutNameSpace --- src/MessagePack.GeneratorCore/CodeAnalysis/Definitions.cs | 4 +++- src/MessagePack.GeneratorCore/Generator/FormatterTemplate.cs | 4 +--- src/MessagePack.GeneratorCore/Generator/FormatterTemplate.tt | 2 +- .../Generator/StringKey/StringKeyFormatterTemplate.cs | 3 +-- .../Generator/StringKey/StringKeyFormatterTemplate.tt | 3 +-- 5 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/MessagePack.GeneratorCore/CodeAnalysis/Definitions.cs b/src/MessagePack.GeneratorCore/CodeAnalysis/Definitions.cs index ab0534429..9e3b86899 100644 --- a/src/MessagePack.GeneratorCore/CodeAnalysis/Definitions.cs +++ b/src/MessagePack.GeneratorCore/CodeAnalysis/Definitions.cs @@ -52,7 +52,9 @@ public bool IsStruct public bool NeedsCastOnAfter { get; set; } - public string FormatterName => (this.Namespace == null ? this.Name : this.Namespace + "." + this.Name) + "Formatter" + (this.IsOpenGenericType ? $"<{string.Join(",", this.GenericTypeParameters.Select(x => x.Name))}>" : string.Empty); + public string FormatterName => this.Namespace == null ? FormatterNameWithoutNameSpace : this.Namespace + "." + FormatterNameWithoutNameSpace; + + public string FormatterNameWithoutNameSpace => this.Name + "Formatter" + (this.IsOpenGenericType ? $"<{string.Join(", ", this.GenericTypeParameters.Select(x => x.Name))}>" : string.Empty); public int WriteCount { diff --git a/src/MessagePack.GeneratorCore/Generator/FormatterTemplate.cs b/src/MessagePack.GeneratorCore/Generator/FormatterTemplate.cs index b114ee1ad..e153d5eb1 100644 --- a/src/MessagePack.GeneratorCore/Generator/FormatterTemplate.cs +++ b/src/MessagePack.GeneratorCore/Generator/FormatterTemplate.cs @@ -47,9 +47,7 @@ namespace "); foreach (var objInfo in ObjectSerializationInfos) { bool isFormatterResolverNecessary = ShouldUseFormatterResolverHelper.ShouldUseFormatterResolver(objInfo.Members); this.Write("\r\n public sealed class "); - this.Write(this.ToStringHelper.ToStringWithCulture(objInfo.Name)); - this.Write("Formatter"); - this.Write(this.ToStringHelper.ToStringWithCulture((objInfo.IsOpenGenericType ? $"<{string.Join(", ", objInfo.GenericTypeParameters.Select(x => x.Name))}>" : ""))); + this.Write(this.ToStringHelper.ToStringWithCulture(objInfo.FormatterNameWithoutNameSpace)); this.Write(" : global::MessagePack.Formatters.IMessagePackFormatter<"); this.Write(this.ToStringHelper.ToStringWithCulture(objInfo.FullName)); this.Write(">\r\n"); diff --git a/src/MessagePack.GeneratorCore/Generator/FormatterTemplate.tt b/src/MessagePack.GeneratorCore/Generator/FormatterTemplate.tt index d56d1d0af..631dc9f15 100644 --- a/src/MessagePack.GeneratorCore/Generator/FormatterTemplate.tt +++ b/src/MessagePack.GeneratorCore/Generator/FormatterTemplate.tt @@ -26,7 +26,7 @@ namespace <#= Namespace #> <# foreach (var objInfo in ObjectSerializationInfos) { bool isFormatterResolverNecessary = ShouldUseFormatterResolverHelper.ShouldUseFormatterResolver(objInfo.Members);#> - public sealed class <#= objInfo.Name #>Formatter<#= (objInfo.IsOpenGenericType ? $"<{string.Join(", ", objInfo.GenericTypeParameters.Select(x => x.Name))}>" : "") #> : global::MessagePack.Formatters.IMessagePackFormatter<<#= objInfo.FullName #>> + public sealed class <#= objInfo.FormatterNameWithoutNameSpace #> : global::MessagePack.Formatters.IMessagePackFormatter<<#= objInfo.FullName #>> <# foreach (var typeArg in objInfo.GenericTypeParameters.Where(x => x.HasConstraints)) { #> where <#= typeArg.Name #> : <#= typeArg.Constraints #> <# } #> diff --git a/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterTemplate.cs b/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterTemplate.cs index 39fef24af..521df4441 100644 --- a/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterTemplate.cs +++ b/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterTemplate.cs @@ -52,10 +52,9 @@ namespace "); list.Add(new ValueTuple(member, binary)); } - string formatterName = objInfo.Name + (objInfo.IsOpenGenericType ? $"Formatter<{string.Join(", ", objInfo.GenericTypeParameters.Select(x => x.Name))}>" : "Formatter"); bool isFormatterResolverNecessary = ShouldUseFormatterResolverHelper.ShouldUseFormatterResolver(objInfo.Members); this.Write("\r\n public sealed class "); - this.Write(this.ToStringHelper.ToStringWithCulture(formatterName)); + this.Write(this.ToStringHelper.ToStringWithCulture(objInfo.FormatterNameWithoutNameSpace)); this.Write(" : global::MessagePack.Formatters.IMessagePackFormatter<"); this.Write(this.ToStringHelper.ToStringWithCulture(objInfo.FullName)); this.Write(">\r\n"); diff --git a/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterTemplate.tt b/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterTemplate.tt index a7ce779bf..251fa55c4 100644 --- a/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterTemplate.tt +++ b/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterTemplate.tt @@ -32,10 +32,9 @@ foreach (var objInfo in ObjectSerializationInfos) { list.Add(new ValueTuple(member, binary)); } - string formatterName = objInfo.Name + (objInfo.IsOpenGenericType ? $"Formatter<{string.Join(", ", objInfo.GenericTypeParameters.Select(x => x.Name))}>" : "Formatter"); bool isFormatterResolverNecessary = ShouldUseFormatterResolverHelper.ShouldUseFormatterResolver(objInfo.Members); #> - public sealed class <#= formatterName #> : global::MessagePack.Formatters.IMessagePackFormatter<<#= objInfo.FullName #>> + public sealed class <#= objInfo.FormatterNameWithoutNameSpace #> : global::MessagePack.Formatters.IMessagePackFormatter<<#= objInfo.FullName #>> <# foreach (var typeArg in objInfo.GenericTypeParameters.Where(x => x.HasConstraints)) {#> where <#= typeArg.Name #> : <#= typeArg.Constraints #> <# }#> From cd7b43416b309a0f688155c157723b1b9fb76521 Mon Sep 17 00:00:00 2001 From: pCYSl5EDgo Date: Tue, 17 Nov 2020 16:02:43 +0900 Subject: [PATCH 016/161] Multiple Target Frameworks --- src/MessagePack.Generator/MessagePack.Generator.csproj | 4 ++-- .../MessagePack.GeneratorCore.csproj | 2 +- .../MessagePack.Generator.Tests.csproj | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/MessagePack.Generator/MessagePack.Generator.csproj b/src/MessagePack.Generator/MessagePack.Generator.csproj index bde486a06..0438acdb8 100644 --- a/src/MessagePack.Generator/MessagePack.Generator.csproj +++ b/src/MessagePack.Generator/MessagePack.Generator.csproj @@ -3,7 +3,7 @@ mpc Exe - netcoreapp3.1 + netcoreapp3.1;net5.0 8 enable true @@ -22,7 +22,7 @@ - + diff --git a/src/MessagePack.GeneratorCore/MessagePack.GeneratorCore.csproj b/src/MessagePack.GeneratorCore/MessagePack.GeneratorCore.csproj index 4be9ff608..866eff8d0 100644 --- a/src/MessagePack.GeneratorCore/MessagePack.GeneratorCore.csproj +++ b/src/MessagePack.GeneratorCore/MessagePack.GeneratorCore.csproj @@ -10,7 +10,7 @@ - + diff --git a/tests/MessagePack.Generator.Tests/MessagePack.Generator.Tests.csproj b/tests/MessagePack.Generator.Tests/MessagePack.Generator.Tests.csproj index 08a0c8028..05b646fe7 100644 --- a/tests/MessagePack.Generator.Tests/MessagePack.Generator.Tests.csproj +++ b/tests/MessagePack.Generator.Tests/MessagePack.Generator.Tests.csproj @@ -10,7 +10,7 @@ - + From cc07ead15ace096543bf7261c673e0b31806c472 Mon Sep 17 00:00:00 2001 From: pCYSl5EDgo Date: Tue, 17 Nov 2020 16:09:54 +0900 Subject: [PATCH 017/161] Revert "Multiple Target Frameworks" This reverts commit cd7b43416b309a0f688155c157723b1b9fb76521. --- src/MessagePack.Generator/MessagePack.Generator.csproj | 4 ++-- .../MessagePack.GeneratorCore.csproj | 2 +- .../MessagePack.Generator.Tests.csproj | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/MessagePack.Generator/MessagePack.Generator.csproj b/src/MessagePack.Generator/MessagePack.Generator.csproj index 0438acdb8..bde486a06 100644 --- a/src/MessagePack.Generator/MessagePack.Generator.csproj +++ b/src/MessagePack.Generator/MessagePack.Generator.csproj @@ -3,7 +3,7 @@ mpc Exe - netcoreapp3.1;net5.0 + netcoreapp3.1 8 enable true @@ -22,7 +22,7 @@ - + diff --git a/src/MessagePack.GeneratorCore/MessagePack.GeneratorCore.csproj b/src/MessagePack.GeneratorCore/MessagePack.GeneratorCore.csproj index 866eff8d0..4be9ff608 100644 --- a/src/MessagePack.GeneratorCore/MessagePack.GeneratorCore.csproj +++ b/src/MessagePack.GeneratorCore/MessagePack.GeneratorCore.csproj @@ -10,7 +10,7 @@ - + diff --git a/tests/MessagePack.Generator.Tests/MessagePack.Generator.Tests.csproj b/tests/MessagePack.Generator.Tests/MessagePack.Generator.Tests.csproj index 05b646fe7..08a0c8028 100644 --- a/tests/MessagePack.Generator.Tests/MessagePack.Generator.Tests.csproj +++ b/tests/MessagePack.Generator.Tests/MessagePack.Generator.Tests.csproj @@ -10,7 +10,7 @@ - + From 081056f2397cdc0e154deaf552915412d4f13de0 Mon Sep 17 00:00:00 2001 From: Nirklav Date: Wed, 18 Nov 2020 13:03:00 +0200 Subject: [PATCH 018/161] Issue with mutable static was fixed; Issue with metgod WithPool was fixed; --- .../MessagePack/MessagePackSerializer.Json.cs | 16 +++++----- .../MessagePackSerializerOptions.cs | 5 ++++ .../MessagePack/MessagePackStreamReader.cs | 29 ++++++++++++++++++- .../Scripts/MessagePack/SequencePool.cs | 5 ++++ .../Assets/Scripts/MessagePack/Utilities.cs | 8 +---- src/MessagePack/PublicAPI.Unshipped.txt | 2 ++ 6 files changed, 49 insertions(+), 16 deletions(-) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.Json.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.Json.cs index 014c49d99..d3ff8adbe 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.Json.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.Json.cs @@ -167,7 +167,7 @@ public static void ConvertFromJson(TextReader reader, ref MessagePackWriter writ MessagePackWriter scratchWriter = writer.Clone(scratchRental.Value); using (var jr = new TinyJsonReader(reader, false)) { - FromJsonCore(jr, ref scratchWriter); + FromJsonCore(jr, ref scratchWriter, options); } scratchWriter.Flush(); @@ -178,12 +178,12 @@ public static void ConvertFromJson(TextReader reader, ref MessagePackWriter writ { using (var jr = new TinyJsonReader(reader, false)) { - FromJsonCore(jr, ref writer); + FromJsonCore(jr, ref writer, options); } } } - private static uint FromJsonCore(TinyJsonReader jr, ref MessagePackWriter writer) + private static uint FromJsonCore(TinyJsonReader jr, ref MessagePackWriter writer, MessagePackSerializerOptions options) { uint count = 0; while (jr.Read()) @@ -194,10 +194,10 @@ private static uint FromJsonCore(TinyJsonReader jr, ref MessagePackWriter writer break; case TinyJsonToken.StartObject: // Set up a scratch area to serialize the collection since we don't know its length yet, which must be written first. - using (var scratchRental = DefaultOptions.Pool.Rent()) + using (var scratchRental = options.Pool.Rent()) { MessagePackWriter scratchWriter = writer.Clone(scratchRental.Value); - var mapCount = FromJsonCore(jr, ref scratchWriter); + var mapCount = FromJsonCore(jr, ref scratchWriter, options); scratchWriter.Flush(); mapCount = mapCount / 2; // remove propertyname string count. @@ -211,10 +211,10 @@ private static uint FromJsonCore(TinyJsonReader jr, ref MessagePackWriter writer return count; // break case TinyJsonToken.StartArray: // Set up a scratch area to serialize the collection since we don't know its length yet, which must be written first. - using (var scratchRental = DefaultOptions.Pool.Rent()) + using (var scratchRental = options.Pool.Rent()) { MessagePackWriter scratchWriter = writer.Clone(scratchRental.Value); - var arrayCount = FromJsonCore(jr, ref scratchWriter); + var arrayCount = FromJsonCore(jr, ref scratchWriter, options); scratchWriter.Flush(); writer.WriteArrayHeader(arrayCount); @@ -304,7 +304,7 @@ private static void ToJsonCore(ref MessagePackReader reader, TextWriter writer, WriteJsonString(reader.ReadString(), writer); break; case MessagePackType.Binary: - ArraySegment segment = ByteArraySegmentFormatter.Instance.Deserialize(ref reader, DefaultOptions); + ArraySegment segment = ByteArraySegmentFormatter.Instance.Deserialize(ref reader, options); writer.Write("\"" + Convert.ToBase64String(segment.Array, segment.Offset, segment.Count) + "\""); break; case MessagePackType.Array: diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs index 2354e8ef1..c61184ee8 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs @@ -278,6 +278,11 @@ public MessagePackSerializerOptions WithPool(SequencePool pool) throw new ArgumentNullException(nameof(pool)); } + if (this.Pool == pool) + { + return this; + } + var result = this.Clone(); result.Pool = pool; return result; diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackStreamReader.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackStreamReader.cs index 80d1ed38c..644cb2328 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackStreamReader.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackStreamReader.cs @@ -21,7 +21,7 @@ public partial class MessagePackStreamReader : IDisposable { private readonly Stream stream; private readonly bool leaveOpen; - private SequencePool.Rental sequenceRental = MessagePackSerializer.DefaultOptions.Pool.Rent(); + private SequencePool.Rental sequenceRental; private SequencePosition? endOfLastMessage; /// @@ -39,9 +39,36 @@ public MessagePackStreamReader(Stream stream) /// The stream to read from. /// If true, leaves the stream open after this is disposed; otherwise, false. public MessagePackStreamReader(Stream stream, bool leaveOpen) + : this(stream, SequencePool.Shared, leaveOpen) { + } + + /// + /// Initializes a new instance of the class. + /// + /// The stream to read from. This stream will be disposed of when this is disposed. + /// The pool to get result. + public MessagePackStreamReader(Stream stream, SequencePool pool) + : this(stream, pool, leaveOpen: false) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// The stream to read from. + /// The pool to get result. + /// If true, leaves the stream open after this is disposed; otherwise, false. + public MessagePackStreamReader(Stream stream, SequencePool pool, bool leaveOpen) + { + if (pool == null) + { + throw new ArgumentNullException(nameof(pool)); + } + this.stream = stream ?? throw new ArgumentNullException(nameof(stream)); this.leaveOpen = leaveOpen; + this.sequenceRental = pool.Rent(); } /// diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/SequencePool.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/SequencePool.cs index 073d65071..4857095d0 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/SequencePool.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/SequencePool.cs @@ -18,6 +18,11 @@ namespace MessagePack #endif class SequencePool { + /// + /// A thread-safe pool of reusable objects. + /// + internal static readonly SequencePool Shared = new SequencePool(); + /// /// The value to use for . /// diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Utilities.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Utilities.cs index 0c3b4be02..8d5a4cfe8 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Utilities.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Utilities.cs @@ -20,17 +20,11 @@ internal static class Utilities internal static readonly bool IsMono = Type.GetType("Mono.Runtime") is Type; #endif -#if MESSAGEPACK_INTERNAL || DYNAMICCODEDUMPER - internal static SequencePool Pool { get; } = new SequencePool(); -#else - internal static SequencePool Pool => MessagePackSerializer.DefaultOptions.Pool; -#endif - internal delegate void GetWriterBytesAction(ref MessagePackWriter writer, TArg argument); internal static byte[] GetWriterBytes(TArg arg, GetWriterBytesAction action) { - using (var sequenceRental = Pool.Rent()) + using (var sequenceRental = SequencePool.Shared.Rent()) { var writer = new MessagePackWriter(sequenceRental.Value); action(ref writer, arg); diff --git a/src/MessagePack/PublicAPI.Unshipped.txt b/src/MessagePack/PublicAPI.Unshipped.txt index 30171cf09..a00ba570c 100644 --- a/src/MessagePack/PublicAPI.Unshipped.txt +++ b/src/MessagePack/PublicAPI.Unshipped.txt @@ -72,6 +72,8 @@ MessagePack.ImmutableCollection.InterfaceImmutableSetFormatter MessagePack.ImmutableCollection.InterfaceImmutableSetFormatter.InterfaceImmutableSetFormatter() -> void MessagePack.ImmutableCollection.InterfaceImmutableStackFormatter MessagePack.ImmutableCollection.InterfaceImmutableStackFormatter.InterfaceImmutableStackFormatter() -> void +MessagePack.MessagePackStreamReader.MessagePackStreamReader(System.IO.Stream stream, MessagePack.SequencePool pool) -> void +MessagePack.MessagePackStreamReader.MessagePackStreamReader(System.IO.Stream stream, MessagePack.SequencePool pool, bool leaveOpen) -> void MessagePack.Resolvers.ExpandoObjectResolver MessagePack.SequencePool MessagePack.SequencePool.SequencePool() -> void From cf55ca970b9843829d1032c4054192944f294084 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 18 Nov 2020 17:06:30 -0700 Subject: [PATCH 019/161] Touch-up on API changes --- .../Formatters/CollectionFormatter.cs | 4 ++-- .../Formatters/TypelessFormatter.cs | 2 +- .../MessagePack/MessagePackSerializer.Json.cs | 12 +++++----- .../MessagePack/MessagePackSerializer.cs | 14 ++++++------ .../MessagePackSerializerOptions.cs | 13 ++++++----- .../MessagePack/MessagePackStreamReader.cs | 22 +++++-------------- .../Resolvers/DynamicObjectResolver.cs | 2 +- .../Assets/Scripts/MessagePack/Utilities.cs | 4 ++-- src/MessagePack/PublicAPI.Unshipped.txt | 5 ++--- 9 files changed, 34 insertions(+), 44 deletions(-) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/CollectionFormatter.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/CollectionFormatter.cs index 9bbaee41f..f6bf5d23f 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/CollectionFormatter.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/CollectionFormatter.cs @@ -346,7 +346,7 @@ public void Serialize(ref MessagePackWriter writer, TCollection value, MessagePa } else { - using (var scratchRental = options.Pool.Rent()) + using (var scratchRental = options.SequencePool.Rent()) { var scratch = scratchRental.Value; MessagePackWriter scratchWriter = writer.Clone(scratch); @@ -950,7 +950,7 @@ public void Serialize(ref MessagePackWriter writer, IEnumerable value, MessagePa IMessagePackFormatter formatter = options.Resolver.GetFormatterWithVerify(); - using (var scratchRental = options.Pool.Rent()) + using (var scratchRental = options.SequencePool.Rent()) { var scratch = scratchRental.Value; MessagePackWriter scratchWriter = writer.Clone(scratch); diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/TypelessFormatter.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/TypelessFormatter.cs index 250546409..488f6800c 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/TypelessFormatter.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/TypelessFormatter.cs @@ -202,7 +202,7 @@ public void Serialize(ref MessagePackWriter writer, object value, MessagePackSer } // mark will be written at the end, when size is known - using (var scratchRental = options.Pool.Rent()) + using (var scratchRental = options.SequencePool.Rent()) { MessagePackWriter scratchWriter = writer.Clone(scratchRental.Value); scratchWriter.WriteString(typeName); diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.Json.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.Json.cs index d3ff8adbe..1d6049579 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.Json.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.Json.cs @@ -23,7 +23,7 @@ public static void SerializeToJson(TextWriter textWriter, T obj, MessagePackS { options = options ?? DefaultOptions; - using (var sequenceRental = options.Pool.Rent()) + using (var sequenceRental = options.SequencePool.Rent()) { var msgpackWriter = new MessagePackWriter(sequenceRental.Value) { @@ -87,7 +87,7 @@ public static void ConvertToJson(ref MessagePackReader reader, TextWriter jsonWr { if (options.Compression.IsCompression()) { - using (var scratchRental = options.Pool.Rent()) + using (var scratchRental = options.SequencePool.Rent()) { if (TryDecompress(ref reader, scratchRental.Value)) { @@ -137,7 +137,7 @@ public static byte[] ConvertFromJson(string str, MessagePackSerializerOptions op { options = options ?? DefaultOptions; - using (var scratchRental = options.Pool.Rent()) + using (var scratchRental = options.SequencePool.Rent()) { var writer = new MessagePackWriter(scratchRental.Value) { @@ -162,7 +162,7 @@ public static void ConvertFromJson(TextReader reader, ref MessagePackWriter writ if (options.Compression.IsCompression()) { - using (var scratchRental = options.Pool.Rent()) + using (var scratchRental = options.SequencePool.Rent()) { MessagePackWriter scratchWriter = writer.Clone(scratchRental.Value); using (var jr = new TinyJsonReader(reader, false)) @@ -194,7 +194,7 @@ private static uint FromJsonCore(TinyJsonReader jr, ref MessagePackWriter writer break; case TinyJsonToken.StartObject: // Set up a scratch area to serialize the collection since we don't know its length yet, which must be written first. - using (var scratchRental = options.Pool.Rent()) + using (var scratchRental = options.SequencePool.Rent()) { MessagePackWriter scratchWriter = writer.Clone(scratchRental.Value); var mapCount = FromJsonCore(jr, ref scratchWriter, options); @@ -211,7 +211,7 @@ private static uint FromJsonCore(TinyJsonReader jr, ref MessagePackWriter writer return count; // break case TinyJsonToken.StartArray: // Set up a scratch area to serialize the collection since we don't know its length yet, which must be written first. - using (var scratchRental = options.Pool.Rent()) + using (var scratchRental = options.SequencePool.Rent()) { MessagePackWriter scratchWriter = writer.Clone(scratchRental.Value); var arrayCount = FromJsonCore(jr, ref scratchWriter, options); diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.cs index 372c8f301..0e0188cff 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.cs @@ -79,7 +79,7 @@ public static void Serialize(ref MessagePackWriter writer, T value, MessagePa { if (options.Compression.IsCompression() && !PrimitiveChecker.IsMessagePackFixedSizePrimitive) { - using (var scratchRental = options.Pool.Rent()) + using (var scratchRental = options.SequencePool.Rent()) { var scratch = scratchRental.Value; MessagePackWriter scratchWriter = writer.Clone(scratch); @@ -120,7 +120,7 @@ public static byte[] Serialize(T value, MessagePackSerializerOptions options } options = options ?? DefaultOptions; - var msgpackWriter = new MessagePackWriter(options.Pool, array) + var msgpackWriter = new MessagePackWriter(options.SequencePool, array) { CancellationToken = cancellationToken, }; @@ -141,7 +141,7 @@ public static void Serialize(Stream stream, T value, MessagePackSerializerOpt options = options ?? DefaultOptions; cancellationToken.ThrowIfCancellationRequested(); - using (SequencePool.Rental sequenceRental = options.Pool.Rent()) + using (SequencePool.Rental sequenceRental = options.SequencePool.Rent()) { Serialize(sequenceRental.Value, value, options, cancellationToken); @@ -174,7 +174,7 @@ public static async Task SerializeAsync(Stream stream, T value, MessagePackSe options = options ?? DefaultOptions; cancellationToken.ThrowIfCancellationRequested(); - using (SequencePool.Rental sequenceRental = options.Pool.Rent()) + using (SequencePool.Rental sequenceRental = options.SequencePool.Rent()) { Serialize(sequenceRental.Value, value, options, cancellationToken); @@ -227,7 +227,7 @@ public static T Deserialize(ref MessagePackReader reader, MessagePackSerializ { if (options.Compression.IsCompression()) { - using (var msgPackUncompressedRental = options.Pool.Rent()) + using (var msgPackUncompressedRental = options.SequencePool.Rent()) { var msgPackUncompressed = msgPackUncompressedRental.Value; if (TryDecompress(ref reader, msgPackUncompressed)) @@ -327,7 +327,7 @@ public static T Deserialize(Stream stream, MessagePackSerializerOptions optio return result; } - using (var sequenceRental = options.Pool.Rent()) + using (var sequenceRental = options.SequencePool.Rent()) { var sequence = sequenceRental.Value; try @@ -376,7 +376,7 @@ public static async ValueTask DeserializeAsync(Stream stream, MessagePackS return result; } - using (var sequenceRental = options.Pool.Rent()) + using (var sequenceRental = options.SequencePool.Rent()) { var sequence = sequenceRental.Value; try diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs index c61184ee8..f6cef8880 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs @@ -61,7 +61,7 @@ protected MessagePackSerializerOptions(MessagePackSerializerOptions copyFrom) this.OmitAssemblyVersion = copyFrom.OmitAssemblyVersion; this.AllowAssemblyVersionMismatch = copyFrom.AllowAssemblyVersionMismatch; this.Security = copyFrom.Security; - this.Pool = copyFrom.Pool; + this.SequencePool = copyFrom.SequencePool; } /// @@ -118,7 +118,8 @@ protected MessagePackSerializerOptions(MessagePackSerializerOptions copyFrom) /// /// Gets a thread-safe pool of reusable objects. /// - public SequencePool Pool { get; private set; } = new SequencePool(); + /// The default value is the instance. + public SequencePool SequencePool { get; private set; } = SequencePool.Shared; /// /// Gets a type given a string representation of the type. @@ -267,9 +268,9 @@ public MessagePackSerializerOptions WithSecurity(MessagePackSecurity security) } /// - /// Gets a copy of these options with the property set to a new value. + /// Gets a copy of these options with the property set to a new value. /// - /// The new value for the property. + /// The new value for the property. /// The new instance. public MessagePackSerializerOptions WithPool(SequencePool pool) { @@ -278,13 +279,13 @@ public MessagePackSerializerOptions WithPool(SequencePool pool) throw new ArgumentNullException(nameof(pool)); } - if (this.Pool == pool) + if (this.SequencePool == pool) { return this; } var result = this.Clone(); - result.Pool = pool; + result.SequencePool = pool; return result; } diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackStreamReader.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackStreamReader.cs index 644cb2328..b35af2698 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackStreamReader.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackStreamReader.cs @@ -39,17 +39,7 @@ public MessagePackStreamReader(Stream stream) /// The stream to read from. /// If true, leaves the stream open after this is disposed; otherwise, false. public MessagePackStreamReader(Stream stream, bool leaveOpen) - : this(stream, SequencePool.Shared, leaveOpen) - { - } - - /// - /// Initializes a new instance of the class. - /// - /// The stream to read from. This stream will be disposed of when this is disposed. - /// The pool to get result. - public MessagePackStreamReader(Stream stream, SequencePool pool) - : this(stream, pool, leaveOpen: false) + : this(stream, leaveOpen, SequencePool.Shared) { } @@ -57,18 +47,18 @@ public MessagePackStreamReader(Stream stream, SequencePool pool) /// Initializes a new instance of the class. /// /// The stream to read from. - /// The pool to get result. /// If true, leaves the stream open after this is disposed; otherwise, false. - public MessagePackStreamReader(Stream stream, SequencePool pool, bool leaveOpen) + /// The pool to rent a object from. + public MessagePackStreamReader(Stream stream, bool leaveOpen, SequencePool sequencePool) { - if (pool == null) + if (sequencePool == null) { - throw new ArgumentNullException(nameof(pool)); + throw new ArgumentNullException(nameof(sequencePool)); } this.stream = stream ?? throw new ArgumentNullException(nameof(stream)); this.leaveOpen = leaveOpen; - this.sequenceRental = pool.Rent(); + this.sequenceRental = sequencePool.Rent(); } /// diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs index 5dac5a32f..73af68261 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs @@ -475,7 +475,7 @@ public static object BuildFormatterToDynamicMethod(Type type, bool forceStringKe var i = 0; foreach (ObjectSerializationInfo.EmittableMember item in serializationInfo.Members.Where(x => x.IsReadable)) { - stringByteKeysField.Add(Utilities.GetWriterBytes(item.StringKey, (ref MessagePackWriter writer, string arg) => writer.Write(arg))); + stringByteKeysField.Add(Utilities.GetWriterBytes(item.StringKey, (ref MessagePackWriter writer, string arg) => writer.Write(arg), SequencePool.Shared)); i++; } } diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Utilities.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Utilities.cs index 8d5a4cfe8..d011ee4d3 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Utilities.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Utilities.cs @@ -22,9 +22,9 @@ internal static class Utilities internal delegate void GetWriterBytesAction(ref MessagePackWriter writer, TArg argument); - internal static byte[] GetWriterBytes(TArg arg, GetWriterBytesAction action) + internal static byte[] GetWriterBytes(TArg arg, GetWriterBytesAction action, SequencePool pool) { - using (var sequenceRental = SequencePool.Shared.Rent()) + using (var sequenceRental = pool.Rent()) { var writer = new MessagePackWriter(sequenceRental.Value); action(ref writer, arg); diff --git a/src/MessagePack/PublicAPI.Unshipped.txt b/src/MessagePack/PublicAPI.Unshipped.txt index a00ba570c..d5ec32ce3 100644 --- a/src/MessagePack/PublicAPI.Unshipped.txt +++ b/src/MessagePack/PublicAPI.Unshipped.txt @@ -72,14 +72,13 @@ MessagePack.ImmutableCollection.InterfaceImmutableSetFormatter MessagePack.ImmutableCollection.InterfaceImmutableSetFormatter.InterfaceImmutableSetFormatter() -> void MessagePack.ImmutableCollection.InterfaceImmutableStackFormatter MessagePack.ImmutableCollection.InterfaceImmutableStackFormatter.InterfaceImmutableStackFormatter() -> void -MessagePack.MessagePackStreamReader.MessagePackStreamReader(System.IO.Stream stream, MessagePack.SequencePool pool) -> void -MessagePack.MessagePackStreamReader.MessagePackStreamReader(System.IO.Stream stream, MessagePack.SequencePool pool, bool leaveOpen) -> void +MessagePack.MessagePackSerializerOptions.SequencePool.get -> MessagePack.SequencePool +MessagePack.MessagePackStreamReader.MessagePackStreamReader(System.IO.Stream stream, bool leaveOpen, MessagePack.SequencePool sequencePool) -> void MessagePack.Resolvers.ExpandoObjectResolver MessagePack.SequencePool MessagePack.SequencePool.SequencePool() -> void MessagePack.SequencePool.SequencePool(int maxSize) -> void MessagePack.SequencePool.SequencePool(int maxSize, System.Buffers.ArrayPool arrayPool) -> void -MessagePack.MessagePackSerializerOptions.Pool.get -> MessagePack.SequencePool MessagePack.MessagePackSerializerOptions.WithPool(MessagePack.SequencePool pool) -> MessagePack.MessagePackSerializerOptions override MessagePack.ImmutableCollection.ImmutableDictionaryFormatter.Add(System.Collections.Immutable.ImmutableDictionary.Builder collection, int index, TKey key, TValue value, MessagePack.MessagePackSerializerOptions options) -> void override MessagePack.ImmutableCollection.ImmutableDictionaryFormatter.Complete(System.Collections.Immutable.ImmutableDictionary.Builder intermediateCollection) -> System.Collections.Immutable.ImmutableDictionary From 5e29bced6d24f4433018d183ff390e50c3d7e9ab Mon Sep 17 00:00:00 2001 From: pCYSl5EDgo Date: Thu, 19 Nov 2020 16:44:21 +0900 Subject: [PATCH 020/161] Update dotnet version --- global.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global.json b/global.json index 11833de02..e6e7ee5c0 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "3.1.301", + "version": "5.0.100", "rollForward": "patch", "allowPrerelease": false } From 1caa7743eabb027275ec6094f5185930576fc7d2 Mon Sep 17 00:00:00 2001 From: pCYSl5EDgo Date: Thu, 19 Nov 2020 16:53:04 +0900 Subject: [PATCH 021/161] Target net5.0 --- sandbox/Sandbox/codegen.ps1 | 2 +- sandbox/TestData2/codegen.ps1 | 2 +- src/MessagePack.Generator/MessagePack.Generator.csproj | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sandbox/Sandbox/codegen.ps1 b/sandbox/Sandbox/codegen.ps1 index 6dd4f2335..2a595dee5 100644 --- a/sandbox/Sandbox/codegen.ps1 +++ b/sandbox/Sandbox/codegen.ps1 @@ -1 +1 @@ -dotnet run -p "$PSScriptRoot/../../src/MessagePack.Generator/MessagePack.Generator.csproj" -- -i "$PSScriptRoot/../SharedData/SharedData.csproj" -o "$PSScriptRoot/Generated.cs" +dotnet run -f "net5.0" -p "$PSScriptRoot/../../src/MessagePack.Generator/MessagePack.Generator.csproj" -- -i "$PSScriptRoot/../SharedData/SharedData.csproj" -o "$PSScriptRoot/Generated.cs" diff --git a/sandbox/TestData2/codegen.ps1 b/sandbox/TestData2/codegen.ps1 index 17ec27b26..d3af92697 100644 --- a/sandbox/TestData2/codegen.ps1 +++ b/sandbox/TestData2/codegen.ps1 @@ -1 +1 @@ -dotnet run -p "$PSScriptRoot/../../src/MessagePack.Generator/MessagePack.Generator.csproj" -- -i "$PSScriptRoot/TestData2.csproj" -o "$PSScriptRoot/Generated.cs" +dotnet run -f "net5.0" -p "$PSScriptRoot/../../src/MessagePack.Generator/MessagePack.Generator.csproj" -- -i "$PSScriptRoot/TestData2.csproj" -o "$PSScriptRoot/Generated.cs" diff --git a/src/MessagePack.Generator/MessagePack.Generator.csproj b/src/MessagePack.Generator/MessagePack.Generator.csproj index bde486a06..253bfd20c 100644 --- a/src/MessagePack.Generator/MessagePack.Generator.csproj +++ b/src/MessagePack.Generator/MessagePack.Generator.csproj @@ -3,8 +3,8 @@ mpc Exe - netcoreapp3.1 - 8 + netcoreapp3.1;net5.0 + 9 enable true true From 146d67599f96da9d0d23017187006cc83d1e073d Mon Sep 17 00:00:00 2001 From: pCYSl5EDgo Date: Thu, 19 Nov 2020 17:13:46 +0900 Subject: [PATCH 022/161] fix: nullable reference dir --- src/MessagePack.Generator/PseudoCompilation.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MessagePack.Generator/PseudoCompilation.cs b/src/MessagePack.Generator/PseudoCompilation.cs index a8daeacb8..80d5a1ed2 100644 --- a/src/MessagePack.Generator/PseudoCompilation.cs +++ b/src/MessagePack.Generator/PseudoCompilation.cs @@ -91,7 +91,7 @@ private static List GetStandardReferences() .Distinct() .ToList(); - var dir = new FileInfo(typeof(object).Assembly.Location).Directory; + var dir = new FileInfo(typeof(object).Assembly.Location).Directory ?? throw new NullReferenceException("Assembly location directory not found!"); { var path = Path.Combine(dir.FullName, "netstandard.dll"); if (File.Exists(path)) From 071d17cc04dd6cd10b7b60b9c8d134fd8a8db287 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 19 Nov 2020 08:07:12 -0700 Subject: [PATCH 023/161] Fix up PublicAPI for net5.0 unique type For this to work, since we now expose public API uniquely per framework, I had to split the PublicAPI files per framework as well. --- src/MessagePack/MessagePack.csproj | 10 +- .../{ => net5.0}/PublicAPI.Shipped.txt | 0 .../net5.0/PublicAPI.Unshipped.txt | 131 +++ .../netcoreapp2.1/PublicAPI.Shipped.txt | 1025 +++++++++++++++++ .../PublicAPI.Unshipped.txt | 0 .../netstandard2.0/PublicAPI.Shipped.txt | 1025 +++++++++++++++++ .../netstandard2.0/PublicAPI.Unshipped.txt | 127 ++ 7 files changed, 2311 insertions(+), 7 deletions(-) rename src/MessagePack/{ => net5.0}/PublicAPI.Shipped.txt (100%) create mode 100644 src/MessagePack/net5.0/PublicAPI.Unshipped.txt create mode 100644 src/MessagePack/netcoreapp2.1/PublicAPI.Shipped.txt rename src/MessagePack/{ => netcoreapp2.1}/PublicAPI.Unshipped.txt (100%) create mode 100644 src/MessagePack/netstandard2.0/PublicAPI.Shipped.txt create mode 100644 src/MessagePack/netstandard2.0/PublicAPI.Unshipped.txt diff --git a/src/MessagePack/MessagePack.csproj b/src/MessagePack/MessagePack.csproj index 026259cc7..2c97b903c 100644 --- a/src/MessagePack/MessagePack.csproj +++ b/src/MessagePack/MessagePack.csproj @@ -16,11 +16,7 @@ - + @@ -28,8 +24,8 @@ - - + + diff --git a/src/MessagePack/PublicAPI.Shipped.txt b/src/MessagePack/net5.0/PublicAPI.Shipped.txt similarity index 100% rename from src/MessagePack/PublicAPI.Shipped.txt rename to src/MessagePack/net5.0/PublicAPI.Shipped.txt diff --git a/src/MessagePack/net5.0/PublicAPI.Unshipped.txt b/src/MessagePack/net5.0/PublicAPI.Unshipped.txt new file mode 100644 index 000000000..293b60a86 --- /dev/null +++ b/src/MessagePack/net5.0/PublicAPI.Unshipped.txt @@ -0,0 +1,131 @@ +MessagePack.Formatters.ByteMemoryFormatter +MessagePack.Formatters.ByteMemoryFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Memory +MessagePack.Formatters.ByteMemoryFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Memory value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ByteReadOnlyMemoryFormatter +MessagePack.Formatters.ByteReadOnlyMemoryFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.ReadOnlyMemory +MessagePack.Formatters.ByteReadOnlyMemoryFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.ReadOnlyMemory value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ByteReadOnlySequenceFormatter +MessagePack.Formatters.ByteReadOnlySequenceFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Buffers.ReadOnlySequence +MessagePack.Formatters.ByteReadOnlySequenceFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Buffers.ReadOnlySequence value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ExpandoObjectFormatter +MessagePack.Formatters.ExpandoObjectFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Dynamic.ExpandoObject +MessagePack.Formatters.ExpandoObjectFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Dynamic.ExpandoObject value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ForceTypelessFormatter +MessagePack.Formatters.ForceTypelessFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> T +MessagePack.Formatters.ForceTypelessFormatter.ForceTypelessFormatter() -> void +MessagePack.Formatters.ForceTypelessFormatter.Serialize(ref MessagePack.MessagePackWriter writer, T value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.HalfFormatter +MessagePack.Formatters.HalfFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Half +MessagePack.Formatters.HalfFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Half value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.MemoryFormatter +MessagePack.Formatters.MemoryFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Memory +MessagePack.Formatters.MemoryFormatter.MemoryFormatter() -> void +MessagePack.Formatters.MemoryFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Memory value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NonGenericInterfaceCollectionFormatter +MessagePack.Formatters.NonGenericInterfaceCollectionFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Collections.ICollection +MessagePack.Formatters.NonGenericInterfaceCollectionFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Collections.ICollection value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NonGenericInterfaceEnumerableFormatter +MessagePack.Formatters.NonGenericInterfaceEnumerableFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Collections.IEnumerable +MessagePack.Formatters.NonGenericInterfaceEnumerableFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Collections.IEnumerable value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.PrimitiveObjectFormatter.PrimitiveObjectFormatter() -> void +MessagePack.Formatters.ReadOnlyMemoryFormatter +MessagePack.Formatters.ReadOnlyMemoryFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.ReadOnlyMemory +MessagePack.Formatters.ReadOnlyMemoryFormatter.ReadOnlyMemoryFormatter() -> void +MessagePack.Formatters.ReadOnlyMemoryFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.ReadOnlyMemory value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ReadOnlySequenceFormatter +MessagePack.Formatters.ReadOnlySequenceFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Buffers.ReadOnlySequence +MessagePack.Formatters.ReadOnlySequenceFormatter.ReadOnlySequenceFormatter() -> void +MessagePack.Formatters.ReadOnlySequenceFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Buffers.ReadOnlySequence value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.TypeFormatter +MessagePack.Formatters.TypeFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> T +MessagePack.Formatters.TypeFormatter.Serialize(ref MessagePack.MessagePackWriter writer, T value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.TypelessFormatter.TypelessFormatter() -> void +MessagePack.ImmutableCollection.ImmutableArrayFormatter +MessagePack.ImmutableCollection.ImmutableArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Collections.Immutable.ImmutableArray +MessagePack.ImmutableCollection.ImmutableArrayFormatter.ImmutableArrayFormatter() -> void +MessagePack.ImmutableCollection.ImmutableArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Collections.Immutable.ImmutableArray value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.ImmutableCollection.ImmutableCollectionResolver +MessagePack.ImmutableCollection.ImmutableCollectionResolver.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter +MessagePack.ImmutableCollection.ImmutableDictionaryFormatter +MessagePack.ImmutableCollection.ImmutableDictionaryFormatter.ImmutableDictionaryFormatter() -> void +MessagePack.ImmutableCollection.ImmutableHashSetFormatter +MessagePack.ImmutableCollection.ImmutableHashSetFormatter.ImmutableHashSetFormatter() -> void +MessagePack.ImmutableCollection.ImmutableListFormatter +MessagePack.ImmutableCollection.ImmutableListFormatter.ImmutableListFormatter() -> void +MessagePack.ImmutableCollection.ImmutableQueueBuilder +MessagePack.ImmutableCollection.ImmutableQueueBuilder.Add(T value) -> void +MessagePack.ImmutableCollection.ImmutableQueueBuilder.ImmutableQueueBuilder() -> void +MessagePack.ImmutableCollection.ImmutableQueueBuilder.Q.get -> System.Collections.Immutable.ImmutableQueue +MessagePack.ImmutableCollection.ImmutableQueueBuilder.Q.set -> void +MessagePack.ImmutableCollection.ImmutableQueueFormatter +MessagePack.ImmutableCollection.ImmutableQueueFormatter.ImmutableQueueFormatter() -> void +MessagePack.ImmutableCollection.ImmutableSortedDictionaryFormatter +MessagePack.ImmutableCollection.ImmutableSortedDictionaryFormatter.ImmutableSortedDictionaryFormatter() -> void +MessagePack.ImmutableCollection.ImmutableSortedSetFormatter +MessagePack.ImmutableCollection.ImmutableSortedSetFormatter.ImmutableSortedSetFormatter() -> void +MessagePack.ImmutableCollection.ImmutableStackFormatter +MessagePack.ImmutableCollection.ImmutableStackFormatter.ImmutableStackFormatter() -> void +MessagePack.ImmutableCollection.InterfaceImmutableDictionaryFormatter +MessagePack.ImmutableCollection.InterfaceImmutableDictionaryFormatter.InterfaceImmutableDictionaryFormatter() -> void +MessagePack.ImmutableCollection.InterfaceImmutableListFormatter +MessagePack.ImmutableCollection.InterfaceImmutableListFormatter.InterfaceImmutableListFormatter() -> void +MessagePack.ImmutableCollection.InterfaceImmutableQueueFormatter +MessagePack.ImmutableCollection.InterfaceImmutableQueueFormatter.InterfaceImmutableQueueFormatter() -> void +MessagePack.ImmutableCollection.InterfaceImmutableSetFormatter +MessagePack.ImmutableCollection.InterfaceImmutableSetFormatter.InterfaceImmutableSetFormatter() -> void +MessagePack.ImmutableCollection.InterfaceImmutableStackFormatter +MessagePack.ImmutableCollection.InterfaceImmutableStackFormatter.InterfaceImmutableStackFormatter() -> void +MessagePack.Resolvers.ExpandoObjectResolver +override MessagePack.ImmutableCollection.ImmutableDictionaryFormatter.Add(System.Collections.Immutable.ImmutableDictionary.Builder collection, int index, TKey key, TValue value, MessagePack.MessagePackSerializerOptions options) -> void +override MessagePack.ImmutableCollection.ImmutableDictionaryFormatter.Complete(System.Collections.Immutable.ImmutableDictionary.Builder intermediateCollection) -> System.Collections.Immutable.ImmutableDictionary +override MessagePack.ImmutableCollection.ImmutableDictionaryFormatter.Create(int count, MessagePack.MessagePackSerializerOptions options) -> System.Collections.Immutable.ImmutableDictionary.Builder +override MessagePack.ImmutableCollection.ImmutableDictionaryFormatter.GetSourceEnumerator(System.Collections.Immutable.ImmutableDictionary source) -> System.Collections.Immutable.ImmutableDictionary.Enumerator +override MessagePack.ImmutableCollection.ImmutableHashSetFormatter.Add(System.Collections.Immutable.ImmutableHashSet.Builder collection, int index, T value, MessagePack.MessagePackSerializerOptions options) -> void +override MessagePack.ImmutableCollection.ImmutableHashSetFormatter.Complete(System.Collections.Immutable.ImmutableHashSet.Builder intermediateCollection) -> System.Collections.Immutable.ImmutableHashSet +override MessagePack.ImmutableCollection.ImmutableHashSetFormatter.Create(int count, MessagePack.MessagePackSerializerOptions options) -> System.Collections.Immutable.ImmutableHashSet.Builder +override MessagePack.ImmutableCollection.ImmutableHashSetFormatter.GetSourceEnumerator(System.Collections.Immutable.ImmutableHashSet source) -> System.Collections.Immutable.ImmutableHashSet.Enumerator +override MessagePack.ImmutableCollection.ImmutableListFormatter.Add(System.Collections.Immutable.ImmutableList.Builder collection, int index, T value, MessagePack.MessagePackSerializerOptions options) -> void +override MessagePack.ImmutableCollection.ImmutableListFormatter.Complete(System.Collections.Immutable.ImmutableList.Builder intermediateCollection) -> System.Collections.Immutable.ImmutableList +override MessagePack.ImmutableCollection.ImmutableListFormatter.Create(int count, MessagePack.MessagePackSerializerOptions options) -> System.Collections.Immutable.ImmutableList.Builder +override MessagePack.ImmutableCollection.ImmutableListFormatter.GetSourceEnumerator(System.Collections.Immutable.ImmutableList source) -> System.Collections.Immutable.ImmutableList.Enumerator +override MessagePack.ImmutableCollection.ImmutableQueueFormatter.Add(MessagePack.ImmutableCollection.ImmutableQueueBuilder collection, int index, T value, MessagePack.MessagePackSerializerOptions options) -> void +override MessagePack.ImmutableCollection.ImmutableQueueFormatter.Complete(MessagePack.ImmutableCollection.ImmutableQueueBuilder intermediateCollection) -> System.Collections.Immutable.ImmutableQueue +override MessagePack.ImmutableCollection.ImmutableQueueFormatter.Create(int count, MessagePack.MessagePackSerializerOptions options) -> MessagePack.ImmutableCollection.ImmutableQueueBuilder +override MessagePack.ImmutableCollection.ImmutableSortedDictionaryFormatter.Add(System.Collections.Immutable.ImmutableSortedDictionary.Builder collection, int index, TKey key, TValue value, MessagePack.MessagePackSerializerOptions options) -> void +override MessagePack.ImmutableCollection.ImmutableSortedDictionaryFormatter.Complete(System.Collections.Immutable.ImmutableSortedDictionary.Builder intermediateCollection) -> System.Collections.Immutable.ImmutableSortedDictionary +override MessagePack.ImmutableCollection.ImmutableSortedDictionaryFormatter.Create(int count, MessagePack.MessagePackSerializerOptions options) -> System.Collections.Immutable.ImmutableSortedDictionary.Builder +override MessagePack.ImmutableCollection.ImmutableSortedDictionaryFormatter.GetSourceEnumerator(System.Collections.Immutable.ImmutableSortedDictionary source) -> System.Collections.Immutable.ImmutableSortedDictionary.Enumerator +override MessagePack.ImmutableCollection.ImmutableSortedSetFormatter.Add(System.Collections.Immutable.ImmutableSortedSet.Builder collection, int index, T value, MessagePack.MessagePackSerializerOptions options) -> void +override MessagePack.ImmutableCollection.ImmutableSortedSetFormatter.Complete(System.Collections.Immutable.ImmutableSortedSet.Builder intermediateCollection) -> System.Collections.Immutable.ImmutableSortedSet +override MessagePack.ImmutableCollection.ImmutableSortedSetFormatter.Create(int count, MessagePack.MessagePackSerializerOptions options) -> System.Collections.Immutable.ImmutableSortedSet.Builder +override MessagePack.ImmutableCollection.ImmutableSortedSetFormatter.GetSourceEnumerator(System.Collections.Immutable.ImmutableSortedSet source) -> System.Collections.Immutable.ImmutableSortedSet.Enumerator +override MessagePack.ImmutableCollection.ImmutableStackFormatter.Add(T[] collection, int index, T value, MessagePack.MessagePackSerializerOptions options) -> void +override MessagePack.ImmutableCollection.ImmutableStackFormatter.Complete(T[] intermediateCollection) -> System.Collections.Immutable.ImmutableStack +override MessagePack.ImmutableCollection.ImmutableStackFormatter.Create(int count, MessagePack.MessagePackSerializerOptions options) -> T[] +override MessagePack.ImmutableCollection.InterfaceImmutableDictionaryFormatter.Add(System.Collections.Immutable.ImmutableDictionary.Builder collection, int index, TKey key, TValue value, MessagePack.MessagePackSerializerOptions options) -> void +override MessagePack.ImmutableCollection.InterfaceImmutableDictionaryFormatter.Complete(System.Collections.Immutable.ImmutableDictionary.Builder intermediateCollection) -> System.Collections.Immutable.IImmutableDictionary +override MessagePack.ImmutableCollection.InterfaceImmutableDictionaryFormatter.Create(int count, MessagePack.MessagePackSerializerOptions options) -> System.Collections.Immutable.ImmutableDictionary.Builder +override MessagePack.ImmutableCollection.InterfaceImmutableListFormatter.Add(System.Collections.Immutable.ImmutableList.Builder collection, int index, T value, MessagePack.MessagePackSerializerOptions options) -> void +override MessagePack.ImmutableCollection.InterfaceImmutableListFormatter.Complete(System.Collections.Immutable.ImmutableList.Builder intermediateCollection) -> System.Collections.Immutable.IImmutableList +override MessagePack.ImmutableCollection.InterfaceImmutableListFormatter.Create(int count, MessagePack.MessagePackSerializerOptions options) -> System.Collections.Immutable.ImmutableList.Builder +override MessagePack.ImmutableCollection.InterfaceImmutableQueueFormatter.Add(MessagePack.ImmutableCollection.ImmutableQueueBuilder collection, int index, T value, MessagePack.MessagePackSerializerOptions options) -> void +override MessagePack.ImmutableCollection.InterfaceImmutableQueueFormatter.Complete(MessagePack.ImmutableCollection.ImmutableQueueBuilder intermediateCollection) -> System.Collections.Immutable.IImmutableQueue +override MessagePack.ImmutableCollection.InterfaceImmutableQueueFormatter.Create(int count, MessagePack.MessagePackSerializerOptions options) -> MessagePack.ImmutableCollection.ImmutableQueueBuilder +override MessagePack.ImmutableCollection.InterfaceImmutableSetFormatter.Add(System.Collections.Immutable.ImmutableHashSet.Builder collection, int index, T value, MessagePack.MessagePackSerializerOptions options) -> void +override MessagePack.ImmutableCollection.InterfaceImmutableSetFormatter.Complete(System.Collections.Immutable.ImmutableHashSet.Builder intermediateCollection) -> System.Collections.Immutable.IImmutableSet +override MessagePack.ImmutableCollection.InterfaceImmutableSetFormatter.Create(int count, MessagePack.MessagePackSerializerOptions options) -> System.Collections.Immutable.ImmutableHashSet.Builder +override MessagePack.ImmutableCollection.InterfaceImmutableStackFormatter.Add(T[] collection, int index, T value, MessagePack.MessagePackSerializerOptions options) -> void +override MessagePack.ImmutableCollection.InterfaceImmutableStackFormatter.Complete(T[] intermediateCollection) -> System.Collections.Immutable.IImmutableStack +override MessagePack.ImmutableCollection.InterfaceImmutableStackFormatter.Create(int count, MessagePack.MessagePackSerializerOptions options) -> T[] +static readonly MessagePack.Formatters.ByteMemoryFormatter.Instance -> MessagePack.Formatters.ByteMemoryFormatter +static readonly MessagePack.Formatters.ByteReadOnlyMemoryFormatter.Instance -> MessagePack.Formatters.ByteReadOnlyMemoryFormatter +static readonly MessagePack.Formatters.ByteReadOnlySequenceFormatter.Instance -> MessagePack.Formatters.ByteReadOnlySequenceFormatter +static readonly MessagePack.Formatters.ExpandoObjectFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter +static readonly MessagePack.Formatters.HalfFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter +static readonly MessagePack.Formatters.NonGenericInterfaceCollectionFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter +static readonly MessagePack.Formatters.NonGenericInterfaceEnumerableFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter +static readonly MessagePack.Formatters.TypeFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter +static readonly MessagePack.ImmutableCollection.ImmutableCollectionResolver.Instance -> MessagePack.ImmutableCollection.ImmutableCollectionResolver +static readonly MessagePack.Resolvers.ExpandoObjectResolver.Instance -> MessagePack.IFormatterResolver +static readonly MessagePack.Resolvers.ExpandoObjectResolver.Options -> MessagePack.MessagePackSerializerOptions +virtual MessagePack.Formatters.PrimitiveObjectFormatter.DeserializeMap(ref MessagePack.MessagePackReader reader, int length, MessagePack.MessagePackSerializerOptions options) -> object diff --git a/src/MessagePack/netcoreapp2.1/PublicAPI.Shipped.txt b/src/MessagePack/netcoreapp2.1/PublicAPI.Shipped.txt new file mode 100644 index 000000000..055787782 --- /dev/null +++ b/src/MessagePack/netcoreapp2.1/PublicAPI.Shipped.txt @@ -0,0 +1,1025 @@ +MessagePack.ExtensionHeader +MessagePack.ExtensionHeader.ExtensionHeader(sbyte typeCode, int length) -> void +MessagePack.ExtensionHeader.ExtensionHeader(sbyte typeCode, uint length) -> void +MessagePack.ExtensionHeader.Length.get -> uint +MessagePack.ExtensionHeader.TypeCode.get -> sbyte +MessagePack.ExtensionResult +MessagePack.ExtensionResult.Data.get -> System.Buffers.ReadOnlySequence +MessagePack.ExtensionResult.ExtensionResult(sbyte typeCode, System.Buffers.ReadOnlySequence data) -> void +MessagePack.ExtensionResult.ExtensionResult(sbyte typeCode, System.Memory data) -> void +MessagePack.ExtensionResult.Header.get -> MessagePack.ExtensionHeader +MessagePack.ExtensionResult.TypeCode.get -> sbyte +MessagePack.FormatterNotRegisteredException +MessagePack.FormatterNotRegisteredException.FormatterNotRegisteredException(string message) -> void +MessagePack.FormatterResolverExtensions +MessagePack.Formatters.ArrayFormatter +MessagePack.Formatters.ArrayFormatter.ArrayFormatter() -> void +MessagePack.Formatters.ArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> T[] +MessagePack.Formatters.ArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, T[] value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ArraySegmentFormatter +MessagePack.Formatters.ArraySegmentFormatter.ArraySegmentFormatter() -> void +MessagePack.Formatters.ArraySegmentFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.ArraySegment +MessagePack.Formatters.ArraySegmentFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.ArraySegment value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.BigIntegerFormatter +MessagePack.Formatters.BigIntegerFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Numerics.BigInteger +MessagePack.Formatters.BigIntegerFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Numerics.BigInteger value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.BitArrayFormatter +MessagePack.Formatters.BitArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Collections.BitArray +MessagePack.Formatters.BitArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Collections.BitArray value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.BooleanArrayFormatter +MessagePack.Formatters.BooleanArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> bool[] +MessagePack.Formatters.BooleanArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, bool[] value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.BooleanFormatter +MessagePack.Formatters.BooleanFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> bool +MessagePack.Formatters.BooleanFormatter.Serialize(ref MessagePack.MessagePackWriter writer, bool value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ByteArrayFormatter +MessagePack.Formatters.ByteArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> byte[] +MessagePack.Formatters.ByteArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, byte[] value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ByteArraySegmentFormatter +MessagePack.Formatters.ByteArraySegmentFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.ArraySegment +MessagePack.Formatters.ByteArraySegmentFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.ArraySegment value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ByteFormatter +MessagePack.Formatters.ByteFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> byte +MessagePack.Formatters.ByteFormatter.Serialize(ref MessagePack.MessagePackWriter writer, byte value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.CharArrayFormatter +MessagePack.Formatters.CharArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> char[] +MessagePack.Formatters.CharArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, char[] value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.CharFormatter +MessagePack.Formatters.CharFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> char +MessagePack.Formatters.CharFormatter.Serialize(ref MessagePack.MessagePackWriter writer, char value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.CollectionFormatterBase +MessagePack.Formatters.CollectionFormatterBase.CollectionFormatterBase() -> void +MessagePack.Formatters.CollectionFormatterBase +MessagePack.Formatters.CollectionFormatterBase.CollectionFormatterBase() -> void +MessagePack.Formatters.CollectionFormatterBase +MessagePack.Formatters.CollectionFormatterBase.CollectionFormatterBase() -> void +MessagePack.Formatters.CollectionFormatterBase.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> TCollection +MessagePack.Formatters.CollectionFormatterBase.Serialize(ref MessagePack.MessagePackWriter writer, TCollection value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ComplexFormatter +MessagePack.Formatters.ComplexFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Numerics.Complex +MessagePack.Formatters.ComplexFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Numerics.Complex value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ConcurrentBagFormatter +MessagePack.Formatters.ConcurrentBagFormatter.ConcurrentBagFormatter() -> void +MessagePack.Formatters.ConcurrentDictionaryFormatter +MessagePack.Formatters.ConcurrentDictionaryFormatter.ConcurrentDictionaryFormatter() -> void +MessagePack.Formatters.ConcurrentQueueFormatter +MessagePack.Formatters.ConcurrentQueueFormatter.ConcurrentQueueFormatter() -> void +MessagePack.Formatters.ConcurrentStackFormatter +MessagePack.Formatters.ConcurrentStackFormatter.ConcurrentStackFormatter() -> void +MessagePack.Formatters.DateTimeArrayFormatter +MessagePack.Formatters.DateTimeArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.DateTime[] +MessagePack.Formatters.DateTimeArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.DateTime[] value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.DateTimeFormatter +MessagePack.Formatters.DateTimeFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.DateTime +MessagePack.Formatters.DateTimeFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.DateTime value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.DateTimeOffsetFormatter +MessagePack.Formatters.DateTimeOffsetFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.DateTimeOffset +MessagePack.Formatters.DateTimeOffsetFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.DateTimeOffset value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.DecimalFormatter +MessagePack.Formatters.DecimalFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> decimal +MessagePack.Formatters.DecimalFormatter.Serialize(ref MessagePack.MessagePackWriter writer, decimal value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.DictionaryFormatter +MessagePack.Formatters.DictionaryFormatter.DictionaryFormatter() -> void +MessagePack.Formatters.DictionaryFormatterBase +MessagePack.Formatters.DictionaryFormatterBase.DictionaryFormatterBase() -> void +MessagePack.Formatters.DictionaryFormatterBase +MessagePack.Formatters.DictionaryFormatterBase.DictionaryFormatterBase() -> void +MessagePack.Formatters.DictionaryFormatterBase +MessagePack.Formatters.DictionaryFormatterBase.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> TDictionary +MessagePack.Formatters.DictionaryFormatterBase.DictionaryFormatterBase() -> void +MessagePack.Formatters.DictionaryFormatterBase.Serialize(ref MessagePack.MessagePackWriter writer, TDictionary value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.DoubleArrayFormatter +MessagePack.Formatters.DoubleArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> double[] +MessagePack.Formatters.DoubleArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, double[] value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.DoubleFormatter +MessagePack.Formatters.DoubleFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> double +MessagePack.Formatters.DoubleFormatter.Serialize(ref MessagePack.MessagePackWriter writer, double value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.DynamicObjectTypeFallbackFormatter +MessagePack.Formatters.DynamicObjectTypeFallbackFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> object +MessagePack.Formatters.DynamicObjectTypeFallbackFormatter.Serialize(ref MessagePack.MessagePackWriter writer, object value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.EnumAsStringFormatter +MessagePack.Formatters.EnumAsStringFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> T +MessagePack.Formatters.EnumAsStringFormatter.EnumAsStringFormatter() -> void +MessagePack.Formatters.EnumAsStringFormatter.Serialize(ref MessagePack.MessagePackWriter writer, T value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ForceByteBlockFormatter +MessagePack.Formatters.ForceByteBlockFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> byte +MessagePack.Formatters.ForceByteBlockFormatter.Serialize(ref MessagePack.MessagePackWriter writer, byte value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ForceInt16BlockArrayFormatter +MessagePack.Formatters.ForceInt16BlockArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> short[] +MessagePack.Formatters.ForceInt16BlockArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, short[] value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ForceInt16BlockFormatter +MessagePack.Formatters.ForceInt16BlockFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> short +MessagePack.Formatters.ForceInt16BlockFormatter.Serialize(ref MessagePack.MessagePackWriter writer, short value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ForceInt32BlockArrayFormatter +MessagePack.Formatters.ForceInt32BlockArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> int[] +MessagePack.Formatters.ForceInt32BlockArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, int[] value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ForceInt32BlockFormatter +MessagePack.Formatters.ForceInt32BlockFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> int +MessagePack.Formatters.ForceInt32BlockFormatter.Serialize(ref MessagePack.MessagePackWriter writer, int value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ForceInt64BlockArrayFormatter +MessagePack.Formatters.ForceInt64BlockArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> long[] +MessagePack.Formatters.ForceInt64BlockArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, long[] value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ForceInt64BlockFormatter +MessagePack.Formatters.ForceInt64BlockFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> long +MessagePack.Formatters.ForceInt64BlockFormatter.Serialize(ref MessagePack.MessagePackWriter writer, long value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ForceSByteBlockArrayFormatter +MessagePack.Formatters.ForceSByteBlockArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> sbyte[] +MessagePack.Formatters.ForceSByteBlockArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, sbyte[] value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ForceSByteBlockFormatter +MessagePack.Formatters.ForceSByteBlockFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> sbyte +MessagePack.Formatters.ForceSByteBlockFormatter.Serialize(ref MessagePack.MessagePackWriter writer, sbyte value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ForceUInt16BlockArrayFormatter +MessagePack.Formatters.ForceUInt16BlockArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> ushort[] +MessagePack.Formatters.ForceUInt16BlockArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, ushort[] value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ForceUInt16BlockFormatter +MessagePack.Formatters.ForceUInt16BlockFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> ushort +MessagePack.Formatters.ForceUInt16BlockFormatter.Serialize(ref MessagePack.MessagePackWriter writer, ushort value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ForceUInt32BlockArrayFormatter +MessagePack.Formatters.ForceUInt32BlockArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> uint[] +MessagePack.Formatters.ForceUInt32BlockArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, uint[] value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ForceUInt32BlockFormatter +MessagePack.Formatters.ForceUInt32BlockFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> uint +MessagePack.Formatters.ForceUInt32BlockFormatter.Serialize(ref MessagePack.MessagePackWriter writer, uint value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ForceUInt64BlockArrayFormatter +MessagePack.Formatters.ForceUInt64BlockArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> ulong[] +MessagePack.Formatters.ForceUInt64BlockArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, ulong[] value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ForceUInt64BlockFormatter +MessagePack.Formatters.ForceUInt64BlockFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> ulong +MessagePack.Formatters.ForceUInt64BlockFormatter.Serialize(ref MessagePack.MessagePackWriter writer, ulong value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.FourDimensionalArrayFormatter +MessagePack.Formatters.FourDimensionalArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> T[,,,] +MessagePack.Formatters.FourDimensionalArrayFormatter.FourDimensionalArrayFormatter() -> void +MessagePack.Formatters.FourDimensionalArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, T[,,,] value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.GenericCollectionFormatter +MessagePack.Formatters.GenericCollectionFormatter.GenericCollectionFormatter() -> void +MessagePack.Formatters.GenericDictionaryFormatter +MessagePack.Formatters.GenericDictionaryFormatter.GenericDictionaryFormatter() -> void +MessagePack.Formatters.GenericEnumFormatter +MessagePack.Formatters.GenericEnumFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> T +MessagePack.Formatters.GenericEnumFormatter.GenericEnumFormatter() -> void +MessagePack.Formatters.GenericEnumFormatter.Serialize(ref MessagePack.MessagePackWriter writer, T value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.GuidFormatter +MessagePack.Formatters.GuidFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Guid +MessagePack.Formatters.GuidFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Guid value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.HashSetFormatter +MessagePack.Formatters.HashSetFormatter.HashSetFormatter() -> void +MessagePack.Formatters.IMessagePackFormatter +MessagePack.Formatters.IMessagePackFormatter +MessagePack.Formatters.IMessagePackFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> T +MessagePack.Formatters.IMessagePackFormatter.Serialize(ref MessagePack.MessagePackWriter writer, T value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.IgnoreFormatter +MessagePack.Formatters.IgnoreFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> T +MessagePack.Formatters.IgnoreFormatter.IgnoreFormatter() -> void +MessagePack.Formatters.IgnoreFormatter.Serialize(ref MessagePack.MessagePackWriter writer, T value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.Int16ArrayFormatter +MessagePack.Formatters.Int16ArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> short[] +MessagePack.Formatters.Int16ArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, short[] value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.Int16Formatter +MessagePack.Formatters.Int16Formatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> short +MessagePack.Formatters.Int16Formatter.Serialize(ref MessagePack.MessagePackWriter writer, short value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.Int32ArrayFormatter +MessagePack.Formatters.Int32ArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> int[] +MessagePack.Formatters.Int32ArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, int[] value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.Int32Formatter +MessagePack.Formatters.Int32Formatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> int +MessagePack.Formatters.Int32Formatter.Serialize(ref MessagePack.MessagePackWriter writer, int value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.Int64ArrayFormatter +MessagePack.Formatters.Int64ArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> long[] +MessagePack.Formatters.Int64ArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, long[] value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.Int64Formatter +MessagePack.Formatters.Int64Formatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> long +MessagePack.Formatters.Int64Formatter.Serialize(ref MessagePack.MessagePackWriter writer, long value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.InterfaceCollectionFormatter +MessagePack.Formatters.InterfaceCollectionFormatter.InterfaceCollectionFormatter() -> void +MessagePack.Formatters.InterfaceDictionaryFormatter +MessagePack.Formatters.InterfaceDictionaryFormatter.InterfaceDictionaryFormatter() -> void +MessagePack.Formatters.InterfaceEnumerableFormatter +MessagePack.Formatters.InterfaceEnumerableFormatter.InterfaceEnumerableFormatter() -> void +MessagePack.Formatters.InterfaceGroupingFormatter +MessagePack.Formatters.InterfaceGroupingFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Linq.IGrouping +MessagePack.Formatters.InterfaceGroupingFormatter.InterfaceGroupingFormatter() -> void +MessagePack.Formatters.InterfaceGroupingFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Linq.IGrouping value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.InterfaceListFormatter +MessagePack.Formatters.InterfaceListFormatter.InterfaceListFormatter() -> void +MessagePack.Formatters.InterfaceLookupFormatter +MessagePack.Formatters.InterfaceLookupFormatter.InterfaceLookupFormatter() -> void +MessagePack.Formatters.InterfaceReadOnlyCollectionFormatter +MessagePack.Formatters.InterfaceReadOnlyCollectionFormatter.InterfaceReadOnlyCollectionFormatter() -> void +MessagePack.Formatters.InterfaceReadOnlyDictionaryFormatter +MessagePack.Formatters.InterfaceReadOnlyDictionaryFormatter.InterfaceReadOnlyDictionaryFormatter() -> void +MessagePack.Formatters.InterfaceReadOnlyListFormatter +MessagePack.Formatters.InterfaceReadOnlyListFormatter.InterfaceReadOnlyListFormatter() -> void +MessagePack.Formatters.InterfaceSetFormatter +MessagePack.Formatters.InterfaceSetFormatter.InterfaceSetFormatter() -> void +MessagePack.Formatters.KeyValuePairFormatter +MessagePack.Formatters.KeyValuePairFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Collections.Generic.KeyValuePair +MessagePack.Formatters.KeyValuePairFormatter.KeyValuePairFormatter() -> void +MessagePack.Formatters.KeyValuePairFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Collections.Generic.KeyValuePair value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.LazyFormatter +MessagePack.Formatters.LazyFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Lazy +MessagePack.Formatters.LazyFormatter.LazyFormatter() -> void +MessagePack.Formatters.LazyFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Lazy value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.LinkedListFormatter +MessagePack.Formatters.LinkedListFormatter.LinkedListFormatter() -> void +MessagePack.Formatters.ListFormatter +MessagePack.Formatters.ListFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Collections.Generic.List +MessagePack.Formatters.ListFormatter.ListFormatter() -> void +MessagePack.Formatters.ListFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Collections.Generic.List value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NativeDateTimeArrayFormatter +MessagePack.Formatters.NativeDateTimeArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.DateTime[] +MessagePack.Formatters.NativeDateTimeArrayFormatter.NativeDateTimeArrayFormatter() -> void +MessagePack.Formatters.NativeDateTimeArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.DateTime[] value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NativeDateTimeFormatter +MessagePack.Formatters.NativeDateTimeFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.DateTime +MessagePack.Formatters.NativeDateTimeFormatter.NativeDateTimeFormatter() -> void +MessagePack.Formatters.NativeDateTimeFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.DateTime value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NativeDecimalFormatter +MessagePack.Formatters.NativeDecimalFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> decimal +MessagePack.Formatters.NativeDecimalFormatter.Serialize(ref MessagePack.MessagePackWriter writer, decimal value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NativeGuidFormatter +MessagePack.Formatters.NativeGuidFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Guid +MessagePack.Formatters.NativeGuidFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Guid value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NilFormatter +MessagePack.Formatters.NilFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> MessagePack.Nil +MessagePack.Formatters.NilFormatter.Serialize(ref MessagePack.MessagePackWriter writer, MessagePack.Nil value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NonGenericDictionaryFormatter +MessagePack.Formatters.NonGenericDictionaryFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> T +MessagePack.Formatters.NonGenericDictionaryFormatter.NonGenericDictionaryFormatter() -> void +MessagePack.Formatters.NonGenericDictionaryFormatter.Serialize(ref MessagePack.MessagePackWriter writer, T value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NonGenericInterfaceDictionaryFormatter +MessagePack.Formatters.NonGenericInterfaceDictionaryFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Collections.IDictionary +MessagePack.Formatters.NonGenericInterfaceDictionaryFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Collections.IDictionary value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NonGenericInterfaceListFormatter +MessagePack.Formatters.NonGenericInterfaceListFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Collections.IList +MessagePack.Formatters.NonGenericInterfaceListFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Collections.IList value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NonGenericListFormatter +MessagePack.Formatters.NonGenericListFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> T +MessagePack.Formatters.NonGenericListFormatter.NonGenericListFormatter() -> void +MessagePack.Formatters.NonGenericListFormatter.Serialize(ref MessagePack.MessagePackWriter writer, T value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NullableBooleanFormatter +MessagePack.Formatters.NullableBooleanFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> bool? +MessagePack.Formatters.NullableBooleanFormatter.Serialize(ref MessagePack.MessagePackWriter writer, bool? value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NullableByteFormatter +MessagePack.Formatters.NullableByteFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> byte? +MessagePack.Formatters.NullableByteFormatter.Serialize(ref MessagePack.MessagePackWriter writer, byte? value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NullableCharFormatter +MessagePack.Formatters.NullableCharFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> char? +MessagePack.Formatters.NullableCharFormatter.Serialize(ref MessagePack.MessagePackWriter writer, char? value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NullableDateTimeFormatter +MessagePack.Formatters.NullableDateTimeFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.DateTime? +MessagePack.Formatters.NullableDateTimeFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.DateTime? value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NullableDoubleFormatter +MessagePack.Formatters.NullableDoubleFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> double? +MessagePack.Formatters.NullableDoubleFormatter.Serialize(ref MessagePack.MessagePackWriter writer, double? value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NullableForceByteBlockFormatter +MessagePack.Formatters.NullableForceByteBlockFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> byte? +MessagePack.Formatters.NullableForceByteBlockFormatter.Serialize(ref MessagePack.MessagePackWriter writer, byte? value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NullableForceInt16BlockFormatter +MessagePack.Formatters.NullableForceInt16BlockFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> short? +MessagePack.Formatters.NullableForceInt16BlockFormatter.Serialize(ref MessagePack.MessagePackWriter writer, short? value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NullableForceInt32BlockFormatter +MessagePack.Formatters.NullableForceInt32BlockFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> int? +MessagePack.Formatters.NullableForceInt32BlockFormatter.Serialize(ref MessagePack.MessagePackWriter writer, int? value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NullableForceInt64BlockFormatter +MessagePack.Formatters.NullableForceInt64BlockFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> long? +MessagePack.Formatters.NullableForceInt64BlockFormatter.Serialize(ref MessagePack.MessagePackWriter writer, long? value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NullableForceSByteBlockFormatter +MessagePack.Formatters.NullableForceSByteBlockFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> sbyte? +MessagePack.Formatters.NullableForceSByteBlockFormatter.Serialize(ref MessagePack.MessagePackWriter writer, sbyte? value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NullableForceUInt16BlockFormatter +MessagePack.Formatters.NullableForceUInt16BlockFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> ushort? +MessagePack.Formatters.NullableForceUInt16BlockFormatter.Serialize(ref MessagePack.MessagePackWriter writer, ushort? value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NullableForceUInt32BlockFormatter +MessagePack.Formatters.NullableForceUInt32BlockFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> uint? +MessagePack.Formatters.NullableForceUInt32BlockFormatter.Serialize(ref MessagePack.MessagePackWriter writer, uint? value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NullableForceUInt64BlockFormatter +MessagePack.Formatters.NullableForceUInt64BlockFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> ulong? +MessagePack.Formatters.NullableForceUInt64BlockFormatter.Serialize(ref MessagePack.MessagePackWriter writer, ulong? value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NullableFormatter +MessagePack.Formatters.NullableFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> T? +MessagePack.Formatters.NullableFormatter.NullableFormatter() -> void +MessagePack.Formatters.NullableFormatter.Serialize(ref MessagePack.MessagePackWriter writer, T? value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NullableInt16Formatter +MessagePack.Formatters.NullableInt16Formatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> short? +MessagePack.Formatters.NullableInt16Formatter.Serialize(ref MessagePack.MessagePackWriter writer, short? value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NullableInt32Formatter +MessagePack.Formatters.NullableInt32Formatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> int? +MessagePack.Formatters.NullableInt32Formatter.Serialize(ref MessagePack.MessagePackWriter writer, int? value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NullableInt64Formatter +MessagePack.Formatters.NullableInt64Formatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> long? +MessagePack.Formatters.NullableInt64Formatter.Serialize(ref MessagePack.MessagePackWriter writer, long? value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NullableNilFormatter +MessagePack.Formatters.NullableNilFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> MessagePack.Nil? +MessagePack.Formatters.NullableNilFormatter.Serialize(ref MessagePack.MessagePackWriter writer, MessagePack.Nil? value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NullableSByteFormatter +MessagePack.Formatters.NullableSByteFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> sbyte? +MessagePack.Formatters.NullableSByteFormatter.Serialize(ref MessagePack.MessagePackWriter writer, sbyte? value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NullableSingleFormatter +MessagePack.Formatters.NullableSingleFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> float? +MessagePack.Formatters.NullableSingleFormatter.Serialize(ref MessagePack.MessagePackWriter writer, float? value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NullableStringArrayFormatter +MessagePack.Formatters.NullableStringArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> string[] +MessagePack.Formatters.NullableStringArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, string[] value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NullableStringFormatter +MessagePack.Formatters.NullableStringFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> string +MessagePack.Formatters.NullableStringFormatter.Serialize(ref MessagePack.MessagePackWriter writer, string value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NullableUInt16Formatter +MessagePack.Formatters.NullableUInt16Formatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> ushort? +MessagePack.Formatters.NullableUInt16Formatter.Serialize(ref MessagePack.MessagePackWriter writer, ushort? value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NullableUInt32Formatter +MessagePack.Formatters.NullableUInt32Formatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> uint? +MessagePack.Formatters.NullableUInt32Formatter.Serialize(ref MessagePack.MessagePackWriter writer, uint? value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NullableUInt64Formatter +MessagePack.Formatters.NullableUInt64Formatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> ulong? +MessagePack.Formatters.NullableUInt64Formatter.Serialize(ref MessagePack.MessagePackWriter writer, ulong? value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ObservableCollectionFormatter +MessagePack.Formatters.ObservableCollectionFormatter.ObservableCollectionFormatter() -> void +MessagePack.Formatters.PrimitiveObjectFormatter +MessagePack.Formatters.PrimitiveObjectFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> object +MessagePack.Formatters.PrimitiveObjectFormatter.Serialize(ref MessagePack.MessagePackWriter writer, object value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.QueueFormatter +MessagePack.Formatters.QueueFormatter.QueueFormatter() -> void +MessagePack.Formatters.ReadOnlyCollectionFormatter +MessagePack.Formatters.ReadOnlyCollectionFormatter.ReadOnlyCollectionFormatter() -> void +MessagePack.Formatters.ReadOnlyDictionaryFormatter +MessagePack.Formatters.ReadOnlyDictionaryFormatter.ReadOnlyDictionaryFormatter() -> void +MessagePack.Formatters.ReadOnlyObservableCollectionFormatter +MessagePack.Formatters.ReadOnlyObservableCollectionFormatter.ReadOnlyObservableCollectionFormatter() -> void +MessagePack.Formatters.SByteArrayFormatter +MessagePack.Formatters.SByteArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> sbyte[] +MessagePack.Formatters.SByteArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, sbyte[] value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.SByteFormatter +MessagePack.Formatters.SByteFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> sbyte +MessagePack.Formatters.SByteFormatter.Serialize(ref MessagePack.MessagePackWriter writer, sbyte value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.SingleArrayFormatter +MessagePack.Formatters.SingleArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> float[] +MessagePack.Formatters.SingleArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, float[] value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.SingleFormatter +MessagePack.Formatters.SingleFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> float +MessagePack.Formatters.SingleFormatter.Serialize(ref MessagePack.MessagePackWriter writer, float value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.SortedDictionaryFormatter +MessagePack.Formatters.SortedDictionaryFormatter.SortedDictionaryFormatter() -> void +MessagePack.Formatters.SortedListFormatter +MessagePack.Formatters.SortedListFormatter.SortedListFormatter() -> void +MessagePack.Formatters.StackFormatter +MessagePack.Formatters.StackFormatter.StackFormatter() -> void +MessagePack.Formatters.StaticNullableFormatter +MessagePack.Formatters.StaticNullableFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> T? +MessagePack.Formatters.StaticNullableFormatter.Serialize(ref MessagePack.MessagePackWriter writer, T? value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.StaticNullableFormatter.StaticNullableFormatter(MessagePack.Formatters.IMessagePackFormatter underlyingFormatter) -> void +MessagePack.Formatters.StringBuilderFormatter +MessagePack.Formatters.StringBuilderFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Text.StringBuilder +MessagePack.Formatters.StringBuilderFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Text.StringBuilder value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ThreeDimensionalArrayFormatter +MessagePack.Formatters.ThreeDimensionalArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> T[,,] +MessagePack.Formatters.ThreeDimensionalArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, T[,,] value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ThreeDimensionalArrayFormatter.ThreeDimensionalArrayFormatter() -> void +MessagePack.Formatters.TimeSpanFormatter +MessagePack.Formatters.TimeSpanFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.TimeSpan +MessagePack.Formatters.TimeSpanFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.TimeSpan value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.TupleFormatter +MessagePack.Formatters.TupleFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Tuple +MessagePack.Formatters.TupleFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Tuple value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.TupleFormatter.TupleFormatter() -> void +MessagePack.Formatters.TupleFormatter +MessagePack.Formatters.TupleFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Tuple +MessagePack.Formatters.TupleFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Tuple value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.TupleFormatter.TupleFormatter() -> void +MessagePack.Formatters.TupleFormatter +MessagePack.Formatters.TupleFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Tuple +MessagePack.Formatters.TupleFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Tuple value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.TupleFormatter.TupleFormatter() -> void +MessagePack.Formatters.TupleFormatter +MessagePack.Formatters.TupleFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Tuple +MessagePack.Formatters.TupleFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Tuple value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.TupleFormatter.TupleFormatter() -> void +MessagePack.Formatters.TupleFormatter +MessagePack.Formatters.TupleFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Tuple +MessagePack.Formatters.TupleFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Tuple value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.TupleFormatter.TupleFormatter() -> void +MessagePack.Formatters.TupleFormatter +MessagePack.Formatters.TupleFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Tuple +MessagePack.Formatters.TupleFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Tuple value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.TupleFormatter.TupleFormatter() -> void +MessagePack.Formatters.TupleFormatter +MessagePack.Formatters.TupleFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Tuple +MessagePack.Formatters.TupleFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Tuple value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.TupleFormatter.TupleFormatter() -> void +MessagePack.Formatters.TupleFormatter +MessagePack.Formatters.TupleFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Tuple +MessagePack.Formatters.TupleFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Tuple value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.TupleFormatter.TupleFormatter() -> void +MessagePack.Formatters.TwoDimensionalArrayFormatter +MessagePack.Formatters.TwoDimensionalArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> T[,] +MessagePack.Formatters.TwoDimensionalArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, T[,] value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.TwoDimensionalArrayFormatter.TwoDimensionalArrayFormatter() -> void +MessagePack.Formatters.TypelessFormatter +MessagePack.Formatters.TypelessFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> object +MessagePack.Formatters.TypelessFormatter.Serialize(ref MessagePack.MessagePackWriter writer, object value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.UInt16ArrayFormatter +MessagePack.Formatters.UInt16ArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> ushort[] +MessagePack.Formatters.UInt16ArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, ushort[] value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.UInt16Formatter +MessagePack.Formatters.UInt16Formatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> ushort +MessagePack.Formatters.UInt16Formatter.Serialize(ref MessagePack.MessagePackWriter writer, ushort value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.UInt32ArrayFormatter +MessagePack.Formatters.UInt32ArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> uint[] +MessagePack.Formatters.UInt32ArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, uint[] value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.UInt32Formatter +MessagePack.Formatters.UInt32Formatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> uint +MessagePack.Formatters.UInt32Formatter.Serialize(ref MessagePack.MessagePackWriter writer, uint value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.UInt64ArrayFormatter +MessagePack.Formatters.UInt64ArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> ulong[] +MessagePack.Formatters.UInt64ArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, ulong[] value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.UInt64Formatter +MessagePack.Formatters.UInt64Formatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> ulong +MessagePack.Formatters.UInt64Formatter.Serialize(ref MessagePack.MessagePackWriter writer, ulong value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.UriFormatter +MessagePack.Formatters.UriFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Uri +MessagePack.Formatters.UriFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Uri value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ValueTupleFormatter +MessagePack.Formatters.ValueTupleFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.ValueTuple +MessagePack.Formatters.ValueTupleFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.ValueTuple value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ValueTupleFormatter.ValueTupleFormatter() -> void +MessagePack.Formatters.ValueTupleFormatter +MessagePack.Formatters.ValueTupleFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> (T1, T2, T3, T4, T5, T6, T7) +MessagePack.Formatters.ValueTupleFormatter.Serialize(ref MessagePack.MessagePackWriter writer, (T1, T2, T3, T4, T5, T6, T7) value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ValueTupleFormatter.ValueTupleFormatter() -> void +MessagePack.Formatters.ValueTupleFormatter +MessagePack.Formatters.ValueTupleFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> (T1, T2, T3, T4, T5, T6) +MessagePack.Formatters.ValueTupleFormatter.Serialize(ref MessagePack.MessagePackWriter writer, (T1, T2, T3, T4, T5, T6) value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ValueTupleFormatter.ValueTupleFormatter() -> void +MessagePack.Formatters.ValueTupleFormatter +MessagePack.Formatters.ValueTupleFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> (T1, T2, T3, T4, T5) +MessagePack.Formatters.ValueTupleFormatter.Serialize(ref MessagePack.MessagePackWriter writer, (T1, T2, T3, T4, T5) value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ValueTupleFormatter.ValueTupleFormatter() -> void +MessagePack.Formatters.ValueTupleFormatter +MessagePack.Formatters.ValueTupleFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> (T1, T2, T3, T4) +MessagePack.Formatters.ValueTupleFormatter.Serialize(ref MessagePack.MessagePackWriter writer, (T1, T2, T3, T4) value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ValueTupleFormatter.ValueTupleFormatter() -> void +MessagePack.Formatters.ValueTupleFormatter +MessagePack.Formatters.ValueTupleFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> (T1, T2, T3) +MessagePack.Formatters.ValueTupleFormatter.Serialize(ref MessagePack.MessagePackWriter writer, (T1, T2, T3) value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ValueTupleFormatter.ValueTupleFormatter() -> void +MessagePack.Formatters.ValueTupleFormatter +MessagePack.Formatters.ValueTupleFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> (T1, T2) +MessagePack.Formatters.ValueTupleFormatter.Serialize(ref MessagePack.MessagePackWriter writer, (T1, T2) value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ValueTupleFormatter.ValueTupleFormatter() -> void +MessagePack.Formatters.ValueTupleFormatter +MessagePack.Formatters.ValueTupleFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.ValueTuple +MessagePack.Formatters.ValueTupleFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.ValueTuple value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ValueTupleFormatter.ValueTupleFormatter() -> void +MessagePack.Formatters.VersionFormatter +MessagePack.Formatters.VersionFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Version +MessagePack.Formatters.VersionFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Version value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.IFormatterResolver +MessagePack.IFormatterResolver.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter +MessagePack.Internal.AutomataDictionary +MessagePack.Internal.AutomataDictionary.Add(string str, int value) -> void +MessagePack.Internal.AutomataDictionary.AutomataDictionary() -> void +MessagePack.Internal.AutomataDictionary.EmitMatch(System.Reflection.Emit.ILGenerator il, System.Reflection.Emit.LocalBuilder bytesSpan, System.Reflection.Emit.LocalBuilder key, System.Action> onFound, System.Action onNotFound) -> void +MessagePack.Internal.AutomataDictionary.GetEnumerator() -> System.Collections.Generic.IEnumerator> +MessagePack.Internal.AutomataDictionary.TryGetValue(System.ReadOnlySpan bytes, out int value) -> bool +MessagePack.Internal.AutomataDictionary.TryGetValue(in System.Buffers.ReadOnlySequence bytes, out int value) -> bool +MessagePack.Internal.AutomataKeyGen +MessagePack.Internal.ByteArrayStringHashTable +MessagePack.Internal.ByteArrayStringHashTable.Add(byte[] key, int value) -> void +MessagePack.Internal.ByteArrayStringHashTable.Add(string key, int value) -> void +MessagePack.Internal.ByteArrayStringHashTable.ByteArrayStringHashTable(int capacity) -> void +MessagePack.Internal.ByteArrayStringHashTable.ByteArrayStringHashTable(int capacity, float loadFactor) -> void +MessagePack.Internal.ByteArrayStringHashTable.GetEnumerator() -> System.Collections.Generic.IEnumerator> +MessagePack.Internal.ByteArrayStringHashTable.TryGetValue(System.ReadOnlySpan key, out int value) -> bool +MessagePack.Internal.ByteArrayStringHashTable.TryGetValue(in System.Buffers.ReadOnlySequence key, out int value) -> bool +MessagePack.Internal.CodeGenHelpers +MessagePack.Internal.RuntimeTypeHandleEqualityComparer +MessagePack.Internal.RuntimeTypeHandleEqualityComparer.Equals(System.RuntimeTypeHandle x, System.RuntimeTypeHandle y) -> bool +MessagePack.Internal.RuntimeTypeHandleEqualityComparer.GetHashCode(System.RuntimeTypeHandle obj) -> int +MessagePack.Internal.UnsafeMemory +MessagePack.Internal.UnsafeMemory32 +MessagePack.Internal.UnsafeMemory64 +MessagePack.MessagePackCode +MessagePack.MessagePackCompression +MessagePack.MessagePackCompression.Lz4Block = 1 -> MessagePack.MessagePackCompression +MessagePack.MessagePackCompression.Lz4BlockArray = 2 -> MessagePack.MessagePackCompression +MessagePack.MessagePackCompression.None = 0 -> MessagePack.MessagePackCompression +MessagePack.MessagePackRange +MessagePack.MessagePackReader +MessagePack.MessagePackReader.CancellationToken.get -> System.Threading.CancellationToken +MessagePack.MessagePackReader.CancellationToken.set -> void +MessagePack.MessagePackReader.Clone(in System.Buffers.ReadOnlySequence readOnlySequence) -> MessagePack.MessagePackReader +MessagePack.MessagePackReader.Consumed.get -> long +MessagePack.MessagePackReader.CreatePeekReader() -> MessagePack.MessagePackReader +MessagePack.MessagePackReader.End.get -> bool +MessagePack.MessagePackReader.IsNil.get -> bool +MessagePack.MessagePackReader.MessagePackReader(System.ReadOnlyMemory memory) -> void +MessagePack.MessagePackReader.MessagePackReader(in System.Buffers.ReadOnlySequence readOnlySequence) -> void +MessagePack.MessagePackReader.NextCode.get -> byte +MessagePack.MessagePackReader.NextMessagePackType.get -> MessagePack.MessagePackType +MessagePack.MessagePackReader.Position.get -> System.SequencePosition +MessagePack.MessagePackReader.ReadArrayHeader() -> int +MessagePack.MessagePackReader.ReadBoolean() -> bool +MessagePack.MessagePackReader.ReadByte() -> byte +MessagePack.MessagePackReader.ReadBytes() -> System.Buffers.ReadOnlySequence? +MessagePack.MessagePackReader.ReadChar() -> char +MessagePack.MessagePackReader.ReadDateTime() -> System.DateTime +MessagePack.MessagePackReader.ReadDouble() -> double +MessagePack.MessagePackReader.ReadExtensionFormat() -> MessagePack.ExtensionResult +MessagePack.MessagePackReader.ReadExtensionFormatHeader() -> MessagePack.ExtensionHeader +MessagePack.MessagePackReader.ReadInt16() -> short +MessagePack.MessagePackReader.ReadInt32() -> int +MessagePack.MessagePackReader.ReadInt64() -> long +MessagePack.MessagePackReader.ReadMapHeader() -> int +MessagePack.MessagePackReader.ReadNil() -> MessagePack.Nil +MessagePack.MessagePackReader.ReadRaw() -> System.Buffers.ReadOnlySequence +MessagePack.MessagePackReader.ReadRaw(long length) -> System.Buffers.ReadOnlySequence +MessagePack.MessagePackReader.ReadSByte() -> sbyte +MessagePack.MessagePackReader.ReadSingle() -> float +MessagePack.MessagePackReader.ReadString() -> string +MessagePack.MessagePackReader.ReadStringSequence() -> System.Buffers.ReadOnlySequence? +MessagePack.MessagePackReader.ReadUInt16() -> ushort +MessagePack.MessagePackReader.ReadUInt32() -> uint +MessagePack.MessagePackReader.ReadUInt64() -> ulong +MessagePack.MessagePackReader.Sequence.get -> System.Buffers.ReadOnlySequence +MessagePack.MessagePackReader.Skip() -> void +MessagePack.MessagePackReader.TryReadNil() -> bool +MessagePack.MessagePackReader.TryReadStringSpan(out System.ReadOnlySpan span) -> bool +MessagePack.MessagePackSerializationException +MessagePack.MessagePackSerializationException.MessagePackSerializationException() -> void +MessagePack.MessagePackSerializationException.MessagePackSerializationException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) -> void +MessagePack.MessagePackSerializationException.MessagePackSerializationException(string message) -> void +MessagePack.MessagePackSerializationException.MessagePackSerializationException(string message, System.Exception inner) -> void +MessagePack.MessagePackSerializer +MessagePack.MessagePackSerializer.Typeless +MessagePack.MessagePackSerializerOptions +MessagePack.MessagePackSerializerOptions.AllowAssemblyVersionMismatch.get -> bool +MessagePack.MessagePackSerializerOptions.Compression.get -> MessagePack.MessagePackCompression +MessagePack.MessagePackSerializerOptions.MessagePackSerializerOptions(MessagePack.IFormatterResolver resolver) -> void +MessagePack.MessagePackSerializerOptions.MessagePackSerializerOptions(MessagePack.MessagePackSerializerOptions copyFrom) -> void +MessagePack.MessagePackSerializerOptions.OldSpec.get -> bool? +MessagePack.MessagePackSerializerOptions.OmitAssemblyVersion.get -> bool +MessagePack.MessagePackSerializerOptions.Resolver.get -> MessagePack.IFormatterResolver +MessagePack.MessagePackSerializerOptions.WithAllowAssemblyVersionMismatch(bool allowAssemblyVersionMismatch) -> MessagePack.MessagePackSerializerOptions +MessagePack.MessagePackSerializerOptions.WithCompression(MessagePack.MessagePackCompression compression) -> MessagePack.MessagePackSerializerOptions +MessagePack.MessagePackSerializerOptions.WithOldSpec(bool? oldSpec = true) -> MessagePack.MessagePackSerializerOptions +MessagePack.MessagePackSerializerOptions.WithOmitAssemblyVersion(bool omitAssemblyVersion) -> MessagePack.MessagePackSerializerOptions +MessagePack.MessagePackSerializerOptions.WithResolver(MessagePack.IFormatterResolver resolver) -> MessagePack.MessagePackSerializerOptions +MessagePack.MessagePackStreamReader +MessagePack.MessagePackStreamReader.Dispose() -> void +MessagePack.MessagePackStreamReader.MessagePackStreamReader(System.IO.Stream stream) -> void +MessagePack.MessagePackStreamReader.ReadAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask?> +MessagePack.MessagePackStreamReader.RemainingBytes.get -> System.Buffers.ReadOnlySequence +MessagePack.MessagePackType +MessagePack.MessagePackType.Array = 7 -> MessagePack.MessagePackType +MessagePack.MessagePackType.Binary = 6 -> MessagePack.MessagePackType +MessagePack.MessagePackType.Boolean = 3 -> MessagePack.MessagePackType +MessagePack.MessagePackType.Extension = 9 -> MessagePack.MessagePackType +MessagePack.MessagePackType.Float = 4 -> MessagePack.MessagePackType +MessagePack.MessagePackType.Integer = 1 -> MessagePack.MessagePackType +MessagePack.MessagePackType.Map = 8 -> MessagePack.MessagePackType +MessagePack.MessagePackType.Nil = 2 -> MessagePack.MessagePackType +MessagePack.MessagePackType.String = 5 -> MessagePack.MessagePackType +MessagePack.MessagePackType.Unknown = 0 -> MessagePack.MessagePackType +MessagePack.MessagePackWriter +MessagePack.MessagePackWriter.Advance(int length) -> void +MessagePack.MessagePackWriter.CancellationToken.get -> System.Threading.CancellationToken +MessagePack.MessagePackWriter.CancellationToken.set -> void +MessagePack.MessagePackWriter.Clone(System.Buffers.IBufferWriter writer) -> MessagePack.MessagePackWriter +MessagePack.MessagePackWriter.Flush() -> void +MessagePack.MessagePackWriter.GetSpan(int length) -> System.Span +MessagePack.MessagePackWriter.MessagePackWriter(System.Buffers.IBufferWriter writer) -> void +MessagePack.MessagePackWriter.OldSpec.get -> bool +MessagePack.MessagePackWriter.OldSpec.set -> void +MessagePack.MessagePackWriter.Write(System.DateTime dateTime) -> void +MessagePack.MessagePackWriter.Write(System.ReadOnlySpan src) -> void +MessagePack.MessagePackWriter.Write(System.ReadOnlySpan value) -> void +MessagePack.MessagePackWriter.Write(bool value) -> void +MessagePack.MessagePackWriter.Write(byte value) -> void +MessagePack.MessagePackWriter.Write(byte[] src) -> void +MessagePack.MessagePackWriter.Write(char value) -> void +MessagePack.MessagePackWriter.Write(double value) -> void +MessagePack.MessagePackWriter.Write(float value) -> void +MessagePack.MessagePackWriter.Write(in System.Buffers.ReadOnlySequence src) -> void +MessagePack.MessagePackWriter.Write(int value) -> void +MessagePack.MessagePackWriter.Write(long value) -> void +MessagePack.MessagePackWriter.Write(sbyte value) -> void +MessagePack.MessagePackWriter.Write(short value) -> void +MessagePack.MessagePackWriter.Write(string value) -> void +MessagePack.MessagePackWriter.Write(uint value) -> void +MessagePack.MessagePackWriter.Write(ulong value) -> void +MessagePack.MessagePackWriter.Write(ushort value) -> void +MessagePack.MessagePackWriter.WriteArrayHeader(int count) -> void +MessagePack.MessagePackWriter.WriteArrayHeader(uint count) -> void +MessagePack.MessagePackWriter.WriteExtensionFormat(MessagePack.ExtensionResult extensionData) -> void +MessagePack.MessagePackWriter.WriteExtensionFormatHeader(MessagePack.ExtensionHeader extensionHeader) -> void +MessagePack.MessagePackWriter.WriteInt16(short value) -> void +MessagePack.MessagePackWriter.WriteInt32(int value) -> void +MessagePack.MessagePackWriter.WriteInt64(long value) -> void +MessagePack.MessagePackWriter.WriteInt8(sbyte value) -> void +MessagePack.MessagePackWriter.WriteMapHeader(int count) -> void +MessagePack.MessagePackWriter.WriteMapHeader(uint count) -> void +MessagePack.MessagePackWriter.WriteNil() -> void +MessagePack.MessagePackWriter.WriteRaw(System.ReadOnlySpan rawMessagePackBlock) -> void +MessagePack.MessagePackWriter.WriteRaw(in System.Buffers.ReadOnlySequence rawMessagePackBlock) -> void +MessagePack.MessagePackWriter.WriteString(System.ReadOnlySpan utf8stringBytes) -> void +MessagePack.MessagePackWriter.WriteString(in System.Buffers.ReadOnlySequence utf8stringBytes) -> void +MessagePack.MessagePackWriter.WriteUInt16(ushort value) -> void +MessagePack.MessagePackWriter.WriteUInt32(uint value) -> void +MessagePack.MessagePackWriter.WriteUInt64(ulong value) -> void +MessagePack.MessagePackWriter.WriteUInt8(byte value) -> void +MessagePack.Nil +MessagePack.Nil.Equals(MessagePack.Nil other) -> bool +MessagePack.Nil.Nil() -> void +MessagePack.ReservedMessagePackExtensionTypeCode +MessagePack.Resolvers.AttributeFormatterResolver +MessagePack.Resolvers.AttributeFormatterResolver.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter +MessagePack.Resolvers.BuiltinResolver +MessagePack.Resolvers.BuiltinResolver.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter +MessagePack.Resolvers.CompositeResolver +MessagePack.Resolvers.ContractlessStandardResolver +MessagePack.Resolvers.ContractlessStandardResolver.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter +MessagePack.Resolvers.ContractlessStandardResolverAllowPrivate +MessagePack.Resolvers.ContractlessStandardResolverAllowPrivate.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter +MessagePack.Resolvers.DynamicContractlessObjectResolver +MessagePack.Resolvers.DynamicContractlessObjectResolver.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter +MessagePack.Resolvers.DynamicContractlessObjectResolverAllowPrivate +MessagePack.Resolvers.DynamicContractlessObjectResolverAllowPrivate.DynamicContractlessObjectResolverAllowPrivate() -> void +MessagePack.Resolvers.DynamicContractlessObjectResolverAllowPrivate.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter +MessagePack.Resolvers.DynamicEnumAsStringResolver +MessagePack.Resolvers.DynamicEnumAsStringResolver.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter +MessagePack.Resolvers.DynamicEnumResolver +MessagePack.Resolvers.DynamicEnumResolver.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter +MessagePack.Resolvers.DynamicGenericResolver +MessagePack.Resolvers.DynamicGenericResolver.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter +MessagePack.Resolvers.DynamicObjectResolver +MessagePack.Resolvers.DynamicObjectResolver.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter +MessagePack.Resolvers.DynamicObjectResolverAllowPrivate +MessagePack.Resolvers.DynamicObjectResolverAllowPrivate.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter +MessagePack.Resolvers.DynamicUnionResolver +MessagePack.Resolvers.DynamicUnionResolver.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter +MessagePack.Resolvers.NativeDateTimeResolver +MessagePack.Resolvers.NativeDateTimeResolver.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter +MessagePack.Resolvers.NativeDecimalResolver +MessagePack.Resolvers.NativeDecimalResolver.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter +MessagePack.Resolvers.NativeGuidResolver +MessagePack.Resolvers.NativeGuidResolver.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter +MessagePack.Resolvers.PrimitiveObjectResolver +MessagePack.Resolvers.PrimitiveObjectResolver.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter +MessagePack.Resolvers.StandardResolver +MessagePack.Resolvers.StandardResolver.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter +MessagePack.Resolvers.StandardResolverAllowPrivate +MessagePack.Resolvers.StandardResolverAllowPrivate.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter +MessagePack.Resolvers.StaticCompositeResolver +MessagePack.Resolvers.StaticCompositeResolver.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter +MessagePack.Resolvers.StaticCompositeResolver.Register(System.Collections.Generic.IReadOnlyList formatters, System.Collections.Generic.IReadOnlyList resolvers) -> void +MessagePack.Resolvers.StaticCompositeResolver.Register(params MessagePack.Formatters.IMessagePackFormatter[] formatters) -> void +MessagePack.Resolvers.StaticCompositeResolver.Register(params MessagePack.IFormatterResolver[] resolvers) -> void +MessagePack.Resolvers.TypelessContractlessStandardResolver +MessagePack.Resolvers.TypelessContractlessStandardResolver.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter +MessagePack.Resolvers.TypelessContractlessStandardResolver.TypelessContractlessStandardResolver() -> void +MessagePack.Resolvers.TypelessObjectResolver +MessagePack.Resolvers.TypelessObjectResolver.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter +MessagePack.TinyJsonException +MessagePack.TinyJsonException.TinyJsonException(string message) -> void +abstract MessagePack.Formatters.CollectionFormatterBase.Add(TIntermediate collection, int index, TElement value, MessagePack.MessagePackSerializerOptions options) -> void +abstract MessagePack.Formatters.CollectionFormatterBase.Complete(TIntermediate intermediateCollection) -> TCollection +abstract MessagePack.Formatters.CollectionFormatterBase.Create(int count, MessagePack.MessagePackSerializerOptions options) -> TIntermediate +abstract MessagePack.Formatters.CollectionFormatterBase.GetSourceEnumerator(TCollection source) -> TEnumerator +abstract MessagePack.Formatters.DictionaryFormatterBase.Add(TIntermediate collection, int index, TKey key, TValue value, MessagePack.MessagePackSerializerOptions options) -> void +abstract MessagePack.Formatters.DictionaryFormatterBase.Complete(TIntermediate intermediateCollection) -> TDictionary +abstract MessagePack.Formatters.DictionaryFormatterBase.Create(int count, MessagePack.MessagePackSerializerOptions options) -> TIntermediate +abstract MessagePack.Formatters.DictionaryFormatterBase.GetSourceEnumerator(TDictionary source) -> TEnumerator +const MessagePack.MessagePackCode.Array16 = 220 -> byte +const MessagePack.MessagePackCode.Array32 = 221 -> byte +const MessagePack.MessagePackCode.Bin16 = 197 -> byte +const MessagePack.MessagePackCode.Bin32 = 198 -> byte +const MessagePack.MessagePackCode.Bin8 = 196 -> byte +const MessagePack.MessagePackCode.Ext16 = 200 -> byte +const MessagePack.MessagePackCode.Ext32 = 201 -> byte +const MessagePack.MessagePackCode.Ext8 = 199 -> byte +const MessagePack.MessagePackCode.False = 194 -> byte +const MessagePack.MessagePackCode.FixExt1 = 212 -> byte +const MessagePack.MessagePackCode.FixExt16 = 216 -> byte +const MessagePack.MessagePackCode.FixExt2 = 213 -> byte +const MessagePack.MessagePackCode.FixExt4 = 214 -> byte +const MessagePack.MessagePackCode.FixExt8 = 215 -> byte +const MessagePack.MessagePackCode.Float32 = 202 -> byte +const MessagePack.MessagePackCode.Float64 = 203 -> byte +const MessagePack.MessagePackCode.Int16 = 209 -> byte +const MessagePack.MessagePackCode.Int32 = 210 -> byte +const MessagePack.MessagePackCode.Int64 = 211 -> byte +const MessagePack.MessagePackCode.Int8 = 208 -> byte +const MessagePack.MessagePackCode.Map16 = 222 -> byte +const MessagePack.MessagePackCode.Map32 = 223 -> byte +const MessagePack.MessagePackCode.MaxFixArray = 159 -> byte +const MessagePack.MessagePackCode.MaxFixInt = 127 -> byte +const MessagePack.MessagePackCode.MaxFixMap = 143 -> byte +const MessagePack.MessagePackCode.MaxFixStr = 191 -> byte +const MessagePack.MessagePackCode.MaxNegativeFixInt = 255 -> byte +const MessagePack.MessagePackCode.MinFixArray = 144 -> byte +const MessagePack.MessagePackCode.MinFixInt = 0 -> byte +const MessagePack.MessagePackCode.MinFixMap = 128 -> byte +const MessagePack.MessagePackCode.MinFixStr = 160 -> byte +const MessagePack.MessagePackCode.MinNegativeFixInt = 224 -> byte +const MessagePack.MessagePackCode.NeverUsed = 193 -> byte +const MessagePack.MessagePackCode.Nil = 192 -> byte +const MessagePack.MessagePackCode.Str16 = 218 -> byte +const MessagePack.MessagePackCode.Str32 = 219 -> byte +const MessagePack.MessagePackCode.Str8 = 217 -> byte +const MessagePack.MessagePackCode.True = 195 -> byte +const MessagePack.MessagePackCode.UInt16 = 205 -> byte +const MessagePack.MessagePackCode.UInt32 = 206 -> byte +const MessagePack.MessagePackCode.UInt64 = 207 -> byte +const MessagePack.MessagePackCode.UInt8 = 204 -> byte +const MessagePack.MessagePackRange.MaxFixArrayCount = 15 -> int +const MessagePack.MessagePackRange.MaxFixMapCount = 15 -> int +const MessagePack.MessagePackRange.MaxFixNegativeInt = -1 -> int +const MessagePack.MessagePackRange.MaxFixPositiveInt = 127 -> int +const MessagePack.MessagePackRange.MaxFixStringLength = 31 -> int +const MessagePack.MessagePackRange.MinFixNegativeInt = -32 -> int +const MessagePack.MessagePackRange.MinFixStringLength = 0 -> int +const MessagePack.ReservedMessagePackExtensionTypeCode.DateTime = -1 -> sbyte +override MessagePack.Formatters.CollectionFormatterBase.GetSourceEnumerator(TCollection source) -> System.Collections.Generic.IEnumerator +override MessagePack.Formatters.DictionaryFormatterBase.Complete(TDictionary intermediateCollection) -> TDictionary +override MessagePack.Formatters.DictionaryFormatterBase.GetSourceEnumerator(TDictionary source) -> System.Collections.Generic.IEnumerator> +override MessagePack.Internal.AutomataDictionary.ToString() -> string +override MessagePack.Nil.Equals(object obj) -> bool +override MessagePack.Nil.GetHashCode() -> int +override MessagePack.Nil.ToString() -> string +override sealed MessagePack.Formatters.CollectionFormatterBase.Complete(TCollection intermediateCollection) -> TCollection +static MessagePack.FormatterResolverExtensions.GetFormatterDynamic(this MessagePack.IFormatterResolver resolver, System.Type type) -> object +static MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(this MessagePack.IFormatterResolver resolver) -> MessagePack.Formatters.IMessagePackFormatter +static MessagePack.Formatters.PrimitiveObjectFormatter.IsSupportedType(System.Type type, System.Reflection.TypeInfo typeInfo, object value) -> bool +static MessagePack.Internal.AutomataKeyGen.GetKey(ref System.ReadOnlySpan span) -> ulong +static MessagePack.Internal.CodeGenHelpers.GetArrayFromNullableSequence(in System.Buffers.ReadOnlySequence? sequence) -> byte[] +static MessagePack.Internal.CodeGenHelpers.GetEncodedStringBytes(string value) -> byte[] +static MessagePack.Internal.CodeGenHelpers.GetSpanFromSequence(in System.Buffers.ReadOnlySequence sequence) -> System.ReadOnlySpan +static MessagePack.Internal.CodeGenHelpers.ReadStringSpan(ref MessagePack.MessagePackReader reader) -> System.ReadOnlySpan +static MessagePack.Internal.UnsafeMemory32.WriteRaw1(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw10(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw11(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw12(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw13(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw14(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw15(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw16(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw17(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw18(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw19(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw2(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw20(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw21(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw22(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw23(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw24(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw25(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw26(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw27(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw28(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw29(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw3(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw30(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw31(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw4(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw5(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw6(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw7(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw8(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw9(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw1(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw10(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw11(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw12(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw13(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw14(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw15(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw16(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw17(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw18(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw19(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw2(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw20(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw21(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw22(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw23(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw24(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw25(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw26(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw27(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw28(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw29(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw3(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw30(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw31(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw4(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw5(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw6(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw7(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw8(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw9(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.MessagePackCode.ToFormatName(byte code) -> string +static MessagePack.MessagePackCode.ToMessagePackType(byte code) -> MessagePack.MessagePackType +static MessagePack.MessagePackSerializer.ConvertFromJson(System.IO.TextReader reader, ref MessagePack.MessagePackWriter writer, MessagePack.MessagePackSerializerOptions options = null) -> void +static MessagePack.MessagePackSerializer.ConvertFromJson(string str, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> byte[] +static MessagePack.MessagePackSerializer.ConvertFromJson(string str, ref MessagePack.MessagePackWriter writer, MessagePack.MessagePackSerializerOptions options = null) -> void +static MessagePack.MessagePackSerializer.ConvertToJson(System.ReadOnlyMemory bytes, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> string +static MessagePack.MessagePackSerializer.ConvertToJson(in System.Buffers.ReadOnlySequence bytes, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> string +static MessagePack.MessagePackSerializer.ConvertToJson(ref MessagePack.MessagePackReader reader, System.IO.TextWriter jsonWriter, MessagePack.MessagePackSerializerOptions options = null) -> void +static MessagePack.MessagePackSerializer.DefaultOptions.get -> MessagePack.MessagePackSerializerOptions +static MessagePack.MessagePackSerializer.DefaultOptions.set -> void +static MessagePack.MessagePackSerializer.Deserialize(System.Type type, System.Buffers.ReadOnlySequence bytes, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> object +static MessagePack.MessagePackSerializer.Deserialize(System.Type type, System.IO.Stream stream, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> object +static MessagePack.MessagePackSerializer.Deserialize(System.Type type, System.ReadOnlyMemory bytes, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> object +static MessagePack.MessagePackSerializer.Deserialize(System.Type type, ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options = null) -> object +static MessagePack.MessagePackSerializer.Deserialize(System.IO.Stream stream, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> T +static MessagePack.MessagePackSerializer.Deserialize(System.ReadOnlyMemory buffer, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> T +static MessagePack.MessagePackSerializer.Deserialize(System.ReadOnlyMemory buffer, MessagePack.MessagePackSerializerOptions options, out int bytesRead, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> T +static MessagePack.MessagePackSerializer.Deserialize(System.ReadOnlyMemory buffer, out int bytesRead, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> T +static MessagePack.MessagePackSerializer.Deserialize(in System.Buffers.ReadOnlySequence byteSequence, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> T +static MessagePack.MessagePackSerializer.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options = null) -> T +static MessagePack.MessagePackSerializer.DeserializeAsync(System.Type type, System.IO.Stream stream, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +static MessagePack.MessagePackSerializer.DeserializeAsync(System.IO.Stream stream, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +static MessagePack.MessagePackSerializer.Serialize(System.Type type, System.Buffers.IBufferWriter writer, object obj, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> void +static MessagePack.MessagePackSerializer.Serialize(System.Type type, System.IO.Stream stream, object obj, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> void +static MessagePack.MessagePackSerializer.Serialize(System.Type type, object obj, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> byte[] +static MessagePack.MessagePackSerializer.Serialize(System.Type type, ref MessagePack.MessagePackWriter writer, object obj, MessagePack.MessagePackSerializerOptions options = null) -> void +static MessagePack.MessagePackSerializer.Serialize(System.Buffers.IBufferWriter writer, T value, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> void +static MessagePack.MessagePackSerializer.Serialize(System.IO.Stream stream, T value, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> void +static MessagePack.MessagePackSerializer.Serialize(T value, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> byte[] +static MessagePack.MessagePackSerializer.Serialize(ref MessagePack.MessagePackWriter writer, T value, MessagePack.MessagePackSerializerOptions options = null) -> void +static MessagePack.MessagePackSerializer.SerializeAsync(System.Type type, System.IO.Stream stream, object obj, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task +static MessagePack.MessagePackSerializer.SerializeAsync(System.IO.Stream stream, T value, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task +static MessagePack.MessagePackSerializer.SerializeToJson(System.IO.TextWriter textWriter, T obj, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> void +static MessagePack.MessagePackSerializer.SerializeToJson(T obj, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> string +static MessagePack.MessagePackSerializer.Typeless.DefaultOptions.get -> MessagePack.MessagePackSerializerOptions +static MessagePack.MessagePackSerializer.Typeless.DefaultOptions.set -> void +static MessagePack.MessagePackSerializer.Typeless.Deserialize(System.IO.Stream stream, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> object +static MessagePack.MessagePackSerializer.Typeless.Deserialize(System.Memory bytes, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> object +static MessagePack.MessagePackSerializer.Typeless.Deserialize(in System.Buffers.ReadOnlySequence byteSequence, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> object +static MessagePack.MessagePackSerializer.Typeless.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options = null) -> object +static MessagePack.MessagePackSerializer.Typeless.DeserializeAsync(System.IO.Stream stream, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +static MessagePack.MessagePackSerializer.Typeless.Serialize(System.Buffers.IBufferWriter writer, object obj, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> void +static MessagePack.MessagePackSerializer.Typeless.Serialize(System.IO.Stream stream, object obj, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> void +static MessagePack.MessagePackSerializer.Typeless.Serialize(object obj, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> byte[] +static MessagePack.MessagePackSerializer.Typeless.Serialize(ref MessagePack.MessagePackWriter writer, object obj, MessagePack.MessagePackSerializerOptions options = null) -> void +static MessagePack.MessagePackSerializer.Typeless.SerializeAsync(System.IO.Stream stream, object obj, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task +static MessagePack.MessagePackSerializerOptions.Standard.get -> MessagePack.MessagePackSerializerOptions +static MessagePack.Resolvers.CompositeResolver.Create(System.Collections.Generic.IReadOnlyList formatters, System.Collections.Generic.IReadOnlyList resolvers) -> MessagePack.IFormatterResolver +static MessagePack.Resolvers.CompositeResolver.Create(params MessagePack.Formatters.IMessagePackFormatter[] formatters) -> MessagePack.IFormatterResolver +static MessagePack.Resolvers.CompositeResolver.Create(params MessagePack.IFormatterResolver[] resolvers) -> MessagePack.IFormatterResolver +static readonly MessagePack.Formatters.BigIntegerFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter +static readonly MessagePack.Formatters.BitArrayFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter +static readonly MessagePack.Formatters.BooleanArrayFormatter.Instance -> MessagePack.Formatters.BooleanArrayFormatter +static readonly MessagePack.Formatters.BooleanFormatter.Instance -> MessagePack.Formatters.BooleanFormatter +static readonly MessagePack.Formatters.ByteArrayFormatter.Instance -> MessagePack.Formatters.ByteArrayFormatter +static readonly MessagePack.Formatters.ByteArraySegmentFormatter.Instance -> MessagePack.Formatters.ByteArraySegmentFormatter +static readonly MessagePack.Formatters.ByteFormatter.Instance -> MessagePack.Formatters.ByteFormatter +static readonly MessagePack.Formatters.CharArrayFormatter.Instance -> MessagePack.Formatters.CharArrayFormatter +static readonly MessagePack.Formatters.CharFormatter.Instance -> MessagePack.Formatters.CharFormatter +static readonly MessagePack.Formatters.ComplexFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter +static readonly MessagePack.Formatters.DateTimeArrayFormatter.Instance -> MessagePack.Formatters.DateTimeArrayFormatter +static readonly MessagePack.Formatters.DateTimeFormatter.Instance -> MessagePack.Formatters.DateTimeFormatter +static readonly MessagePack.Formatters.DateTimeOffsetFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter +static readonly MessagePack.Formatters.DecimalFormatter.Instance -> MessagePack.Formatters.DecimalFormatter +static readonly MessagePack.Formatters.DoubleArrayFormatter.Instance -> MessagePack.Formatters.DoubleArrayFormatter +static readonly MessagePack.Formatters.DoubleFormatter.Instance -> MessagePack.Formatters.DoubleFormatter +static readonly MessagePack.Formatters.DynamicObjectTypeFallbackFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter +static readonly MessagePack.Formatters.ForceByteBlockFormatter.Instance -> MessagePack.Formatters.ForceByteBlockFormatter +static readonly MessagePack.Formatters.ForceInt16BlockArrayFormatter.Instance -> MessagePack.Formatters.ForceInt16BlockArrayFormatter +static readonly MessagePack.Formatters.ForceInt16BlockFormatter.Instance -> MessagePack.Formatters.ForceInt16BlockFormatter +static readonly MessagePack.Formatters.ForceInt32BlockArrayFormatter.Instance -> MessagePack.Formatters.ForceInt32BlockArrayFormatter +static readonly MessagePack.Formatters.ForceInt32BlockFormatter.Instance -> MessagePack.Formatters.ForceInt32BlockFormatter +static readonly MessagePack.Formatters.ForceInt64BlockArrayFormatter.Instance -> MessagePack.Formatters.ForceInt64BlockArrayFormatter +static readonly MessagePack.Formatters.ForceInt64BlockFormatter.Instance -> MessagePack.Formatters.ForceInt64BlockFormatter +static readonly MessagePack.Formatters.ForceSByteBlockArrayFormatter.Instance -> MessagePack.Formatters.ForceSByteBlockArrayFormatter +static readonly MessagePack.Formatters.ForceSByteBlockFormatter.Instance -> MessagePack.Formatters.ForceSByteBlockFormatter +static readonly MessagePack.Formatters.ForceUInt16BlockArrayFormatter.Instance -> MessagePack.Formatters.ForceUInt16BlockArrayFormatter +static readonly MessagePack.Formatters.ForceUInt16BlockFormatter.Instance -> MessagePack.Formatters.ForceUInt16BlockFormatter +static readonly MessagePack.Formatters.ForceUInt32BlockArrayFormatter.Instance -> MessagePack.Formatters.ForceUInt32BlockArrayFormatter +static readonly MessagePack.Formatters.ForceUInt32BlockFormatter.Instance -> MessagePack.Formatters.ForceUInt32BlockFormatter +static readonly MessagePack.Formatters.ForceUInt64BlockArrayFormatter.Instance -> MessagePack.Formatters.ForceUInt64BlockArrayFormatter +static readonly MessagePack.Formatters.ForceUInt64BlockFormatter.Instance -> MessagePack.Formatters.ForceUInt64BlockFormatter +static readonly MessagePack.Formatters.GuidFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter +static readonly MessagePack.Formatters.Int16ArrayFormatter.Instance -> MessagePack.Formatters.Int16ArrayFormatter +static readonly MessagePack.Formatters.Int16Formatter.Instance -> MessagePack.Formatters.Int16Formatter +static readonly MessagePack.Formatters.Int32ArrayFormatter.Instance -> MessagePack.Formatters.Int32ArrayFormatter +static readonly MessagePack.Formatters.Int32Formatter.Instance -> MessagePack.Formatters.Int32Formatter +static readonly MessagePack.Formatters.Int64ArrayFormatter.Instance -> MessagePack.Formatters.Int64ArrayFormatter +static readonly MessagePack.Formatters.Int64Formatter.Instance -> MessagePack.Formatters.Int64Formatter +static readonly MessagePack.Formatters.NativeDateTimeArrayFormatter.Instance -> MessagePack.Formatters.NativeDateTimeArrayFormatter +static readonly MessagePack.Formatters.NativeDateTimeFormatter.Instance -> MessagePack.Formatters.NativeDateTimeFormatter +static readonly MessagePack.Formatters.NativeDecimalFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter +static readonly MessagePack.Formatters.NativeGuidFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter +static readonly MessagePack.Formatters.NilFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter +static readonly MessagePack.Formatters.NonGenericInterfaceDictionaryFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter +static readonly MessagePack.Formatters.NonGenericInterfaceListFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter +static readonly MessagePack.Formatters.NullableBooleanFormatter.Instance -> MessagePack.Formatters.NullableBooleanFormatter +static readonly MessagePack.Formatters.NullableByteFormatter.Instance -> MessagePack.Formatters.NullableByteFormatter +static readonly MessagePack.Formatters.NullableCharFormatter.Instance -> MessagePack.Formatters.NullableCharFormatter +static readonly MessagePack.Formatters.NullableDateTimeFormatter.Instance -> MessagePack.Formatters.NullableDateTimeFormatter +static readonly MessagePack.Formatters.NullableDoubleFormatter.Instance -> MessagePack.Formatters.NullableDoubleFormatter +static readonly MessagePack.Formatters.NullableForceByteBlockFormatter.Instance -> MessagePack.Formatters.NullableForceByteBlockFormatter +static readonly MessagePack.Formatters.NullableForceInt16BlockFormatter.Instance -> MessagePack.Formatters.NullableForceInt16BlockFormatter +static readonly MessagePack.Formatters.NullableForceInt32BlockFormatter.Instance -> MessagePack.Formatters.NullableForceInt32BlockFormatter +static readonly MessagePack.Formatters.NullableForceInt64BlockFormatter.Instance -> MessagePack.Formatters.NullableForceInt64BlockFormatter +static readonly MessagePack.Formatters.NullableForceSByteBlockFormatter.Instance -> MessagePack.Formatters.NullableForceSByteBlockFormatter +static readonly MessagePack.Formatters.NullableForceUInt16BlockFormatter.Instance -> MessagePack.Formatters.NullableForceUInt16BlockFormatter +static readonly MessagePack.Formatters.NullableForceUInt32BlockFormatter.Instance -> MessagePack.Formatters.NullableForceUInt32BlockFormatter +static readonly MessagePack.Formatters.NullableForceUInt64BlockFormatter.Instance -> MessagePack.Formatters.NullableForceUInt64BlockFormatter +static readonly MessagePack.Formatters.NullableInt16Formatter.Instance -> MessagePack.Formatters.NullableInt16Formatter +static readonly MessagePack.Formatters.NullableInt32Formatter.Instance -> MessagePack.Formatters.NullableInt32Formatter +static readonly MessagePack.Formatters.NullableInt64Formatter.Instance -> MessagePack.Formatters.NullableInt64Formatter +static readonly MessagePack.Formatters.NullableNilFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter +static readonly MessagePack.Formatters.NullableSByteFormatter.Instance -> MessagePack.Formatters.NullableSByteFormatter +static readonly MessagePack.Formatters.NullableSingleFormatter.Instance -> MessagePack.Formatters.NullableSingleFormatter +static readonly MessagePack.Formatters.NullableStringArrayFormatter.Instance -> MessagePack.Formatters.NullableStringArrayFormatter +static readonly MessagePack.Formatters.NullableStringFormatter.Instance -> MessagePack.Formatters.NullableStringFormatter +static readonly MessagePack.Formatters.NullableUInt16Formatter.Instance -> MessagePack.Formatters.NullableUInt16Formatter +static readonly MessagePack.Formatters.NullableUInt32Formatter.Instance -> MessagePack.Formatters.NullableUInt32Formatter +static readonly MessagePack.Formatters.NullableUInt64Formatter.Instance -> MessagePack.Formatters.NullableUInt64Formatter +static readonly MessagePack.Formatters.PrimitiveObjectFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter +static readonly MessagePack.Formatters.SByteArrayFormatter.Instance -> MessagePack.Formatters.SByteArrayFormatter +static readonly MessagePack.Formatters.SByteFormatter.Instance -> MessagePack.Formatters.SByteFormatter +static readonly MessagePack.Formatters.SingleArrayFormatter.Instance -> MessagePack.Formatters.SingleArrayFormatter +static readonly MessagePack.Formatters.SingleFormatter.Instance -> MessagePack.Formatters.SingleFormatter +static readonly MessagePack.Formatters.StringBuilderFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter +static readonly MessagePack.Formatters.TimeSpanFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter +static readonly MessagePack.Formatters.TypelessFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter +static readonly MessagePack.Formatters.UInt16ArrayFormatter.Instance -> MessagePack.Formatters.UInt16ArrayFormatter +static readonly MessagePack.Formatters.UInt16Formatter.Instance -> MessagePack.Formatters.UInt16Formatter +static readonly MessagePack.Formatters.UInt32ArrayFormatter.Instance -> MessagePack.Formatters.UInt32ArrayFormatter +static readonly MessagePack.Formatters.UInt32Formatter.Instance -> MessagePack.Formatters.UInt32Formatter +static readonly MessagePack.Formatters.UInt64ArrayFormatter.Instance -> MessagePack.Formatters.UInt64ArrayFormatter +static readonly MessagePack.Formatters.UInt64Formatter.Instance -> MessagePack.Formatters.UInt64Formatter +static readonly MessagePack.Formatters.UriFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter +static readonly MessagePack.Formatters.VersionFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter +static readonly MessagePack.Internal.AutomataKeyGen.GetKeyMethod -> System.Reflection.MethodInfo +static readonly MessagePack.Internal.RuntimeTypeHandleEqualityComparer.Default -> System.Collections.Generic.IEqualityComparer +static readonly MessagePack.Internal.UnsafeMemory.Is32Bit -> bool +static readonly MessagePack.Nil.Default -> MessagePack.Nil +static readonly MessagePack.Resolvers.AttributeFormatterResolver.Instance -> MessagePack.Resolvers.AttributeFormatterResolver +static readonly MessagePack.Resolvers.BuiltinResolver.Instance -> MessagePack.Resolvers.BuiltinResolver +static readonly MessagePack.Resolvers.ContractlessStandardResolver.Instance -> MessagePack.Resolvers.ContractlessStandardResolver +static readonly MessagePack.Resolvers.ContractlessStandardResolver.Options -> MessagePack.MessagePackSerializerOptions +static readonly MessagePack.Resolvers.ContractlessStandardResolverAllowPrivate.Instance -> MessagePack.Resolvers.ContractlessStandardResolverAllowPrivate +static readonly MessagePack.Resolvers.ContractlessStandardResolverAllowPrivate.Options -> MessagePack.MessagePackSerializerOptions +static readonly MessagePack.Resolvers.DynamicContractlessObjectResolver.Instance -> MessagePack.Resolvers.DynamicContractlessObjectResolver +static readonly MessagePack.Resolvers.DynamicContractlessObjectResolverAllowPrivate.Instance -> MessagePack.Resolvers.DynamicContractlessObjectResolverAllowPrivate +static readonly MessagePack.Resolvers.DynamicEnumAsStringResolver.Instance -> MessagePack.Resolvers.DynamicEnumAsStringResolver +static readonly MessagePack.Resolvers.DynamicEnumAsStringResolver.Options -> MessagePack.MessagePackSerializerOptions +static readonly MessagePack.Resolvers.DynamicEnumResolver.Instance -> MessagePack.Resolvers.DynamicEnumResolver +static readonly MessagePack.Resolvers.DynamicGenericResolver.Instance -> MessagePack.Resolvers.DynamicGenericResolver +static readonly MessagePack.Resolvers.DynamicObjectResolver.Instance -> MessagePack.Resolvers.DynamicObjectResolver +static readonly MessagePack.Resolvers.DynamicObjectResolver.Options -> MessagePack.MessagePackSerializerOptions +static readonly MessagePack.Resolvers.DynamicObjectResolverAllowPrivate.Instance -> MessagePack.Resolvers.DynamicObjectResolverAllowPrivate +static readonly MessagePack.Resolvers.DynamicUnionResolver.Instance -> MessagePack.Resolvers.DynamicUnionResolver +static readonly MessagePack.Resolvers.DynamicUnionResolver.Options -> MessagePack.MessagePackSerializerOptions +static readonly MessagePack.Resolvers.NativeDateTimeResolver.Instance -> MessagePack.Resolvers.NativeDateTimeResolver +static readonly MessagePack.Resolvers.NativeDateTimeResolver.Options -> MessagePack.MessagePackSerializerOptions +static readonly MessagePack.Resolvers.NativeDecimalResolver.Instance -> MessagePack.Resolvers.NativeDecimalResolver +static readonly MessagePack.Resolvers.NativeGuidResolver.Instance -> MessagePack.Resolvers.NativeGuidResolver +static readonly MessagePack.Resolvers.PrimitiveObjectResolver.Instance -> MessagePack.Resolvers.PrimitiveObjectResolver +static readonly MessagePack.Resolvers.PrimitiveObjectResolver.Options -> MessagePack.MessagePackSerializerOptions +static readonly MessagePack.Resolvers.StandardResolver.Instance -> MessagePack.Resolvers.StandardResolver +static readonly MessagePack.Resolvers.StandardResolver.Options -> MessagePack.MessagePackSerializerOptions +static readonly MessagePack.Resolvers.StandardResolverAllowPrivate.Instance -> MessagePack.Resolvers.StandardResolverAllowPrivate +static readonly MessagePack.Resolvers.StandardResolverAllowPrivate.Options -> MessagePack.MessagePackSerializerOptions +static readonly MessagePack.Resolvers.StaticCompositeResolver.Instance -> MessagePack.Resolvers.StaticCompositeResolver +static readonly MessagePack.Resolvers.TypelessContractlessStandardResolver.Instance -> MessagePack.Resolvers.TypelessContractlessStandardResolver +static readonly MessagePack.Resolvers.TypelessContractlessStandardResolver.Options -> MessagePack.MessagePackSerializerOptions +static readonly MessagePack.Resolvers.TypelessObjectResolver.Instance -> MessagePack.IFormatterResolver +virtual MessagePack.Formatters.CollectionFormatterBase.GetCount(TCollection sequence) -> int? +virtual MessagePack.MessagePackSerializerOptions.Clone() -> MessagePack.MessagePackSerializerOptions +virtual MessagePack.MessagePackSerializerOptions.LoadType(string typeName) -> System.Type +virtual MessagePack.MessagePackSerializerOptions.ThrowIfDeserializingTypeIsDisallowed(System.Type type) -> void +MessagePack.ExtensionHeader.Equals(MessagePack.ExtensionHeader other) -> bool +MessagePack.Formatters.InterfaceCollectionFormatter2 +MessagePack.Formatters.InterfaceCollectionFormatter2.InterfaceCollectionFormatter2() -> void +MessagePack.Formatters.InterfaceListFormatter2 +MessagePack.Formatters.InterfaceListFormatter2.InterfaceListFormatter2() -> void +MessagePack.MessagePackReader.Depth.get -> int +MessagePack.MessagePackReader.Depth.set -> void +MessagePack.MessagePackReader.ReadDateTime(MessagePack.ExtensionHeader header) -> System.DateTime +MessagePack.MessagePackReader.TryReadArrayHeader(out int count) -> bool +MessagePack.MessagePackReader.TryReadExtensionFormatHeader(out MessagePack.ExtensionHeader extensionHeader) -> bool +MessagePack.MessagePackReader.TryReadMapHeader(out int count) -> bool +MessagePack.MessagePackSecurity +MessagePack.MessagePackSecurity.DepthStep(ref MessagePack.MessagePackReader reader) -> void +MessagePack.MessagePackSecurity.GetEqualityComparer() -> System.Collections.IEqualityComparer +MessagePack.MessagePackSecurity.GetEqualityComparer() -> System.Collections.Generic.IEqualityComparer +MessagePack.MessagePackSecurity.HashCollisionResistant.get -> bool +MessagePack.MessagePackSecurity.MaximumObjectGraphDepth.get -> int +MessagePack.MessagePackSecurity.MessagePackSecurity(MessagePack.MessagePackSecurity copyFrom) -> void +MessagePack.MessagePackSecurity.WithHashCollisionResistant(bool hashCollisionResistant) -> MessagePack.MessagePackSecurity +MessagePack.MessagePackSecurity.WithMaximumObjectGraphDepth(int maximumObjectGraphDepth) -> MessagePack.MessagePackSecurity +MessagePack.MessagePackSerializerOptions.Security.get -> MessagePack.MessagePackSecurity +MessagePack.MessagePackSerializerOptions.WithSecurity(MessagePack.MessagePackSecurity security) -> MessagePack.MessagePackSerializerOptions +MessagePack.MessagePackStreamReader.DiscardBufferedData() -> void +MessagePack.MessagePackStreamReader.MessagePackStreamReader(System.IO.Stream stream, bool leaveOpen) -> void +MessagePack.MessagePackStreamReader.ReadArrayAsync(System.Threading.CancellationToken cancellationToken) -> System.Collections.Generic.IAsyncEnumerable> +MessagePack.MessagePackWriter.WriteBinHeader(int length) -> void +MessagePack.MessagePackWriter.WriteStringHeader(int byteCount) -> void +static readonly MessagePack.MessagePackSecurity.TrustedData -> MessagePack.MessagePackSecurity +static readonly MessagePack.MessagePackSecurity.UntrustedData -> MessagePack.MessagePackSecurity +virtual MessagePack.MessagePackSecurity.Clone() -> MessagePack.MessagePackSecurity +virtual MessagePack.MessagePackSecurity.GetHashCollisionResistantEqualityComparer() -> System.Collections.IEqualityComparer +virtual MessagePack.MessagePackSecurity.GetHashCollisionResistantEqualityComparer() -> System.Collections.Generic.IEqualityComparer diff --git a/src/MessagePack/PublicAPI.Unshipped.txt b/src/MessagePack/netcoreapp2.1/PublicAPI.Unshipped.txt similarity index 100% rename from src/MessagePack/PublicAPI.Unshipped.txt rename to src/MessagePack/netcoreapp2.1/PublicAPI.Unshipped.txt diff --git a/src/MessagePack/netstandard2.0/PublicAPI.Shipped.txt b/src/MessagePack/netstandard2.0/PublicAPI.Shipped.txt new file mode 100644 index 000000000..055787782 --- /dev/null +++ b/src/MessagePack/netstandard2.0/PublicAPI.Shipped.txt @@ -0,0 +1,1025 @@ +MessagePack.ExtensionHeader +MessagePack.ExtensionHeader.ExtensionHeader(sbyte typeCode, int length) -> void +MessagePack.ExtensionHeader.ExtensionHeader(sbyte typeCode, uint length) -> void +MessagePack.ExtensionHeader.Length.get -> uint +MessagePack.ExtensionHeader.TypeCode.get -> sbyte +MessagePack.ExtensionResult +MessagePack.ExtensionResult.Data.get -> System.Buffers.ReadOnlySequence +MessagePack.ExtensionResult.ExtensionResult(sbyte typeCode, System.Buffers.ReadOnlySequence data) -> void +MessagePack.ExtensionResult.ExtensionResult(sbyte typeCode, System.Memory data) -> void +MessagePack.ExtensionResult.Header.get -> MessagePack.ExtensionHeader +MessagePack.ExtensionResult.TypeCode.get -> sbyte +MessagePack.FormatterNotRegisteredException +MessagePack.FormatterNotRegisteredException.FormatterNotRegisteredException(string message) -> void +MessagePack.FormatterResolverExtensions +MessagePack.Formatters.ArrayFormatter +MessagePack.Formatters.ArrayFormatter.ArrayFormatter() -> void +MessagePack.Formatters.ArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> T[] +MessagePack.Formatters.ArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, T[] value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ArraySegmentFormatter +MessagePack.Formatters.ArraySegmentFormatter.ArraySegmentFormatter() -> void +MessagePack.Formatters.ArraySegmentFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.ArraySegment +MessagePack.Formatters.ArraySegmentFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.ArraySegment value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.BigIntegerFormatter +MessagePack.Formatters.BigIntegerFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Numerics.BigInteger +MessagePack.Formatters.BigIntegerFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Numerics.BigInteger value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.BitArrayFormatter +MessagePack.Formatters.BitArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Collections.BitArray +MessagePack.Formatters.BitArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Collections.BitArray value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.BooleanArrayFormatter +MessagePack.Formatters.BooleanArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> bool[] +MessagePack.Formatters.BooleanArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, bool[] value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.BooleanFormatter +MessagePack.Formatters.BooleanFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> bool +MessagePack.Formatters.BooleanFormatter.Serialize(ref MessagePack.MessagePackWriter writer, bool value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ByteArrayFormatter +MessagePack.Formatters.ByteArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> byte[] +MessagePack.Formatters.ByteArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, byte[] value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ByteArraySegmentFormatter +MessagePack.Formatters.ByteArraySegmentFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.ArraySegment +MessagePack.Formatters.ByteArraySegmentFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.ArraySegment value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ByteFormatter +MessagePack.Formatters.ByteFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> byte +MessagePack.Formatters.ByteFormatter.Serialize(ref MessagePack.MessagePackWriter writer, byte value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.CharArrayFormatter +MessagePack.Formatters.CharArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> char[] +MessagePack.Formatters.CharArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, char[] value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.CharFormatter +MessagePack.Formatters.CharFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> char +MessagePack.Formatters.CharFormatter.Serialize(ref MessagePack.MessagePackWriter writer, char value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.CollectionFormatterBase +MessagePack.Formatters.CollectionFormatterBase.CollectionFormatterBase() -> void +MessagePack.Formatters.CollectionFormatterBase +MessagePack.Formatters.CollectionFormatterBase.CollectionFormatterBase() -> void +MessagePack.Formatters.CollectionFormatterBase +MessagePack.Formatters.CollectionFormatterBase.CollectionFormatterBase() -> void +MessagePack.Formatters.CollectionFormatterBase.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> TCollection +MessagePack.Formatters.CollectionFormatterBase.Serialize(ref MessagePack.MessagePackWriter writer, TCollection value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ComplexFormatter +MessagePack.Formatters.ComplexFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Numerics.Complex +MessagePack.Formatters.ComplexFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Numerics.Complex value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ConcurrentBagFormatter +MessagePack.Formatters.ConcurrentBagFormatter.ConcurrentBagFormatter() -> void +MessagePack.Formatters.ConcurrentDictionaryFormatter +MessagePack.Formatters.ConcurrentDictionaryFormatter.ConcurrentDictionaryFormatter() -> void +MessagePack.Formatters.ConcurrentQueueFormatter +MessagePack.Formatters.ConcurrentQueueFormatter.ConcurrentQueueFormatter() -> void +MessagePack.Formatters.ConcurrentStackFormatter +MessagePack.Formatters.ConcurrentStackFormatter.ConcurrentStackFormatter() -> void +MessagePack.Formatters.DateTimeArrayFormatter +MessagePack.Formatters.DateTimeArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.DateTime[] +MessagePack.Formatters.DateTimeArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.DateTime[] value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.DateTimeFormatter +MessagePack.Formatters.DateTimeFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.DateTime +MessagePack.Formatters.DateTimeFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.DateTime value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.DateTimeOffsetFormatter +MessagePack.Formatters.DateTimeOffsetFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.DateTimeOffset +MessagePack.Formatters.DateTimeOffsetFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.DateTimeOffset value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.DecimalFormatter +MessagePack.Formatters.DecimalFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> decimal +MessagePack.Formatters.DecimalFormatter.Serialize(ref MessagePack.MessagePackWriter writer, decimal value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.DictionaryFormatter +MessagePack.Formatters.DictionaryFormatter.DictionaryFormatter() -> void +MessagePack.Formatters.DictionaryFormatterBase +MessagePack.Formatters.DictionaryFormatterBase.DictionaryFormatterBase() -> void +MessagePack.Formatters.DictionaryFormatterBase +MessagePack.Formatters.DictionaryFormatterBase.DictionaryFormatterBase() -> void +MessagePack.Formatters.DictionaryFormatterBase +MessagePack.Formatters.DictionaryFormatterBase.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> TDictionary +MessagePack.Formatters.DictionaryFormatterBase.DictionaryFormatterBase() -> void +MessagePack.Formatters.DictionaryFormatterBase.Serialize(ref MessagePack.MessagePackWriter writer, TDictionary value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.DoubleArrayFormatter +MessagePack.Formatters.DoubleArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> double[] +MessagePack.Formatters.DoubleArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, double[] value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.DoubleFormatter +MessagePack.Formatters.DoubleFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> double +MessagePack.Formatters.DoubleFormatter.Serialize(ref MessagePack.MessagePackWriter writer, double value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.DynamicObjectTypeFallbackFormatter +MessagePack.Formatters.DynamicObjectTypeFallbackFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> object +MessagePack.Formatters.DynamicObjectTypeFallbackFormatter.Serialize(ref MessagePack.MessagePackWriter writer, object value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.EnumAsStringFormatter +MessagePack.Formatters.EnumAsStringFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> T +MessagePack.Formatters.EnumAsStringFormatter.EnumAsStringFormatter() -> void +MessagePack.Formatters.EnumAsStringFormatter.Serialize(ref MessagePack.MessagePackWriter writer, T value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ForceByteBlockFormatter +MessagePack.Formatters.ForceByteBlockFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> byte +MessagePack.Formatters.ForceByteBlockFormatter.Serialize(ref MessagePack.MessagePackWriter writer, byte value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ForceInt16BlockArrayFormatter +MessagePack.Formatters.ForceInt16BlockArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> short[] +MessagePack.Formatters.ForceInt16BlockArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, short[] value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ForceInt16BlockFormatter +MessagePack.Formatters.ForceInt16BlockFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> short +MessagePack.Formatters.ForceInt16BlockFormatter.Serialize(ref MessagePack.MessagePackWriter writer, short value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ForceInt32BlockArrayFormatter +MessagePack.Formatters.ForceInt32BlockArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> int[] +MessagePack.Formatters.ForceInt32BlockArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, int[] value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ForceInt32BlockFormatter +MessagePack.Formatters.ForceInt32BlockFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> int +MessagePack.Formatters.ForceInt32BlockFormatter.Serialize(ref MessagePack.MessagePackWriter writer, int value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ForceInt64BlockArrayFormatter +MessagePack.Formatters.ForceInt64BlockArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> long[] +MessagePack.Formatters.ForceInt64BlockArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, long[] value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ForceInt64BlockFormatter +MessagePack.Formatters.ForceInt64BlockFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> long +MessagePack.Formatters.ForceInt64BlockFormatter.Serialize(ref MessagePack.MessagePackWriter writer, long value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ForceSByteBlockArrayFormatter +MessagePack.Formatters.ForceSByteBlockArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> sbyte[] +MessagePack.Formatters.ForceSByteBlockArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, sbyte[] value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ForceSByteBlockFormatter +MessagePack.Formatters.ForceSByteBlockFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> sbyte +MessagePack.Formatters.ForceSByteBlockFormatter.Serialize(ref MessagePack.MessagePackWriter writer, sbyte value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ForceUInt16BlockArrayFormatter +MessagePack.Formatters.ForceUInt16BlockArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> ushort[] +MessagePack.Formatters.ForceUInt16BlockArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, ushort[] value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ForceUInt16BlockFormatter +MessagePack.Formatters.ForceUInt16BlockFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> ushort +MessagePack.Formatters.ForceUInt16BlockFormatter.Serialize(ref MessagePack.MessagePackWriter writer, ushort value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ForceUInt32BlockArrayFormatter +MessagePack.Formatters.ForceUInt32BlockArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> uint[] +MessagePack.Formatters.ForceUInt32BlockArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, uint[] value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ForceUInt32BlockFormatter +MessagePack.Formatters.ForceUInt32BlockFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> uint +MessagePack.Formatters.ForceUInt32BlockFormatter.Serialize(ref MessagePack.MessagePackWriter writer, uint value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ForceUInt64BlockArrayFormatter +MessagePack.Formatters.ForceUInt64BlockArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> ulong[] +MessagePack.Formatters.ForceUInt64BlockArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, ulong[] value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ForceUInt64BlockFormatter +MessagePack.Formatters.ForceUInt64BlockFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> ulong +MessagePack.Formatters.ForceUInt64BlockFormatter.Serialize(ref MessagePack.MessagePackWriter writer, ulong value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.FourDimensionalArrayFormatter +MessagePack.Formatters.FourDimensionalArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> T[,,,] +MessagePack.Formatters.FourDimensionalArrayFormatter.FourDimensionalArrayFormatter() -> void +MessagePack.Formatters.FourDimensionalArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, T[,,,] value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.GenericCollectionFormatter +MessagePack.Formatters.GenericCollectionFormatter.GenericCollectionFormatter() -> void +MessagePack.Formatters.GenericDictionaryFormatter +MessagePack.Formatters.GenericDictionaryFormatter.GenericDictionaryFormatter() -> void +MessagePack.Formatters.GenericEnumFormatter +MessagePack.Formatters.GenericEnumFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> T +MessagePack.Formatters.GenericEnumFormatter.GenericEnumFormatter() -> void +MessagePack.Formatters.GenericEnumFormatter.Serialize(ref MessagePack.MessagePackWriter writer, T value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.GuidFormatter +MessagePack.Formatters.GuidFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Guid +MessagePack.Formatters.GuidFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Guid value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.HashSetFormatter +MessagePack.Formatters.HashSetFormatter.HashSetFormatter() -> void +MessagePack.Formatters.IMessagePackFormatter +MessagePack.Formatters.IMessagePackFormatter +MessagePack.Formatters.IMessagePackFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> T +MessagePack.Formatters.IMessagePackFormatter.Serialize(ref MessagePack.MessagePackWriter writer, T value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.IgnoreFormatter +MessagePack.Formatters.IgnoreFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> T +MessagePack.Formatters.IgnoreFormatter.IgnoreFormatter() -> void +MessagePack.Formatters.IgnoreFormatter.Serialize(ref MessagePack.MessagePackWriter writer, T value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.Int16ArrayFormatter +MessagePack.Formatters.Int16ArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> short[] +MessagePack.Formatters.Int16ArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, short[] value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.Int16Formatter +MessagePack.Formatters.Int16Formatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> short +MessagePack.Formatters.Int16Formatter.Serialize(ref MessagePack.MessagePackWriter writer, short value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.Int32ArrayFormatter +MessagePack.Formatters.Int32ArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> int[] +MessagePack.Formatters.Int32ArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, int[] value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.Int32Formatter +MessagePack.Formatters.Int32Formatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> int +MessagePack.Formatters.Int32Formatter.Serialize(ref MessagePack.MessagePackWriter writer, int value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.Int64ArrayFormatter +MessagePack.Formatters.Int64ArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> long[] +MessagePack.Formatters.Int64ArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, long[] value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.Int64Formatter +MessagePack.Formatters.Int64Formatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> long +MessagePack.Formatters.Int64Formatter.Serialize(ref MessagePack.MessagePackWriter writer, long value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.InterfaceCollectionFormatter +MessagePack.Formatters.InterfaceCollectionFormatter.InterfaceCollectionFormatter() -> void +MessagePack.Formatters.InterfaceDictionaryFormatter +MessagePack.Formatters.InterfaceDictionaryFormatter.InterfaceDictionaryFormatter() -> void +MessagePack.Formatters.InterfaceEnumerableFormatter +MessagePack.Formatters.InterfaceEnumerableFormatter.InterfaceEnumerableFormatter() -> void +MessagePack.Formatters.InterfaceGroupingFormatter +MessagePack.Formatters.InterfaceGroupingFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Linq.IGrouping +MessagePack.Formatters.InterfaceGroupingFormatter.InterfaceGroupingFormatter() -> void +MessagePack.Formatters.InterfaceGroupingFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Linq.IGrouping value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.InterfaceListFormatter +MessagePack.Formatters.InterfaceListFormatter.InterfaceListFormatter() -> void +MessagePack.Formatters.InterfaceLookupFormatter +MessagePack.Formatters.InterfaceLookupFormatter.InterfaceLookupFormatter() -> void +MessagePack.Formatters.InterfaceReadOnlyCollectionFormatter +MessagePack.Formatters.InterfaceReadOnlyCollectionFormatter.InterfaceReadOnlyCollectionFormatter() -> void +MessagePack.Formatters.InterfaceReadOnlyDictionaryFormatter +MessagePack.Formatters.InterfaceReadOnlyDictionaryFormatter.InterfaceReadOnlyDictionaryFormatter() -> void +MessagePack.Formatters.InterfaceReadOnlyListFormatter +MessagePack.Formatters.InterfaceReadOnlyListFormatter.InterfaceReadOnlyListFormatter() -> void +MessagePack.Formatters.InterfaceSetFormatter +MessagePack.Formatters.InterfaceSetFormatter.InterfaceSetFormatter() -> void +MessagePack.Formatters.KeyValuePairFormatter +MessagePack.Formatters.KeyValuePairFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Collections.Generic.KeyValuePair +MessagePack.Formatters.KeyValuePairFormatter.KeyValuePairFormatter() -> void +MessagePack.Formatters.KeyValuePairFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Collections.Generic.KeyValuePair value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.LazyFormatter +MessagePack.Formatters.LazyFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Lazy +MessagePack.Formatters.LazyFormatter.LazyFormatter() -> void +MessagePack.Formatters.LazyFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Lazy value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.LinkedListFormatter +MessagePack.Formatters.LinkedListFormatter.LinkedListFormatter() -> void +MessagePack.Formatters.ListFormatter +MessagePack.Formatters.ListFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Collections.Generic.List +MessagePack.Formatters.ListFormatter.ListFormatter() -> void +MessagePack.Formatters.ListFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Collections.Generic.List value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NativeDateTimeArrayFormatter +MessagePack.Formatters.NativeDateTimeArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.DateTime[] +MessagePack.Formatters.NativeDateTimeArrayFormatter.NativeDateTimeArrayFormatter() -> void +MessagePack.Formatters.NativeDateTimeArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.DateTime[] value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NativeDateTimeFormatter +MessagePack.Formatters.NativeDateTimeFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.DateTime +MessagePack.Formatters.NativeDateTimeFormatter.NativeDateTimeFormatter() -> void +MessagePack.Formatters.NativeDateTimeFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.DateTime value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NativeDecimalFormatter +MessagePack.Formatters.NativeDecimalFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> decimal +MessagePack.Formatters.NativeDecimalFormatter.Serialize(ref MessagePack.MessagePackWriter writer, decimal value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NativeGuidFormatter +MessagePack.Formatters.NativeGuidFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Guid +MessagePack.Formatters.NativeGuidFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Guid value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NilFormatter +MessagePack.Formatters.NilFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> MessagePack.Nil +MessagePack.Formatters.NilFormatter.Serialize(ref MessagePack.MessagePackWriter writer, MessagePack.Nil value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NonGenericDictionaryFormatter +MessagePack.Formatters.NonGenericDictionaryFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> T +MessagePack.Formatters.NonGenericDictionaryFormatter.NonGenericDictionaryFormatter() -> void +MessagePack.Formatters.NonGenericDictionaryFormatter.Serialize(ref MessagePack.MessagePackWriter writer, T value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NonGenericInterfaceDictionaryFormatter +MessagePack.Formatters.NonGenericInterfaceDictionaryFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Collections.IDictionary +MessagePack.Formatters.NonGenericInterfaceDictionaryFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Collections.IDictionary value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NonGenericInterfaceListFormatter +MessagePack.Formatters.NonGenericInterfaceListFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Collections.IList +MessagePack.Formatters.NonGenericInterfaceListFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Collections.IList value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NonGenericListFormatter +MessagePack.Formatters.NonGenericListFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> T +MessagePack.Formatters.NonGenericListFormatter.NonGenericListFormatter() -> void +MessagePack.Formatters.NonGenericListFormatter.Serialize(ref MessagePack.MessagePackWriter writer, T value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NullableBooleanFormatter +MessagePack.Formatters.NullableBooleanFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> bool? +MessagePack.Formatters.NullableBooleanFormatter.Serialize(ref MessagePack.MessagePackWriter writer, bool? value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NullableByteFormatter +MessagePack.Formatters.NullableByteFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> byte? +MessagePack.Formatters.NullableByteFormatter.Serialize(ref MessagePack.MessagePackWriter writer, byte? value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NullableCharFormatter +MessagePack.Formatters.NullableCharFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> char? +MessagePack.Formatters.NullableCharFormatter.Serialize(ref MessagePack.MessagePackWriter writer, char? value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NullableDateTimeFormatter +MessagePack.Formatters.NullableDateTimeFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.DateTime? +MessagePack.Formatters.NullableDateTimeFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.DateTime? value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NullableDoubleFormatter +MessagePack.Formatters.NullableDoubleFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> double? +MessagePack.Formatters.NullableDoubleFormatter.Serialize(ref MessagePack.MessagePackWriter writer, double? value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NullableForceByteBlockFormatter +MessagePack.Formatters.NullableForceByteBlockFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> byte? +MessagePack.Formatters.NullableForceByteBlockFormatter.Serialize(ref MessagePack.MessagePackWriter writer, byte? value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NullableForceInt16BlockFormatter +MessagePack.Formatters.NullableForceInt16BlockFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> short? +MessagePack.Formatters.NullableForceInt16BlockFormatter.Serialize(ref MessagePack.MessagePackWriter writer, short? value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NullableForceInt32BlockFormatter +MessagePack.Formatters.NullableForceInt32BlockFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> int? +MessagePack.Formatters.NullableForceInt32BlockFormatter.Serialize(ref MessagePack.MessagePackWriter writer, int? value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NullableForceInt64BlockFormatter +MessagePack.Formatters.NullableForceInt64BlockFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> long? +MessagePack.Formatters.NullableForceInt64BlockFormatter.Serialize(ref MessagePack.MessagePackWriter writer, long? value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NullableForceSByteBlockFormatter +MessagePack.Formatters.NullableForceSByteBlockFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> sbyte? +MessagePack.Formatters.NullableForceSByteBlockFormatter.Serialize(ref MessagePack.MessagePackWriter writer, sbyte? value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NullableForceUInt16BlockFormatter +MessagePack.Formatters.NullableForceUInt16BlockFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> ushort? +MessagePack.Formatters.NullableForceUInt16BlockFormatter.Serialize(ref MessagePack.MessagePackWriter writer, ushort? value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NullableForceUInt32BlockFormatter +MessagePack.Formatters.NullableForceUInt32BlockFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> uint? +MessagePack.Formatters.NullableForceUInt32BlockFormatter.Serialize(ref MessagePack.MessagePackWriter writer, uint? value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NullableForceUInt64BlockFormatter +MessagePack.Formatters.NullableForceUInt64BlockFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> ulong? +MessagePack.Formatters.NullableForceUInt64BlockFormatter.Serialize(ref MessagePack.MessagePackWriter writer, ulong? value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NullableFormatter +MessagePack.Formatters.NullableFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> T? +MessagePack.Formatters.NullableFormatter.NullableFormatter() -> void +MessagePack.Formatters.NullableFormatter.Serialize(ref MessagePack.MessagePackWriter writer, T? value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NullableInt16Formatter +MessagePack.Formatters.NullableInt16Formatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> short? +MessagePack.Formatters.NullableInt16Formatter.Serialize(ref MessagePack.MessagePackWriter writer, short? value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NullableInt32Formatter +MessagePack.Formatters.NullableInt32Formatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> int? +MessagePack.Formatters.NullableInt32Formatter.Serialize(ref MessagePack.MessagePackWriter writer, int? value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NullableInt64Formatter +MessagePack.Formatters.NullableInt64Formatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> long? +MessagePack.Formatters.NullableInt64Formatter.Serialize(ref MessagePack.MessagePackWriter writer, long? value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NullableNilFormatter +MessagePack.Formatters.NullableNilFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> MessagePack.Nil? +MessagePack.Formatters.NullableNilFormatter.Serialize(ref MessagePack.MessagePackWriter writer, MessagePack.Nil? value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NullableSByteFormatter +MessagePack.Formatters.NullableSByteFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> sbyte? +MessagePack.Formatters.NullableSByteFormatter.Serialize(ref MessagePack.MessagePackWriter writer, sbyte? value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NullableSingleFormatter +MessagePack.Formatters.NullableSingleFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> float? +MessagePack.Formatters.NullableSingleFormatter.Serialize(ref MessagePack.MessagePackWriter writer, float? value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NullableStringArrayFormatter +MessagePack.Formatters.NullableStringArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> string[] +MessagePack.Formatters.NullableStringArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, string[] value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NullableStringFormatter +MessagePack.Formatters.NullableStringFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> string +MessagePack.Formatters.NullableStringFormatter.Serialize(ref MessagePack.MessagePackWriter writer, string value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NullableUInt16Formatter +MessagePack.Formatters.NullableUInt16Formatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> ushort? +MessagePack.Formatters.NullableUInt16Formatter.Serialize(ref MessagePack.MessagePackWriter writer, ushort? value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NullableUInt32Formatter +MessagePack.Formatters.NullableUInt32Formatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> uint? +MessagePack.Formatters.NullableUInt32Formatter.Serialize(ref MessagePack.MessagePackWriter writer, uint? value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NullableUInt64Formatter +MessagePack.Formatters.NullableUInt64Formatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> ulong? +MessagePack.Formatters.NullableUInt64Formatter.Serialize(ref MessagePack.MessagePackWriter writer, ulong? value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ObservableCollectionFormatter +MessagePack.Formatters.ObservableCollectionFormatter.ObservableCollectionFormatter() -> void +MessagePack.Formatters.PrimitiveObjectFormatter +MessagePack.Formatters.PrimitiveObjectFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> object +MessagePack.Formatters.PrimitiveObjectFormatter.Serialize(ref MessagePack.MessagePackWriter writer, object value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.QueueFormatter +MessagePack.Formatters.QueueFormatter.QueueFormatter() -> void +MessagePack.Formatters.ReadOnlyCollectionFormatter +MessagePack.Formatters.ReadOnlyCollectionFormatter.ReadOnlyCollectionFormatter() -> void +MessagePack.Formatters.ReadOnlyDictionaryFormatter +MessagePack.Formatters.ReadOnlyDictionaryFormatter.ReadOnlyDictionaryFormatter() -> void +MessagePack.Formatters.ReadOnlyObservableCollectionFormatter +MessagePack.Formatters.ReadOnlyObservableCollectionFormatter.ReadOnlyObservableCollectionFormatter() -> void +MessagePack.Formatters.SByteArrayFormatter +MessagePack.Formatters.SByteArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> sbyte[] +MessagePack.Formatters.SByteArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, sbyte[] value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.SByteFormatter +MessagePack.Formatters.SByteFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> sbyte +MessagePack.Formatters.SByteFormatter.Serialize(ref MessagePack.MessagePackWriter writer, sbyte value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.SingleArrayFormatter +MessagePack.Formatters.SingleArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> float[] +MessagePack.Formatters.SingleArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, float[] value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.SingleFormatter +MessagePack.Formatters.SingleFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> float +MessagePack.Formatters.SingleFormatter.Serialize(ref MessagePack.MessagePackWriter writer, float value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.SortedDictionaryFormatter +MessagePack.Formatters.SortedDictionaryFormatter.SortedDictionaryFormatter() -> void +MessagePack.Formatters.SortedListFormatter +MessagePack.Formatters.SortedListFormatter.SortedListFormatter() -> void +MessagePack.Formatters.StackFormatter +MessagePack.Formatters.StackFormatter.StackFormatter() -> void +MessagePack.Formatters.StaticNullableFormatter +MessagePack.Formatters.StaticNullableFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> T? +MessagePack.Formatters.StaticNullableFormatter.Serialize(ref MessagePack.MessagePackWriter writer, T? value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.StaticNullableFormatter.StaticNullableFormatter(MessagePack.Formatters.IMessagePackFormatter underlyingFormatter) -> void +MessagePack.Formatters.StringBuilderFormatter +MessagePack.Formatters.StringBuilderFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Text.StringBuilder +MessagePack.Formatters.StringBuilderFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Text.StringBuilder value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ThreeDimensionalArrayFormatter +MessagePack.Formatters.ThreeDimensionalArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> T[,,] +MessagePack.Formatters.ThreeDimensionalArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, T[,,] value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ThreeDimensionalArrayFormatter.ThreeDimensionalArrayFormatter() -> void +MessagePack.Formatters.TimeSpanFormatter +MessagePack.Formatters.TimeSpanFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.TimeSpan +MessagePack.Formatters.TimeSpanFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.TimeSpan value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.TupleFormatter +MessagePack.Formatters.TupleFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Tuple +MessagePack.Formatters.TupleFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Tuple value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.TupleFormatter.TupleFormatter() -> void +MessagePack.Formatters.TupleFormatter +MessagePack.Formatters.TupleFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Tuple +MessagePack.Formatters.TupleFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Tuple value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.TupleFormatter.TupleFormatter() -> void +MessagePack.Formatters.TupleFormatter +MessagePack.Formatters.TupleFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Tuple +MessagePack.Formatters.TupleFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Tuple value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.TupleFormatter.TupleFormatter() -> void +MessagePack.Formatters.TupleFormatter +MessagePack.Formatters.TupleFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Tuple +MessagePack.Formatters.TupleFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Tuple value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.TupleFormatter.TupleFormatter() -> void +MessagePack.Formatters.TupleFormatter +MessagePack.Formatters.TupleFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Tuple +MessagePack.Formatters.TupleFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Tuple value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.TupleFormatter.TupleFormatter() -> void +MessagePack.Formatters.TupleFormatter +MessagePack.Formatters.TupleFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Tuple +MessagePack.Formatters.TupleFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Tuple value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.TupleFormatter.TupleFormatter() -> void +MessagePack.Formatters.TupleFormatter +MessagePack.Formatters.TupleFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Tuple +MessagePack.Formatters.TupleFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Tuple value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.TupleFormatter.TupleFormatter() -> void +MessagePack.Formatters.TupleFormatter +MessagePack.Formatters.TupleFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Tuple +MessagePack.Formatters.TupleFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Tuple value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.TupleFormatter.TupleFormatter() -> void +MessagePack.Formatters.TwoDimensionalArrayFormatter +MessagePack.Formatters.TwoDimensionalArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> T[,] +MessagePack.Formatters.TwoDimensionalArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, T[,] value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.TwoDimensionalArrayFormatter.TwoDimensionalArrayFormatter() -> void +MessagePack.Formatters.TypelessFormatter +MessagePack.Formatters.TypelessFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> object +MessagePack.Formatters.TypelessFormatter.Serialize(ref MessagePack.MessagePackWriter writer, object value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.UInt16ArrayFormatter +MessagePack.Formatters.UInt16ArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> ushort[] +MessagePack.Formatters.UInt16ArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, ushort[] value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.UInt16Formatter +MessagePack.Formatters.UInt16Formatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> ushort +MessagePack.Formatters.UInt16Formatter.Serialize(ref MessagePack.MessagePackWriter writer, ushort value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.UInt32ArrayFormatter +MessagePack.Formatters.UInt32ArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> uint[] +MessagePack.Formatters.UInt32ArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, uint[] value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.UInt32Formatter +MessagePack.Formatters.UInt32Formatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> uint +MessagePack.Formatters.UInt32Formatter.Serialize(ref MessagePack.MessagePackWriter writer, uint value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.UInt64ArrayFormatter +MessagePack.Formatters.UInt64ArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> ulong[] +MessagePack.Formatters.UInt64ArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, ulong[] value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.UInt64Formatter +MessagePack.Formatters.UInt64Formatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> ulong +MessagePack.Formatters.UInt64Formatter.Serialize(ref MessagePack.MessagePackWriter writer, ulong value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.UriFormatter +MessagePack.Formatters.UriFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Uri +MessagePack.Formatters.UriFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Uri value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ValueTupleFormatter +MessagePack.Formatters.ValueTupleFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.ValueTuple +MessagePack.Formatters.ValueTupleFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.ValueTuple value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ValueTupleFormatter.ValueTupleFormatter() -> void +MessagePack.Formatters.ValueTupleFormatter +MessagePack.Formatters.ValueTupleFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> (T1, T2, T3, T4, T5, T6, T7) +MessagePack.Formatters.ValueTupleFormatter.Serialize(ref MessagePack.MessagePackWriter writer, (T1, T2, T3, T4, T5, T6, T7) value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ValueTupleFormatter.ValueTupleFormatter() -> void +MessagePack.Formatters.ValueTupleFormatter +MessagePack.Formatters.ValueTupleFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> (T1, T2, T3, T4, T5, T6) +MessagePack.Formatters.ValueTupleFormatter.Serialize(ref MessagePack.MessagePackWriter writer, (T1, T2, T3, T4, T5, T6) value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ValueTupleFormatter.ValueTupleFormatter() -> void +MessagePack.Formatters.ValueTupleFormatter +MessagePack.Formatters.ValueTupleFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> (T1, T2, T3, T4, T5) +MessagePack.Formatters.ValueTupleFormatter.Serialize(ref MessagePack.MessagePackWriter writer, (T1, T2, T3, T4, T5) value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ValueTupleFormatter.ValueTupleFormatter() -> void +MessagePack.Formatters.ValueTupleFormatter +MessagePack.Formatters.ValueTupleFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> (T1, T2, T3, T4) +MessagePack.Formatters.ValueTupleFormatter.Serialize(ref MessagePack.MessagePackWriter writer, (T1, T2, T3, T4) value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ValueTupleFormatter.ValueTupleFormatter() -> void +MessagePack.Formatters.ValueTupleFormatter +MessagePack.Formatters.ValueTupleFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> (T1, T2, T3) +MessagePack.Formatters.ValueTupleFormatter.Serialize(ref MessagePack.MessagePackWriter writer, (T1, T2, T3) value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ValueTupleFormatter.ValueTupleFormatter() -> void +MessagePack.Formatters.ValueTupleFormatter +MessagePack.Formatters.ValueTupleFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> (T1, T2) +MessagePack.Formatters.ValueTupleFormatter.Serialize(ref MessagePack.MessagePackWriter writer, (T1, T2) value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ValueTupleFormatter.ValueTupleFormatter() -> void +MessagePack.Formatters.ValueTupleFormatter +MessagePack.Formatters.ValueTupleFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.ValueTuple +MessagePack.Formatters.ValueTupleFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.ValueTuple value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ValueTupleFormatter.ValueTupleFormatter() -> void +MessagePack.Formatters.VersionFormatter +MessagePack.Formatters.VersionFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Version +MessagePack.Formatters.VersionFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Version value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.IFormatterResolver +MessagePack.IFormatterResolver.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter +MessagePack.Internal.AutomataDictionary +MessagePack.Internal.AutomataDictionary.Add(string str, int value) -> void +MessagePack.Internal.AutomataDictionary.AutomataDictionary() -> void +MessagePack.Internal.AutomataDictionary.EmitMatch(System.Reflection.Emit.ILGenerator il, System.Reflection.Emit.LocalBuilder bytesSpan, System.Reflection.Emit.LocalBuilder key, System.Action> onFound, System.Action onNotFound) -> void +MessagePack.Internal.AutomataDictionary.GetEnumerator() -> System.Collections.Generic.IEnumerator> +MessagePack.Internal.AutomataDictionary.TryGetValue(System.ReadOnlySpan bytes, out int value) -> bool +MessagePack.Internal.AutomataDictionary.TryGetValue(in System.Buffers.ReadOnlySequence bytes, out int value) -> bool +MessagePack.Internal.AutomataKeyGen +MessagePack.Internal.ByteArrayStringHashTable +MessagePack.Internal.ByteArrayStringHashTable.Add(byte[] key, int value) -> void +MessagePack.Internal.ByteArrayStringHashTable.Add(string key, int value) -> void +MessagePack.Internal.ByteArrayStringHashTable.ByteArrayStringHashTable(int capacity) -> void +MessagePack.Internal.ByteArrayStringHashTable.ByteArrayStringHashTable(int capacity, float loadFactor) -> void +MessagePack.Internal.ByteArrayStringHashTable.GetEnumerator() -> System.Collections.Generic.IEnumerator> +MessagePack.Internal.ByteArrayStringHashTable.TryGetValue(System.ReadOnlySpan key, out int value) -> bool +MessagePack.Internal.ByteArrayStringHashTable.TryGetValue(in System.Buffers.ReadOnlySequence key, out int value) -> bool +MessagePack.Internal.CodeGenHelpers +MessagePack.Internal.RuntimeTypeHandleEqualityComparer +MessagePack.Internal.RuntimeTypeHandleEqualityComparer.Equals(System.RuntimeTypeHandle x, System.RuntimeTypeHandle y) -> bool +MessagePack.Internal.RuntimeTypeHandleEqualityComparer.GetHashCode(System.RuntimeTypeHandle obj) -> int +MessagePack.Internal.UnsafeMemory +MessagePack.Internal.UnsafeMemory32 +MessagePack.Internal.UnsafeMemory64 +MessagePack.MessagePackCode +MessagePack.MessagePackCompression +MessagePack.MessagePackCompression.Lz4Block = 1 -> MessagePack.MessagePackCompression +MessagePack.MessagePackCompression.Lz4BlockArray = 2 -> MessagePack.MessagePackCompression +MessagePack.MessagePackCompression.None = 0 -> MessagePack.MessagePackCompression +MessagePack.MessagePackRange +MessagePack.MessagePackReader +MessagePack.MessagePackReader.CancellationToken.get -> System.Threading.CancellationToken +MessagePack.MessagePackReader.CancellationToken.set -> void +MessagePack.MessagePackReader.Clone(in System.Buffers.ReadOnlySequence readOnlySequence) -> MessagePack.MessagePackReader +MessagePack.MessagePackReader.Consumed.get -> long +MessagePack.MessagePackReader.CreatePeekReader() -> MessagePack.MessagePackReader +MessagePack.MessagePackReader.End.get -> bool +MessagePack.MessagePackReader.IsNil.get -> bool +MessagePack.MessagePackReader.MessagePackReader(System.ReadOnlyMemory memory) -> void +MessagePack.MessagePackReader.MessagePackReader(in System.Buffers.ReadOnlySequence readOnlySequence) -> void +MessagePack.MessagePackReader.NextCode.get -> byte +MessagePack.MessagePackReader.NextMessagePackType.get -> MessagePack.MessagePackType +MessagePack.MessagePackReader.Position.get -> System.SequencePosition +MessagePack.MessagePackReader.ReadArrayHeader() -> int +MessagePack.MessagePackReader.ReadBoolean() -> bool +MessagePack.MessagePackReader.ReadByte() -> byte +MessagePack.MessagePackReader.ReadBytes() -> System.Buffers.ReadOnlySequence? +MessagePack.MessagePackReader.ReadChar() -> char +MessagePack.MessagePackReader.ReadDateTime() -> System.DateTime +MessagePack.MessagePackReader.ReadDouble() -> double +MessagePack.MessagePackReader.ReadExtensionFormat() -> MessagePack.ExtensionResult +MessagePack.MessagePackReader.ReadExtensionFormatHeader() -> MessagePack.ExtensionHeader +MessagePack.MessagePackReader.ReadInt16() -> short +MessagePack.MessagePackReader.ReadInt32() -> int +MessagePack.MessagePackReader.ReadInt64() -> long +MessagePack.MessagePackReader.ReadMapHeader() -> int +MessagePack.MessagePackReader.ReadNil() -> MessagePack.Nil +MessagePack.MessagePackReader.ReadRaw() -> System.Buffers.ReadOnlySequence +MessagePack.MessagePackReader.ReadRaw(long length) -> System.Buffers.ReadOnlySequence +MessagePack.MessagePackReader.ReadSByte() -> sbyte +MessagePack.MessagePackReader.ReadSingle() -> float +MessagePack.MessagePackReader.ReadString() -> string +MessagePack.MessagePackReader.ReadStringSequence() -> System.Buffers.ReadOnlySequence? +MessagePack.MessagePackReader.ReadUInt16() -> ushort +MessagePack.MessagePackReader.ReadUInt32() -> uint +MessagePack.MessagePackReader.ReadUInt64() -> ulong +MessagePack.MessagePackReader.Sequence.get -> System.Buffers.ReadOnlySequence +MessagePack.MessagePackReader.Skip() -> void +MessagePack.MessagePackReader.TryReadNil() -> bool +MessagePack.MessagePackReader.TryReadStringSpan(out System.ReadOnlySpan span) -> bool +MessagePack.MessagePackSerializationException +MessagePack.MessagePackSerializationException.MessagePackSerializationException() -> void +MessagePack.MessagePackSerializationException.MessagePackSerializationException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) -> void +MessagePack.MessagePackSerializationException.MessagePackSerializationException(string message) -> void +MessagePack.MessagePackSerializationException.MessagePackSerializationException(string message, System.Exception inner) -> void +MessagePack.MessagePackSerializer +MessagePack.MessagePackSerializer.Typeless +MessagePack.MessagePackSerializerOptions +MessagePack.MessagePackSerializerOptions.AllowAssemblyVersionMismatch.get -> bool +MessagePack.MessagePackSerializerOptions.Compression.get -> MessagePack.MessagePackCompression +MessagePack.MessagePackSerializerOptions.MessagePackSerializerOptions(MessagePack.IFormatterResolver resolver) -> void +MessagePack.MessagePackSerializerOptions.MessagePackSerializerOptions(MessagePack.MessagePackSerializerOptions copyFrom) -> void +MessagePack.MessagePackSerializerOptions.OldSpec.get -> bool? +MessagePack.MessagePackSerializerOptions.OmitAssemblyVersion.get -> bool +MessagePack.MessagePackSerializerOptions.Resolver.get -> MessagePack.IFormatterResolver +MessagePack.MessagePackSerializerOptions.WithAllowAssemblyVersionMismatch(bool allowAssemblyVersionMismatch) -> MessagePack.MessagePackSerializerOptions +MessagePack.MessagePackSerializerOptions.WithCompression(MessagePack.MessagePackCompression compression) -> MessagePack.MessagePackSerializerOptions +MessagePack.MessagePackSerializerOptions.WithOldSpec(bool? oldSpec = true) -> MessagePack.MessagePackSerializerOptions +MessagePack.MessagePackSerializerOptions.WithOmitAssemblyVersion(bool omitAssemblyVersion) -> MessagePack.MessagePackSerializerOptions +MessagePack.MessagePackSerializerOptions.WithResolver(MessagePack.IFormatterResolver resolver) -> MessagePack.MessagePackSerializerOptions +MessagePack.MessagePackStreamReader +MessagePack.MessagePackStreamReader.Dispose() -> void +MessagePack.MessagePackStreamReader.MessagePackStreamReader(System.IO.Stream stream) -> void +MessagePack.MessagePackStreamReader.ReadAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask?> +MessagePack.MessagePackStreamReader.RemainingBytes.get -> System.Buffers.ReadOnlySequence +MessagePack.MessagePackType +MessagePack.MessagePackType.Array = 7 -> MessagePack.MessagePackType +MessagePack.MessagePackType.Binary = 6 -> MessagePack.MessagePackType +MessagePack.MessagePackType.Boolean = 3 -> MessagePack.MessagePackType +MessagePack.MessagePackType.Extension = 9 -> MessagePack.MessagePackType +MessagePack.MessagePackType.Float = 4 -> MessagePack.MessagePackType +MessagePack.MessagePackType.Integer = 1 -> MessagePack.MessagePackType +MessagePack.MessagePackType.Map = 8 -> MessagePack.MessagePackType +MessagePack.MessagePackType.Nil = 2 -> MessagePack.MessagePackType +MessagePack.MessagePackType.String = 5 -> MessagePack.MessagePackType +MessagePack.MessagePackType.Unknown = 0 -> MessagePack.MessagePackType +MessagePack.MessagePackWriter +MessagePack.MessagePackWriter.Advance(int length) -> void +MessagePack.MessagePackWriter.CancellationToken.get -> System.Threading.CancellationToken +MessagePack.MessagePackWriter.CancellationToken.set -> void +MessagePack.MessagePackWriter.Clone(System.Buffers.IBufferWriter writer) -> MessagePack.MessagePackWriter +MessagePack.MessagePackWriter.Flush() -> void +MessagePack.MessagePackWriter.GetSpan(int length) -> System.Span +MessagePack.MessagePackWriter.MessagePackWriter(System.Buffers.IBufferWriter writer) -> void +MessagePack.MessagePackWriter.OldSpec.get -> bool +MessagePack.MessagePackWriter.OldSpec.set -> void +MessagePack.MessagePackWriter.Write(System.DateTime dateTime) -> void +MessagePack.MessagePackWriter.Write(System.ReadOnlySpan src) -> void +MessagePack.MessagePackWriter.Write(System.ReadOnlySpan value) -> void +MessagePack.MessagePackWriter.Write(bool value) -> void +MessagePack.MessagePackWriter.Write(byte value) -> void +MessagePack.MessagePackWriter.Write(byte[] src) -> void +MessagePack.MessagePackWriter.Write(char value) -> void +MessagePack.MessagePackWriter.Write(double value) -> void +MessagePack.MessagePackWriter.Write(float value) -> void +MessagePack.MessagePackWriter.Write(in System.Buffers.ReadOnlySequence src) -> void +MessagePack.MessagePackWriter.Write(int value) -> void +MessagePack.MessagePackWriter.Write(long value) -> void +MessagePack.MessagePackWriter.Write(sbyte value) -> void +MessagePack.MessagePackWriter.Write(short value) -> void +MessagePack.MessagePackWriter.Write(string value) -> void +MessagePack.MessagePackWriter.Write(uint value) -> void +MessagePack.MessagePackWriter.Write(ulong value) -> void +MessagePack.MessagePackWriter.Write(ushort value) -> void +MessagePack.MessagePackWriter.WriteArrayHeader(int count) -> void +MessagePack.MessagePackWriter.WriteArrayHeader(uint count) -> void +MessagePack.MessagePackWriter.WriteExtensionFormat(MessagePack.ExtensionResult extensionData) -> void +MessagePack.MessagePackWriter.WriteExtensionFormatHeader(MessagePack.ExtensionHeader extensionHeader) -> void +MessagePack.MessagePackWriter.WriteInt16(short value) -> void +MessagePack.MessagePackWriter.WriteInt32(int value) -> void +MessagePack.MessagePackWriter.WriteInt64(long value) -> void +MessagePack.MessagePackWriter.WriteInt8(sbyte value) -> void +MessagePack.MessagePackWriter.WriteMapHeader(int count) -> void +MessagePack.MessagePackWriter.WriteMapHeader(uint count) -> void +MessagePack.MessagePackWriter.WriteNil() -> void +MessagePack.MessagePackWriter.WriteRaw(System.ReadOnlySpan rawMessagePackBlock) -> void +MessagePack.MessagePackWriter.WriteRaw(in System.Buffers.ReadOnlySequence rawMessagePackBlock) -> void +MessagePack.MessagePackWriter.WriteString(System.ReadOnlySpan utf8stringBytes) -> void +MessagePack.MessagePackWriter.WriteString(in System.Buffers.ReadOnlySequence utf8stringBytes) -> void +MessagePack.MessagePackWriter.WriteUInt16(ushort value) -> void +MessagePack.MessagePackWriter.WriteUInt32(uint value) -> void +MessagePack.MessagePackWriter.WriteUInt64(ulong value) -> void +MessagePack.MessagePackWriter.WriteUInt8(byte value) -> void +MessagePack.Nil +MessagePack.Nil.Equals(MessagePack.Nil other) -> bool +MessagePack.Nil.Nil() -> void +MessagePack.ReservedMessagePackExtensionTypeCode +MessagePack.Resolvers.AttributeFormatterResolver +MessagePack.Resolvers.AttributeFormatterResolver.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter +MessagePack.Resolvers.BuiltinResolver +MessagePack.Resolvers.BuiltinResolver.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter +MessagePack.Resolvers.CompositeResolver +MessagePack.Resolvers.ContractlessStandardResolver +MessagePack.Resolvers.ContractlessStandardResolver.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter +MessagePack.Resolvers.ContractlessStandardResolverAllowPrivate +MessagePack.Resolvers.ContractlessStandardResolverAllowPrivate.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter +MessagePack.Resolvers.DynamicContractlessObjectResolver +MessagePack.Resolvers.DynamicContractlessObjectResolver.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter +MessagePack.Resolvers.DynamicContractlessObjectResolverAllowPrivate +MessagePack.Resolvers.DynamicContractlessObjectResolverAllowPrivate.DynamicContractlessObjectResolverAllowPrivate() -> void +MessagePack.Resolvers.DynamicContractlessObjectResolverAllowPrivate.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter +MessagePack.Resolvers.DynamicEnumAsStringResolver +MessagePack.Resolvers.DynamicEnumAsStringResolver.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter +MessagePack.Resolvers.DynamicEnumResolver +MessagePack.Resolvers.DynamicEnumResolver.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter +MessagePack.Resolvers.DynamicGenericResolver +MessagePack.Resolvers.DynamicGenericResolver.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter +MessagePack.Resolvers.DynamicObjectResolver +MessagePack.Resolvers.DynamicObjectResolver.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter +MessagePack.Resolvers.DynamicObjectResolverAllowPrivate +MessagePack.Resolvers.DynamicObjectResolverAllowPrivate.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter +MessagePack.Resolvers.DynamicUnionResolver +MessagePack.Resolvers.DynamicUnionResolver.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter +MessagePack.Resolvers.NativeDateTimeResolver +MessagePack.Resolvers.NativeDateTimeResolver.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter +MessagePack.Resolvers.NativeDecimalResolver +MessagePack.Resolvers.NativeDecimalResolver.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter +MessagePack.Resolvers.NativeGuidResolver +MessagePack.Resolvers.NativeGuidResolver.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter +MessagePack.Resolvers.PrimitiveObjectResolver +MessagePack.Resolvers.PrimitiveObjectResolver.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter +MessagePack.Resolvers.StandardResolver +MessagePack.Resolvers.StandardResolver.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter +MessagePack.Resolvers.StandardResolverAllowPrivate +MessagePack.Resolvers.StandardResolverAllowPrivate.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter +MessagePack.Resolvers.StaticCompositeResolver +MessagePack.Resolvers.StaticCompositeResolver.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter +MessagePack.Resolvers.StaticCompositeResolver.Register(System.Collections.Generic.IReadOnlyList formatters, System.Collections.Generic.IReadOnlyList resolvers) -> void +MessagePack.Resolvers.StaticCompositeResolver.Register(params MessagePack.Formatters.IMessagePackFormatter[] formatters) -> void +MessagePack.Resolvers.StaticCompositeResolver.Register(params MessagePack.IFormatterResolver[] resolvers) -> void +MessagePack.Resolvers.TypelessContractlessStandardResolver +MessagePack.Resolvers.TypelessContractlessStandardResolver.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter +MessagePack.Resolvers.TypelessContractlessStandardResolver.TypelessContractlessStandardResolver() -> void +MessagePack.Resolvers.TypelessObjectResolver +MessagePack.Resolvers.TypelessObjectResolver.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter +MessagePack.TinyJsonException +MessagePack.TinyJsonException.TinyJsonException(string message) -> void +abstract MessagePack.Formatters.CollectionFormatterBase.Add(TIntermediate collection, int index, TElement value, MessagePack.MessagePackSerializerOptions options) -> void +abstract MessagePack.Formatters.CollectionFormatterBase.Complete(TIntermediate intermediateCollection) -> TCollection +abstract MessagePack.Formatters.CollectionFormatterBase.Create(int count, MessagePack.MessagePackSerializerOptions options) -> TIntermediate +abstract MessagePack.Formatters.CollectionFormatterBase.GetSourceEnumerator(TCollection source) -> TEnumerator +abstract MessagePack.Formatters.DictionaryFormatterBase.Add(TIntermediate collection, int index, TKey key, TValue value, MessagePack.MessagePackSerializerOptions options) -> void +abstract MessagePack.Formatters.DictionaryFormatterBase.Complete(TIntermediate intermediateCollection) -> TDictionary +abstract MessagePack.Formatters.DictionaryFormatterBase.Create(int count, MessagePack.MessagePackSerializerOptions options) -> TIntermediate +abstract MessagePack.Formatters.DictionaryFormatterBase.GetSourceEnumerator(TDictionary source) -> TEnumerator +const MessagePack.MessagePackCode.Array16 = 220 -> byte +const MessagePack.MessagePackCode.Array32 = 221 -> byte +const MessagePack.MessagePackCode.Bin16 = 197 -> byte +const MessagePack.MessagePackCode.Bin32 = 198 -> byte +const MessagePack.MessagePackCode.Bin8 = 196 -> byte +const MessagePack.MessagePackCode.Ext16 = 200 -> byte +const MessagePack.MessagePackCode.Ext32 = 201 -> byte +const MessagePack.MessagePackCode.Ext8 = 199 -> byte +const MessagePack.MessagePackCode.False = 194 -> byte +const MessagePack.MessagePackCode.FixExt1 = 212 -> byte +const MessagePack.MessagePackCode.FixExt16 = 216 -> byte +const MessagePack.MessagePackCode.FixExt2 = 213 -> byte +const MessagePack.MessagePackCode.FixExt4 = 214 -> byte +const MessagePack.MessagePackCode.FixExt8 = 215 -> byte +const MessagePack.MessagePackCode.Float32 = 202 -> byte +const MessagePack.MessagePackCode.Float64 = 203 -> byte +const MessagePack.MessagePackCode.Int16 = 209 -> byte +const MessagePack.MessagePackCode.Int32 = 210 -> byte +const MessagePack.MessagePackCode.Int64 = 211 -> byte +const MessagePack.MessagePackCode.Int8 = 208 -> byte +const MessagePack.MessagePackCode.Map16 = 222 -> byte +const MessagePack.MessagePackCode.Map32 = 223 -> byte +const MessagePack.MessagePackCode.MaxFixArray = 159 -> byte +const MessagePack.MessagePackCode.MaxFixInt = 127 -> byte +const MessagePack.MessagePackCode.MaxFixMap = 143 -> byte +const MessagePack.MessagePackCode.MaxFixStr = 191 -> byte +const MessagePack.MessagePackCode.MaxNegativeFixInt = 255 -> byte +const MessagePack.MessagePackCode.MinFixArray = 144 -> byte +const MessagePack.MessagePackCode.MinFixInt = 0 -> byte +const MessagePack.MessagePackCode.MinFixMap = 128 -> byte +const MessagePack.MessagePackCode.MinFixStr = 160 -> byte +const MessagePack.MessagePackCode.MinNegativeFixInt = 224 -> byte +const MessagePack.MessagePackCode.NeverUsed = 193 -> byte +const MessagePack.MessagePackCode.Nil = 192 -> byte +const MessagePack.MessagePackCode.Str16 = 218 -> byte +const MessagePack.MessagePackCode.Str32 = 219 -> byte +const MessagePack.MessagePackCode.Str8 = 217 -> byte +const MessagePack.MessagePackCode.True = 195 -> byte +const MessagePack.MessagePackCode.UInt16 = 205 -> byte +const MessagePack.MessagePackCode.UInt32 = 206 -> byte +const MessagePack.MessagePackCode.UInt64 = 207 -> byte +const MessagePack.MessagePackCode.UInt8 = 204 -> byte +const MessagePack.MessagePackRange.MaxFixArrayCount = 15 -> int +const MessagePack.MessagePackRange.MaxFixMapCount = 15 -> int +const MessagePack.MessagePackRange.MaxFixNegativeInt = -1 -> int +const MessagePack.MessagePackRange.MaxFixPositiveInt = 127 -> int +const MessagePack.MessagePackRange.MaxFixStringLength = 31 -> int +const MessagePack.MessagePackRange.MinFixNegativeInt = -32 -> int +const MessagePack.MessagePackRange.MinFixStringLength = 0 -> int +const MessagePack.ReservedMessagePackExtensionTypeCode.DateTime = -1 -> sbyte +override MessagePack.Formatters.CollectionFormatterBase.GetSourceEnumerator(TCollection source) -> System.Collections.Generic.IEnumerator +override MessagePack.Formatters.DictionaryFormatterBase.Complete(TDictionary intermediateCollection) -> TDictionary +override MessagePack.Formatters.DictionaryFormatterBase.GetSourceEnumerator(TDictionary source) -> System.Collections.Generic.IEnumerator> +override MessagePack.Internal.AutomataDictionary.ToString() -> string +override MessagePack.Nil.Equals(object obj) -> bool +override MessagePack.Nil.GetHashCode() -> int +override MessagePack.Nil.ToString() -> string +override sealed MessagePack.Formatters.CollectionFormatterBase.Complete(TCollection intermediateCollection) -> TCollection +static MessagePack.FormatterResolverExtensions.GetFormatterDynamic(this MessagePack.IFormatterResolver resolver, System.Type type) -> object +static MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(this MessagePack.IFormatterResolver resolver) -> MessagePack.Formatters.IMessagePackFormatter +static MessagePack.Formatters.PrimitiveObjectFormatter.IsSupportedType(System.Type type, System.Reflection.TypeInfo typeInfo, object value) -> bool +static MessagePack.Internal.AutomataKeyGen.GetKey(ref System.ReadOnlySpan span) -> ulong +static MessagePack.Internal.CodeGenHelpers.GetArrayFromNullableSequence(in System.Buffers.ReadOnlySequence? sequence) -> byte[] +static MessagePack.Internal.CodeGenHelpers.GetEncodedStringBytes(string value) -> byte[] +static MessagePack.Internal.CodeGenHelpers.GetSpanFromSequence(in System.Buffers.ReadOnlySequence sequence) -> System.ReadOnlySpan +static MessagePack.Internal.CodeGenHelpers.ReadStringSpan(ref MessagePack.MessagePackReader reader) -> System.ReadOnlySpan +static MessagePack.Internal.UnsafeMemory32.WriteRaw1(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw10(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw11(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw12(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw13(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw14(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw15(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw16(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw17(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw18(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw19(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw2(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw20(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw21(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw22(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw23(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw24(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw25(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw26(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw27(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw28(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw29(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw3(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw30(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw31(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw4(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw5(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw6(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw7(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw8(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory32.WriteRaw9(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw1(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw10(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw11(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw12(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw13(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw14(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw15(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw16(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw17(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw18(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw19(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw2(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw20(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw21(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw22(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw23(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw24(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw25(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw26(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw27(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw28(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw29(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw3(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw30(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw31(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw4(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw5(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw6(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw7(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw8(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.Internal.UnsafeMemory64.WriteRaw9(ref MessagePack.MessagePackWriter writer, System.ReadOnlySpan src) -> void +static MessagePack.MessagePackCode.ToFormatName(byte code) -> string +static MessagePack.MessagePackCode.ToMessagePackType(byte code) -> MessagePack.MessagePackType +static MessagePack.MessagePackSerializer.ConvertFromJson(System.IO.TextReader reader, ref MessagePack.MessagePackWriter writer, MessagePack.MessagePackSerializerOptions options = null) -> void +static MessagePack.MessagePackSerializer.ConvertFromJson(string str, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> byte[] +static MessagePack.MessagePackSerializer.ConvertFromJson(string str, ref MessagePack.MessagePackWriter writer, MessagePack.MessagePackSerializerOptions options = null) -> void +static MessagePack.MessagePackSerializer.ConvertToJson(System.ReadOnlyMemory bytes, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> string +static MessagePack.MessagePackSerializer.ConvertToJson(in System.Buffers.ReadOnlySequence bytes, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> string +static MessagePack.MessagePackSerializer.ConvertToJson(ref MessagePack.MessagePackReader reader, System.IO.TextWriter jsonWriter, MessagePack.MessagePackSerializerOptions options = null) -> void +static MessagePack.MessagePackSerializer.DefaultOptions.get -> MessagePack.MessagePackSerializerOptions +static MessagePack.MessagePackSerializer.DefaultOptions.set -> void +static MessagePack.MessagePackSerializer.Deserialize(System.Type type, System.Buffers.ReadOnlySequence bytes, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> object +static MessagePack.MessagePackSerializer.Deserialize(System.Type type, System.IO.Stream stream, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> object +static MessagePack.MessagePackSerializer.Deserialize(System.Type type, System.ReadOnlyMemory bytes, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> object +static MessagePack.MessagePackSerializer.Deserialize(System.Type type, ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options = null) -> object +static MessagePack.MessagePackSerializer.Deserialize(System.IO.Stream stream, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> T +static MessagePack.MessagePackSerializer.Deserialize(System.ReadOnlyMemory buffer, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> T +static MessagePack.MessagePackSerializer.Deserialize(System.ReadOnlyMemory buffer, MessagePack.MessagePackSerializerOptions options, out int bytesRead, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> T +static MessagePack.MessagePackSerializer.Deserialize(System.ReadOnlyMemory buffer, out int bytesRead, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> T +static MessagePack.MessagePackSerializer.Deserialize(in System.Buffers.ReadOnlySequence byteSequence, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> T +static MessagePack.MessagePackSerializer.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options = null) -> T +static MessagePack.MessagePackSerializer.DeserializeAsync(System.Type type, System.IO.Stream stream, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +static MessagePack.MessagePackSerializer.DeserializeAsync(System.IO.Stream stream, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +static MessagePack.MessagePackSerializer.Serialize(System.Type type, System.Buffers.IBufferWriter writer, object obj, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> void +static MessagePack.MessagePackSerializer.Serialize(System.Type type, System.IO.Stream stream, object obj, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> void +static MessagePack.MessagePackSerializer.Serialize(System.Type type, object obj, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> byte[] +static MessagePack.MessagePackSerializer.Serialize(System.Type type, ref MessagePack.MessagePackWriter writer, object obj, MessagePack.MessagePackSerializerOptions options = null) -> void +static MessagePack.MessagePackSerializer.Serialize(System.Buffers.IBufferWriter writer, T value, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> void +static MessagePack.MessagePackSerializer.Serialize(System.IO.Stream stream, T value, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> void +static MessagePack.MessagePackSerializer.Serialize(T value, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> byte[] +static MessagePack.MessagePackSerializer.Serialize(ref MessagePack.MessagePackWriter writer, T value, MessagePack.MessagePackSerializerOptions options = null) -> void +static MessagePack.MessagePackSerializer.SerializeAsync(System.Type type, System.IO.Stream stream, object obj, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task +static MessagePack.MessagePackSerializer.SerializeAsync(System.IO.Stream stream, T value, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task +static MessagePack.MessagePackSerializer.SerializeToJson(System.IO.TextWriter textWriter, T obj, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> void +static MessagePack.MessagePackSerializer.SerializeToJson(T obj, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> string +static MessagePack.MessagePackSerializer.Typeless.DefaultOptions.get -> MessagePack.MessagePackSerializerOptions +static MessagePack.MessagePackSerializer.Typeless.DefaultOptions.set -> void +static MessagePack.MessagePackSerializer.Typeless.Deserialize(System.IO.Stream stream, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> object +static MessagePack.MessagePackSerializer.Typeless.Deserialize(System.Memory bytes, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> object +static MessagePack.MessagePackSerializer.Typeless.Deserialize(in System.Buffers.ReadOnlySequence byteSequence, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> object +static MessagePack.MessagePackSerializer.Typeless.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options = null) -> object +static MessagePack.MessagePackSerializer.Typeless.DeserializeAsync(System.IO.Stream stream, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +static MessagePack.MessagePackSerializer.Typeless.Serialize(System.Buffers.IBufferWriter writer, object obj, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> void +static MessagePack.MessagePackSerializer.Typeless.Serialize(System.IO.Stream stream, object obj, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> void +static MessagePack.MessagePackSerializer.Typeless.Serialize(object obj, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> byte[] +static MessagePack.MessagePackSerializer.Typeless.Serialize(ref MessagePack.MessagePackWriter writer, object obj, MessagePack.MessagePackSerializerOptions options = null) -> void +static MessagePack.MessagePackSerializer.Typeless.SerializeAsync(System.IO.Stream stream, object obj, MessagePack.MessagePackSerializerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task +static MessagePack.MessagePackSerializerOptions.Standard.get -> MessagePack.MessagePackSerializerOptions +static MessagePack.Resolvers.CompositeResolver.Create(System.Collections.Generic.IReadOnlyList formatters, System.Collections.Generic.IReadOnlyList resolvers) -> MessagePack.IFormatterResolver +static MessagePack.Resolvers.CompositeResolver.Create(params MessagePack.Formatters.IMessagePackFormatter[] formatters) -> MessagePack.IFormatterResolver +static MessagePack.Resolvers.CompositeResolver.Create(params MessagePack.IFormatterResolver[] resolvers) -> MessagePack.IFormatterResolver +static readonly MessagePack.Formatters.BigIntegerFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter +static readonly MessagePack.Formatters.BitArrayFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter +static readonly MessagePack.Formatters.BooleanArrayFormatter.Instance -> MessagePack.Formatters.BooleanArrayFormatter +static readonly MessagePack.Formatters.BooleanFormatter.Instance -> MessagePack.Formatters.BooleanFormatter +static readonly MessagePack.Formatters.ByteArrayFormatter.Instance -> MessagePack.Formatters.ByteArrayFormatter +static readonly MessagePack.Formatters.ByteArraySegmentFormatter.Instance -> MessagePack.Formatters.ByteArraySegmentFormatter +static readonly MessagePack.Formatters.ByteFormatter.Instance -> MessagePack.Formatters.ByteFormatter +static readonly MessagePack.Formatters.CharArrayFormatter.Instance -> MessagePack.Formatters.CharArrayFormatter +static readonly MessagePack.Formatters.CharFormatter.Instance -> MessagePack.Formatters.CharFormatter +static readonly MessagePack.Formatters.ComplexFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter +static readonly MessagePack.Formatters.DateTimeArrayFormatter.Instance -> MessagePack.Formatters.DateTimeArrayFormatter +static readonly MessagePack.Formatters.DateTimeFormatter.Instance -> MessagePack.Formatters.DateTimeFormatter +static readonly MessagePack.Formatters.DateTimeOffsetFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter +static readonly MessagePack.Formatters.DecimalFormatter.Instance -> MessagePack.Formatters.DecimalFormatter +static readonly MessagePack.Formatters.DoubleArrayFormatter.Instance -> MessagePack.Formatters.DoubleArrayFormatter +static readonly MessagePack.Formatters.DoubleFormatter.Instance -> MessagePack.Formatters.DoubleFormatter +static readonly MessagePack.Formatters.DynamicObjectTypeFallbackFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter +static readonly MessagePack.Formatters.ForceByteBlockFormatter.Instance -> MessagePack.Formatters.ForceByteBlockFormatter +static readonly MessagePack.Formatters.ForceInt16BlockArrayFormatter.Instance -> MessagePack.Formatters.ForceInt16BlockArrayFormatter +static readonly MessagePack.Formatters.ForceInt16BlockFormatter.Instance -> MessagePack.Formatters.ForceInt16BlockFormatter +static readonly MessagePack.Formatters.ForceInt32BlockArrayFormatter.Instance -> MessagePack.Formatters.ForceInt32BlockArrayFormatter +static readonly MessagePack.Formatters.ForceInt32BlockFormatter.Instance -> MessagePack.Formatters.ForceInt32BlockFormatter +static readonly MessagePack.Formatters.ForceInt64BlockArrayFormatter.Instance -> MessagePack.Formatters.ForceInt64BlockArrayFormatter +static readonly MessagePack.Formatters.ForceInt64BlockFormatter.Instance -> MessagePack.Formatters.ForceInt64BlockFormatter +static readonly MessagePack.Formatters.ForceSByteBlockArrayFormatter.Instance -> MessagePack.Formatters.ForceSByteBlockArrayFormatter +static readonly MessagePack.Formatters.ForceSByteBlockFormatter.Instance -> MessagePack.Formatters.ForceSByteBlockFormatter +static readonly MessagePack.Formatters.ForceUInt16BlockArrayFormatter.Instance -> MessagePack.Formatters.ForceUInt16BlockArrayFormatter +static readonly MessagePack.Formatters.ForceUInt16BlockFormatter.Instance -> MessagePack.Formatters.ForceUInt16BlockFormatter +static readonly MessagePack.Formatters.ForceUInt32BlockArrayFormatter.Instance -> MessagePack.Formatters.ForceUInt32BlockArrayFormatter +static readonly MessagePack.Formatters.ForceUInt32BlockFormatter.Instance -> MessagePack.Formatters.ForceUInt32BlockFormatter +static readonly MessagePack.Formatters.ForceUInt64BlockArrayFormatter.Instance -> MessagePack.Formatters.ForceUInt64BlockArrayFormatter +static readonly MessagePack.Formatters.ForceUInt64BlockFormatter.Instance -> MessagePack.Formatters.ForceUInt64BlockFormatter +static readonly MessagePack.Formatters.GuidFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter +static readonly MessagePack.Formatters.Int16ArrayFormatter.Instance -> MessagePack.Formatters.Int16ArrayFormatter +static readonly MessagePack.Formatters.Int16Formatter.Instance -> MessagePack.Formatters.Int16Formatter +static readonly MessagePack.Formatters.Int32ArrayFormatter.Instance -> MessagePack.Formatters.Int32ArrayFormatter +static readonly MessagePack.Formatters.Int32Formatter.Instance -> MessagePack.Formatters.Int32Formatter +static readonly MessagePack.Formatters.Int64ArrayFormatter.Instance -> MessagePack.Formatters.Int64ArrayFormatter +static readonly MessagePack.Formatters.Int64Formatter.Instance -> MessagePack.Formatters.Int64Formatter +static readonly MessagePack.Formatters.NativeDateTimeArrayFormatter.Instance -> MessagePack.Formatters.NativeDateTimeArrayFormatter +static readonly MessagePack.Formatters.NativeDateTimeFormatter.Instance -> MessagePack.Formatters.NativeDateTimeFormatter +static readonly MessagePack.Formatters.NativeDecimalFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter +static readonly MessagePack.Formatters.NativeGuidFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter +static readonly MessagePack.Formatters.NilFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter +static readonly MessagePack.Formatters.NonGenericInterfaceDictionaryFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter +static readonly MessagePack.Formatters.NonGenericInterfaceListFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter +static readonly MessagePack.Formatters.NullableBooleanFormatter.Instance -> MessagePack.Formatters.NullableBooleanFormatter +static readonly MessagePack.Formatters.NullableByteFormatter.Instance -> MessagePack.Formatters.NullableByteFormatter +static readonly MessagePack.Formatters.NullableCharFormatter.Instance -> MessagePack.Formatters.NullableCharFormatter +static readonly MessagePack.Formatters.NullableDateTimeFormatter.Instance -> MessagePack.Formatters.NullableDateTimeFormatter +static readonly MessagePack.Formatters.NullableDoubleFormatter.Instance -> MessagePack.Formatters.NullableDoubleFormatter +static readonly MessagePack.Formatters.NullableForceByteBlockFormatter.Instance -> MessagePack.Formatters.NullableForceByteBlockFormatter +static readonly MessagePack.Formatters.NullableForceInt16BlockFormatter.Instance -> MessagePack.Formatters.NullableForceInt16BlockFormatter +static readonly MessagePack.Formatters.NullableForceInt32BlockFormatter.Instance -> MessagePack.Formatters.NullableForceInt32BlockFormatter +static readonly MessagePack.Formatters.NullableForceInt64BlockFormatter.Instance -> MessagePack.Formatters.NullableForceInt64BlockFormatter +static readonly MessagePack.Formatters.NullableForceSByteBlockFormatter.Instance -> MessagePack.Formatters.NullableForceSByteBlockFormatter +static readonly MessagePack.Formatters.NullableForceUInt16BlockFormatter.Instance -> MessagePack.Formatters.NullableForceUInt16BlockFormatter +static readonly MessagePack.Formatters.NullableForceUInt32BlockFormatter.Instance -> MessagePack.Formatters.NullableForceUInt32BlockFormatter +static readonly MessagePack.Formatters.NullableForceUInt64BlockFormatter.Instance -> MessagePack.Formatters.NullableForceUInt64BlockFormatter +static readonly MessagePack.Formatters.NullableInt16Formatter.Instance -> MessagePack.Formatters.NullableInt16Formatter +static readonly MessagePack.Formatters.NullableInt32Formatter.Instance -> MessagePack.Formatters.NullableInt32Formatter +static readonly MessagePack.Formatters.NullableInt64Formatter.Instance -> MessagePack.Formatters.NullableInt64Formatter +static readonly MessagePack.Formatters.NullableNilFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter +static readonly MessagePack.Formatters.NullableSByteFormatter.Instance -> MessagePack.Formatters.NullableSByteFormatter +static readonly MessagePack.Formatters.NullableSingleFormatter.Instance -> MessagePack.Formatters.NullableSingleFormatter +static readonly MessagePack.Formatters.NullableStringArrayFormatter.Instance -> MessagePack.Formatters.NullableStringArrayFormatter +static readonly MessagePack.Formatters.NullableStringFormatter.Instance -> MessagePack.Formatters.NullableStringFormatter +static readonly MessagePack.Formatters.NullableUInt16Formatter.Instance -> MessagePack.Formatters.NullableUInt16Formatter +static readonly MessagePack.Formatters.NullableUInt32Formatter.Instance -> MessagePack.Formatters.NullableUInt32Formatter +static readonly MessagePack.Formatters.NullableUInt64Formatter.Instance -> MessagePack.Formatters.NullableUInt64Formatter +static readonly MessagePack.Formatters.PrimitiveObjectFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter +static readonly MessagePack.Formatters.SByteArrayFormatter.Instance -> MessagePack.Formatters.SByteArrayFormatter +static readonly MessagePack.Formatters.SByteFormatter.Instance -> MessagePack.Formatters.SByteFormatter +static readonly MessagePack.Formatters.SingleArrayFormatter.Instance -> MessagePack.Formatters.SingleArrayFormatter +static readonly MessagePack.Formatters.SingleFormatter.Instance -> MessagePack.Formatters.SingleFormatter +static readonly MessagePack.Formatters.StringBuilderFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter +static readonly MessagePack.Formatters.TimeSpanFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter +static readonly MessagePack.Formatters.TypelessFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter +static readonly MessagePack.Formatters.UInt16ArrayFormatter.Instance -> MessagePack.Formatters.UInt16ArrayFormatter +static readonly MessagePack.Formatters.UInt16Formatter.Instance -> MessagePack.Formatters.UInt16Formatter +static readonly MessagePack.Formatters.UInt32ArrayFormatter.Instance -> MessagePack.Formatters.UInt32ArrayFormatter +static readonly MessagePack.Formatters.UInt32Formatter.Instance -> MessagePack.Formatters.UInt32Formatter +static readonly MessagePack.Formatters.UInt64ArrayFormatter.Instance -> MessagePack.Formatters.UInt64ArrayFormatter +static readonly MessagePack.Formatters.UInt64Formatter.Instance -> MessagePack.Formatters.UInt64Formatter +static readonly MessagePack.Formatters.UriFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter +static readonly MessagePack.Formatters.VersionFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter +static readonly MessagePack.Internal.AutomataKeyGen.GetKeyMethod -> System.Reflection.MethodInfo +static readonly MessagePack.Internal.RuntimeTypeHandleEqualityComparer.Default -> System.Collections.Generic.IEqualityComparer +static readonly MessagePack.Internal.UnsafeMemory.Is32Bit -> bool +static readonly MessagePack.Nil.Default -> MessagePack.Nil +static readonly MessagePack.Resolvers.AttributeFormatterResolver.Instance -> MessagePack.Resolvers.AttributeFormatterResolver +static readonly MessagePack.Resolvers.BuiltinResolver.Instance -> MessagePack.Resolvers.BuiltinResolver +static readonly MessagePack.Resolvers.ContractlessStandardResolver.Instance -> MessagePack.Resolvers.ContractlessStandardResolver +static readonly MessagePack.Resolvers.ContractlessStandardResolver.Options -> MessagePack.MessagePackSerializerOptions +static readonly MessagePack.Resolvers.ContractlessStandardResolverAllowPrivate.Instance -> MessagePack.Resolvers.ContractlessStandardResolverAllowPrivate +static readonly MessagePack.Resolvers.ContractlessStandardResolverAllowPrivate.Options -> MessagePack.MessagePackSerializerOptions +static readonly MessagePack.Resolvers.DynamicContractlessObjectResolver.Instance -> MessagePack.Resolvers.DynamicContractlessObjectResolver +static readonly MessagePack.Resolvers.DynamicContractlessObjectResolverAllowPrivate.Instance -> MessagePack.Resolvers.DynamicContractlessObjectResolverAllowPrivate +static readonly MessagePack.Resolvers.DynamicEnumAsStringResolver.Instance -> MessagePack.Resolvers.DynamicEnumAsStringResolver +static readonly MessagePack.Resolvers.DynamicEnumAsStringResolver.Options -> MessagePack.MessagePackSerializerOptions +static readonly MessagePack.Resolvers.DynamicEnumResolver.Instance -> MessagePack.Resolvers.DynamicEnumResolver +static readonly MessagePack.Resolvers.DynamicGenericResolver.Instance -> MessagePack.Resolvers.DynamicGenericResolver +static readonly MessagePack.Resolvers.DynamicObjectResolver.Instance -> MessagePack.Resolvers.DynamicObjectResolver +static readonly MessagePack.Resolvers.DynamicObjectResolver.Options -> MessagePack.MessagePackSerializerOptions +static readonly MessagePack.Resolvers.DynamicObjectResolverAllowPrivate.Instance -> MessagePack.Resolvers.DynamicObjectResolverAllowPrivate +static readonly MessagePack.Resolvers.DynamicUnionResolver.Instance -> MessagePack.Resolvers.DynamicUnionResolver +static readonly MessagePack.Resolvers.DynamicUnionResolver.Options -> MessagePack.MessagePackSerializerOptions +static readonly MessagePack.Resolvers.NativeDateTimeResolver.Instance -> MessagePack.Resolvers.NativeDateTimeResolver +static readonly MessagePack.Resolvers.NativeDateTimeResolver.Options -> MessagePack.MessagePackSerializerOptions +static readonly MessagePack.Resolvers.NativeDecimalResolver.Instance -> MessagePack.Resolvers.NativeDecimalResolver +static readonly MessagePack.Resolvers.NativeGuidResolver.Instance -> MessagePack.Resolvers.NativeGuidResolver +static readonly MessagePack.Resolvers.PrimitiveObjectResolver.Instance -> MessagePack.Resolvers.PrimitiveObjectResolver +static readonly MessagePack.Resolvers.PrimitiveObjectResolver.Options -> MessagePack.MessagePackSerializerOptions +static readonly MessagePack.Resolvers.StandardResolver.Instance -> MessagePack.Resolvers.StandardResolver +static readonly MessagePack.Resolvers.StandardResolver.Options -> MessagePack.MessagePackSerializerOptions +static readonly MessagePack.Resolvers.StandardResolverAllowPrivate.Instance -> MessagePack.Resolvers.StandardResolverAllowPrivate +static readonly MessagePack.Resolvers.StandardResolverAllowPrivate.Options -> MessagePack.MessagePackSerializerOptions +static readonly MessagePack.Resolvers.StaticCompositeResolver.Instance -> MessagePack.Resolvers.StaticCompositeResolver +static readonly MessagePack.Resolvers.TypelessContractlessStandardResolver.Instance -> MessagePack.Resolvers.TypelessContractlessStandardResolver +static readonly MessagePack.Resolvers.TypelessContractlessStandardResolver.Options -> MessagePack.MessagePackSerializerOptions +static readonly MessagePack.Resolvers.TypelessObjectResolver.Instance -> MessagePack.IFormatterResolver +virtual MessagePack.Formatters.CollectionFormatterBase.GetCount(TCollection sequence) -> int? +virtual MessagePack.MessagePackSerializerOptions.Clone() -> MessagePack.MessagePackSerializerOptions +virtual MessagePack.MessagePackSerializerOptions.LoadType(string typeName) -> System.Type +virtual MessagePack.MessagePackSerializerOptions.ThrowIfDeserializingTypeIsDisallowed(System.Type type) -> void +MessagePack.ExtensionHeader.Equals(MessagePack.ExtensionHeader other) -> bool +MessagePack.Formatters.InterfaceCollectionFormatter2 +MessagePack.Formatters.InterfaceCollectionFormatter2.InterfaceCollectionFormatter2() -> void +MessagePack.Formatters.InterfaceListFormatter2 +MessagePack.Formatters.InterfaceListFormatter2.InterfaceListFormatter2() -> void +MessagePack.MessagePackReader.Depth.get -> int +MessagePack.MessagePackReader.Depth.set -> void +MessagePack.MessagePackReader.ReadDateTime(MessagePack.ExtensionHeader header) -> System.DateTime +MessagePack.MessagePackReader.TryReadArrayHeader(out int count) -> bool +MessagePack.MessagePackReader.TryReadExtensionFormatHeader(out MessagePack.ExtensionHeader extensionHeader) -> bool +MessagePack.MessagePackReader.TryReadMapHeader(out int count) -> bool +MessagePack.MessagePackSecurity +MessagePack.MessagePackSecurity.DepthStep(ref MessagePack.MessagePackReader reader) -> void +MessagePack.MessagePackSecurity.GetEqualityComparer() -> System.Collections.IEqualityComparer +MessagePack.MessagePackSecurity.GetEqualityComparer() -> System.Collections.Generic.IEqualityComparer +MessagePack.MessagePackSecurity.HashCollisionResistant.get -> bool +MessagePack.MessagePackSecurity.MaximumObjectGraphDepth.get -> int +MessagePack.MessagePackSecurity.MessagePackSecurity(MessagePack.MessagePackSecurity copyFrom) -> void +MessagePack.MessagePackSecurity.WithHashCollisionResistant(bool hashCollisionResistant) -> MessagePack.MessagePackSecurity +MessagePack.MessagePackSecurity.WithMaximumObjectGraphDepth(int maximumObjectGraphDepth) -> MessagePack.MessagePackSecurity +MessagePack.MessagePackSerializerOptions.Security.get -> MessagePack.MessagePackSecurity +MessagePack.MessagePackSerializerOptions.WithSecurity(MessagePack.MessagePackSecurity security) -> MessagePack.MessagePackSerializerOptions +MessagePack.MessagePackStreamReader.DiscardBufferedData() -> void +MessagePack.MessagePackStreamReader.MessagePackStreamReader(System.IO.Stream stream, bool leaveOpen) -> void +MessagePack.MessagePackStreamReader.ReadArrayAsync(System.Threading.CancellationToken cancellationToken) -> System.Collections.Generic.IAsyncEnumerable> +MessagePack.MessagePackWriter.WriteBinHeader(int length) -> void +MessagePack.MessagePackWriter.WriteStringHeader(int byteCount) -> void +static readonly MessagePack.MessagePackSecurity.TrustedData -> MessagePack.MessagePackSecurity +static readonly MessagePack.MessagePackSecurity.UntrustedData -> MessagePack.MessagePackSecurity +virtual MessagePack.MessagePackSecurity.Clone() -> MessagePack.MessagePackSecurity +virtual MessagePack.MessagePackSecurity.GetHashCollisionResistantEqualityComparer() -> System.Collections.IEqualityComparer +virtual MessagePack.MessagePackSecurity.GetHashCollisionResistantEqualityComparer() -> System.Collections.Generic.IEqualityComparer diff --git a/src/MessagePack/netstandard2.0/PublicAPI.Unshipped.txt b/src/MessagePack/netstandard2.0/PublicAPI.Unshipped.txt new file mode 100644 index 000000000..d31186945 --- /dev/null +++ b/src/MessagePack/netstandard2.0/PublicAPI.Unshipped.txt @@ -0,0 +1,127 @@ +MessagePack.Formatters.ByteMemoryFormatter +MessagePack.Formatters.ByteMemoryFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Memory +MessagePack.Formatters.ByteMemoryFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Memory value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ByteReadOnlyMemoryFormatter +MessagePack.Formatters.ByteReadOnlyMemoryFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.ReadOnlyMemory +MessagePack.Formatters.ByteReadOnlyMemoryFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.ReadOnlyMemory value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ByteReadOnlySequenceFormatter +MessagePack.Formatters.ByteReadOnlySequenceFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Buffers.ReadOnlySequence +MessagePack.Formatters.ByteReadOnlySequenceFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Buffers.ReadOnlySequence value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ExpandoObjectFormatter +MessagePack.Formatters.ExpandoObjectFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Dynamic.ExpandoObject +MessagePack.Formatters.ExpandoObjectFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Dynamic.ExpandoObject value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ForceTypelessFormatter +MessagePack.Formatters.ForceTypelessFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> T +MessagePack.Formatters.ForceTypelessFormatter.ForceTypelessFormatter() -> void +MessagePack.Formatters.ForceTypelessFormatter.Serialize(ref MessagePack.MessagePackWriter writer, T value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.MemoryFormatter +MessagePack.Formatters.MemoryFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Memory +MessagePack.Formatters.MemoryFormatter.MemoryFormatter() -> void +MessagePack.Formatters.MemoryFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Memory value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NonGenericInterfaceCollectionFormatter +MessagePack.Formatters.NonGenericInterfaceCollectionFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Collections.ICollection +MessagePack.Formatters.NonGenericInterfaceCollectionFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Collections.ICollection value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NonGenericInterfaceEnumerableFormatter +MessagePack.Formatters.NonGenericInterfaceEnumerableFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Collections.IEnumerable +MessagePack.Formatters.NonGenericInterfaceEnumerableFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Collections.IEnumerable value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.PrimitiveObjectFormatter.PrimitiveObjectFormatter() -> void +MessagePack.Formatters.ReadOnlyMemoryFormatter +MessagePack.Formatters.ReadOnlyMemoryFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.ReadOnlyMemory +MessagePack.Formatters.ReadOnlyMemoryFormatter.ReadOnlyMemoryFormatter() -> void +MessagePack.Formatters.ReadOnlyMemoryFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.ReadOnlyMemory value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ReadOnlySequenceFormatter +MessagePack.Formatters.ReadOnlySequenceFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Buffers.ReadOnlySequence +MessagePack.Formatters.ReadOnlySequenceFormatter.ReadOnlySequenceFormatter() -> void +MessagePack.Formatters.ReadOnlySequenceFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Buffers.ReadOnlySequence value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.TypeFormatter +MessagePack.Formatters.TypeFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> T +MessagePack.Formatters.TypeFormatter.Serialize(ref MessagePack.MessagePackWriter writer, T value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.TypelessFormatter.TypelessFormatter() -> void +MessagePack.ImmutableCollection.ImmutableArrayFormatter +MessagePack.ImmutableCollection.ImmutableArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Collections.Immutable.ImmutableArray +MessagePack.ImmutableCollection.ImmutableArrayFormatter.ImmutableArrayFormatter() -> void +MessagePack.ImmutableCollection.ImmutableArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Collections.Immutable.ImmutableArray value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.ImmutableCollection.ImmutableCollectionResolver +MessagePack.ImmutableCollection.ImmutableCollectionResolver.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter +MessagePack.ImmutableCollection.ImmutableDictionaryFormatter +MessagePack.ImmutableCollection.ImmutableDictionaryFormatter.ImmutableDictionaryFormatter() -> void +MessagePack.ImmutableCollection.ImmutableHashSetFormatter +MessagePack.ImmutableCollection.ImmutableHashSetFormatter.ImmutableHashSetFormatter() -> void +MessagePack.ImmutableCollection.ImmutableListFormatter +MessagePack.ImmutableCollection.ImmutableListFormatter.ImmutableListFormatter() -> void +MessagePack.ImmutableCollection.ImmutableQueueBuilder +MessagePack.ImmutableCollection.ImmutableQueueBuilder.Add(T value) -> void +MessagePack.ImmutableCollection.ImmutableQueueBuilder.ImmutableQueueBuilder() -> void +MessagePack.ImmutableCollection.ImmutableQueueBuilder.Q.get -> System.Collections.Immutable.ImmutableQueue +MessagePack.ImmutableCollection.ImmutableQueueBuilder.Q.set -> void +MessagePack.ImmutableCollection.ImmutableQueueFormatter +MessagePack.ImmutableCollection.ImmutableQueueFormatter.ImmutableQueueFormatter() -> void +MessagePack.ImmutableCollection.ImmutableSortedDictionaryFormatter +MessagePack.ImmutableCollection.ImmutableSortedDictionaryFormatter.ImmutableSortedDictionaryFormatter() -> void +MessagePack.ImmutableCollection.ImmutableSortedSetFormatter +MessagePack.ImmutableCollection.ImmutableSortedSetFormatter.ImmutableSortedSetFormatter() -> void +MessagePack.ImmutableCollection.ImmutableStackFormatter +MessagePack.ImmutableCollection.ImmutableStackFormatter.ImmutableStackFormatter() -> void +MessagePack.ImmutableCollection.InterfaceImmutableDictionaryFormatter +MessagePack.ImmutableCollection.InterfaceImmutableDictionaryFormatter.InterfaceImmutableDictionaryFormatter() -> void +MessagePack.ImmutableCollection.InterfaceImmutableListFormatter +MessagePack.ImmutableCollection.InterfaceImmutableListFormatter.InterfaceImmutableListFormatter() -> void +MessagePack.ImmutableCollection.InterfaceImmutableQueueFormatter +MessagePack.ImmutableCollection.InterfaceImmutableQueueFormatter.InterfaceImmutableQueueFormatter() -> void +MessagePack.ImmutableCollection.InterfaceImmutableSetFormatter +MessagePack.ImmutableCollection.InterfaceImmutableSetFormatter.InterfaceImmutableSetFormatter() -> void +MessagePack.ImmutableCollection.InterfaceImmutableStackFormatter +MessagePack.ImmutableCollection.InterfaceImmutableStackFormatter.InterfaceImmutableStackFormatter() -> void +MessagePack.Resolvers.ExpandoObjectResolver +override MessagePack.ImmutableCollection.ImmutableDictionaryFormatter.Add(System.Collections.Immutable.ImmutableDictionary.Builder collection, int index, TKey key, TValue value, MessagePack.MessagePackSerializerOptions options) -> void +override MessagePack.ImmutableCollection.ImmutableDictionaryFormatter.Complete(System.Collections.Immutable.ImmutableDictionary.Builder intermediateCollection) -> System.Collections.Immutable.ImmutableDictionary +override MessagePack.ImmutableCollection.ImmutableDictionaryFormatter.Create(int count, MessagePack.MessagePackSerializerOptions options) -> System.Collections.Immutable.ImmutableDictionary.Builder +override MessagePack.ImmutableCollection.ImmutableDictionaryFormatter.GetSourceEnumerator(System.Collections.Immutable.ImmutableDictionary source) -> System.Collections.Immutable.ImmutableDictionary.Enumerator +override MessagePack.ImmutableCollection.ImmutableHashSetFormatter.Add(System.Collections.Immutable.ImmutableHashSet.Builder collection, int index, T value, MessagePack.MessagePackSerializerOptions options) -> void +override MessagePack.ImmutableCollection.ImmutableHashSetFormatter.Complete(System.Collections.Immutable.ImmutableHashSet.Builder intermediateCollection) -> System.Collections.Immutable.ImmutableHashSet +override MessagePack.ImmutableCollection.ImmutableHashSetFormatter.Create(int count, MessagePack.MessagePackSerializerOptions options) -> System.Collections.Immutable.ImmutableHashSet.Builder +override MessagePack.ImmutableCollection.ImmutableHashSetFormatter.GetSourceEnumerator(System.Collections.Immutable.ImmutableHashSet source) -> System.Collections.Immutable.ImmutableHashSet.Enumerator +override MessagePack.ImmutableCollection.ImmutableListFormatter.Add(System.Collections.Immutable.ImmutableList.Builder collection, int index, T value, MessagePack.MessagePackSerializerOptions options) -> void +override MessagePack.ImmutableCollection.ImmutableListFormatter.Complete(System.Collections.Immutable.ImmutableList.Builder intermediateCollection) -> System.Collections.Immutable.ImmutableList +override MessagePack.ImmutableCollection.ImmutableListFormatter.Create(int count, MessagePack.MessagePackSerializerOptions options) -> System.Collections.Immutable.ImmutableList.Builder +override MessagePack.ImmutableCollection.ImmutableListFormatter.GetSourceEnumerator(System.Collections.Immutable.ImmutableList source) -> System.Collections.Immutable.ImmutableList.Enumerator +override MessagePack.ImmutableCollection.ImmutableQueueFormatter.Add(MessagePack.ImmutableCollection.ImmutableQueueBuilder collection, int index, T value, MessagePack.MessagePackSerializerOptions options) -> void +override MessagePack.ImmutableCollection.ImmutableQueueFormatter.Complete(MessagePack.ImmutableCollection.ImmutableQueueBuilder intermediateCollection) -> System.Collections.Immutable.ImmutableQueue +override MessagePack.ImmutableCollection.ImmutableQueueFormatter.Create(int count, MessagePack.MessagePackSerializerOptions options) -> MessagePack.ImmutableCollection.ImmutableQueueBuilder +override MessagePack.ImmutableCollection.ImmutableSortedDictionaryFormatter.Add(System.Collections.Immutable.ImmutableSortedDictionary.Builder collection, int index, TKey key, TValue value, MessagePack.MessagePackSerializerOptions options) -> void +override MessagePack.ImmutableCollection.ImmutableSortedDictionaryFormatter.Complete(System.Collections.Immutable.ImmutableSortedDictionary.Builder intermediateCollection) -> System.Collections.Immutable.ImmutableSortedDictionary +override MessagePack.ImmutableCollection.ImmutableSortedDictionaryFormatter.Create(int count, MessagePack.MessagePackSerializerOptions options) -> System.Collections.Immutable.ImmutableSortedDictionary.Builder +override MessagePack.ImmutableCollection.ImmutableSortedDictionaryFormatter.GetSourceEnumerator(System.Collections.Immutable.ImmutableSortedDictionary source) -> System.Collections.Immutable.ImmutableSortedDictionary.Enumerator +override MessagePack.ImmutableCollection.ImmutableSortedSetFormatter.Add(System.Collections.Immutable.ImmutableSortedSet.Builder collection, int index, T value, MessagePack.MessagePackSerializerOptions options) -> void +override MessagePack.ImmutableCollection.ImmutableSortedSetFormatter.Complete(System.Collections.Immutable.ImmutableSortedSet.Builder intermediateCollection) -> System.Collections.Immutable.ImmutableSortedSet +override MessagePack.ImmutableCollection.ImmutableSortedSetFormatter.Create(int count, MessagePack.MessagePackSerializerOptions options) -> System.Collections.Immutable.ImmutableSortedSet.Builder +override MessagePack.ImmutableCollection.ImmutableSortedSetFormatter.GetSourceEnumerator(System.Collections.Immutable.ImmutableSortedSet source) -> System.Collections.Immutable.ImmutableSortedSet.Enumerator +override MessagePack.ImmutableCollection.ImmutableStackFormatter.Add(T[] collection, int index, T value, MessagePack.MessagePackSerializerOptions options) -> void +override MessagePack.ImmutableCollection.ImmutableStackFormatter.Complete(T[] intermediateCollection) -> System.Collections.Immutable.ImmutableStack +override MessagePack.ImmutableCollection.ImmutableStackFormatter.Create(int count, MessagePack.MessagePackSerializerOptions options) -> T[] +override MessagePack.ImmutableCollection.InterfaceImmutableDictionaryFormatter.Add(System.Collections.Immutable.ImmutableDictionary.Builder collection, int index, TKey key, TValue value, MessagePack.MessagePackSerializerOptions options) -> void +override MessagePack.ImmutableCollection.InterfaceImmutableDictionaryFormatter.Complete(System.Collections.Immutable.ImmutableDictionary.Builder intermediateCollection) -> System.Collections.Immutable.IImmutableDictionary +override MessagePack.ImmutableCollection.InterfaceImmutableDictionaryFormatter.Create(int count, MessagePack.MessagePackSerializerOptions options) -> System.Collections.Immutable.ImmutableDictionary.Builder +override MessagePack.ImmutableCollection.InterfaceImmutableListFormatter.Add(System.Collections.Immutable.ImmutableList.Builder collection, int index, T value, MessagePack.MessagePackSerializerOptions options) -> void +override MessagePack.ImmutableCollection.InterfaceImmutableListFormatter.Complete(System.Collections.Immutable.ImmutableList.Builder intermediateCollection) -> System.Collections.Immutable.IImmutableList +override MessagePack.ImmutableCollection.InterfaceImmutableListFormatter.Create(int count, MessagePack.MessagePackSerializerOptions options) -> System.Collections.Immutable.ImmutableList.Builder +override MessagePack.ImmutableCollection.InterfaceImmutableQueueFormatter.Add(MessagePack.ImmutableCollection.ImmutableQueueBuilder collection, int index, T value, MessagePack.MessagePackSerializerOptions options) -> void +override MessagePack.ImmutableCollection.InterfaceImmutableQueueFormatter.Complete(MessagePack.ImmutableCollection.ImmutableQueueBuilder intermediateCollection) -> System.Collections.Immutable.IImmutableQueue +override MessagePack.ImmutableCollection.InterfaceImmutableQueueFormatter.Create(int count, MessagePack.MessagePackSerializerOptions options) -> MessagePack.ImmutableCollection.ImmutableQueueBuilder +override MessagePack.ImmutableCollection.InterfaceImmutableSetFormatter.Add(System.Collections.Immutable.ImmutableHashSet.Builder collection, int index, T value, MessagePack.MessagePackSerializerOptions options) -> void +override MessagePack.ImmutableCollection.InterfaceImmutableSetFormatter.Complete(System.Collections.Immutable.ImmutableHashSet.Builder intermediateCollection) -> System.Collections.Immutable.IImmutableSet +override MessagePack.ImmutableCollection.InterfaceImmutableSetFormatter.Create(int count, MessagePack.MessagePackSerializerOptions options) -> System.Collections.Immutable.ImmutableHashSet.Builder +override MessagePack.ImmutableCollection.InterfaceImmutableStackFormatter.Add(T[] collection, int index, T value, MessagePack.MessagePackSerializerOptions options) -> void +override MessagePack.ImmutableCollection.InterfaceImmutableStackFormatter.Complete(T[] intermediateCollection) -> System.Collections.Immutable.IImmutableStack +override MessagePack.ImmutableCollection.InterfaceImmutableStackFormatter.Create(int count, MessagePack.MessagePackSerializerOptions options) -> T[] +static readonly MessagePack.Formatters.ByteMemoryFormatter.Instance -> MessagePack.Formatters.ByteMemoryFormatter +static readonly MessagePack.Formatters.ByteReadOnlyMemoryFormatter.Instance -> MessagePack.Formatters.ByteReadOnlyMemoryFormatter +static readonly MessagePack.Formatters.ByteReadOnlySequenceFormatter.Instance -> MessagePack.Formatters.ByteReadOnlySequenceFormatter +static readonly MessagePack.Formatters.ExpandoObjectFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter +static readonly MessagePack.Formatters.NonGenericInterfaceCollectionFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter +static readonly MessagePack.Formatters.NonGenericInterfaceEnumerableFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter +static readonly MessagePack.Formatters.TypeFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter +static readonly MessagePack.ImmutableCollection.ImmutableCollectionResolver.Instance -> MessagePack.ImmutableCollection.ImmutableCollectionResolver +static readonly MessagePack.Resolvers.ExpandoObjectResolver.Instance -> MessagePack.IFormatterResolver +static readonly MessagePack.Resolvers.ExpandoObjectResolver.Options -> MessagePack.MessagePackSerializerOptions +virtual MessagePack.Formatters.PrimitiveObjectFormatter.DeserializeMap(ref MessagePack.MessagePackReader reader, int length, MessagePack.MessagePackSerializerOptions options) -> object From 97b014eb02e275090e4261b5aee2ae2d53c1f0ff Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 19 Nov 2020 08:15:09 -0700 Subject: [PATCH 024/161] Fix up compiler warnings --- .../Scripts/MessagePack/IFormatterResolver.cs | 7 ++++++ .../MessagePack/Internal/TinyJsonReader.cs | 7 ++++++ .../MessagePack/MessagePackStreamReader.cs | 23 +++++++++++++++---- .../Assets/Scripts/MessagePack/Nil.cs | 5 ++++ .../net5.0/PublicAPI.Unshipped.txt | 12 ++++++++++ .../netcoreapp2.1/PublicAPI.Unshipped.txt | 5 ++++ .../netstandard2.0/PublicAPI.Unshipped.txt | 12 ++++++++++ 7 files changed, 66 insertions(+), 5 deletions(-) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/IFormatterResolver.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/IFormatterResolver.cs index 7c5d00022..51a8e14e4 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/IFormatterResolver.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/IFormatterResolver.cs @@ -6,6 +6,7 @@ using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.ExceptionServices; +using System.Runtime.Serialization; using MessagePack.Formatters; using MessagePack.Internal; @@ -107,11 +108,17 @@ internal static object GetFormatterDynamicWithVerify(this IFormatterResolver res } } + [Serializable] public class FormatterNotRegisteredException : MessagePackSerializationException { public FormatterNotRegisteredException(string message) : base(message) { } + + protected FormatterNotRegisteredException(SerializationInfo info, StreamingContext context) + : base(info, context) + { + } } } diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Internal/TinyJsonReader.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Internal/TinyJsonReader.cs index 87263061a..02229621b 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Internal/TinyJsonReader.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Internal/TinyJsonReader.cs @@ -4,6 +4,7 @@ using System; using System.Globalization; using System.IO; +using System.Runtime.Serialization; using System.Text; #pragma warning disable SA1649 // File name should match first type name @@ -39,12 +40,18 @@ internal enum ValueType : byte String, } + [Serializable] public class TinyJsonException : MessagePackSerializationException { public TinyJsonException(string message) : base(message) { } + + protected TinyJsonException(SerializationInfo info, StreamingContext context) + : base(info, context) + { + } } internal class TinyJsonReader : IDisposable diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackStreamReader.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackStreamReader.cs index b35af2698..2c29bc28c 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackStreamReader.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackStreamReader.cs @@ -124,13 +124,26 @@ public void DiscardBufferedData() /// public void Dispose() { - if (!this.leaveOpen) + this.Dispose(true); + GC.SuppressFinalize(this); + } + + /// + /// Disposes of managed and unmanaged resources. + /// + /// if this instance is being disposed; if it is being finalized. + protected virtual void Dispose(bool disposing) + { + if (disposing) { - this.stream.Dispose(); - } + if (!this.leaveOpen) + { + this.stream.Dispose(); + } - this.sequenceRental.Dispose(); - this.sequenceRental = default; + this.sequenceRental.Dispose(); + this.sequenceRental = default; + } } /// diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Nil.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Nil.cs index 9533d24dd..04bade766 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Nil.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Nil.cs @@ -3,6 +3,7 @@ using System; using System.Buffers; +using System.Data.Common; namespace MessagePack { @@ -15,6 +16,10 @@ struct Nil : IEquatable { public static readonly Nil Default = default(Nil); + public static bool operator ==(Nil left, Nil right) => true; + + public static bool operator !=(Nil left, Nil right) => false; + public override bool Equals(object obj) { return obj is Nil; diff --git a/src/MessagePack/net5.0/PublicAPI.Unshipped.txt b/src/MessagePack/net5.0/PublicAPI.Unshipped.txt index 293b60a86..5e0d2fd96 100644 --- a/src/MessagePack/net5.0/PublicAPI.Unshipped.txt +++ b/src/MessagePack/net5.0/PublicAPI.Unshipped.txt @@ -1,3 +1,4 @@ +MessagePack.FormatterNotRegisteredException.FormatterNotRegisteredException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) -> void MessagePack.Formatters.ByteMemoryFormatter MessagePack.Formatters.ByteMemoryFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Memory MessagePack.Formatters.ByteMemoryFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Memory value, MessagePack.MessagePackSerializerOptions options) -> void @@ -75,7 +76,15 @@ MessagePack.ImmutableCollection.InterfaceImmutableSetFormatter MessagePack.ImmutableCollection.InterfaceImmutableSetFormatter.InterfaceImmutableSetFormatter() -> void MessagePack.ImmutableCollection.InterfaceImmutableStackFormatter MessagePack.ImmutableCollection.InterfaceImmutableStackFormatter.InterfaceImmutableStackFormatter() -> void +MessagePack.MessagePackSerializerOptions.SequencePool.get -> MessagePack.SequencePool +MessagePack.MessagePackSerializerOptions.WithPool(MessagePack.SequencePool pool) -> MessagePack.MessagePackSerializerOptions +MessagePack.MessagePackStreamReader.MessagePackStreamReader(System.IO.Stream stream, bool leaveOpen, MessagePack.SequencePool sequencePool) -> void MessagePack.Resolvers.ExpandoObjectResolver +MessagePack.SequencePool +MessagePack.SequencePool.SequencePool() -> void +MessagePack.SequencePool.SequencePool(int maxSize) -> void +MessagePack.SequencePool.SequencePool(int maxSize, System.Buffers.ArrayPool arrayPool) -> void +MessagePack.TinyJsonException.TinyJsonException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) -> void override MessagePack.ImmutableCollection.ImmutableDictionaryFormatter.Add(System.Collections.Immutable.ImmutableDictionary.Builder collection, int index, TKey key, TValue value, MessagePack.MessagePackSerializerOptions options) -> void override MessagePack.ImmutableCollection.ImmutableDictionaryFormatter.Complete(System.Collections.Immutable.ImmutableDictionary.Builder intermediateCollection) -> System.Collections.Immutable.ImmutableDictionary override MessagePack.ImmutableCollection.ImmutableDictionaryFormatter.Create(int count, MessagePack.MessagePackSerializerOptions options) -> System.Collections.Immutable.ImmutableDictionary.Builder @@ -117,6 +126,8 @@ override MessagePack.ImmutableCollection.InterfaceImmutableSetFormatter.Creat override MessagePack.ImmutableCollection.InterfaceImmutableStackFormatter.Add(T[] collection, int index, T value, MessagePack.MessagePackSerializerOptions options) -> void override MessagePack.ImmutableCollection.InterfaceImmutableStackFormatter.Complete(T[] intermediateCollection) -> System.Collections.Immutable.IImmutableStack override MessagePack.ImmutableCollection.InterfaceImmutableStackFormatter.Create(int count, MessagePack.MessagePackSerializerOptions options) -> T[] +static MessagePack.Nil.operator !=(MessagePack.Nil left, MessagePack.Nil right) -> bool +static MessagePack.Nil.operator ==(MessagePack.Nil left, MessagePack.Nil right) -> bool static readonly MessagePack.Formatters.ByteMemoryFormatter.Instance -> MessagePack.Formatters.ByteMemoryFormatter static readonly MessagePack.Formatters.ByteReadOnlyMemoryFormatter.Instance -> MessagePack.Formatters.ByteReadOnlyMemoryFormatter static readonly MessagePack.Formatters.ByteReadOnlySequenceFormatter.Instance -> MessagePack.Formatters.ByteReadOnlySequenceFormatter @@ -129,3 +140,4 @@ static readonly MessagePack.ImmutableCollection.ImmutableCollectionResolver.Inst static readonly MessagePack.Resolvers.ExpandoObjectResolver.Instance -> MessagePack.IFormatterResolver static readonly MessagePack.Resolvers.ExpandoObjectResolver.Options -> MessagePack.MessagePackSerializerOptions virtual MessagePack.Formatters.PrimitiveObjectFormatter.DeserializeMap(ref MessagePack.MessagePackReader reader, int length, MessagePack.MessagePackSerializerOptions options) -> object +virtual MessagePack.MessagePackStreamReader.Dispose(bool disposing) -> void diff --git a/src/MessagePack/netcoreapp2.1/PublicAPI.Unshipped.txt b/src/MessagePack/netcoreapp2.1/PublicAPI.Unshipped.txt index d5ec32ce3..8481f014d 100644 --- a/src/MessagePack/netcoreapp2.1/PublicAPI.Unshipped.txt +++ b/src/MessagePack/netcoreapp2.1/PublicAPI.Unshipped.txt @@ -1,3 +1,4 @@ +MessagePack.FormatterNotRegisteredException.FormatterNotRegisteredException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) -> void MessagePack.Formatters.ByteMemoryFormatter MessagePack.Formatters.ByteMemoryFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Memory MessagePack.Formatters.ByteMemoryFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Memory value, MessagePack.MessagePackSerializerOptions options) -> void @@ -80,6 +81,7 @@ MessagePack.SequencePool.SequencePool() -> void MessagePack.SequencePool.SequencePool(int maxSize) -> void MessagePack.SequencePool.SequencePool(int maxSize, System.Buffers.ArrayPool arrayPool) -> void MessagePack.MessagePackSerializerOptions.WithPool(MessagePack.SequencePool pool) -> MessagePack.MessagePackSerializerOptions +MessagePack.TinyJsonException.TinyJsonException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) -> void override MessagePack.ImmutableCollection.ImmutableDictionaryFormatter.Add(System.Collections.Immutable.ImmutableDictionary.Builder collection, int index, TKey key, TValue value, MessagePack.MessagePackSerializerOptions options) -> void override MessagePack.ImmutableCollection.ImmutableDictionaryFormatter.Complete(System.Collections.Immutable.ImmutableDictionary.Builder intermediateCollection) -> System.Collections.Immutable.ImmutableDictionary override MessagePack.ImmutableCollection.ImmutableDictionaryFormatter.Create(int count, MessagePack.MessagePackSerializerOptions options) -> System.Collections.Immutable.ImmutableDictionary.Builder @@ -121,6 +123,8 @@ override MessagePack.ImmutableCollection.InterfaceImmutableSetFormatter.Creat override MessagePack.ImmutableCollection.InterfaceImmutableStackFormatter.Add(T[] collection, int index, T value, MessagePack.MessagePackSerializerOptions options) -> void override MessagePack.ImmutableCollection.InterfaceImmutableStackFormatter.Complete(T[] intermediateCollection) -> System.Collections.Immutable.IImmutableStack override MessagePack.ImmutableCollection.InterfaceImmutableStackFormatter.Create(int count, MessagePack.MessagePackSerializerOptions options) -> T[] +static MessagePack.Nil.operator !=(MessagePack.Nil left, MessagePack.Nil right) -> bool +static MessagePack.Nil.operator ==(MessagePack.Nil left, MessagePack.Nil right) -> bool static readonly MessagePack.Formatters.ByteMemoryFormatter.Instance -> MessagePack.Formatters.ByteMemoryFormatter static readonly MessagePack.Formatters.ByteReadOnlyMemoryFormatter.Instance -> MessagePack.Formatters.ByteReadOnlyMemoryFormatter static readonly MessagePack.Formatters.ByteReadOnlySequenceFormatter.Instance -> MessagePack.Formatters.ByteReadOnlySequenceFormatter @@ -132,3 +136,4 @@ static readonly MessagePack.ImmutableCollection.ImmutableCollectionResolver.Inst static readonly MessagePack.Resolvers.ExpandoObjectResolver.Instance -> MessagePack.IFormatterResolver static readonly MessagePack.Resolvers.ExpandoObjectResolver.Options -> MessagePack.MessagePackSerializerOptions virtual MessagePack.Formatters.PrimitiveObjectFormatter.DeserializeMap(ref MessagePack.MessagePackReader reader, int length, MessagePack.MessagePackSerializerOptions options) -> object +virtual MessagePack.MessagePackStreamReader.Dispose(bool disposing) -> void diff --git a/src/MessagePack/netstandard2.0/PublicAPI.Unshipped.txt b/src/MessagePack/netstandard2.0/PublicAPI.Unshipped.txt index d31186945..991ca2174 100644 --- a/src/MessagePack/netstandard2.0/PublicAPI.Unshipped.txt +++ b/src/MessagePack/netstandard2.0/PublicAPI.Unshipped.txt @@ -1,3 +1,4 @@ +MessagePack.FormatterNotRegisteredException.FormatterNotRegisteredException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) -> void MessagePack.Formatters.ByteMemoryFormatter MessagePack.Formatters.ByteMemoryFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Memory MessagePack.Formatters.ByteMemoryFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Memory value, MessagePack.MessagePackSerializerOptions options) -> void @@ -72,7 +73,15 @@ MessagePack.ImmutableCollection.InterfaceImmutableSetFormatter MessagePack.ImmutableCollection.InterfaceImmutableSetFormatter.InterfaceImmutableSetFormatter() -> void MessagePack.ImmutableCollection.InterfaceImmutableStackFormatter MessagePack.ImmutableCollection.InterfaceImmutableStackFormatter.InterfaceImmutableStackFormatter() -> void +MessagePack.MessagePackSerializerOptions.SequencePool.get -> MessagePack.SequencePool +MessagePack.MessagePackSerializerOptions.WithPool(MessagePack.SequencePool pool) -> MessagePack.MessagePackSerializerOptions +MessagePack.MessagePackStreamReader.MessagePackStreamReader(System.IO.Stream stream, bool leaveOpen, MessagePack.SequencePool sequencePool) -> void MessagePack.Resolvers.ExpandoObjectResolver +MessagePack.SequencePool +MessagePack.SequencePool.SequencePool() -> void +MessagePack.SequencePool.SequencePool(int maxSize) -> void +MessagePack.SequencePool.SequencePool(int maxSize, System.Buffers.ArrayPool arrayPool) -> void +MessagePack.TinyJsonException.TinyJsonException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) -> void override MessagePack.ImmutableCollection.ImmutableDictionaryFormatter.Add(System.Collections.Immutable.ImmutableDictionary.Builder collection, int index, TKey key, TValue value, MessagePack.MessagePackSerializerOptions options) -> void override MessagePack.ImmutableCollection.ImmutableDictionaryFormatter.Complete(System.Collections.Immutable.ImmutableDictionary.Builder intermediateCollection) -> System.Collections.Immutable.ImmutableDictionary override MessagePack.ImmutableCollection.ImmutableDictionaryFormatter.Create(int count, MessagePack.MessagePackSerializerOptions options) -> System.Collections.Immutable.ImmutableDictionary.Builder @@ -114,6 +123,8 @@ override MessagePack.ImmutableCollection.InterfaceImmutableSetFormatter.Creat override MessagePack.ImmutableCollection.InterfaceImmutableStackFormatter.Add(T[] collection, int index, T value, MessagePack.MessagePackSerializerOptions options) -> void override MessagePack.ImmutableCollection.InterfaceImmutableStackFormatter.Complete(T[] intermediateCollection) -> System.Collections.Immutable.IImmutableStack override MessagePack.ImmutableCollection.InterfaceImmutableStackFormatter.Create(int count, MessagePack.MessagePackSerializerOptions options) -> T[] +static MessagePack.Nil.operator !=(MessagePack.Nil left, MessagePack.Nil right) -> bool +static MessagePack.Nil.operator ==(MessagePack.Nil left, MessagePack.Nil right) -> bool static readonly MessagePack.Formatters.ByteMemoryFormatter.Instance -> MessagePack.Formatters.ByteMemoryFormatter static readonly MessagePack.Formatters.ByteReadOnlyMemoryFormatter.Instance -> MessagePack.Formatters.ByteReadOnlyMemoryFormatter static readonly MessagePack.Formatters.ByteReadOnlySequenceFormatter.Instance -> MessagePack.Formatters.ByteReadOnlySequenceFormatter @@ -125,3 +136,4 @@ static readonly MessagePack.ImmutableCollection.ImmutableCollectionResolver.Inst static readonly MessagePack.Resolvers.ExpandoObjectResolver.Instance -> MessagePack.IFormatterResolver static readonly MessagePack.Resolvers.ExpandoObjectResolver.Options -> MessagePack.MessagePackSerializerOptions virtual MessagePack.Formatters.PrimitiveObjectFormatter.DeserializeMap(ref MessagePack.MessagePackReader reader, int length, MessagePack.MessagePackSerializerOptions options) -> object +virtual MessagePack.MessagePackStreamReader.Dispose(bool disposing) -> void From 010ed714bea15a6d8c557bec75b1a80e09622e2d Mon Sep 17 00:00:00 2001 From: pCYSl5EDgo <31692496+pCYSl5EDgo@users.noreply.github.com> Date: Fri, 20 Nov 2020 12:14:21 +0900 Subject: [PATCH 025/161] MPC: nullable enable and update language version to 9. (#1125) * Refactoring enable nullable * Relax nullable * refactor: is IArrayTypeSymbol pattern match * Typo: NameSpace -> Namespace * Typo: INameSpaceInfo -> INamespaceInfo * Fix: INamespaceInfo --- .../CodeAnalysis/Definitions.cs | 156 ++++-- .../CodeAnalysis/TypeCollector.cs | 510 +++++++----------- .../CodeGenerator.cs | 122 ++--- .../Generator/IFormatterTemplate.cs | 4 +- .../Generator/TemplatePartials.cs | 56 +- .../MessagePack.GeneratorCore.csproj | 3 +- .../Utils/RoslynExtensions.cs | 118 +--- 7 files changed, 399 insertions(+), 570 deletions(-) diff --git a/src/MessagePack.GeneratorCore/CodeAnalysis/Definitions.cs b/src/MessagePack.GeneratorCore/CodeAnalysis/Definitions.cs index 9e3b86899..5ccf8c5b3 100644 --- a/src/MessagePack.GeneratorCore/CodeAnalysis/Definitions.cs +++ b/src/MessagePack.GeneratorCore/CodeAnalysis/Definitions.cs @@ -9,6 +9,11 @@ namespace MessagePackCompiler.CodeAnalysis { + public interface INamespaceInfo + { + string? Namespace { get; } + } + public interface IResolverRegisterInfo { string FullName { get; } @@ -16,41 +21,36 @@ public interface IResolverRegisterInfo string FormatterName { get; } } - public class ObjectSerializationInfo : IResolverRegisterInfo + public class ObjectSerializationInfo : IResolverRegisterInfo, INamespaceInfo { - public string Name { get; set; } + public string Name { get; } - public string FullName { get; set; } + public string FullName { get; } - public string Namespace { get; set; } + public string? Namespace { get; } - public GenericTypeParameterInfo[] GenericTypeParameters { get; set; } + public GenericTypeParameterInfo[] GenericTypeParameters { get; } - public bool IsOpenGenericType { get; set; } + public bool IsOpenGenericType { get; } - public bool IsIntKey { get; set; } + public bool IsIntKey { get; } public bool IsStringKey { get { return !this.IsIntKey; } } - public bool IsClass { get; set; } - - public bool IsStruct - { - get { return !this.IsClass; } - } + public bool IsClass { get; } - public MemberSerializationInfo[] ConstructorParameters { get; set; } + public MemberSerializationInfo[] ConstructorParameters { get; } - public MemberSerializationInfo[] Members { get; set; } + public MemberSerializationInfo[] Members { get; } - public bool HasIMessagePackSerializationCallbackReceiver { get; set; } + public bool HasIMessagePackSerializationCallbackReceiver { get; } - public bool NeedsCastOnBefore { get; set; } + public bool NeedsCastOnBefore { get; } - public bool NeedsCastOnAfter { get; set; } + public bool NeedsCastOnAfter { get; } public string FormatterName => this.Namespace == null ? FormatterNameWithoutNameSpace : this.Namespace + "." + FormatterNameWithoutNameSpace; @@ -79,7 +79,7 @@ public int MaxKey } } - public MemberSerializationInfo GetMember(int index) + public MemberSerializationInfo? GetMember(int index) { return this.Members.FirstOrDefault(x => x.IntKey == index); } @@ -89,6 +89,22 @@ public string GetConstructorString() var args = string.Join(", ", this.ConstructorParameters.Select(x => "__" + x.Name + "__")); return $"{this.FullName}({args})"; } + + public ObjectSerializationInfo(bool isClass, bool isOpenGenericType, GenericTypeParameterInfo[] genericTypeParameterInfos, MemberSerializationInfo[] constructorParameters, bool isIntKey, MemberSerializationInfo[] members, string name, string fullName, string? @namespace, bool hasSerializationConstructor, bool needsCastOnAfter, bool needsCastOnBefore) + { + IsClass = isClass; + IsOpenGenericType = isOpenGenericType; + GenericTypeParameters = genericTypeParameterInfos; + ConstructorParameters = constructorParameters; + IsIntKey = isIntKey; + Members = members; + Name = name; + FullName = fullName; + Namespace = @namespace; + HasIMessagePackSerializationCallbackReceiver = hasSerializationConstructor; + NeedsCastOnAfter = needsCastOnAfter; + NeedsCastOnBefore = needsCastOnBefore; + } } public class GenericTypeParameterInfo @@ -103,33 +119,44 @@ public GenericTypeParameterInfo(string name, string constraints) { Name = name ?? throw new ArgumentNullException(nameof(name)); Constraints = constraints ?? throw new ArgumentNullException(nameof(name)); - HasConstraints = !string.IsNullOrEmpty(constraints); + HasConstraints = constraints != string.Empty; } } public class MemberSerializationInfo { - public bool IsProperty { get; set; } + public bool IsProperty { get; } - public bool IsField { get; set; } + public bool IsWritable { get; } - public bool IsWritable { get; set; } + public bool IsReadable { get; } - public bool IsReadable { get; set; } + public int IntKey { get; } - public int IntKey { get; set; } + public string StringKey { get; } - public string StringKey { get; set; } + public string Type { get; } - public string Type { get; set; } + public string Name { get; } - public string Name { get; set; } + public string ShortTypeName { get; } - public string ShortTypeName { get; set; } + public string? CustomFormatterTypeName { get; } - public string CustomFormatterTypeName { get; set; } + private readonly HashSet primitiveTypes = new (Generator.ShouldUseFormatterResolverHelper.PrimitiveTypes); - private readonly HashSet primitiveTypes = new HashSet(Generator.ShouldUseFormatterResolverHelper.PrimitiveTypes); + public MemberSerializationInfo(bool isProperty, bool isWritable, bool isReadable, int intKey, string stringKey, string name, string type, string shortTypeName, string? customFormatterTypeName) + { + IsProperty = isProperty; + IsWritable = isWritable; + IsReadable = isReadable; + IntKey = intKey; + StringKey = stringKey; + Type = type; + Name = name; + ShortTypeName = shortTypeName; + CustomFormatterTypeName = customFormatterTypeName; + } public string GetSerializeMethodString() { @@ -139,7 +166,7 @@ public string GetSerializeMethodString() } else if (this.primitiveTypes.Contains(this.Type)) { - return $"writer.Write(value.{this.Name})"; + return "writer.Write(value." + this.Name + ")"; } else { @@ -156,7 +183,7 @@ public string GetDeserializeMethodString() else if (this.primitiveTypes.Contains(this.Type)) { string suffix = this.Type == "byte[]" ? "?.ToArray()" : string.Empty; - return $"reader.Read{this.ShortTypeName.Replace("[]", "s")}()" + suffix; + return $"reader.Read{this.ShortTypeName!.Replace("[]", "s")}()" + suffix; } else { @@ -165,55 +192,84 @@ public string GetDeserializeMethodString() } } - public class EnumSerializationInfo : IResolverRegisterInfo + public class EnumSerializationInfo : IResolverRegisterInfo, INamespaceInfo { - public string Namespace { get; set; } + public EnumSerializationInfo(string? @namespace, string name, string fullName, string underlyingType) + { + Namespace = @namespace; + Name = name; + FullName = fullName; + UnderlyingType = underlyingType; + } + + public string? Namespace { get; } - public string Name { get; set; } + public string Name { get; } - public string FullName { get; set; } + public string FullName { get; } - public string UnderlyingType { get; set; } + public string UnderlyingType { get; } public string FormatterName => (this.Namespace == null ? this.Name : this.Namespace + "." + this.Name) + "Formatter"; } public class GenericSerializationInfo : IResolverRegisterInfo, IEquatable { - public string FullName { get; set; } + public string FullName { get; } - public string FormatterName { get; set; } + public string FormatterName { get; } - public bool IsOpenGenericType { get; set; } + public bool IsOpenGenericType { get; } - public bool Equals(GenericSerializationInfo other) + public bool Equals(GenericSerializationInfo? other) { - return this.FullName.Equals(other.FullName); + return this.FullName.Equals(other?.FullName); } public override int GetHashCode() { return this.FullName.GetHashCode(); } + + public GenericSerializationInfo(string fullName, string formatterName, bool isOpenGenericType) + { + FullName = fullName; + FormatterName = formatterName; + IsOpenGenericType = isOpenGenericType; + } } - public class UnionSerializationInfo : IResolverRegisterInfo + public class UnionSerializationInfo : IResolverRegisterInfo, INamespaceInfo { - public string Namespace { get; set; } + public string? Namespace { get; } - public string Name { get; set; } + public string Name { get; } - public string FullName { get; set; } + public string FullName { get; } public string FormatterName => (this.Namespace == null ? this.Name : this.Namespace + "." + this.Name) + "Formatter"; - public UnionSubTypeInfo[] SubTypes { get; set; } + public UnionSubTypeInfo[] SubTypes { get; } + + public UnionSerializationInfo(string? @namespace, string name, string fullName, UnionSubTypeInfo[] subTypes) + { + Namespace = @namespace; + Name = name; + FullName = fullName; + SubTypes = subTypes; + } } public class UnionSubTypeInfo { - public string Type { get; set; } + public UnionSubTypeInfo(int key, string type) + { + Key = key; + Type = type; + } + + public int Key { get; } - public int Key { get; set; } + public string Type { get; } } } diff --git a/src/MessagePack.GeneratorCore/CodeAnalysis/TypeCollector.cs b/src/MessagePack.GeneratorCore/CodeAnalysis/TypeCollector.cs index b65a9f7d3..93cac37b2 100644 --- a/src/MessagePack.GeneratorCore/CodeAnalysis/TypeCollector.cs +++ b/src/MessagePack.GeneratorCore/CodeAnalysis/TypeCollector.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; +using System.Collections.Immutable; using System.Linq; using System.Text; using System.Text.RegularExpressions; @@ -23,14 +24,14 @@ public MessagePackGeneratorResolveFailedException(string message) internal class ReferenceSymbols { #pragma warning disable SA1401 // Fields should be private - internal readonly INamedTypeSymbol Task; - internal readonly INamedTypeSymbol TaskOfT; + internal readonly INamedTypeSymbol? Task; + internal readonly INamedTypeSymbol? TaskOfT; internal readonly INamedTypeSymbol MessagePackObjectAttribute; internal readonly INamedTypeSymbol UnionAttribute; internal readonly INamedTypeSymbol SerializationConstructorAttribute; internal readonly INamedTypeSymbol KeyAttribute; internal readonly INamedTypeSymbol IgnoreAttribute; - internal readonly INamedTypeSymbol IgnoreDataMemberAttribute; + internal readonly INamedTypeSymbol? IgnoreDataMemberAttribute; internal readonly INamedTypeSymbol IMessagePackSerializationCallbackReceiver; internal readonly INamedTypeSymbol MessagePackFormatterAttribute; #pragma warning restore SA1401 // Fields should be private @@ -49,35 +50,20 @@ public ReferenceSymbols(Compilation compilation, Action logger) logger("failed to get metadata of System.Threading.Tasks.Task"); } - MessagePackObjectAttribute = compilation.GetTypeByMetadataName("MessagePack.MessagePackObjectAttribute"); - if (MessagePackObjectAttribute == null) - { - throw new InvalidOperationException("failed to get metadata of MessagePack.MessagePackObjectAttribute"); - } + MessagePackObjectAttribute = compilation.GetTypeByMetadataName("MessagePack.MessagePackObjectAttribute") + ?? throw new InvalidOperationException("failed to get metadata of MessagePack.MessagePackObjectAttribute"); - UnionAttribute = compilation.GetTypeByMetadataName("MessagePack.UnionAttribute"); - if (UnionAttribute == null) - { - throw new InvalidOperationException("failed to get metadata of MessagePack.UnionAttribute"); - } + UnionAttribute = compilation.GetTypeByMetadataName("MessagePack.UnionAttribute") + ?? throw new InvalidOperationException("failed to get metadata of MessagePack.UnionAttribute"); - SerializationConstructorAttribute = compilation.GetTypeByMetadataName("MessagePack.SerializationConstructorAttribute"); - if (SerializationConstructorAttribute == null) - { - throw new InvalidOperationException("failed to get metadata of MessagePack.SerializationConstructorAttribute"); - } + SerializationConstructorAttribute = compilation.GetTypeByMetadataName("MessagePack.SerializationConstructorAttribute") + ?? throw new InvalidOperationException("failed to get metadata of MessagePack.SerializationConstructorAttribute"); - KeyAttribute = compilation.GetTypeByMetadataName("MessagePack.KeyAttribute"); - if (KeyAttribute == null) - { - throw new InvalidOperationException("failed to get metadata of MessagePack.KeyAttribute"); - } + KeyAttribute = compilation.GetTypeByMetadataName("MessagePack.KeyAttribute") + ?? throw new InvalidOperationException("failed to get metadata of MessagePack.KeyAttribute"); - IgnoreAttribute = compilation.GetTypeByMetadataName("MessagePack.IgnoreMemberAttribute"); - if (IgnoreAttribute == null) - { - throw new InvalidOperationException("failed to get metadata of MessagePack.IgnoreMemberAttribute"); - } + IgnoreAttribute = compilation.GetTypeByMetadataName("MessagePack.IgnoreMemberAttribute") + ?? throw new InvalidOperationException("failed to get metadata of MessagePack.IgnoreMemberAttribute"); IgnoreDataMemberAttribute = compilation.GetTypeByMetadataName("System.Runtime.Serialization.IgnoreDataMemberAttribute"); if (IgnoreDataMemberAttribute == null) @@ -85,24 +71,16 @@ public ReferenceSymbols(Compilation compilation, Action logger) logger("failed to get metadata of System.Runtime.Serialization.IgnoreDataMemberAttribute"); } - IMessagePackSerializationCallbackReceiver = compilation.GetTypeByMetadataName("MessagePack.IMessagePackSerializationCallbackReceiver"); - if (IMessagePackSerializationCallbackReceiver == null) - { - throw new InvalidOperationException("failed to get metadata of MessagePack.IMessagePackSerializationCallbackReceiver"); - } + IMessagePackSerializationCallbackReceiver = compilation.GetTypeByMetadataName("MessagePack.IMessagePackSerializationCallbackReceiver") + ?? throw new InvalidOperationException("failed to get metadata of MessagePack.IMessagePackSerializationCallbackReceiver"); - MessagePackFormatterAttribute = compilation.GetTypeByMetadataName("MessagePack.MessagePackFormatterAttribute"); - if (MessagePackFormatterAttribute == null) - { - throw new InvalidOperationException("failed to get metadata of MessagePack.MessagePackFormatterAttribute"); - } + MessagePackFormatterAttribute = compilation.GetTypeByMetadataName("MessagePack.MessagePackFormatterAttribute") + ?? throw new InvalidOperationException("failed to get metadata of MessagePack.MessagePackFormatterAttribute"); } } public class TypeCollector { - private const string CodegeneratorOnlyPreprocessorSymbol = "INCLUDE_ONLY_CODE_GENERATION"; - private static readonly SymbolDisplayFormat BinaryWriteFormat = new SymbolDisplayFormat( genericsOptions: SymbolDisplayGenericsOptions.IncludeTypeParameters, miscellaneousOptions: SymbolDisplayMiscellaneousOptions.ExpandNullable, @@ -114,7 +92,7 @@ public class TypeCollector private readonly bool isForceUseMap; private readonly ReferenceSymbols typeReferences; private readonly INamedTypeSymbol[] targetTypes; - private readonly HashSet embeddedTypes = new HashSet(new string[] + private readonly HashSet embeddedTypes = new (new[] { "short", "int", @@ -185,7 +163,7 @@ public class TypeCollector "System.Reactive.Unit", }); - private readonly Dictionary knownGenericTypes = new Dictionary + private readonly Dictionary knownGenericTypes = new () { #pragma warning disable SA1509 // Opening braces should not be preceded by blank line { "System.Collections.Generic.List<>", "global::MessagePack.Formatters.ListFormatter" }, @@ -261,22 +239,19 @@ public class TypeCollector #pragma warning restore SA1509 // Opening braces should not be preceded by blank line }; - private readonly Action logger; - private readonly bool disallowInternal; - private HashSet externalIgnoreTypeNames; + private readonly HashSet externalIgnoreTypeNames; // visitor workspace: - private HashSet alreadyCollected; - private List collectedObjectInfo; - private List collectedEnumInfo; - private List collectedGenericInfo; - private List collectedUnionInfo; + private readonly HashSet alreadyCollected = new (); + private readonly List collectedObjectInfo = new (); + private readonly List collectedEnumInfo = new (); + private readonly List collectedGenericInfo = new (); + private readonly List collectedUnionInfo = new (); - public TypeCollector(Compilation compilation, bool disallowInternal, bool isForceUseMap, string[] ignoreTypeNames, Action logger) + public TypeCollector(Compilation compilation, bool disallowInternal, bool isForceUseMap, string[]? ignoreTypeNames, Action logger) { - this.logger = logger; this.typeReferences = new ReferenceSymbols(compilation, logger); this.disallowInternal = disallowInternal; this.isForceUseMap = isForceUseMap; @@ -307,11 +282,11 @@ public TypeCollector(Compilation compilation, bool disallowInternal, bool isForc private void ResetWorkspace() { - this.alreadyCollected = new HashSet(); - this.collectedObjectInfo = new List(); - this.collectedEnumInfo = new List(); - this.collectedGenericInfo = new List(); - this.collectedUnionInfo = new List(); + this.alreadyCollected.Clear(); + this.collectedObjectInfo.Clear(); + this.collectedEnumInfo.Clear(); + this.collectedGenericInfo.Clear(); + this.collectedUnionInfo.Clear(); } // EntryPoint @@ -339,19 +314,20 @@ private void CollectCore(ITypeSymbol typeSymbol) return; } - if (this.embeddedTypes.Contains(typeSymbol.ToString())) + var typeSymbolString = typeSymbol.ToString() ?? throw new InvalidOperationException(); + if (this.embeddedTypes.Contains(typeSymbolString)) { return; } - if (this.externalIgnoreTypeNames.Contains(typeSymbol.ToString())) + if (this.externalIgnoreTypeNames.Contains(typeSymbolString)) { return; } - if (typeSymbol.TypeKind == TypeKind.Array) + if (typeSymbol is IArrayTypeSymbol arrayTypeSymbol) { - this.CollectArray(typeSymbol as IArrayTypeSymbol); + this.CollectArray(arrayTypeSymbol); return; } @@ -371,9 +347,9 @@ private void CollectCore(ITypeSymbol typeSymbol) return; } - if (typeSymbol.TypeKind == TypeKind.Enum) + if (type.EnumUnderlyingType != null) { - this.CollectEnum(type); + this.CollectEnum(type, type.EnumUnderlyingType); return; } @@ -401,62 +377,57 @@ private void CollectCore(ITypeSymbol typeSymbol) } this.CollectObject(type); - return; } - private void CollectEnum(INamedTypeSymbol type) + private void CollectEnum(INamedTypeSymbol type, ISymbol enumUnderlyingType) { - var info = new EnumSerializationInfo - { - Name = type.ToDisplayString(ShortTypeNameFormat).Replace(".", "_"), - Namespace = type.ContainingNamespace.IsGlobalNamespace ? null : type.ContainingNamespace.ToDisplayString(), - FullName = type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat), - UnderlyingType = type.EnumUnderlyingType.ToDisplayString(BinaryWriteFormat), - }; - + var info = new EnumSerializationInfo(type.ContainingNamespace.IsGlobalNamespace ? null : type.ContainingNamespace.ToDisplayString(), type.ToDisplayString(ShortTypeNameFormat).Replace(".", "_"), type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat), enumUnderlyingType.ToDisplayString(BinaryWriteFormat)); this.collectedEnumInfo.Add(info); } private void CollectUnion(INamedTypeSymbol type) { - System.Collections.Immutable.ImmutableArray[] unionAttrs = type.GetAttributes().Where(x => x.AttributeClass.ApproximatelyEqual(this.typeReferences.UnionAttribute)).Select(x => x.ConstructorArguments).ToArray(); + ImmutableArray[] unionAttrs = type.GetAttributes().Where(x => x.AttributeClass.ApproximatelyEqual(this.typeReferences.UnionAttribute)).Select(x => x.ConstructorArguments).ToArray(); if (unionAttrs.Length == 0) { throw new MessagePackGeneratorResolveFailedException("Serialization Type must mark UnionAttribute." + " type: " + type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)); } // 0, Int 1, SubType - var info = new UnionSerializationInfo + UnionSubTypeInfo UnionSubTypeInfoSelector(ImmutableArray x) { - Name = type.Name, - Namespace = type.ContainingNamespace.IsGlobalNamespace ? null : type.ContainingNamespace.ToDisplayString(), - FullName = type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat), - SubTypes = unionAttrs.Select(x => new UnionSubTypeInfo + if (!(x[0] is { Value: int key }) || !(x[1] is { Value: ITypeSymbol typeSymbol })) { - Key = (int)x[0].Value, - Type = x[1].Value is ITypeSymbol typeSymbol ? typeSymbol.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat) : throw new NotSupportedException($"AOT code generation only supports UnionAttribute that uses a Type parameter, but the {type.ToDisplayString(SymbolDisplayFormat.CSharpErrorMessageFormat)} type uses an unsupported parameter."), - }).OrderBy(x => x.Key).ToArray(), - }; + throw new NotSupportedException("AOT code generation only supports UnionAttribute that uses a Type parameter, but the " + type.ToDisplayString(SymbolDisplayFormat.CSharpErrorMessageFormat) + " type uses an unsupported parameter."); + } + + var typeName = typeSymbol.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat); + return new UnionSubTypeInfo(key, typeName); + } + + var info = new UnionSerializationInfo(type.ContainingNamespace.IsGlobalNamespace ? null : type.ContainingNamespace.ToDisplayString(), type.Name, type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat), unionAttrs.Select(UnionSubTypeInfoSelector).OrderBy(x => x.Key).ToArray()); this.collectedUnionInfo.Add(info); } private void CollectGenericUnion(INamedTypeSymbol type) { - System.Collections.Immutable.ImmutableArray[] unionAttrs = type.GetAttributes().Where(x => x.AttributeClass.ApproximatelyEqual(this.typeReferences.UnionAttribute)).Select(x => x.ConstructorArguments).ToArray(); - if (unionAttrs.Length == 0) + var unionAttrs = type.GetAttributes().Where(x => x.AttributeClass.ApproximatelyEqual(this.typeReferences.UnionAttribute)).Select(x => x.ConstructorArguments); + using var enumerator = unionAttrs.GetEnumerator(); + if (!enumerator.MoveNext()) { return; } - var subTypes = unionAttrs.Select(x => x[1].Value).OfType().ToArray(); - foreach (var unionType in subTypes) + do { - if (alreadyCollected.Contains(unionType) == false) + var x = enumerator.Current; + if (x[1] is { Value: INamedTypeSymbol unionType } && alreadyCollected.Contains(unionType) == false) { CollectCore(unionType); } } + while (enumerator.MoveNext()); } private void CollectArray(IArrayTypeSymbol array) @@ -464,36 +435,26 @@ private void CollectArray(IArrayTypeSymbol array) ITypeSymbol elemType = array.ElementType; this.CollectCore(elemType); - var info = new GenericSerializationInfo - { - FullName = array.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat), - IsOpenGenericType = elemType is ITypeParameterSymbol, - }; - + var fullName = array.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat); + var elementTypeDisplayName = elemType.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat); + string formatterName; if (array.IsSZArray) { - info.FormatterName = $"global::MessagePack.Formatters.ArrayFormatter<{elemType.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)}>"; - } - else if (array.Rank == 2) - { - info.FormatterName = $"global::MessagePack.Formatters.TwoDimensionalArrayFormatter<{elemType.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)}>"; - } - else if (array.Rank == 3) - { - info.FormatterName = $"global::MessagePack.Formatters.ThreeDimensionalArrayFormatter<{elemType.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)}>"; - } - else if (array.Rank == 4) - { - info.FormatterName = $"global::MessagePack.Formatters.FourDimensionalArrayFormatter<{elemType.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)}>"; + formatterName = "global::MessagePack.Formatters.ArrayFormatter<" + elementTypeDisplayName + ">"; } else { - throw new InvalidOperationException("does not supports array dimension, " + info.FullName); + formatterName = array.Rank switch + { + 2 => "global::MessagePack.Formatters.TwoDimensionalArrayFormatter<" + elementTypeDisplayName + ">", + 3 => "global::MessagePack.Formatters.ThreeDimensionalArrayFormatter<" + elementTypeDisplayName + ">", + 4 => "global::MessagePack.Formatters.FourDimensionalArrayFormatter<" + elementTypeDisplayName + ">", + _ => throw new InvalidOperationException("does not supports array dimension, " + fullName), + }; } + var info = new GenericSerializationInfo(fullName, formatterName, elemType is ITypeParameterSymbol); this.collectedGenericInfo.Add(info); - - return; } private void CollectGeneric(INamedTypeSymbol type) @@ -512,20 +473,16 @@ private void CollectGeneric(INamedTypeSymbol type) // nullable if (genericTypeString == "T?") { - this.CollectCore(type.TypeArguments[0]); + var firstTypeArgument = type.TypeArguments[0]; + this.CollectCore(firstTypeArgument); - if (!this.embeddedTypes.Contains(type.TypeArguments[0].ToString())) + if (this.embeddedTypes.Contains(firstTypeArgument.ToString()!)) { - var info = new GenericSerializationInfo - { - FormatterName = $"global::MessagePack.Formatters.NullableFormatter<{type.TypeArguments[0].ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)}>", - FullName = type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat), - IsOpenGenericType = isOpenGenericType, - }; - - this.collectedGenericInfo.Add(info); + return; } + var info = new GenericSerializationInfo(type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat), "global::MessagePack.Formatters.NullableFormatter<" + firstTypeArgument.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat) + ">", isOpenGenericType); + this.collectedGenericInfo.Add(info); return; } @@ -540,43 +497,27 @@ private void CollectGeneric(INamedTypeSymbol type) var typeArgs = string.Join(", ", type.TypeArguments.Select(x => x.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat))); var f = formatter.Replace("TREPLACE", typeArgs); - var info = new GenericSerializationInfo - { - FormatterName = f, - FullName = type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat), - IsOpenGenericType = isOpenGenericType, - }; + var info = new GenericSerializationInfo(type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat), f, isOpenGenericType); this.collectedGenericInfo.Add(info); - if (genericTypeString == "System.Linq.ILookup<,>") + if (genericTypeString != "System.Linq.ILookup<,>") { - formatter = this.knownGenericTypes["System.Linq.IGrouping<,>"]; - f = formatter.Replace("TREPLACE", typeArgs); - - var groupingInfo = new GenericSerializationInfo - { - FormatterName = f, - FullName = $"global::System.Linq.IGrouping<{typeArgs}>", - IsOpenGenericType = isOpenGenericType, - }; - - this.collectedGenericInfo.Add(groupingInfo); + return; + } - formatter = this.knownGenericTypes["System.Collections.Generic.IEnumerable<>"]; - typeArgs = type.TypeArguments[1].ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat); - f = formatter.Replace("TREPLACE", typeArgs); + formatter = this.knownGenericTypes["System.Linq.IGrouping<,>"]; + f = formatter.Replace("TREPLACE", typeArgs); - var enumerableInfo = new GenericSerializationInfo - { - FormatterName = f, - FullName = $"global::System.Collections.Generic.IEnumerable<{typeArgs}>", - IsOpenGenericType = isOpenGenericType, - }; + var groupingInfo = new GenericSerializationInfo("global::System.Linq.IGrouping<" + typeArgs + ">", f, isOpenGenericType); + this.collectedGenericInfo.Add(groupingInfo); - this.collectedGenericInfo.Add(enumerableInfo); - } + formatter = this.knownGenericTypes["System.Collections.Generic.IEnumerable<>"]; + typeArgs = type.TypeArguments[1].ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat); + f = formatter.Replace("TREPLACE", typeArgs); + var enumerableInfo = new GenericSerializationInfo("global::System.Collections.Generic.IEnumerable<" + typeArgs + ">", f, isOpenGenericType); + this.collectedGenericInfo.Add(enumerableInfo); return; } @@ -609,16 +550,23 @@ private void CollectGeneric(INamedTypeSymbol type) formatterBuilder.Append(type.Name); formatterBuilder.Append("Formatter<"); - formatterBuilder.Append(string.Join(", ", type.TypeArguments.Select(x => x.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)))); - formatterBuilder.Append(">"); - - var genericSerializationInfo = new GenericSerializationInfo + var typeArgumentIterator = type.TypeArguments.GetEnumerator(); { - FullName = type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat), - FormatterName = formatterBuilder.ToString(), - IsOpenGenericType = isOpenGenericType, - }; + if (typeArgumentIterator.MoveNext()) + { + formatterBuilder.Append(typeArgumentIterator.Current.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)); + } + + while (typeArgumentIterator.MoveNext()) + { + formatterBuilder.Append(", "); + formatterBuilder.Append(typeArgumentIterator.Current.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)); + } + } + formatterBuilder.Append('>'); + + var genericSerializationInfo = new GenericSerializationInfo(type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat), formatterBuilder.ToString(), isOpenGenericType); this.collectedGenericInfo.Add(genericSerializationInfo); } @@ -633,17 +581,14 @@ private ObjectSerializationInfo GetObjectInfo(INamedTypeSymbol type) var isClass = !type.IsValueType; var isOpenGenericType = type.IsGenericType; - AttributeData contractAttr = type.GetAttributes().FirstOrDefault(x => x.AttributeClass.ApproximatelyEqual(this.typeReferences.MessagePackObjectAttribute)); - if (contractAttr == null) - { - throw new MessagePackGeneratorResolveFailedException("Serialization Object must mark MessagePackObjectAttribute." + " type: " + type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)); - } + AttributeData contractAttr = type.GetAttributes().FirstOrDefault(x => x.AttributeClass.ApproximatelyEqual(this.typeReferences.MessagePackObjectAttribute)) + ?? throw new MessagePackGeneratorResolveFailedException("Serialization Object must mark MessagePackObjectAttribute." + " type: " + type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)); var isIntKey = true; var intMembers = new Dictionary(); var stringMembers = new Dictionary(); - if (this.isForceUseMap || (bool)contractAttr.ConstructorArguments[0].Value) + if (this.isForceUseMap || (contractAttr.ConstructorArguments[0] is { Value: bool firstConstructorArgument } && firstConstructorArgument)) { // All public members are serialize target except [Ignore] member. isIntKey = false; @@ -652,31 +597,20 @@ private ObjectSerializationInfo GetObjectInfo(INamedTypeSymbol type) foreach (IPropertySymbol item in type.GetAllMembers().OfType().Where(x => !x.IsOverride)) { - if (item.GetAttributes().Any(x => x.AttributeClass.ApproximatelyEqual(this.typeReferences.IgnoreAttribute) || x.AttributeClass.Name == this.typeReferences.IgnoreDataMemberAttribute.Name)) + if (item.GetAttributes().Any(x => (x.AttributeClass.ApproximatelyEqual(this.typeReferences.IgnoreAttribute) || x.AttributeClass?.Name == this.typeReferences.IgnoreDataMemberAttribute?.Name))) { continue; } - var customFormatterAttr = item.GetAttributes().FirstOrDefault(x => x.AttributeClass.ApproximatelyEqual(this.typeReferences.MessagePackFormatterAttribute))?.ConstructorArguments[0].Value as INamedTypeSymbol; - - var member = new MemberSerializationInfo - { - IsReadable = (item.GetMethod != null) && item.GetMethod.DeclaredAccessibility == Accessibility.Public && !item.IsStatic, - IsWritable = (item.SetMethod != null) && item.SetMethod.DeclaredAccessibility == Accessibility.Public && !item.IsStatic, - StringKey = item.Name, - IsProperty = true, - IsField = false, - Name = item.Name, - Type = item.Type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat), - ShortTypeName = item.Type.ToDisplayString(BinaryWriteFormat), - CustomFormatterTypeName = customFormatterAttr?.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat), - }; - if (!member.IsReadable && !member.IsWritable) + var isReadable = item.GetMethod != null && item.GetMethod.DeclaredAccessibility == Accessibility.Public && !item.IsStatic; + var isWritable = item.SetMethod != null && item.SetMethod.DeclaredAccessibility == Accessibility.Public && !item.IsStatic; + if (!isReadable && !isWritable) { continue; } - member.IntKey = hiddenIntKey++; + var customFormatterAttr = item.GetAttributes().FirstOrDefault(x => x.AttributeClass.ApproximatelyEqual(this.typeReferences.MessagePackFormatterAttribute))?.ConstructorArguments[0].Value as INamedTypeSymbol; + var member = new MemberSerializationInfo(true, isWritable, isReadable, hiddenIntKey++, item.Name, item.Name, item.Type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat), item.Type.ToDisplayString(BinaryWriteFormat), customFormatterAttr?.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)); stringMembers.Add(member.StringKey, member); this.CollectCore(item.Type); // recursive collect @@ -684,7 +618,7 @@ private ObjectSerializationInfo GetObjectInfo(INamedTypeSymbol type) foreach (IFieldSymbol item in type.GetAllMembers().OfType()) { - if (item.GetAttributes().Any(x => x.AttributeClass.ApproximatelyEqual(this.typeReferences.IgnoreAttribute) || x.AttributeClass.Name == this.typeReferences.IgnoreDataMemberAttribute.Name)) + if (item.GetAttributes().Any(x => (x.AttributeClass.ApproximatelyEqual(this.typeReferences.IgnoreAttribute) || x.AttributeClass?.Name == this.typeReferences.IgnoreDataMemberAttribute?.Name))) { continue; } @@ -694,26 +628,15 @@ private ObjectSerializationInfo GetObjectInfo(INamedTypeSymbol type) continue; } - var customFormatterAttr = item.GetAttributes().FirstOrDefault(x => x.AttributeClass.ApproximatelyEqual(this.typeReferences.MessagePackFormatterAttribute))?.ConstructorArguments[0].Value as INamedTypeSymbol; - - var member = new MemberSerializationInfo - { - IsReadable = item.DeclaredAccessibility == Accessibility.Public && !item.IsStatic, - IsWritable = item.DeclaredAccessibility == Accessibility.Public && !item.IsReadOnly && !item.IsStatic, - StringKey = item.Name, - IsProperty = false, - IsField = true, - Name = item.Name, - Type = item.Type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat), - ShortTypeName = item.Type.ToDisplayString(BinaryWriteFormat), - CustomFormatterTypeName = customFormatterAttr?.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat), - }; - if (!member.IsReadable && !member.IsWritable) + var isReadable = item.DeclaredAccessibility == Accessibility.Public && !item.IsStatic; + var isWritable = item.DeclaredAccessibility == Accessibility.Public && !item.IsReadOnly && !item.IsStatic; + if (!isReadable && !isWritable) { continue; } - member.IntKey = hiddenIntKey++; + var customFormatterAttr = item.GetAttributes().FirstOrDefault(x => x.AttributeClass.ApproximatelyEqual(this.typeReferences.MessagePackFormatterAttribute))?.ConstructorArguments[0].Value as INamedTypeSymbol; + var member = new MemberSerializationInfo(false, isWritable, isReadable, hiddenIntKey++, item.Name, item.Name, item.Type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat), item.Type.ToDisplayString(BinaryWriteFormat), customFormatterAttr?.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)); stringMembers.Add(member.StringKey, member); this.CollectCore(item.Type); // recursive collect } @@ -731,37 +654,28 @@ private ObjectSerializationInfo GetObjectInfo(INamedTypeSymbol type) continue; // .tt files don't generate good code for this yet: https://github.com/neuecc/MessagePack-CSharp/issues/390 } - if (item.GetAttributes().Any(x => x.AttributeClass.ApproximatelyEqual(this.typeReferences.IgnoreAttribute) || x.AttributeClass.ApproximatelyEqual(this.typeReferences.IgnoreDataMemberAttribute))) + if (item.GetAttributes().Any(x => + { + var typeReferencesIgnoreDataMemberAttribute = this.typeReferences.IgnoreDataMemberAttribute; + return typeReferencesIgnoreDataMemberAttribute != null && (x.AttributeClass.ApproximatelyEqual(this.typeReferences.IgnoreAttribute) || x.AttributeClass.ApproximatelyEqual(typeReferencesIgnoreDataMemberAttribute)); + })) { continue; } - var customFormatterAttr = item.GetAttributes().FirstOrDefault(x => x.AttributeClass.ApproximatelyEqual(this.typeReferences.MessagePackFormatterAttribute))?.ConstructorArguments[0].Value as INamedTypeSymbol; - - var member = new MemberSerializationInfo - { - IsReadable = (item.GetMethod != null) && item.GetMethod.DeclaredAccessibility == Accessibility.Public && !item.IsStatic, - IsWritable = (item.SetMethod != null) && item.SetMethod.DeclaredAccessibility == Accessibility.Public && !item.IsStatic, - IsProperty = true, - IsField = false, - Name = item.Name, - Type = item.Type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat), - ShortTypeName = item.Type.ToDisplayString(BinaryWriteFormat), - CustomFormatterTypeName = customFormatterAttr?.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat), - }; - if (!member.IsReadable && !member.IsWritable) + var isReadable = item.GetMethod != null && item.GetMethod.DeclaredAccessibility == Accessibility.Public && !item.IsStatic; + var isWritable = item.SetMethod != null && item.SetMethod.DeclaredAccessibility == Accessibility.Public && !item.IsStatic; + if (!isReadable && !isWritable) { continue; } - TypedConstant? key = item.GetAttributes().FirstOrDefault(x => x.AttributeClass.ApproximatelyEqual(this.typeReferences.KeyAttribute))?.ConstructorArguments[0]; - if (key == null) - { - throw new MessagePackGeneratorResolveFailedException("all public members must mark KeyAttribute or IgnoreMemberAttribute." + " type: " + type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat) + " member:" + item.Name); - } + var customFormatterAttr = item.GetAttributes().FirstOrDefault(x => x.AttributeClass.ApproximatelyEqual(this.typeReferences.MessagePackFormatterAttribute))?.ConstructorArguments[0].Value as INamedTypeSymbol; + var key = item.GetAttributes().FirstOrDefault(x => x.AttributeClass.ApproximatelyEqual(this.typeReferences.KeyAttribute))?.ConstructorArguments[0] + ?? throw new MessagePackGeneratorResolveFailedException("all public members must mark KeyAttribute or IgnoreMemberAttribute." + " type: " + type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat) + " member:" + item.Name); - var intKey = (key.Value.Value is int) ? (int)key.Value.Value : (int?)null; - var stringKey = (key.Value.Value is string) ? (string)key.Value.Value : (string)null; + var intKey = key is { Value: int intKeyValue } ? intKeyValue : default(int?); + var stringKey = key is { Value: string stringKeyValue } ? stringKeyValue : default; if (intKey == null && stringKey == null) { throw new MessagePackGeneratorResolveFailedException("both IntKey and StringKey are null." + " type: " + type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat) + " member:" + item.Name); @@ -782,23 +696,22 @@ private ObjectSerializationInfo GetObjectInfo(INamedTypeSymbol type) if (isIntKey) { - member.IntKey = (int)intKey; - if (intMembers.ContainsKey(member.IntKey)) + if (intMembers.ContainsKey(intKey!.Value)) { throw new MessagePackGeneratorResolveFailedException("key is duplicated, all members key must be unique." + " type: " + type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat) + " member:" + item.Name); } + var member = new MemberSerializationInfo(true, isWritable, isReadable, intKey!.Value, item.Name, item.Name, item.Type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat), item.Type.ToDisplayString(BinaryWriteFormat), customFormatterAttr?.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)); intMembers.Add(member.IntKey, member); } else { - member.StringKey = (string)stringKey; - if (stringMembers.ContainsKey(member.StringKey)) + if (stringMembers.ContainsKey(stringKey!)) { throw new MessagePackGeneratorResolveFailedException("key is duplicated, all members key must be unique." + " type: " + type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat) + " member:" + item.Name); } - member.IntKey = hiddenIntKey++; + var member = new MemberSerializationInfo(true, isWritable, isReadable, hiddenIntKey++, stringKey!, item.Name, item.Type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat), item.Type.ToDisplayString(BinaryWriteFormat), customFormatterAttr?.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)); stringMembers.Add(member.StringKey, member); } @@ -817,32 +730,19 @@ private ObjectSerializationInfo GetObjectInfo(INamedTypeSymbol type) continue; } - var customFormatterAttr = item.GetAttributes().FirstOrDefault(x => x.AttributeClass.ApproximatelyEqual(this.typeReferences.MessagePackFormatterAttribute))?.ConstructorArguments[0].Value as INamedTypeSymbol; - - var member = new MemberSerializationInfo - { - IsReadable = item.DeclaredAccessibility == Accessibility.Public && !item.IsStatic, - IsWritable = item.DeclaredAccessibility == Accessibility.Public && !item.IsReadOnly && !item.IsStatic, - IsProperty = true, - IsField = false, - Name = item.Name, - Type = item.Type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat), - ShortTypeName = item.Type.ToDisplayString(BinaryWriteFormat), - CustomFormatterTypeName = customFormatterAttr?.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat), - }; - if (!member.IsReadable && !member.IsWritable) + var isReadable = item.DeclaredAccessibility == Accessibility.Public && !item.IsStatic; + var isWritable = item.DeclaredAccessibility == Accessibility.Public && !item.IsReadOnly && !item.IsStatic; + if (!isReadable && !isWritable) { continue; } - TypedConstant? key = item.GetAttributes().FirstOrDefault(x => x.AttributeClass.ApproximatelyEqual(this.typeReferences.KeyAttribute))?.ConstructorArguments[0]; - if (key == null) - { - throw new MessagePackGeneratorResolveFailedException("all public members must mark KeyAttribute or IgnoreMemberAttribute." + " type: " + type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat) + " member:" + item.Name); - } + var customFormatterAttr = item.GetAttributes().FirstOrDefault(x => x.AttributeClass.ApproximatelyEqual(this.typeReferences.MessagePackFormatterAttribute))?.ConstructorArguments[0].Value as INamedTypeSymbol; + var key = item.GetAttributes().FirstOrDefault(x => x.AttributeClass.ApproximatelyEqual(this.typeReferences.KeyAttribute))?.ConstructorArguments[0] + ?? throw new MessagePackGeneratorResolveFailedException("all public members must mark KeyAttribute or IgnoreMemberAttribute." + " type: " + type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat) + " member:" + item.Name); - var intKey = (key.Value.Value is int) ? (int)key.Value.Value : (int?)null; - var stringKey = (key.Value.Value is string) ? (string)key.Value.Value : (string)null; + var intKey = key is { Value: int intKeyValue } ? intKeyValue : default(int?); + var stringKey = key is { Value: string stringKeyValue } ? stringKeyValue : default; if (intKey == null && stringKey == null) { throw new MessagePackGeneratorResolveFailedException("both IntKey and StringKey are null." + " type: " + type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat) + " member:" + item.Name); @@ -863,23 +763,22 @@ private ObjectSerializationInfo GetObjectInfo(INamedTypeSymbol type) if (isIntKey) { - member.IntKey = (int)intKey; - if (intMembers.ContainsKey(member.IntKey)) + if (intMembers.ContainsKey(intKey!.Value)) { throw new MessagePackGeneratorResolveFailedException("key is duplicated, all members key must be unique." + " type: " + type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat) + " member:" + item.Name); } + var member = new MemberSerializationInfo(true, isWritable, isReadable, intKey!.Value, item.Name, item.Name, item.Type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat), item.Type.ToDisplayString(BinaryWriteFormat), customFormatterAttr?.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)); intMembers.Add(member.IntKey, member); } else { - member.StringKey = (string)stringKey; - if (stringMembers.ContainsKey(member.StringKey)) + if (stringMembers.ContainsKey(stringKey!)) { throw new MessagePackGeneratorResolveFailedException("key is duplicated, all members key must be unique." + " type: " + type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat) + " member:" + item.Name); } - member.IntKey = hiddenIntKey++; + var member = new MemberSerializationInfo(true, isWritable, isReadable, hiddenIntKey++, stringKey!, item.Name, item.Type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat), item.Type.ToDisplayString(BinaryWriteFormat), customFormatterAttr?.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)); stringMembers.Add(member.StringKey, member); } @@ -888,8 +787,8 @@ private ObjectSerializationInfo GetObjectInfo(INamedTypeSymbol type) } // GetConstructor - IEnumerator ctorEnumerator = null; - IMethodSymbol ctor = type.Constructors.Where(x => x.DeclaredAccessibility == Accessibility.Public).SingleOrDefault(x => x.GetAttributes().Any(y => y.AttributeClass.ApproximatelyEqual(this.typeReferences.SerializationConstructorAttribute))); + var ctorEnumerator = default(IEnumerator); + var ctor = type.Constructors.Where(x => x.DeclaredAccessibility == Accessibility.Public).SingleOrDefault(x => x.GetAttributes().Any(y => y.AttributeClass != null && y.AttributeClass.ApproximatelyEqual(this.typeReferences.SerializationConstructorAttribute))); if (ctor == null) { ctorEnumerator = type.Constructors.Where(x => x.DeclaredAccessibility == Accessibility.Public).OrderByDescending(x => x.Parameters.Length).GetEnumerator(); @@ -909,17 +808,17 @@ private ObjectSerializationInfo GetObjectInfo(INamedTypeSymbol type) var constructorParameters = new List(); if (ctor != null) { - ILookup> constructorLookupDictionary = stringMembers.ToLookup(x => x.Key, x => x, StringComparer.OrdinalIgnoreCase); + var constructorLookupDictionary = stringMembers.ToLookup(x => x.Key, x => x, StringComparer.OrdinalIgnoreCase); do { constructorParameters.Clear(); var ctorParamIndex = 0; - foreach (IParameterSymbol item in ctor.Parameters) + foreach (IParameterSymbol item in ctor!.Parameters) { MemberSerializationInfo paramMember; if (isIntKey) { - if (intMembers.TryGetValue(ctorParamIndex, out paramMember)) + if (intMembers.TryGetValue(ctorParamIndex, out paramMember!)) { if (item.Type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat) == paramMember.Type && paramMember.IsReadable) { @@ -954,51 +853,46 @@ private ObjectSerializationInfo GetObjectInfo(INamedTypeSymbol type) else { IEnumerable> hasKey = constructorLookupDictionary[item.Name]; - var len = hasKey.Count(); - if (len != 0) + using var enumerator = hasKey.GetEnumerator(); + // hasKey.Count() == 0 + if (!enumerator.MoveNext()) { - if (len != 1) + if (ctorEnumerator == null) { - if (ctorEnumerator != null) - { - ctor = null; - continue; - } - else - { - throw new MessagePackGeneratorResolveFailedException("duplicate matched constructor parameter name:" + type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat) + " parameterName:" + item.Name + " paramterType:" + item.Type.Name); - } + throw new MessagePackGeneratorResolveFailedException("can't find matched constructor parameter, index not found. type:" + type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat) + " parameterName:" + item.Name); } - paramMember = hasKey.First().Value; - if (item.Type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat) == paramMember.Type && paramMember.IsReadable) - { - constructorParameters.Add(paramMember); - } - else + ctor = null; + continue; + } + + var first = enumerator.Current.Value; + // hasKey.Count() != 1 + if (enumerator.MoveNext()) + { + if (ctorEnumerator == null) { - if (ctorEnumerator != null) - { - ctor = null; - continue; - } - else - { - throw new MessagePackGeneratorResolveFailedException("can't find matched constructor parameter, parameterType mismatch. type:" + type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat) + " parameterName:" + item.Name + " paramterType:" + item.Type.Name); - } + throw new MessagePackGeneratorResolveFailedException("duplicate matched constructor parameter name:" + type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat) + " parameterName:" + item.Name + " paramterType:" + item.Type.Name); } + + ctor = null; + continue; + } + + paramMember = first; + if (item.Type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat) == paramMember.Type && paramMember.IsReadable) + { + constructorParameters.Add(paramMember); } else { - if (ctorEnumerator != null) - { - ctor = null; - continue; - } - else + if (ctorEnumerator == null) { - throw new MessagePackGeneratorResolveFailedException("can't find matched constructor parameter, index not found. type:" + type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat) + " parameterName:" + item.Name); + throw new MessagePackGeneratorResolveFailedException("can't find matched constructor parameter, parameterType mismatch. type:" + type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat) + " parameterName:" + item.Name + " paramterType:" + item.Type.Name); } + + ctor = null; + continue; } } @@ -1022,23 +916,7 @@ private ObjectSerializationInfo GetObjectInfo(INamedTypeSymbol type) needsCastOnAfter = !type.GetMembers("OnAfterDeserialize").Any(); } - var info = new ObjectSerializationInfo - { - IsClass = isClass, - IsOpenGenericType = isOpenGenericType, - GenericTypeParameters = isOpenGenericType - ? type.TypeParameters.Select(ToGenericTypeParameterInfo).ToArray() - : Array.Empty(), - ConstructorParameters = constructorParameters.ToArray(), - IsIntKey = isIntKey, - Members = isIntKey ? intMembers.Values.ToArray() : stringMembers.Values.ToArray(), - Name = isOpenGenericType ? GetGenericFormatterClassName(type) : GetMinimallyQualifiedClassName(type), - FullName = type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat), - Namespace = type.ContainingNamespace.IsGlobalNamespace ? null : type.ContainingNamespace.ToDisplayString(), - HasIMessagePackSerializationCallbackReceiver = hasSerializationConstructor, - NeedsCastOnAfter = needsCastOnAfter, - NeedsCastOnBefore = needsCastOnBefore, - }; + var info = new ObjectSerializationInfo(isClass, isOpenGenericType, isOpenGenericType ? type.TypeParameters.Select(ToGenericTypeParameterInfo).ToArray() : Array.Empty(), constructorParameters.ToArray(), isIntKey, isIntKey ? intMembers.Values.ToArray() : stringMembers.Values.ToArray(), isOpenGenericType ? GetGenericFormatterClassName(type) : GetMinimallyQualifiedClassName(type), type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat), type.ContainingNamespace.IsGlobalNamespace ? null : type.ContainingNamespace.ToDisplayString(), hasSerializationConstructor, needsCastOnAfter, needsCastOnBefore); return info; } @@ -1055,26 +933,12 @@ private static GenericTypeParameterInfo ToGenericTypeParameterInfo(ITypeParamete if (typeParameter.HasReferenceTypeConstraint) { - if (typeParameter.ReferenceTypeConstraintNullableAnnotation == NullableAnnotation.Annotated) - { - constraints.Add("class?"); - } - else - { - constraints.Add("class"); - } + constraints.Add(typeParameter.ReferenceTypeConstraintNullableAnnotation == NullableAnnotation.Annotated ? "class?" : "class"); } if (typeParameter.HasValueTypeConstraint) { - if (typeParameter.HasUnmanagedTypeConstraint) - { - constraints.Add("unmanaged"); - } - else - { - constraints.Add("struct"); - } + constraints.Add(typeParameter.HasUnmanagedTypeConstraint ? "unmanaged" : "struct"); } // constraint types (IDisposable, IEnumerable ...) @@ -1109,7 +973,7 @@ private static string GetMinimallyQualifiedClassName(INamedTypeSymbol type) return name; } - private static bool TryGetNextConstructor(IEnumerator ctorEnumerator, ref IMethodSymbol ctor) + private static bool TryGetNextConstructor(IEnumerator? ctorEnumerator, ref IMethodSymbol? ctor) { if (ctorEnumerator == null || ctor != null) { diff --git a/src/MessagePack.GeneratorCore/CodeGenerator.cs b/src/MessagePack.GeneratorCore/CodeGenerator.cs index a48528a04..f96546937 100644 --- a/src/MessagePack.GeneratorCore/CodeGenerator.cs +++ b/src/MessagePack.GeneratorCore/CodeGenerator.cs @@ -18,13 +18,11 @@ public class CodeGenerator { private static readonly Encoding NoBomUtf8 = new UTF8Encoding(false); - private Action logger; - private CancellationToken cancellationToken; + private readonly Action logger; public CodeGenerator(Action logger, CancellationToken cancellationToken) { this.logger = logger; - this.cancellationToken = cancellationToken; } /// @@ -42,21 +40,21 @@ public async Task GenerateFileAsync( Compilation compilation, string output, string resolverName, - string @namespace, + string? @namespace, bool useMapMode, - string multipleIfDirectiveOutputSymbols, - string[] externalIgnoreTypeNames) + string? multipleIfDirectiveOutputSymbols, + string[]? externalIgnoreTypeNames) { var namespaceDot = string.IsNullOrWhiteSpace(@namespace) ? string.Empty : @namespace + "."; var multipleOutputSymbols = multipleIfDirectiveOutputSymbols?.Split(',') ?? Array.Empty(); var sw = Stopwatch.StartNew(); - foreach (var multioutSymbol in multipleOutputSymbols.Length == 0 ? new[] { string.Empty } : multipleOutputSymbols) + foreach (var multiOutputSymbol in multipleOutputSymbols.Length == 0 ? new[] { string.Empty } : multipleOutputSymbols) { logger("Project Compilation Start:" + compilation.AssemblyName); - var collector = new TypeCollector(compilation, true, useMapMode, externalIgnoreTypeNames, x => Console.WriteLine(x)); + var collector = new TypeCollector(compilation, true, useMapMode, externalIgnoreTypeNames, Console.WriteLine); logger("Project Compilation Complete:" + sw.Elapsed.ToString()); @@ -74,21 +72,21 @@ public async Task GenerateFileAsync( { // SingleFile Output var fullGeneratedProgramText = GenerateSingleFileSync(resolverName, namespaceDot, objectInfo, enumInfo, unionInfo, genericInfo); - if (multioutSymbol == string.Empty) + if (multiOutputSymbol == string.Empty) { - await OutputAsync(output, fullGeneratedProgramText, cancellationToken); + await OutputAsync(output, fullGeneratedProgramText); } else { - var fname = Path.GetFileNameWithoutExtension(output) + "." + MultiSymbolToSafeFilePath(multioutSymbol) + ".cs"; - var text = $"#if {multioutSymbol}" + Environment.NewLine + fullGeneratedProgramText + Environment.NewLine + "#endif"; - await OutputAsync(Path.Combine(Path.GetDirectoryName(output), fname), text, cancellationToken); + var fname = Path.GetFileNameWithoutExtension(output) + "." + MultiSymbolToSafeFilePath(multiOutputSymbol) + ".cs"; + var text = $"#if {multiOutputSymbol}" + Environment.NewLine + fullGeneratedProgramText + Environment.NewLine + "#endif"; + await OutputAsync(Path.Combine(Path.GetDirectoryName(output) ?? string.Empty, fname), text); } } else { // Multiple File output - await GenerateMultipleFileAsync(output, resolverName, objectInfo, enumInfo, unionInfo, namespaceDot, multioutSymbol, genericInfo); + await GenerateMultipleFileAsync(output, resolverName, objectInfo, enumInfo, unionInfo, namespaceDot, multiOutputSymbol, genericInfo); } if (objectInfo.Length == 0 && enumInfo.Length == 0 && genericInfo.Length == 0 && unionInfo.Length == 0) @@ -117,40 +115,33 @@ public static string GenerateSingleFileSync(string resolverName, string namespac { var (nameSpace, isStringKey) = x.Key; var objectSerializationInfos = x.ToArray(); - var template = isStringKey ? new StringKeyFormatterTemplate() : (IFormatterTemplate)new FormatterTemplate(); - - template.Namespace = namespaceDot + "Formatters" + (nameSpace is null ? string.Empty : "." + nameSpace); - template.ObjectSerializationInfos = objectSerializationInfos; - + var ns = namespaceDot + "Formatters" + (nameSpace is null ? string.Empty : "." + nameSpace); + var template = isStringKey ? new StringKeyFormatterTemplate(ns, objectSerializationInfos) : (IFormatterTemplate)new FormatterTemplate(ns, objectSerializationInfos); return template; }) .ToArray(); + string GetNamespace(IGrouping x) + { + if (x.Key == null) + { + return namespaceDot + "Formatters"; + } + + return namespaceDot + "Formatters." + x.Key; + } + var enumFormatterTemplates = enumInfo .GroupBy(x => x.Namespace) - .Select(x => new EnumTemplate() - { - Namespace = namespaceDot + "Formatters" + ((x.Key == null) ? string.Empty : "." + x.Key), - EnumSerializationInfos = x.ToArray(), - }) + .Select(x => new EnumTemplate(GetNamespace(x), x.ToArray())) .ToArray(); var unionFormatterTemplates = unionInfo .GroupBy(x => x.Namespace) - .Select(x => new UnionTemplate() - { - Namespace = namespaceDot + "Formatters" + ((x.Key == null) ? string.Empty : "." + x.Key), - UnionSerializationInfos = x.ToArray(), - }) + .Select(x => new UnionTemplate(GetNamespace(x), x.ToArray())) .ToArray(); - var resolverTemplate = new ResolverTemplate() - { - Namespace = namespaceDot + "Resolvers", - FormatterNamespace = namespaceDot + "Formatters", - ResolverName = resolverName, - RegisterInfos = genericInfo.Where(x => !x.IsOpenGenericType).Cast().Concat(enumInfo).Concat(unionInfo).Concat(objectInfo.Where(x => !x.IsOpenGenericType)).ToArray(), - }; + var resolverTemplate = new ResolverTemplate(namespaceDot + "Resolvers", namespaceDot + "Formatters", resolverName, genericInfo.Where(x => !x.IsOpenGenericType).Cast().Concat(enumInfo).Concat(unionInfo).Concat(objectInfo.Where(x => !x.IsOpenGenericType)).ToArray()); var sb = new StringBuilder(); sb.AppendLine(resolverTemplate.TransformText()); @@ -180,68 +171,59 @@ public static string GenerateSingleFileSync(string resolverName, string namespac private Task GenerateMultipleFileAsync(string output, string resolverName, ObjectSerializationInfo[] objectInfo, EnumSerializationInfo[] enumInfo, UnionSerializationInfo[] unionInfo, string namespaceDot, string multioutSymbol, GenericSerializationInfo[] genericInfo) { + string GetNamespace(INamespaceInfo x) + { + if (x.Namespace == null) + { + return namespaceDot + "Formatters"; + } + + return namespaceDot + "Formatters." + x.Namespace; + } + var waitingTasks = new Task[objectInfo.Length + enumInfo.Length + unionInfo.Length + 1]; var waitingIndex = 0; foreach (var x in objectInfo) { - var template = x.IsStringKey ? new StringKeyFormatterTemplate() : (IFormatterTemplate)new FormatterTemplate(); - template.Namespace = namespaceDot + "Formatters" + (x.Namespace is null ? string.Empty : "." + x.Namespace); - template.ObjectSerializationInfos = new[] { x }; - + var ns = namespaceDot + "Formatters" + (x.Namespace is null ? string.Empty : "." + x.Namespace); + var template = x.IsStringKey ? new StringKeyFormatterTemplate(ns, new[] { x }) : (IFormatterTemplate)new FormatterTemplate(ns, new[] { x }); var text = template.TransformText(); - waitingTasks[waitingIndex++] = OutputToDirAsync(output, template.Namespace, x.Name + "Formatter", multioutSymbol, text, cancellationToken); + waitingTasks[waitingIndex++] = OutputToDirAsync(output, template.Namespace, x.Name + "Formatter", multioutSymbol, text); } foreach (var x in enumInfo) { - var template = new EnumTemplate() - { - Namespace = namespaceDot + "Formatters" + ((x.Namespace == null) ? string.Empty : "." + x.Namespace), - EnumSerializationInfos = new[] { x }, - }; - + var template = new EnumTemplate(GetNamespace(x), new[] { x }); var text = template.TransformText(); - waitingTasks[waitingIndex++] = OutputToDirAsync(output, template.Namespace, x.Name + "Formatter", multioutSymbol, text, cancellationToken); + waitingTasks[waitingIndex++] = OutputToDirAsync(output, template.Namespace, x.Name + "Formatter", multioutSymbol, text); } foreach (var x in unionInfo) { - var template = new UnionTemplate() - { - Namespace = namespaceDot + "Formatters" + ((x.Namespace == null) ? string.Empty : "." + x.Namespace), - UnionSerializationInfos = new[] { x }, - }; - + var template = new UnionTemplate(GetNamespace(x), new[] { x }); var text = template.TransformText(); - waitingTasks[waitingIndex++] = OutputToDirAsync(output, template.Namespace, x.Name + "Formatter", multioutSymbol, text, cancellationToken); + waitingTasks[waitingIndex++] = OutputToDirAsync(output, template.Namespace, x.Name + "Formatter", multioutSymbol, text); } - var resolverTemplate = new ResolverTemplate() - { - Namespace = namespaceDot + "Resolvers", - FormatterNamespace = namespaceDot + "Formatters", - ResolverName = resolverName, - RegisterInfos = genericInfo.Where(x => !x.IsOpenGenericType).Cast().Concat(enumInfo).Concat(unionInfo).Concat(objectInfo.Where(x => !x.IsOpenGenericType)).ToArray(), - }; - - waitingTasks[waitingIndex] = OutputToDirAsync(output, resolverTemplate.Namespace, resolverTemplate.ResolverName, multioutSymbol, resolverTemplate.TransformText(), cancellationToken); + var resolverTemplate = new ResolverTemplate(namespaceDot + "Resolvers", namespaceDot + "Formatters", resolverName, genericInfo.Where(x => !x.IsOpenGenericType).Cast().Concat(enumInfo).Concat(unionInfo).Concat(objectInfo.Where(x => !x.IsOpenGenericType)).ToArray()); + waitingTasks[waitingIndex] = OutputToDirAsync(output, resolverTemplate.Namespace, resolverTemplate.ResolverName, multioutSymbol, resolverTemplate.TransformText()); return Task.WhenAll(waitingTasks); } - private Task OutputToDirAsync(string dir, string ns, string name, string multipleOutSymbol, string text, CancellationToken cancellationToken) + private Task OutputToDirAsync(string dir, string ns, string name, string multipleOutSymbol, string text) { if (multipleOutSymbol == string.Empty) { - return OutputAsync(Path.Combine(dir, $"{ns}_{name}".Replace(".", "_").Replace("global::", string.Empty) + ".cs"), text, cancellationToken); + return OutputAsync(Path.Combine(dir, $"{ns}_{name}".Replace(".", "_").Replace("global::", string.Empty) + ".cs"), text); } else { text = $"#if {multipleOutSymbol}" + Environment.NewLine + text + Environment.NewLine + "#endif"; - return OutputAsync(Path.Combine(dir, MultiSymbolToSafeFilePath(multipleOutSymbol), $"{ns}_{name}".Replace(".", "_").Replace("global::", string.Empty) + ".cs"), text, cancellationToken); + return OutputAsync(Path.Combine(dir, MultiSymbolToSafeFilePath(multipleOutSymbol), $"{ns}_{name}".Replace(".", "_").Replace("global::", string.Empty) + ".cs"), text); } } - private Task OutputAsync(string path, string text, CancellationToken cancellationToken) + private Task OutputAsync(string path, string text) { path = path.Replace("global::", string.Empty); @@ -249,12 +231,12 @@ private Task OutputAsync(string path, string text, CancellationToken cancellatio logger(prefix + path); var fi = new FileInfo(path); - if (!fi.Directory.Exists) + if (fi.Directory != null && !fi.Directory.Exists) { fi.Directory.Create(); } - System.IO.File.WriteAllText(path, NormalizeNewLines(text), NoBomUtf8); + File.WriteAllText(path, NormalizeNewLines(text), NoBomUtf8); return Task.CompletedTask; } diff --git a/src/MessagePack.GeneratorCore/Generator/IFormatterTemplate.cs b/src/MessagePack.GeneratorCore/Generator/IFormatterTemplate.cs index 188f79954..ea3363a6e 100644 --- a/src/MessagePack.GeneratorCore/Generator/IFormatterTemplate.cs +++ b/src/MessagePack.GeneratorCore/Generator/IFormatterTemplate.cs @@ -7,9 +7,9 @@ namespace MessagePackCompiler.Generator { public interface IFormatterTemplate { - string Namespace { get; set; } + string Namespace { get; } - ObjectSerializationInfo[] ObjectSerializationInfos { get; set; } + ObjectSerializationInfo[] ObjectSerializationInfos { get; } string TransformText(); } diff --git a/src/MessagePack.GeneratorCore/Generator/TemplatePartials.cs b/src/MessagePack.GeneratorCore/Generator/TemplatePartials.cs index 6ab80bf5a..bca5c5876 100644 --- a/src/MessagePack.GeneratorCore/Generator/TemplatePartials.cs +++ b/src/MessagePack.GeneratorCore/Generator/TemplatePartials.cs @@ -7,40 +7,72 @@ namespace MessagePackCompiler.Generator { public partial class FormatterTemplate : IFormatterTemplate { - public string Namespace { get; set; } + public FormatterTemplate(string @namespace, ObjectSerializationInfo[] objectSerializationInfos) + { + Namespace = @namespace; + ObjectSerializationInfos = objectSerializationInfos; + } - public ObjectSerializationInfo[] ObjectSerializationInfos { get; set; } + public string Namespace { get; } + + public ObjectSerializationInfo[] ObjectSerializationInfos { get; } } public partial class StringKeyFormatterTemplate : IFormatterTemplate { - public string Namespace { get; set; } + public StringKeyFormatterTemplate(string @namespace, ObjectSerializationInfo[] objectSerializationInfos) + { + Namespace = @namespace; + ObjectSerializationInfos = objectSerializationInfos; + } + + public string Namespace { get; } - public ObjectSerializationInfo[] ObjectSerializationInfos { get; set; } + public ObjectSerializationInfo[] ObjectSerializationInfos { get; } } public partial class ResolverTemplate { - public string Namespace { get; set; } + public ResolverTemplate(string @namespace, string formatterNamespace, string resolverName, IResolverRegisterInfo[] registerInfos) + { + Namespace = @namespace; + FormatterNamespace = formatterNamespace; + ResolverName = resolverName; + RegisterInfos = registerInfos; + } + + public string Namespace { get; } - public string FormatterNamespace { get; set; } + public string FormatterNamespace { get; } - public string ResolverName { get; set; } = "GeneratedResolver"; + public string ResolverName { get; } - public IResolverRegisterInfo[] RegisterInfos { get; set; } + public IResolverRegisterInfo[] RegisterInfos { get; } } public partial class EnumTemplate { - public string Namespace { get; set; } + public EnumTemplate(string @namespace, EnumSerializationInfo[] enumSerializationInfos) + { + Namespace = @namespace; + EnumSerializationInfos = enumSerializationInfos; + } - public EnumSerializationInfo[] EnumSerializationInfos { get; set; } + public string Namespace { get; } + + public EnumSerializationInfo[] EnumSerializationInfos { get; } } public partial class UnionTemplate { - public string Namespace { get; set; } + public UnionTemplate(string @namespace, UnionSerializationInfo[] unionSerializationInfos) + { + Namespace = @namespace; + UnionSerializationInfos = unionSerializationInfos; + } + + public string Namespace { get; } - public UnionSerializationInfo[] UnionSerializationInfos { get; set; } + public UnionSerializationInfo[] UnionSerializationInfos { get; } } } diff --git a/src/MessagePack.GeneratorCore/MessagePack.GeneratorCore.csproj b/src/MessagePack.GeneratorCore/MessagePack.GeneratorCore.csproj index 4be9ff608..d2d86f281 100644 --- a/src/MessagePack.GeneratorCore/MessagePack.GeneratorCore.csproj +++ b/src/MessagePack.GeneratorCore/MessagePack.GeneratorCore.csproj @@ -6,7 +6,8 @@ True ..\..\opensource.snk - 8 + 9 + enable diff --git a/src/MessagePack.GeneratorCore/Utils/RoslynExtensions.cs b/src/MessagePack.GeneratorCore/Utils/RoslynExtensions.cs index a02a282c0..b8645e11b 100644 --- a/src/MessagePack.GeneratorCore/Utils/RoslynExtensions.cs +++ b/src/MessagePack.GeneratorCore/Utils/RoslynExtensions.cs @@ -1,12 +1,9 @@ // Copyright (c) All contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -using System; using System.Collections.Generic; using System.Linq; using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.CSharp; -using Microsoft.CodeAnalysis.CSharp.Syntax; namespace MessagePackCompiler { @@ -15,111 +12,14 @@ internal static class RoslynExtensions { public static IEnumerable GetNamedTypeSymbols(this Compilation compilation) { - foreach (var syntaxTree in compilation.SyntaxTrees) + return compilation.SyntaxTrees.SelectMany(syntaxTree => { var semModel = compilation.GetSemanticModel(syntaxTree); - - foreach (var item in syntaxTree.GetRoot() + return syntaxTree.GetRoot() .DescendantNodes() .Select(x => semModel.GetDeclaredSymbol(x)) - .Where(x => x != null)) - { - var namedType = item as INamedTypeSymbol; - if (namedType != null) - { - yield return namedType; - } - } - } - } - - public static IEnumerable EnumerateBaseType(this ITypeSymbol symbol) - { - var t = symbol.BaseType; - while (t != null) - { - yield return t; - t = t.BaseType; - } - } - - public static AttributeData FindAttribute(this IEnumerable attributeDataList, string typeName) - { - return attributeDataList - .Where(x => x.AttributeClass.ToDisplayString() == typeName) - .FirstOrDefault(); - } - - public static AttributeData FindAttributeShortName( - this IEnumerable attributeDataList, - string typeName) - { - return attributeDataList - .Where(x => x.AttributeClass.Name == typeName) - .FirstOrDefault(); - } - - public static AttributeData FindAttributeIncludeBasePropertyShortName( - this IPropertySymbol property, - string typeName) - { - do - { - var data = FindAttributeShortName(property.GetAttributes(), typeName); - if (data != null) - { - return data; - } - - property = property.OverriddenProperty; - } - while (property != null); - - return null; - } - - public static AttributeSyntax FindAttribute( - this BaseTypeDeclarationSyntax typeDeclaration, - SemanticModel model, - string typeName) - { - return typeDeclaration.AttributeLists - .SelectMany(x => x.Attributes) - .Where(x => model.GetTypeInfo(x).Type?.ToDisplayString() == typeName) - .FirstOrDefault(); - } - - public static INamedTypeSymbol FindBaseTargetType(this ITypeSymbol symbol, string typeName) - { - return symbol.EnumerateBaseType() - .Where(x => x.OriginalDefinition?.ToDisplayString() == typeName) - .FirstOrDefault(); - } - - public static object GetSingleNamedArgumentValue(this AttributeData attribute, string key) - { - foreach (var item in attribute.NamedArguments) - { - if (item.Key == key) - { - return item.Value.Value; - } - } - - return null; - } - - public static bool IsNullable(this INamedTypeSymbol symbol) - { - if (symbol.IsGenericType) - { - if (symbol.ConstructUnboundGenericType().ToDisplayString() == "T?") - { - return true; - } - } - - return false; + .OfType(); + }); } public static IEnumerable GetAllMembers(this ITypeSymbol symbol) @@ -136,17 +36,11 @@ public static IEnumerable GetAllMembers(this ITypeSymbol symbol) } } - public static IEnumerable GetAllInterfaceMembers(this ITypeSymbol symbol) - { - return symbol.GetMembers() - .Concat(symbol.AllInterfaces.SelectMany(x => x.GetMembers())); - } - - public static bool ApproximatelyEqual(this INamedTypeSymbol left, INamedTypeSymbol right) + public static bool ApproximatelyEqual(this INamedTypeSymbol? left, INamedTypeSymbol? right) { if (left is IErrorTypeSymbol || right is IErrorTypeSymbol) { - return left.ToDisplayString() == right.ToDisplayString(); + return left?.ToDisplayString() == right?.ToDisplayString(); } else { From 1ff4ac6d1faeba7265f4849fd1638205a68cba28 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sun, 22 Nov 2020 10:26:58 -0700 Subject: [PATCH 026/161] Update StyleCop.Analyzers to support C# 9 syntax --- Directory.Build.props | 2 +- .../CodeAnalysis/Definitions.cs | 2 +- .../CodeAnalysis/TypeCollector.cs | 14 +++++++------- .../Scripts/MessagePack/MessagePackCompression.cs | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index b6fc8cf18..99d92e03e 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -32,7 +32,7 @@ - + diff --git a/src/MessagePack.GeneratorCore/CodeAnalysis/Definitions.cs b/src/MessagePack.GeneratorCore/CodeAnalysis/Definitions.cs index 5ccf8c5b3..532cdc711 100644 --- a/src/MessagePack.GeneratorCore/CodeAnalysis/Definitions.cs +++ b/src/MessagePack.GeneratorCore/CodeAnalysis/Definitions.cs @@ -143,7 +143,7 @@ public class MemberSerializationInfo public string? CustomFormatterTypeName { get; } - private readonly HashSet primitiveTypes = new (Generator.ShouldUseFormatterResolverHelper.PrimitiveTypes); + private readonly HashSet primitiveTypes = new(Generator.ShouldUseFormatterResolverHelper.PrimitiveTypes); public MemberSerializationInfo(bool isProperty, bool isWritable, bool isReadable, int intKey, string stringKey, string name, string type, string shortTypeName, string? customFormatterTypeName) { diff --git a/src/MessagePack.GeneratorCore/CodeAnalysis/TypeCollector.cs b/src/MessagePack.GeneratorCore/CodeAnalysis/TypeCollector.cs index 93cac37b2..add659746 100644 --- a/src/MessagePack.GeneratorCore/CodeAnalysis/TypeCollector.cs +++ b/src/MessagePack.GeneratorCore/CodeAnalysis/TypeCollector.cs @@ -92,7 +92,7 @@ public class TypeCollector private readonly bool isForceUseMap; private readonly ReferenceSymbols typeReferences; private readonly INamedTypeSymbol[] targetTypes; - private readonly HashSet embeddedTypes = new (new[] + private readonly HashSet embeddedTypes = new(new[] { "short", "int", @@ -163,7 +163,7 @@ public class TypeCollector "System.Reactive.Unit", }); - private readonly Dictionary knownGenericTypes = new () + private readonly Dictionary knownGenericTypes = new() { #pragma warning disable SA1509 // Opening braces should not be preceded by blank line { "System.Collections.Generic.List<>", "global::MessagePack.Formatters.ListFormatter" }, @@ -244,11 +244,11 @@ public class TypeCollector private readonly HashSet externalIgnoreTypeNames; // visitor workspace: - private readonly HashSet alreadyCollected = new (); - private readonly List collectedObjectInfo = new (); - private readonly List collectedEnumInfo = new (); - private readonly List collectedGenericInfo = new (); - private readonly List collectedUnionInfo = new (); + private readonly HashSet alreadyCollected = new(); + private readonly List collectedObjectInfo = new(); + private readonly List collectedEnumInfo = new(); + private readonly List collectedGenericInfo = new(); + private readonly List collectedUnionInfo = new(); public TypeCollector(Compilation compilation, bool disallowInternal, bool isForceUseMap, string[]? ignoreTypeNames, Action logger) { diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackCompression.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackCompression.cs index 1fb1a7229..8303a219d 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackCompression.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackCompression.cs @@ -22,7 +22,7 @@ public enum MessagePackCompression /// Uses msgpack type code ext99 and is compatible with v1 of this library. /// /// - /// See also ThisLibraryExtensionTypeCodes.Lz4Block + /// See also ThisLibraryExtensionTypeCodes.Lz4Block. /// Lz4Block, @@ -35,7 +35,7 @@ public enum MessagePackCompression /// Uses msgpack type code ext98 in array. /// /// - /// See also ThisLibraryExtensionTypeCodes.Lz4BlockArray + /// See also ThisLibraryExtensionTypeCodes.Lz4BlockArray. /// Lz4BlockArray, } From d87428d9019f35fe89cdf5804ff8406d5f70c89a Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sun, 22 Nov 2020 10:30:31 -0700 Subject: [PATCH 027/161] Add C# 9 records serialization tests --- .../DynamicObjectResolverRecordsTests.cs | 70 +++++++++++++++++++ .../MessagePack.Tests.csproj | 2 +- 2 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 tests/MessagePack.Tests/DynamicObjectResolverRecordsTests.cs diff --git a/tests/MessagePack.Tests/DynamicObjectResolverRecordsTests.cs b/tests/MessagePack.Tests/DynamicObjectResolverRecordsTests.cs new file mode 100644 index 000000000..229753c1d --- /dev/null +++ b/tests/MessagePack.Tests/DynamicObjectResolverRecordsTests.cs @@ -0,0 +1,70 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using Xunit; + +#if NET5_0 + +namespace MessagePack.Tests +{ + public class DynamicObjectResolverRecordsTests : TestBase + { + [Fact] + public void RoundtripRecord() + { + this.AssertRoundTrip(new Person { FirstName = "bob", LastName = "smith" }); + } + + [Fact] + public void RoundtripPositionalRecord() + { + this.AssertRoundTrip(new PersonPositional("bob", "smith")); + } + + [Fact] + public void RoundtripDerivedRecord() + { + this.AssertRoundTrip(new Student { FirstName = "bob", LastName = "smith", Grade = 5 }); + } + + [Fact] + public void RoundtripPositionalDerivedRecord() + { + this.AssertRoundTrip(new StudentPositional("bob", "smith", 5)); + } + + protected T AssertRoundTrip(T value) + { + byte[] msgpack = MessagePackSerializer.Serialize(value, MessagePackSerializerOptions.Standard, this.TimeoutToken); + T deserializedValue = MessagePackSerializer.Deserialize(msgpack, MessagePackSerializerOptions.Standard, this.TimeoutToken); + Assert.Equal(value, deserializedValue); + return deserializedValue; + } + + [MessagePackObject] + public record PersonPositional([property: Key(0)] string FirstName, [property: Key(1)] string LastName); + + [MessagePackObject] + public record StudentPositional(string FirstName, string LastName, [property: Key(2)] int Grade) + : PersonPositional(FirstName, LastName); + + [MessagePackObject] + public record Person + { + [Key(0)] + public string FirstName { get; init; } + + [Key(1)] + public string LastName { get; init; } + } + + [MessagePackObject] + public record Student : Person + { + [Key(2)] + public int Grade { get; init; } + } + } +} + +#endif diff --git a/tests/MessagePack.Tests/MessagePack.Tests.csproj b/tests/MessagePack.Tests/MessagePack.Tests.csproj index f6cba8772..72f7e7723 100644 --- a/tests/MessagePack.Tests/MessagePack.Tests.csproj +++ b/tests/MessagePack.Tests/MessagePack.Tests.csproj @@ -2,7 +2,7 @@ net472;netcoreapp2.1;net5.0 true - 8.0 + 9.0 true true $(NoWarn);CS1701 From 908ac7b674310cd44af8a4d074837f6bbcad5daf Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sun, 22 Nov 2020 10:28:12 -0700 Subject: [PATCH 028/161] Add test for generic class containing property with `init` setter Repro for failure as reported in #1134 --- .../ShareTests/DynamicObjectResolverTests.cs | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/DynamicObjectResolverTests.cs b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/DynamicObjectResolverTests.cs index 48b1ab446..b317cee99 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/DynamicObjectResolverTests.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/DynamicObjectResolverTests.cs @@ -312,6 +312,17 @@ public void DefaultValueIntKeyStructWithExplicitConstructorSetPropertyTest() Assert.Equal(-98, instance.Prop2); } +#if NET5_0 + [Fact] + public void RoundtripGenericClass() + { + var person = new GenericPerson { Name = "bob" }; + byte[] msgpack = MessagePackSerializer.Serialize(person, MessagePackSerializerOptions.Standard); + var deserialized = MessagePackSerializer.Deserialize>(msgpack, MessagePackSerializerOptions.Standard); + Assert.Equal(person.Name, deserialized.Name); + } +#endif + [MessagePackObject(true)] public class DefaultValueStringKeyClassWithoutExplicitConstructor { @@ -597,6 +608,15 @@ public class DerivedClass : BaseClass [DataMember] public string Name { get; set; } } + +#if NET5_0 + [MessagePackObject] + public class GenericPerson + { + [Key(0)] + public string Name { get; init; } + } +#endif } } From 1076aff7ec49c6a6308e4b2a4d9ee6cafe9d0813 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 23 Nov 2020 10:00:04 -0700 Subject: [PATCH 029/161] Avoid `MissingMethodException` on generic classes with `init` property setters Fixes #1134 as much as we can while .NET has the underlying bug. When .NET 6 ships with the fix, we can add a .NET 6 target that re-allows setting `init` property setters from the `DynamicObjectResolver`. --- README.md | 20 ++++++ .../Resolvers/DynamicObjectResolver.cs | 68 ++++++++++++++++--- .../ShareTests/DynamicObjectResolverTests.cs | 58 +++++++++++++++- .../DynamicObjectResolverRecordsTests.cs | 9 +++ 4 files changed, 142 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 454f47927..8e36e79da 100644 --- a/README.md +++ b/README.md @@ -404,6 +404,8 @@ public struct Point } ``` +### C# 9 `record` types + C# 9.0 record with primary constructor is similar immutable object, also supports serialize/deserialize. ```csharp @@ -412,8 +414,26 @@ C# 9.0 record with primary constructor is similar immutable object, also support // use property: to set KeyAttribute [MessagePackObject] public record Point([property:Key(0)] int X, [property: Key(1)] int Y); + +// Or use explicit properties +[MessagePackObject] +public record Person +{ + [Key(0)] + public string FirstName { get; init; } + + [Key(1)] + public string LastName { get; init; } +} ``` +### C# 9 `init` property setter limitations + +When using `init` property setters in _generic_ classes, [a CLR bug](https://github.com/neuecc/MessagePack-CSharp/issues/1134) prevents our most efficient code generation from invoking the property setter. +As a result, you should avoid using `init` on property setters in generic classes when using the public-only `DynamicObjectResolver`/`StandardResolver`. + +When using the `DynamicObjectResolverAllowPrivate`/`StandardResolverAllowPrivate` resolver the bug does not apply and you may use `init` without restriction. + ## Serialization Callback Objects implementing the `IMessagePackSerializationCallbackReceiver` interface will received `OnBeforeSerialize` and `OnAfterDeserialize` calls during serialization/deserialization. diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs index 73af68261..fc3d5d9e7 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs @@ -611,7 +611,7 @@ private static void BuildConstructor(Type type, ObjectSerializationInfo info, Co private static Dictionary BuildCustomFormatterField(TypeBuilder builder, ObjectSerializationInfo info, ILGenerator il) { Dictionary dict = new Dictionary(); - foreach (ObjectSerializationInfo.EmittableMember item in info.Members.Where(x => x.IsReadable || x.IsWritable)) + foreach (ObjectSerializationInfo.EmittableMember item in info.Members.Where(x => x.IsReadable || x.IsActuallyWritable)) { MessagePackFormatterAttribute attr = item.GetMessagePackFormatterAttribute(); if (attr != null) @@ -977,7 +977,7 @@ private static void BuildDeserializeInternalAssignFieldFromLocalVariableIntKey(O } Label? memberAssignmentDoneLabel = null; - var intKeyMap = infoList.Where(x => x.MemberInfo != null && x.MemberInfo.IsWritable).ToDictionary(x => x.MemberInfo.IntKey); + var intKeyMap = infoList.Where(x => x.MemberInfo != null && x.MemberInfo.IsActuallyWritable).ToDictionary(x => x.MemberInfo.IntKey); for (var key = 0; key <= maxKey; key++) { if (!intKeyMap.TryGetValue(key, out var item)) @@ -1043,7 +1043,7 @@ private static DeserializeInfo[] BuildDeserializeInternalDeserializationInfoArra for (var i = 0; i < infoList.Length; i++) { var item = info.Members[i]; - if (canOverwrite && item.IsWritable) + if (canOverwrite && item.IsActuallyWritable) { infoList[i] = new DeserializeInfo { @@ -1077,7 +1077,7 @@ private static DeserializeInfo[] BuildDeserializeInternalDeserializationInfoArra { if (intKeyMap.TryGetValue(i, out var member)) { - if (canOverwrite && member.IsWritable) + if (canOverwrite && member.IsActuallyWritable) { infoList[i] = new DeserializeInfo { @@ -1375,7 +1375,7 @@ private static void BuildDeserializeInternalDeserializeValueAssignDirectly(ILGen var t = member.Type; var emitter = tryEmitLoadCustomFormatter(index, member); - if (member.IsWritable) + if (member.IsActuallyWritable) { if (localResult.LocalType.IsClass) { @@ -1439,7 +1439,7 @@ private static void BuildDeserializeInternalDeserializeValueAssignDirectly(ILGen } il.MarkLabel(storeLabel); - if (member.IsWritable) + if (member.IsActuallyWritable) { member.EmitStoreValue(il); } @@ -1739,7 +1739,7 @@ public static ObjectSerializationInfo CreateOrNull(Type type, bool forceStringKe MethodInfo getMethod = property.GetGetMethod(true); MethodInfo setMethod = property.GetSetMethod(true); - member = new EmittableMember + member = new EmittableMember(allowPrivate) { PropertyInfo = property, IsReadable = (getMethod != null) && (allowPrivate || getMethod.IsPublic) && !getMethod.IsStatic, @@ -1759,7 +1759,7 @@ public static ObjectSerializationInfo CreateOrNull(Type type, bool forceStringKe continue; } - member = new EmittableMember + member = new EmittableMember(allowPrivate) { FieldInfo = field, IsReadable = allowPrivate || field.IsPublic, @@ -1817,7 +1817,7 @@ public static ObjectSerializationInfo CreateOrNull(Type type, bool forceStringKe MethodInfo getMethod = item.GetGetMethod(true); MethodInfo setMethod = item.GetSetMethod(true); - var member = new EmittableMember + var member = new EmittableMember(allowPrivate) { PropertyInfo = item, IsReadable = (getMethod != null) && (allowPrivate || getMethod.IsPublic) && !getMethod.IsStatic, @@ -1942,7 +1942,7 @@ public static ObjectSerializationInfo CreateOrNull(Type type, bool forceStringKe continue; } - var member = new EmittableMember + var member = new EmittableMember(allowPrivate) { FieldInfo = item, IsReadable = allowPrivate || item.IsPublic, @@ -2219,6 +2219,15 @@ public static ObjectSerializationInfo CreateOrNull(Type type, bool forceStringKe break; } + // Under a certain combination of conditions, throw to draw attention to the fact that we cannot set a property. + if (!allowPrivate) + { + // A property is not actually problematic if we can set it via the type's constructor. + var problematicProperties = membersArray + .Where(m => m.IsProblematicInitProperty && !constructorParameters.Any(cp => cp.MemberInfo == m)); + problematicProperties.FirstOrDefault()?.ThrowIfNotWritable(); + } + return new ObjectSerializationInfo { Type = type, @@ -2318,6 +2327,13 @@ public class EmittableMemberAndConstructorParameter public class EmittableMember { + private readonly bool dynamicMethod; + + internal EmittableMember(bool dynamicMethod) + { + this.dynamicMethod = dynamicMethod; + } + public bool IsProperty { get { return this.PropertyInfo != null; } @@ -2330,6 +2346,11 @@ public bool IsField public bool IsWritable { get; set; } + /// + /// Gets a value indicating whether the property can only be set by an object initializer, a constructor, or another `init` member. + /// + public bool IsInitOnly => this.PropertyInfo?.GetSetMethod(true)?.ReturnParameter.GetRequiredCustomModifiers().Any(modifierType => modifierType.FullName == "System.Runtime.CompilerServices.IsExternalInit") ?? false; + public bool IsReadable { get; set; } public int IntKey { get; set; } @@ -2367,6 +2388,22 @@ public bool IsValueType /// public bool IsExplicitContract { get; set; } + /// + /// Gets a value indicating whether a dynamic resolver can write to this property, + /// going beyond by also considering CLR bugs. + /// + internal bool IsActuallyWritable => this.IsWritable && (this.dynamicMethod || !this.IsProblematicInitProperty); + + /// + /// Gets a value indicating whether this member is a property with an property setter + /// and is declared on a generic class. + /// + /// + /// A bug in + /// blocks its ability to invoke property init accessors when in a generic class. + /// + internal bool IsProblematicInitProperty => this.PropertyInfo is PropertyInfo property && property.DeclaringType.IsGenericType && this.IsInitOnly; + public MessagePackFormatterAttribute GetMessagePackFormatterAttribute() { if (this.IsProperty) @@ -2415,6 +2452,17 @@ public void EmitStoreValue(ILGenerator il) } } + internal void ThrowIfNotWritable() + { + if (this.IsProblematicInitProperty && !this.dynamicMethod) + { + throw new NotSupportedException( + $"`init` property accessor {this.PropertyInfo.SetMethod.DeclaringType.FullName}.{this.PropertyInfo.Name} found in generic type, " + + $"which is not supported with the DynamicObjectResolver. Use the AllowPrivate variety of the resolver instead. " + + $"See https://github.com/neuecc/MessagePack-CSharp/issues/1134 for details."); + } + } + ////public object ReflectionLoadValue(object value) ////{ //// if (IsProperty) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/DynamicObjectResolverTests.cs b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/DynamicObjectResolverTests.cs index b317cee99..4051f5043 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/DynamicObjectResolverTests.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/DynamicObjectResolverTests.cs @@ -314,11 +314,46 @@ public void DefaultValueIntKeyStructWithExplicitConstructorSetPropertyTest() #if NET5_0 [Fact] - public void RoundtripGenericClass() + public void RoundtripGenericClass_StandardResolverThrowsOnInitProperty() { var person = new GenericPerson { Name = "bob" }; - byte[] msgpack = MessagePackSerializer.Serialize(person, MessagePackSerializerOptions.Standard); - var deserialized = MessagePackSerializer.Deserialize>(msgpack, MessagePackSerializerOptions.Standard); + var options = StandardResolver.Options; + var exception = Assert.Throws(() => + { + byte[] msgpack = MessagePackSerializer.Serialize(person, options); + var deserialized = MessagePackSerializer.Deserialize>(msgpack, options); + ////Assert.Equal(person.Name, deserialized.Name); + }); + Assert.Contains("https://github.com/neuecc/MessagePack-CSharp/issues/1134", exception.ToString()); + } + + [Fact] + public void RoundtripNonGenericClass_StandardResolverWorksWithInitPropertySetter() + { + var person = new Person { Name = "bob" }; + var options = StandardResolver.Options; + byte[] msgpack = MessagePackSerializer.Serialize(person, options); + var deserialized = MessagePackSerializer.Deserialize(msgpack, options); + Assert.Equal(person.Name, deserialized.Name); + } + + [Fact] + public void RoundtripGenericClass_StandardResolverWorksWithDeserializingCtor() + { + var person = new GenericPersonWithCtor("bob"); + var options = StandardResolver.Options; + byte[] msgpack = MessagePackSerializer.Serialize(person, options); + var deserialized = MessagePackSerializer.Deserialize>(msgpack, options); + Assert.Equal(person.Name, deserialized.Name); + } + + [Fact] + public void RoundtripGenericClass_AllowPrivateStandardResolver() + { + var person = new GenericPerson { Name = "bob" }; + var options = StandardResolverAllowPrivate.Options; + byte[] msgpack = MessagePackSerializer.Serialize(person, options); + var deserialized = MessagePackSerializer.Deserialize>(msgpack, options); Assert.Equal(person.Name, deserialized.Name); } #endif @@ -610,12 +645,29 @@ public class DerivedClass : BaseClass } #if NET5_0 + [MessagePackObject] + public class Person + { + [Key(0)] + public string Name { get; init; } + } + [MessagePackObject] public class GenericPerson { [Key(0)] public string Name { get; init; } } + + [MessagePackObject] + public class GenericPersonWithCtor + { + [SerializationConstructor] + public GenericPersonWithCtor(string name) => this.Name = name; + + [Key(0)] + public string Name { get; init; } + } #endif } } diff --git a/tests/MessagePack.Tests/DynamicObjectResolverRecordsTests.cs b/tests/MessagePack.Tests/DynamicObjectResolverRecordsTests.cs index 229753c1d..a9bf1b1a8 100644 --- a/tests/MessagePack.Tests/DynamicObjectResolverRecordsTests.cs +++ b/tests/MessagePack.Tests/DynamicObjectResolverRecordsTests.cs @@ -21,6 +21,12 @@ public void RoundtripPositionalRecord() this.AssertRoundTrip(new PersonPositional("bob", "smith")); } + [Fact] + public void RoundtripGenericPositionalRecord() + { + this.AssertRoundTrip(new GenericPersonPositional("bob", "smith")); + } + [Fact] public void RoundtripDerivedRecord() { @@ -41,6 +47,9 @@ protected T AssertRoundTrip(T value) return deserializedValue; } + [MessagePackObject] + public record GenericPersonPositional([property: Key(0)] string FirstName, [property: Key(1)] string LastName); + [MessagePackObject] public record PersonPositional([property: Key(0)] string FirstName, [property: Key(1)] string LastName); From 7a4e9835e6419c749dd0ee394acfd635e76c9245 Mon Sep 17 00:00:00 2001 From: Johannes Deml Date: Tue, 1 Dec 2020 18:08:20 +0100 Subject: [PATCH 030/161] Change namespace of BenchmarkProgram to Benchmark Matches the namespace of the other classes in the project --- benchmark/SerializerBenchmark/Program.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/benchmark/SerializerBenchmark/Program.cs b/benchmark/SerializerBenchmark/Program.cs index 8bc34aecc..c0d23073b 100644 --- a/benchmark/SerializerBenchmark/Program.cs +++ b/benchmark/SerializerBenchmark/Program.cs @@ -1,13 +1,11 @@ // Copyright (c) All contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -using Benchmark; -using Benchmark.Models; using BenchmarkDotNet.Running; -namespace ConsoleApp1 +namespace Benchmark { - internal class Program + internal static class Program { private static void Main(string[] args) { From e67f88f1eb88f264b44de383362d2d781f6f100c Mon Sep 17 00:00:00 2001 From: Johannes Deml Date: Tue, 1 Dec 2020 18:10:15 +0100 Subject: [PATCH 031/161] Fix small typo --- benchmark/SerializerBenchmark/SerializerBenchmark.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/benchmark/SerializerBenchmark/SerializerBenchmark.cs b/benchmark/SerializerBenchmark/SerializerBenchmark.cs index c29155384..f88aa5a04 100644 --- a/benchmark/SerializerBenchmark/SerializerBenchmark.cs +++ b/benchmark/SerializerBenchmark/SerializerBenchmark.cs @@ -21,7 +21,7 @@ public class AllSerializerBenchmark_BytesInOut [ParamsSource(nameof(Serializers))] public SerializerBase Serializer; - // Currently BenchmarkdDotNet does not detect inherited ParamsSource so use copy and paste:) + // Currently BenchmarkDotNet does not detect inherited ParamsSource so use copy and paste:) public IEnumerable Serializers => new SerializerBase[] { new MessagePack_v1(), @@ -568,7 +568,7 @@ public class MsgPackV1_Vs_MsgPackV2_BytesInOut // : AllSerializerBenchmark [ParamsSource(nameof(Serializers))] public SerializerBase Serializer; - // Currently BenchmarkdDotNet does not detect inherited ParamsSource so use copy and paste:) + // Currently BenchmarkDotNet does not detect inherited ParamsSource so use copy and paste:) public IEnumerable Serializers => new SerializerBase[] { new MessagePack_v1(), @@ -1099,7 +1099,7 @@ public class ShortRun_AllSerializerBenchmark_BytesInOut private bool isContractless; - // Currently BenchmarkdDotNet does not detect inherited ParamsSource so use copy and paste:) + // Currently BenchmarkDotNet does not detect inherited ParamsSource so use copy and paste:) public IEnumerable Serializers => new SerializerBase[] { new MessagePack_v1(), @@ -1197,7 +1197,7 @@ public class ShortRun_MsgPackV1_Vs_MsgPackV2_BytesInOut [ParamsSource(nameof(Serializers))] public SerializerBase Serializer; - // Currently BenchmarkdDotNet does not detect inherited ParamsSource so use copy and paste:) + // Currently BenchmarkDotNet does not detect inherited ParamsSource so use copy and paste:) public IEnumerable Serializers => new SerializerBase[] { new MessagePack_v1(), From c51e9691cc119b3990cf287b0241cd5419dbce4c Mon Sep 17 00:00:00 2001 From: Johannes Deml Date: Tue, 1 Dec 2020 18:12:09 +0100 Subject: [PATCH 032/161] Change use readable size conversion from BenchmarkDotNet Introduced in 0.12.1, therefore an update to the new version was necessary --- .../SerializerBenchmark/BenchmarkConfig.cs | 82 +++---------------- .../SerializerBenchmark.csproj | 2 +- 2 files changed, 14 insertions(+), 70 deletions(-) diff --git a/benchmark/SerializerBenchmark/BenchmarkConfig.cs b/benchmark/SerializerBenchmark/BenchmarkConfig.cs index c641d7315..591d228ec 100644 --- a/benchmark/SerializerBenchmark/BenchmarkConfig.cs +++ b/benchmark/SerializerBenchmark/BenchmarkConfig.cs @@ -96,19 +96,22 @@ public string GetValue(Summary summary, BenchmarkCase benchmarkCase) public string GetValue(Summary summary, BenchmarkCase benchmarkCase, SummaryStyle style) { System.Reflection.MethodInfo mi = benchmarkCase.Descriptor.WorkloadMethod; - if (mi.Name.Contains("Serialize")) - { - var instance = Activator.CreateInstance(mi.DeclaringType); - mi.DeclaringType.GetField("Serializer").SetValue(instance, benchmarkCase.Parameters[0].Value); - mi.DeclaringType.GetMethod("Setup").Invoke(instance, null); - - var bytes = (byte[])mi.Invoke(instance, null); - return ToHumanReadableSize(bytes.Length); - } - else + if (!mi.Name.Contains("Serialize")) { return "-"; } + + var instance = Activator.CreateInstance(mi.DeclaringType); + mi.DeclaringType.GetField("Serializer").SetValue(instance, benchmarkCase.Parameters[0].Value); + mi.DeclaringType.GetMethod("Setup").Invoke(instance, null); + + var bytes = (byte[]) mi.Invoke(instance, null); + var byteSize = bytes.Length; + var cultureInfo = summary.GetCultureInfo(); + if (style.PrintUnitsInContent) + return SizeValue.FromBytes(byteSize).ToString(style.SizeUnit, cultureInfo); + + return byteSize.ToString("0.##", cultureInfo); } public bool IsAvailable(Summary summary) @@ -120,65 +123,6 @@ public bool IsDefault(Summary summary, BenchmarkCase benchmarkCase) { return false; } - - private static string ToHumanReadableSize(long size) - { - return ToHumanReadableSize(new long?(size)); - } - - private static string ToHumanReadableSize(long? size) - { - if (size == null) - { - return "NULL"; - } - - double bytes = size.Value; - - if (bytes <= 1024) - { - return bytes.ToString("f2") + " B"; - } - - bytes = bytes / 1024; - if (bytes <= 1024) - { - return bytes.ToString("f2") + " KB"; - } - - bytes = bytes / 1024; - if (bytes <= 1024) - { - return bytes.ToString("f2") + " MB"; - } - - bytes = bytes / 1024; - if (bytes <= 1024) - { - return bytes.ToString("f2") + " GB"; - } - - bytes = bytes / 1024; - if (bytes <= 1024) - { - return bytes.ToString("f2") + " TB"; - } - - bytes = bytes / 1024; - if (bytes <= 1024) - { - return bytes.ToString("f2") + " PB"; - } - - bytes = bytes / 1024; - if (bytes <= 1024) - { - return bytes.ToString("f2") + " EB"; - } - - bytes = bytes / 1024; - return bytes + " ZB"; - } } } } diff --git a/benchmark/SerializerBenchmark/SerializerBenchmark.csproj b/benchmark/SerializerBenchmark/SerializerBenchmark.csproj index b4912cc86..9ec7b940b 100644 --- a/benchmark/SerializerBenchmark/SerializerBenchmark.csproj +++ b/benchmark/SerializerBenchmark/SerializerBenchmark.csproj @@ -10,7 +10,7 @@ - + From 66f1d7f1a2792e24f27448b7862ff56acd58e7a9 Mon Sep 17 00:00:00 2001 From: Johannes Deml Date: Wed, 2 Dec 2020 10:54:10 +0100 Subject: [PATCH 033/161] Fix deprecated methods and code styling --- benchmark/SerializerBenchmark/BenchmarkConfig.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/benchmark/SerializerBenchmark/BenchmarkConfig.cs b/benchmark/SerializerBenchmark/BenchmarkConfig.cs index 591d228ec..e6e7066c4 100644 --- a/benchmark/SerializerBenchmark/BenchmarkConfig.cs +++ b/benchmark/SerializerBenchmark/BenchmarkConfig.cs @@ -27,13 +27,13 @@ public BenchmarkConfig() Job baseConfig = Job.ShortRun.WithIterationCount(1).WithWarmupCount(1); // Add(baseConfig.With(Runtime.Clr).With(Jit.RyuJit).With(Platform.X64)); - this.Add(baseConfig.With(CoreRuntime.Core31).With(Jit.RyuJit).With(Platform.X64)); + this.AddJob(baseConfig.WithRuntime(CoreRuntime.Core31).WithJit(Jit.RyuJit).WithPlatform(Platform.X64)); - this.Add(MarkdownExporter.GitHub); - this.Add(CsvExporter.Default); - this.Add(MemoryDiagnoser.Default); + this.AddExporter(MarkdownExporter.GitHub); + this.AddExporter(CsvExporter.Default); + this.AddDiagnoser(MemoryDiagnoser.Default); - this.Add(new DataSizeColumn()); + this.AddColumn(new DataSizeColumn()); this.Orderer = new CustomOrderer(); } @@ -105,11 +105,13 @@ public string GetValue(Summary summary, BenchmarkCase benchmarkCase, SummaryStyl mi.DeclaringType.GetField("Serializer").SetValue(instance, benchmarkCase.Parameters[0].Value); mi.DeclaringType.GetMethod("Setup").Invoke(instance, null); - var bytes = (byte[]) mi.Invoke(instance, null); + var bytes = (byte[])mi.Invoke(instance, null); var byteSize = bytes.Length; var cultureInfo = summary.GetCultureInfo(); if (style.PrintUnitsInContent) + { return SizeValue.FromBytes(byteSize).ToString(style.SizeUnit, cultureInfo); + } return byteSize.ToString("0.##", cultureInfo); } From 7db2ed623124034d7c93ec52ae0966be2872db4c Mon Sep 17 00:00:00 2001 From: Johannes Deml Date: Tue, 8 Dec 2020 10:16:44 +0100 Subject: [PATCH 034/161] Add ToString to all serializers This way they will be named with ToString in the benchmarkdotnet generated tables --- .../Serializers/BinaryFormatter.cs | 5 +++ .../Serializers/BsonNetSerializer.cs | 5 +++ .../Serializers/CerasSerializer.cs | 5 +++ .../Serializers/DataContractSerializer.cs | 5 +++ .../Serializers/FsPicklerSerializer.cs | 5 +++ .../Serializers/HyperionSerializer.cs | 5 +++ .../Serializers/JilSerializer.cs | 5 +++ .../Serializers/JsonNetSerializer.cs | 5 +++ .../Serializers/MessagePackSerializer.cs | 45 +++++++++++++++++++ .../Serializers/MsgPackCliSerializer.cs | 5 +++ .../Serializers/ProtobufSerializer.cs | 5 +++ .../Serializers/SpanJsonSerializer.cs | 5 +++ .../Serializers/SystemTextJsonSerializer.cs | 5 +++ .../Serializers/Utf8JsonSerializer.cs | 5 +++ 14 files changed, 110 insertions(+) diff --git a/benchmark/SerializerBenchmark/Serializers/BinaryFormatter.cs b/benchmark/SerializerBenchmark/Serializers/BinaryFormatter.cs index b3981a890..ee59bfb27 100644 --- a/benchmark/SerializerBenchmark/Serializers/BinaryFormatter.cs +++ b/benchmark/SerializerBenchmark/Serializers/BinaryFormatter.cs @@ -26,4 +26,9 @@ public override object Serialize(T input) return ms.ToArray(); } } + + public override string ToString() + { + return "BinaryFormatter"; + } } diff --git a/benchmark/SerializerBenchmark/Serializers/BsonNetSerializer.cs b/benchmark/SerializerBenchmark/Serializers/BsonNetSerializer.cs index cd379a0fe..dbce4410d 100644 --- a/benchmark/SerializerBenchmark/Serializers/BsonNetSerializer.cs +++ b/benchmark/SerializerBenchmark/Serializers/BsonNetSerializer.cs @@ -40,4 +40,9 @@ public override object Serialize(T input) return ms.ToArray(); } } + + public override string ToString() + { + return "BsonNet"; + } } diff --git a/benchmark/SerializerBenchmark/Serializers/CerasSerializer.cs b/benchmark/SerializerBenchmark/Serializers/CerasSerializer.cs index cfdd9be09..56391bde9 100644 --- a/benchmark/SerializerBenchmark/Serializers/CerasSerializer.cs +++ b/benchmark/SerializerBenchmark/Serializers/CerasSerializer.cs @@ -18,4 +18,9 @@ public override object Serialize(T input) { return this.ceras.Serialize(input); } + + public override string ToString() + { + return "Ceras"; + } } diff --git a/benchmark/SerializerBenchmark/Serializers/DataContractSerializer.cs b/benchmark/SerializerBenchmark/Serializers/DataContractSerializer.cs index eae1431ff..2215ae188 100644 --- a/benchmark/SerializerBenchmark/Serializers/DataContractSerializer.cs +++ b/benchmark/SerializerBenchmark/Serializers/DataContractSerializer.cs @@ -26,4 +26,9 @@ public override object Serialize(T input) return ms.ToArray(); } } + + public override string ToString() + { + return "DataContract"; + } } diff --git a/benchmark/SerializerBenchmark/Serializers/FsPicklerSerializer.cs b/benchmark/SerializerBenchmark/Serializers/FsPicklerSerializer.cs index 18b1c88e8..70873f8b3 100644 --- a/benchmark/SerializerBenchmark/Serializers/FsPicklerSerializer.cs +++ b/benchmark/SerializerBenchmark/Serializers/FsPicklerSerializer.cs @@ -28,4 +28,9 @@ public override object Serialize(T input) return ms.ToArray(); } } + + public override string ToString() + { + return "FsPickler"; + } } diff --git a/benchmark/SerializerBenchmark/Serializers/HyperionSerializer.cs b/benchmark/SerializerBenchmark/Serializers/HyperionSerializer.cs index b38ef9494..1d7a121a8 100644 --- a/benchmark/SerializerBenchmark/Serializers/HyperionSerializer.cs +++ b/benchmark/SerializerBenchmark/Serializers/HyperionSerializer.cs @@ -28,4 +28,9 @@ public override object Serialize(T input) return ms.ToArray(); } } + + public override string ToString() + { + return "Hyperion"; + } } diff --git a/benchmark/SerializerBenchmark/Serializers/JilSerializer.cs b/benchmark/SerializerBenchmark/Serializers/JilSerializer.cs index b68a0585f..8d2b49616 100644 --- a/benchmark/SerializerBenchmark/Serializers/JilSerializer.cs +++ b/benchmark/SerializerBenchmark/Serializers/JilSerializer.cs @@ -18,4 +18,9 @@ public override T Deserialize(object input) { return Jil.JSON.Deserialize(Encoding.UTF8.GetString((byte[])input), Options.ISO8601); } + + public override string ToString() + { + return "Jil"; + } } diff --git a/benchmark/SerializerBenchmark/Serializers/JsonNetSerializer.cs b/benchmark/SerializerBenchmark/Serializers/JsonNetSerializer.cs index 80761c6a4..1e9b827fb 100644 --- a/benchmark/SerializerBenchmark/Serializers/JsonNetSerializer.cs +++ b/benchmark/SerializerBenchmark/Serializers/JsonNetSerializer.cs @@ -36,4 +36,9 @@ public override object Serialize(T input) return ms.ToArray(); } } + + public override string ToString() + { + return "JsonNet"; + } } diff --git a/benchmark/SerializerBenchmark/Serializers/MessagePackSerializer.cs b/benchmark/SerializerBenchmark/Serializers/MessagePackSerializer.cs index eb5901c9f..167ed06f0 100644 --- a/benchmark/SerializerBenchmark/Serializers/MessagePackSerializer.cs +++ b/benchmark/SerializerBenchmark/Serializers/MessagePackSerializer.cs @@ -19,6 +19,11 @@ public override object Serialize(T input) { return oldmsgpack::MessagePack.MessagePackSerializer.Serialize(input); } + + public override string ToString() + { + return "MessagePack_v1"; + } } public class MessagePack_v2 : SerializerBase @@ -32,6 +37,11 @@ public override object Serialize(T input) { return newmsgpack::MessagePack.MessagePackSerializer.Serialize(input); } + + public override string ToString() + { + return "MessagePack_v2"; + } } public class MsgPack_v1_string : SerializerBase @@ -45,6 +55,11 @@ public override object Serialize(T input) { return oldmsgpack::MessagePack.MessagePackSerializer.Serialize(input, oldmsgpack::MessagePack.Resolvers.ContractlessStandardResolver.Instance); } + + public override string ToString() + { + return "MsgPack_v1_string"; + } } public class MsgPack_v2_string : SerializerBase @@ -60,6 +75,11 @@ public override object Serialize(T input) { return newmsgpack::MessagePack.MessagePackSerializer.Serialize(input, options: Options); } + + public override string ToString() + { + return "MsgPack_v2_string"; + } } public class MessagePackLz4_v1 : SerializerBase @@ -73,6 +93,11 @@ public override object Serialize(T input) { return oldmsgpack::MessagePack.LZ4MessagePackSerializer.Serialize(input); } + + public override string ToString() + { + return "MessagePackLz4_v1"; + } } public class MessagePackLz4_v2 : SerializerBase @@ -88,6 +113,11 @@ public override object Serialize(T input) { return newmsgpack::MessagePack.MessagePackSerializer.Serialize(input, LZ4BlockArray); } + + public override string ToString() + { + return "MessagePackLz4_v2"; + } } public class MsgPack_v1_str_lz4 : SerializerBase @@ -101,6 +131,11 @@ public override object Serialize(T input) { return oldmsgpack::MessagePack.LZ4MessagePackSerializer.Serialize(input, oldmsgpack::MessagePack.Resolvers.ContractlessStandardResolver.Instance); } + + public override string ToString() + { + return "MsgPack_v1_str_lz4"; + } } public class MsgPack_v2_str_lz4 : SerializerBase @@ -116,6 +151,11 @@ public override object Serialize(T input) { return newmsgpack::MessagePack.MessagePackSerializer.Serialize(input, Options); } + + public override string ToString() + { + return "MsgPack_v2_str_lz4"; + } } public class MsgPack_v2_opt : SerializerBase @@ -131,6 +171,11 @@ public override object Serialize(T input) { return newmsgpack::MessagePack.MessagePackSerializer.Serialize(input, Options); } + + public override string ToString() + { + return "MsgPack_v2_opt"; + } } public class OptimizedResolver : newmsgpack::MessagePack.IFormatterResolver diff --git a/benchmark/SerializerBenchmark/Serializers/MsgPackCliSerializer.cs b/benchmark/SerializerBenchmark/Serializers/MsgPackCliSerializer.cs index a03127ae6..0bc1f9ce0 100644 --- a/benchmark/SerializerBenchmark/Serializers/MsgPackCliSerializer.cs +++ b/benchmark/SerializerBenchmark/Serializers/MsgPackCliSerializer.cs @@ -16,4 +16,9 @@ public override object Serialize(T input) { return MsgPack.Serialization.MessagePackSerializer.Get().PackSingleObject(input); } + + public override string ToString() + { + return "MsgPackCli"; + } } diff --git a/benchmark/SerializerBenchmark/Serializers/ProtobufSerializer.cs b/benchmark/SerializerBenchmark/Serializers/ProtobufSerializer.cs index d0394065d..e9a4b8281 100644 --- a/benchmark/SerializerBenchmark/Serializers/ProtobufSerializer.cs +++ b/benchmark/SerializerBenchmark/Serializers/ProtobufSerializer.cs @@ -25,5 +25,10 @@ public override object Serialize(T input) Serializer.Serialize(ms, input); return ms.ToArray(); } + + public override string ToString() + { + return "ProtobufNet"; + } } } diff --git a/benchmark/SerializerBenchmark/Serializers/SpanJsonSerializer.cs b/benchmark/SerializerBenchmark/Serializers/SpanJsonSerializer.cs index a3a2f44d7..68e6d1815 100644 --- a/benchmark/SerializerBenchmark/Serializers/SpanJsonSerializer.cs +++ b/benchmark/SerializerBenchmark/Serializers/SpanJsonSerializer.cs @@ -16,4 +16,9 @@ public override T Deserialize(object input) { return SpanJson.JsonSerializer.Generic.Utf8.Deserialize((byte[])input); } + + public override string ToString() + { + return "SpanJson"; + } } diff --git a/benchmark/SerializerBenchmark/Serializers/SystemTextJsonSerializer.cs b/benchmark/SerializerBenchmark/Serializers/SystemTextJsonSerializer.cs index f6358d154..7d892eb86 100644 --- a/benchmark/SerializerBenchmark/Serializers/SystemTextJsonSerializer.cs +++ b/benchmark/SerializerBenchmark/Serializers/SystemTextJsonSerializer.cs @@ -17,4 +17,9 @@ public override T Deserialize(object input) var span = (byte[])input; return System.Text.Json.JsonSerializer.Deserialize(span); } + + public override string ToString() + { + return "SystemTextJson"; + } } diff --git a/benchmark/SerializerBenchmark/Serializers/Utf8JsonSerializer.cs b/benchmark/SerializerBenchmark/Serializers/Utf8JsonSerializer.cs index f52b0d9b7..124ef284f 100644 --- a/benchmark/SerializerBenchmark/Serializers/Utf8JsonSerializer.cs +++ b/benchmark/SerializerBenchmark/Serializers/Utf8JsonSerializer.cs @@ -15,5 +15,10 @@ public override object Serialize(T input) public override T Deserialize(object input) { return Utf8Json.JsonSerializer.Deserialize((byte[])input); + + public override string ToString() + { + return "UTF8Json"; + } } } From 25fe3f9eea6b1641f88092dde5dc7b469a0a6938 Mon Sep 17 00:00:00 2001 From: Johannes Deml Date: Tue, 8 Dec 2020 10:34:07 +0100 Subject: [PATCH 035/161] Change add namespaces and make naming consistent with their file names Rename of ProtobufSerializer to ProtobufNetSerializer and BinaryFormatter to BinaryFormatterSerializer to have more consistency. --- .../SerializerBenchmark.cs | 52 +-- .../Serializers/BinaryFormatter.cs | 34 -- .../Serializers/BinaryFormatterSerializer.cs | 34 ++ .../Serializers/BsonNetSerializer.cs | 54 +-- .../Serializers/CerasSerializer.cs | 33 +- .../Serializers/DataContractSerializer.cs | 37 +-- .../Serializers/FsPicklerSerializer.cs | 40 +-- .../Serializers/HyperionSerializer.cs | 40 +-- .../Serializers/JilSerializer.cs | 28 +- .../Serializers/JsonNetSerializer.cs | 50 +-- .../Serializers/MessagePackSerializer.cs | 308 +++++++++--------- .../Serializers/MsgPackCliSerializer.cs | 29 +- .../Serializers/ProtobufNetSerializer.cs | 33 ++ .../Serializers/ProtobufSerializer.cs | 34 -- .../Serializers/SpanJsonSerializer.cs | 29 +- .../Serializers/SystemTextJsonSerializer.cs | 31 +- .../Serializers/Utf8JsonSerializer.cs | 21 +- 17 files changed, 442 insertions(+), 445 deletions(-) delete mode 100644 benchmark/SerializerBenchmark/Serializers/BinaryFormatter.cs create mode 100644 benchmark/SerializerBenchmark/Serializers/BinaryFormatterSerializer.cs create mode 100644 benchmark/SerializerBenchmark/Serializers/ProtobufNetSerializer.cs delete mode 100644 benchmark/SerializerBenchmark/Serializers/ProtobufSerializer.cs diff --git a/benchmark/SerializerBenchmark/SerializerBenchmark.cs b/benchmark/SerializerBenchmark/SerializerBenchmark.cs index f88aa5a04..4832d5810 100644 --- a/benchmark/SerializerBenchmark/SerializerBenchmark.cs +++ b/benchmark/SerializerBenchmark/SerializerBenchmark.cs @@ -31,19 +31,19 @@ public class AllSerializerBenchmark_BytesInOut new MsgPack_v2_opt(), //new MsgPack_v2_string(), //new MsgPack_v2_str_lz4(), - new ProtobufNet(), - new JsonNet(), - new BsonNet(), - new BinaryFormatter_(), - new DataContract_(), - new Hyperion_(), - new Jil_(), - new SpanJson_(), - new Utf8Json_(), - new SystemTextJson(), - new MsgPackCli(), - new FsPickler_(), - new Ceras_(), + new ProtobufNetSerializer(), + new JsonNetSerializer(), + new BsonNetSerializer(), + new BinaryFormatterSerializer(), + new DataContractSerializer(), + new HyperionSerializer(), + new JilSerializer(), + new SpanJsonSerializer(), + new Utf8JsonSerializer(), + new SystemTextJsonSerializer(), + new MsgPackCliSerializer(), + new FsPicklerSerializer(), + new CerasSerializer(), }; protected static readonly ExpressionTreeFixture ExpressionTreeFixture = new ExpressionTreeFixture(); @@ -1111,19 +1111,19 @@ public class ShortRun_AllSerializerBenchmark_BytesInOut new MsgPack_v2_string(), new MsgPack_v1_str_lz4(), new MsgPack_v2_str_lz4(), - new ProtobufNet(), - new JsonNet(), - new BsonNet(), - new BinaryFormatter_(), - new DataContract_(), - new Hyperion_(), - new Jil_(), - new SpanJson_(), - new Utf8Json_(), - new SystemTextJson(), - new MsgPackCli(), - new FsPickler_(), - new Ceras_(), + new ProtobufNetSerializer(), + new JsonNetSerializer(), + new BsonNetSerializer(), + new BinaryFormatterSerializer(), + new DataContractSerializer(), + new HyperionSerializer(), + new JilSerializer(), + new SpanJsonSerializer(), + new Utf8JsonSerializer(), + new SystemTextJsonSerializer(), + new MsgPackCliSerializer(), + new FsPicklerSerializer(), + new CerasSerializer(), }; protected static readonly ExpressionTreeFixture ExpressionTreeFixture = new ExpressionTreeFixture(); diff --git a/benchmark/SerializerBenchmark/Serializers/BinaryFormatter.cs b/benchmark/SerializerBenchmark/Serializers/BinaryFormatter.cs deleted file mode 100644 index ee59bfb27..000000000 --- a/benchmark/SerializerBenchmark/Serializers/BinaryFormatter.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) All contributors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -using System.IO; -using System.Runtime.Serialization.Formatters.Binary; -using Benchmark.Serializers; - -#pragma warning disable SA1649 // File name should match first type name - -public class BinaryFormatter_ : SerializerBase -{ - public override T Deserialize(object input) - { - using (var ms = new MemoryStream((byte[])input)) - { - return (T)new BinaryFormatter().Deserialize(ms); - } - } - - public override object Serialize(T input) - { - using (var ms = new MemoryStream()) - { - new BinaryFormatter().Serialize(ms, input); - ms.Flush(); - return ms.ToArray(); - } - } - - public override string ToString() - { - return "BinaryFormatter"; - } -} diff --git a/benchmark/SerializerBenchmark/Serializers/BinaryFormatterSerializer.cs b/benchmark/SerializerBenchmark/Serializers/BinaryFormatterSerializer.cs new file mode 100644 index 000000000..c54b5487f --- /dev/null +++ b/benchmark/SerializerBenchmark/Serializers/BinaryFormatterSerializer.cs @@ -0,0 +1,34 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System.IO; +using System.Runtime.Serialization.Formatters.Binary; + +namespace Benchmark.Serializers +{ + public class BinaryFormatterSerializer : SerializerBase + { + public override T Deserialize(object input) + { + using (var ms = new MemoryStream((byte[])input)) + { + return (T)new BinaryFormatter().Deserialize(ms); + } + } + + public override object Serialize(T input) + { + using (var ms = new MemoryStream()) + { + new BinaryFormatter().Serialize(ms, input); + ms.Flush(); + return ms.ToArray(); + } + } + + public override string ToString() + { + return "BinaryFormatter"; + } + } +} diff --git a/benchmark/SerializerBenchmark/Serializers/BsonNetSerializer.cs b/benchmark/SerializerBenchmark/Serializers/BsonNetSerializer.cs index dbce4410d..68616af44 100644 --- a/benchmark/SerializerBenchmark/Serializers/BsonNetSerializer.cs +++ b/benchmark/SerializerBenchmark/Serializers/BsonNetSerializer.cs @@ -2,47 +2,47 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System.IO; -using Benchmark.Serializers; using Newtonsoft.Json; using Newtonsoft.Json.Bson; -#pragma warning disable SA1649 // File name should match first type name - -public class BsonNet : SerializerBase +namespace Benchmark.Serializers { - private static readonly JsonSerializer Serializer = new JsonSerializer(); - - public override T Deserialize(object input) + public class BsonNetSerializer : SerializerBase { - using (var ms = new MemoryStream((byte[])input)) - using (var jr = new BsonDataReader(ms)) - { - return Serializer.Deserialize(jr); - } - } + private static readonly JsonSerializer Serializer = new JsonSerializer(); - public override object Serialize(T input) - { - object value = input; - if (typeof(T).IsValueType) + public override T Deserialize(object input) { - value = new[] { input }; + using (var ms = new MemoryStream((byte[])input)) + using (var jr = new BsonDataReader(ms)) + { + return Serializer.Deserialize(jr); + } } - using (var ms = new MemoryStream()) + public override object Serialize(T input) { - using (var jw = new BsonDataWriter(ms)) + object value = input; + if (typeof(T).IsValueType) { - Serializer.Serialize(jw, value); + value = new[] { input }; } - ms.Flush(); - return ms.ToArray(); + using (var ms = new MemoryStream()) + { + using (var jw = new BsonDataWriter(ms)) + { + Serializer.Serialize(jw, value); + } + + ms.Flush(); + return ms.ToArray(); + } } - } - public override string ToString() - { - return "BsonNet"; + public override string ToString() + { + return "BsonNet"; + } } } diff --git a/benchmark/SerializerBenchmark/Serializers/CerasSerializer.cs b/benchmark/SerializerBenchmark/Serializers/CerasSerializer.cs index 56391bde9..9521e4f2b 100644 --- a/benchmark/SerializerBenchmark/Serializers/CerasSerializer.cs +++ b/benchmark/SerializerBenchmark/Serializers/CerasSerializer.cs @@ -1,26 +1,25 @@ // Copyright (c) All contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -using Benchmark.Serializers; - -#pragma warning disable SA1649 // File name should match first type name - -public class Ceras_ : SerializerBase +namespace Benchmark.Serializers { - private Ceras.CerasSerializer ceras = new Ceras.CerasSerializer(); - - public override T Deserialize(object input) + public class CerasSerializer : SerializerBase { - return this.ceras.Deserialize((byte[])input); - } + private Ceras.CerasSerializer ceras = new Ceras.CerasSerializer(); - public override object Serialize(T input) - { - return this.ceras.Serialize(input); - } + public override T Deserialize(object input) + { + return this.ceras.Deserialize((byte[])input); + } - public override string ToString() - { - return "Ceras"; + public override object Serialize(T input) + { + return this.ceras.Serialize(input); + } + + public override string ToString() + { + return "Ceras"; + } } } diff --git a/benchmark/SerializerBenchmark/Serializers/DataContractSerializer.cs b/benchmark/SerializerBenchmark/Serializers/DataContractSerializer.cs index 2215ae188..4425ed0e2 100644 --- a/benchmark/SerializerBenchmark/Serializers/DataContractSerializer.cs +++ b/benchmark/SerializerBenchmark/Serializers/DataContractSerializer.cs @@ -2,33 +2,32 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System.IO; -using System.Runtime.Serialization; -using Benchmark.Serializers; -#pragma warning disable SA1649 // File name should match first type name - -public class DataContract_ : SerializerBase +namespace Benchmark.Serializers { - public override T Deserialize(object input) + public class DataContractSerializer : SerializerBase { - using (var ms = new MemoryStream((byte[])input)) + public override T Deserialize(object input) { - return (T)new DataContractSerializer(typeof(T)).ReadObject(ms); + using (var ms = new MemoryStream((byte[])input)) + { + return (T)new System.Runtime.Serialization.DataContractSerializer(typeof(T)).ReadObject(ms); + } } - } - public override object Serialize(T input) - { - using (var ms = new MemoryStream()) + public override object Serialize(T input) { - new DataContractSerializer(typeof(T)).WriteObject(ms, input); - ms.Flush(); - return ms.ToArray(); + using (var ms = new MemoryStream()) + { + new System.Runtime.Serialization.DataContractSerializer(typeof(T)).WriteObject(ms, input); + ms.Flush(); + return ms.ToArray(); + } } - } - public override string ToString() - { - return "DataContract"; + public override string ToString() + { + return "DataContract"; + } } } diff --git a/benchmark/SerializerBenchmark/Serializers/FsPicklerSerializer.cs b/benchmark/SerializerBenchmark/Serializers/FsPicklerSerializer.cs index 70873f8b3..d0c8341fe 100644 --- a/benchmark/SerializerBenchmark/Serializers/FsPicklerSerializer.cs +++ b/benchmark/SerializerBenchmark/Serializers/FsPicklerSerializer.cs @@ -2,35 +2,35 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System.IO; -using Benchmark.Serializers; using MBrace.FsPickler; -#pragma warning disable SA1649 // File name should match first type name - -public class FsPickler_ : SerializerBase +namespace Benchmark.Serializers { - private static readonly BinarySerializer Serializer = MBrace.FsPickler.FsPickler.CreateBinarySerializer(); - - public override T Deserialize(object input) + public class FsPicklerSerializer : SerializerBase { - using (var ms = new MemoryStream((byte[])input)) + private static readonly BinarySerializer Serializer = MBrace.FsPickler.FsPickler.CreateBinarySerializer(); + + public override T Deserialize(object input) { - return Serializer.Deserialize(ms); + using (var ms = new MemoryStream((byte[])input)) + { + return Serializer.Deserialize(ms); + } } - } - public override object Serialize(T input) - { - using (var ms = new MemoryStream()) + public override object Serialize(T input) { - Serializer.Serialize(ms, input); - ms.Flush(); - return ms.ToArray(); + using (var ms = new MemoryStream()) + { + Serializer.Serialize(ms, input); + ms.Flush(); + return ms.ToArray(); + } } - } - public override string ToString() - { - return "FsPickler"; + public override string ToString() + { + return "FsPickler"; + } } } diff --git a/benchmark/SerializerBenchmark/Serializers/HyperionSerializer.cs b/benchmark/SerializerBenchmark/Serializers/HyperionSerializer.cs index 1d7a121a8..0f5d5d847 100644 --- a/benchmark/SerializerBenchmark/Serializers/HyperionSerializer.cs +++ b/benchmark/SerializerBenchmark/Serializers/HyperionSerializer.cs @@ -2,35 +2,35 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System.IO; -using Benchmark.Serializers; using Hyperion; -#pragma warning disable SA1649 // File name should match first type name - -public class Hyperion_ : SerializerBase +namespace Benchmark.Serializers { - private static readonly Serializer Serializer = new Hyperion.Serializer(); - - public override T Deserialize(object input) + public class HyperionSerializer : SerializerBase { - using (var ms = new MemoryStream((byte[])input)) + private static readonly Serializer Serializer = new Hyperion.Serializer(); + + public override T Deserialize(object input) { - return Serializer.Deserialize(ms); + using (var ms = new MemoryStream((byte[])input)) + { + return Serializer.Deserialize(ms); + } } - } - public override object Serialize(T input) - { - using (var ms = new MemoryStream()) + public override object Serialize(T input) { - Serializer.Serialize(input, ms); - ms.Flush(); - return ms.ToArray(); + using (var ms = new MemoryStream()) + { + Serializer.Serialize(input, ms); + ms.Flush(); + return ms.ToArray(); + } } - } - public override string ToString() - { - return "Hyperion"; + public override string ToString() + { + return "Hyperion"; + } } } diff --git a/benchmark/SerializerBenchmark/Serializers/JilSerializer.cs b/benchmark/SerializerBenchmark/Serializers/JilSerializer.cs index 8d2b49616..983e07d3e 100644 --- a/benchmark/SerializerBenchmark/Serializers/JilSerializer.cs +++ b/benchmark/SerializerBenchmark/Serializers/JilSerializer.cs @@ -2,25 +2,25 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System.Text; -using Benchmark.Serializers; using Jil; -#pragma warning disable SA1649 // File name should match first type name - -public class Jil_ : SerializerBase +namespace Benchmark.Serializers { - public override object Serialize(T input) + public class JilSerializer : SerializerBase { - return Encoding.UTF8.GetBytes(Jil.JSON.Serialize(input, Options.ISO8601)); - } + public override object Serialize(T input) + { + return Encoding.UTF8.GetBytes(Jil.JSON.Serialize(input, Options.ISO8601)); + } - public override T Deserialize(object input) - { - return Jil.JSON.Deserialize(Encoding.UTF8.GetString((byte[])input), Options.ISO8601); - } + public override T Deserialize(object input) + { + return Jil.JSON.Deserialize(Encoding.UTF8.GetString((byte[])input), Options.ISO8601); + } - public override string ToString() - { - return "Jil"; + public override string ToString() + { + return "Jil"; + } } } diff --git a/benchmark/SerializerBenchmark/Serializers/JsonNetSerializer.cs b/benchmark/SerializerBenchmark/Serializers/JsonNetSerializer.cs index 1e9b827fb..b85574ddc 100644 --- a/benchmark/SerializerBenchmark/Serializers/JsonNetSerializer.cs +++ b/benchmark/SerializerBenchmark/Serializers/JsonNetSerializer.cs @@ -3,42 +3,42 @@ using System.IO; using System.Text; -using Benchmark.Serializers; using Newtonsoft.Json; -#pragma warning disable SA1649 // File name should match first type name - -public class JsonNet : SerializerBase +namespace Benchmark.Serializers { - private static readonly JsonSerializer Serializer = new JsonSerializer(); - - public override T Deserialize(object input) + public class JsonNetSerializer : SerializerBase { - using (var ms = new MemoryStream((byte[])input)) - using (var sr = new StreamReader(ms, Encoding.UTF8)) - using (var jr = new JsonTextReader(sr)) + private static readonly JsonSerializer Serializer = new JsonSerializer(); + + public override T Deserialize(object input) { - return Serializer.Deserialize(jr); + using (var ms = new MemoryStream((byte[])input)) + using (var sr = new StreamReader(ms, Encoding.UTF8)) + using (var jr = new JsonTextReader(sr)) + { + return Serializer.Deserialize(jr); + } } - } - public override object Serialize(T input) - { - using (var ms = new MemoryStream()) + public override object Serialize(T input) { - using (var sw = new StreamWriter(ms, Encoding.UTF8)) - using (var jw = new JsonTextWriter(sw)) + using (var ms = new MemoryStream()) { - Serializer.Serialize(jw, input); - } + using (var sw = new StreamWriter(ms, Encoding.UTF8)) + using (var jw = new JsonTextWriter(sw)) + { + Serializer.Serialize(jw, input); + } - ms.Flush(); - return ms.ToArray(); + ms.Flush(); + return ms.ToArray(); + } } - } - public override string ToString() - { - return "JsonNet"; + public override string ToString() + { + return "JsonNet"; + } } } diff --git a/benchmark/SerializerBenchmark/Serializers/MessagePackSerializer.cs b/benchmark/SerializerBenchmark/Serializers/MessagePackSerializer.cs index 167ed06f0..7583e0361 100644 --- a/benchmark/SerializerBenchmark/Serializers/MessagePackSerializer.cs +++ b/benchmark/SerializerBenchmark/Serializers/MessagePackSerializer.cs @@ -4,217 +4,221 @@ extern alias oldmsgpack; extern alias newmsgpack; -using Benchmark.Serializers; - #pragma warning disable SA1649 // File name should match first type name -public class MessagePack_v1 : SerializerBase +namespace Benchmark.Serializers { - public override T Deserialize(object input) + public class MessagePack_v1 : SerializerBase { - return oldmsgpack::MessagePack.MessagePackSerializer.Deserialize((byte[])input); - } + public override T Deserialize(object input) + { + return oldmsgpack::MessagePack.MessagePackSerializer.Deserialize((byte[])input); + } - public override object Serialize(T input) - { - return oldmsgpack::MessagePack.MessagePackSerializer.Serialize(input); - } + public override object Serialize(T input) + { + return oldmsgpack::MessagePack.MessagePackSerializer.Serialize(input); + } - public override string ToString() - { - return "MessagePack_v1"; + public override string ToString() + { + return "MessagePack_v1"; + } } -} -public class MessagePack_v2 : SerializerBase -{ - public override T Deserialize(object input) + public class MessagePack_v2 : SerializerBase { - return newmsgpack::MessagePack.MessagePackSerializer.Deserialize((byte[])input); - } + public override T Deserialize(object input) + { + return newmsgpack::MessagePack.MessagePackSerializer.Deserialize((byte[])input); + } - public override object Serialize(T input) - { - return newmsgpack::MessagePack.MessagePackSerializer.Serialize(input); - } + public override object Serialize(T input) + { + return newmsgpack::MessagePack.MessagePackSerializer.Serialize(input); + } - public override string ToString() - { - return "MessagePack_v2"; + public override string ToString() + { + return "MessagePack_v2"; + } } -} -public class MsgPack_v1_string : SerializerBase -{ - public override T Deserialize(object input) + public class MsgPack_v1_string : SerializerBase { - return oldmsgpack::MessagePack.MessagePackSerializer.Deserialize((byte[])input, oldmsgpack::MessagePack.Resolvers.ContractlessStandardResolver.Instance); - } + public override T Deserialize(object input) + { + return oldmsgpack::MessagePack.MessagePackSerializer.Deserialize((byte[])input, oldmsgpack::MessagePack.Resolvers.ContractlessStandardResolver.Instance); + } - public override object Serialize(T input) - { - return oldmsgpack::MessagePack.MessagePackSerializer.Serialize(input, oldmsgpack::MessagePack.Resolvers.ContractlessStandardResolver.Instance); + public override object Serialize(T input) + { + return oldmsgpack::MessagePack.MessagePackSerializer.Serialize(input, oldmsgpack::MessagePack.Resolvers.ContractlessStandardResolver.Instance); + } + + public override string ToString() + { + return "MsgPack_v1_string"; + } } - public override string ToString() + public class MsgPack_v2_string : SerializerBase { - return "MsgPack_v1_string"; - } -} + private static readonly newmsgpack::MessagePack.MessagePackSerializerOptions Options = + newmsgpack::MessagePack.MessagePackSerializerOptions.Standard.WithResolver(newmsgpack::MessagePack.Resolvers.ContractlessStandardResolver.Instance); -public class MsgPack_v2_string : SerializerBase -{ - private static readonly newmsgpack::MessagePack.MessagePackSerializerOptions Options = newmsgpack::MessagePack.MessagePackSerializerOptions.Standard.WithResolver(newmsgpack::MessagePack.Resolvers.ContractlessStandardResolver.Instance); + public override T Deserialize(object input) + { + return newmsgpack::MessagePack.MessagePackSerializer.Deserialize((byte[])input, options: Options); + } - public override T Deserialize(object input) - { - return newmsgpack::MessagePack.MessagePackSerializer.Deserialize((byte[])input, options: Options); - } + public override object Serialize(T input) + { + return newmsgpack::MessagePack.MessagePackSerializer.Serialize(input, options: Options); + } - public override object Serialize(T input) - { - return newmsgpack::MessagePack.MessagePackSerializer.Serialize(input, options: Options); + public override string ToString() + { + return "MsgPack_v2_string"; + } } - public override string ToString() + public class MessagePackLz4_v1 : SerializerBase { - return "MsgPack_v2_string"; - } -} + public override T Deserialize(object input) + { + return oldmsgpack::MessagePack.LZ4MessagePackSerializer.Deserialize((byte[])input); + } -public class MessagePackLz4_v1 : SerializerBase -{ - public override T Deserialize(object input) - { - return oldmsgpack::MessagePack.LZ4MessagePackSerializer.Deserialize((byte[])input); - } + public override object Serialize(T input) + { + return oldmsgpack::MessagePack.LZ4MessagePackSerializer.Serialize(input); + } - public override object Serialize(T input) - { - return oldmsgpack::MessagePack.LZ4MessagePackSerializer.Serialize(input); + public override string ToString() + { + return "MessagePackLz4_v1"; + } } - public override string ToString() + public class MessagePackLz4_v2 : SerializerBase { - return "MessagePackLz4_v1"; - } -} + private static readonly newmsgpack::MessagePack.MessagePackSerializerOptions LZ4BlockArray = + newmsgpack::MessagePack.MessagePackSerializerOptions.Standard.WithCompression(newmsgpack::MessagePack.MessagePackCompression.Lz4BlockArray); -public class MessagePackLz4_v2 : SerializerBase -{ - private static readonly newmsgpack::MessagePack.MessagePackSerializerOptions LZ4BlockArray = newmsgpack::MessagePack.MessagePackSerializerOptions.Standard.WithCompression(newmsgpack::MessagePack.MessagePackCompression.Lz4BlockArray); + public override T Deserialize(object input) + { + return newmsgpack::MessagePack.MessagePackSerializer.Deserialize((byte[])input, LZ4BlockArray); + } - public override T Deserialize(object input) - { - return newmsgpack::MessagePack.MessagePackSerializer.Deserialize((byte[])input, LZ4BlockArray); - } + public override object Serialize(T input) + { + return newmsgpack::MessagePack.MessagePackSerializer.Serialize(input, LZ4BlockArray); + } - public override object Serialize(T input) - { - return newmsgpack::MessagePack.MessagePackSerializer.Serialize(input, LZ4BlockArray); + public override string ToString() + { + return "MessagePackLz4_v2"; + } } - public override string ToString() + public class MsgPack_v1_str_lz4 : SerializerBase { - return "MessagePackLz4_v2"; - } -} + public override T Deserialize(object input) + { + return oldmsgpack::MessagePack.LZ4MessagePackSerializer.Deserialize((byte[])input, oldmsgpack::MessagePack.Resolvers.ContractlessStandardResolver.Instance); + } -public class MsgPack_v1_str_lz4 : SerializerBase -{ - public override T Deserialize(object input) - { - return oldmsgpack::MessagePack.LZ4MessagePackSerializer.Deserialize((byte[])input, oldmsgpack::MessagePack.Resolvers.ContractlessStandardResolver.Instance); - } + public override object Serialize(T input) + { + return oldmsgpack::MessagePack.LZ4MessagePackSerializer.Serialize(input, oldmsgpack::MessagePack.Resolvers.ContractlessStandardResolver.Instance); + } - public override object Serialize(T input) - { - return oldmsgpack::MessagePack.LZ4MessagePackSerializer.Serialize(input, oldmsgpack::MessagePack.Resolvers.ContractlessStandardResolver.Instance); + public override string ToString() + { + return "MsgPack_v1_str_lz4"; + } } - public override string ToString() + public class MsgPack_v2_str_lz4 : SerializerBase { - return "MsgPack_v1_str_lz4"; - } -} + private static readonly newmsgpack::MessagePack.MessagePackSerializerOptions Options = newmsgpack::MessagePack.MessagePackSerializerOptions.Standard + .WithResolver(newmsgpack::MessagePack.Resolvers.ContractlessStandardResolver.Instance) + .WithCompression(newmsgpack::MessagePack.MessagePackCompression.Lz4BlockArray); -public class MsgPack_v2_str_lz4 : SerializerBase -{ - private static readonly newmsgpack::MessagePack.MessagePackSerializerOptions Options = newmsgpack::MessagePack.MessagePackSerializerOptions.Standard.WithResolver(newmsgpack::MessagePack.Resolvers.ContractlessStandardResolver.Instance).WithCompression(newmsgpack::MessagePack.MessagePackCompression.Lz4BlockArray); + public override T Deserialize(object input) + { + return newmsgpack::MessagePack.MessagePackSerializer.Deserialize((byte[])input, Options); + } - public override T Deserialize(object input) - { - return newmsgpack::MessagePack.MessagePackSerializer.Deserialize((byte[])input, Options); - } + public override object Serialize(T input) + { + return newmsgpack::MessagePack.MessagePackSerializer.Serialize(input, Options); + } - public override object Serialize(T input) - { - return newmsgpack::MessagePack.MessagePackSerializer.Serialize(input, Options); + public override string ToString() + { + return "MsgPack_v2_str_lz4"; + } } - public override string ToString() + public class MsgPack_v2_opt : SerializerBase { - return "MsgPack_v2_str_lz4"; - } -} - -public class MsgPack_v2_opt : SerializerBase -{ - private static readonly newmsgpack::MessagePack.MessagePackSerializerOptions Options = newmsgpack::MessagePack.MessagePackSerializerOptions.Standard.WithResolver(OptimizedResolver.Instance); + private static readonly newmsgpack::MessagePack.MessagePackSerializerOptions Options = + newmsgpack::MessagePack.MessagePackSerializerOptions.Standard.WithResolver(OptimizedResolver.Instance); - public override T Deserialize(object input) - { - return newmsgpack::MessagePack.MessagePackSerializer.Deserialize((byte[])input, Options); - } + public override T Deserialize(object input) + { + return newmsgpack::MessagePack.MessagePackSerializer.Deserialize((byte[])input, Options); + } - public override object Serialize(T input) - { - return newmsgpack::MessagePack.MessagePackSerializer.Serialize(input, Options); - } + public override object Serialize(T input) + { + return newmsgpack::MessagePack.MessagePackSerializer.Serialize(input, Options); + } - public override string ToString() - { - return "MsgPack_v2_opt"; + public override string ToString() + { + return "MsgPack_v2_opt"; + } } -} - -public class OptimizedResolver : newmsgpack::MessagePack.IFormatterResolver -{ - public static readonly newmsgpack::MessagePack.IFormatterResolver Instance = new OptimizedResolver(); - // configure your custom resolvers. - private static readonly newmsgpack::MessagePack.IFormatterResolver[] Resolvers = new newmsgpack::MessagePack.IFormatterResolver[] + public class OptimizedResolver : newmsgpack::MessagePack.IFormatterResolver { - newmsgpack::MessagePack.Resolvers.NativeGuidResolver.Instance, - newmsgpack::MessagePack.Resolvers.NativeDecimalResolver.Instance, - newmsgpack::MessagePack.Resolvers.NativeDateTimeResolver.Instance, - newmsgpack::MessagePack.Resolvers.StandardResolver.Instance, - }; + public static readonly newmsgpack::MessagePack.IFormatterResolver Instance = new OptimizedResolver(); - private OptimizedResolver() - { - } + // configure your custom resolvers. + private static readonly newmsgpack::MessagePack.IFormatterResolver[] Resolvers = new newmsgpack::MessagePack.IFormatterResolver[] + { + newmsgpack::MessagePack.Resolvers.NativeGuidResolver.Instance, newmsgpack::MessagePack.Resolvers.NativeDecimalResolver.Instance, + newmsgpack::MessagePack.Resolvers.NativeDateTimeResolver.Instance, newmsgpack::MessagePack.Resolvers.StandardResolver.Instance, + }; - public newmsgpack::MessagePack.Formatters.IMessagePackFormatter GetFormatter() - { - return Cache.Formatter; - } + private OptimizedResolver() + { + } - private static class Cache - { -#pragma warning disable SA1401 // Fields should be private - public static newmsgpack::MessagePack.Formatters.IMessagePackFormatter Formatter; -#pragma warning restore SA1401 // Fields should be private + public newmsgpack::MessagePack.Formatters.IMessagePackFormatter GetFormatter() + { + return Cache.Formatter; + } - static Cache() + private static class Cache { - foreach (var resolver in Resolvers) + #pragma warning disable SA1401 // Fields should be private + public static newmsgpack::MessagePack.Formatters.IMessagePackFormatter Formatter; + #pragma warning restore SA1401 // Fields should be private + + static Cache() { - var f = resolver.GetFormatter(); - if (f != null) + foreach (var resolver in Resolvers) { - Formatter = f; - return; + var f = resolver.GetFormatter(); + if (f != null) + { + Formatter = f; + return; + } } } } diff --git a/benchmark/SerializerBenchmark/Serializers/MsgPackCliSerializer.cs b/benchmark/SerializerBenchmark/Serializers/MsgPackCliSerializer.cs index 0bc1f9ce0..f3238d556 100644 --- a/benchmark/SerializerBenchmark/Serializers/MsgPackCliSerializer.cs +++ b/benchmark/SerializerBenchmark/Serializers/MsgPackCliSerializer.cs @@ -1,24 +1,23 @@ // Copyright (c) All contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -using Benchmark.Serializers; - -#pragma warning disable SA1649 // File name should match first type name - -public class MsgPackCli : SerializerBase +namespace Benchmark.Serializers { - public override T Deserialize(object input) + public class MsgPackCliSerializer : SerializerBase { - return MsgPack.Serialization.MessagePackSerializer.Get().UnpackSingleObject((byte[])input); - } + public override T Deserialize(object input) + { + return MsgPack.Serialization.MessagePackSerializer.Get().UnpackSingleObject((byte[])input); + } - public override object Serialize(T input) - { - return MsgPack.Serialization.MessagePackSerializer.Get().PackSingleObject(input); - } + public override object Serialize(T input) + { + return MsgPack.Serialization.MessagePackSerializer.Get().PackSingleObject(input); + } - public override string ToString() - { - return "MsgPackCli"; + public override string ToString() + { + return "MsgPackCli"; + } } } diff --git a/benchmark/SerializerBenchmark/Serializers/ProtobufNetSerializer.cs b/benchmark/SerializerBenchmark/Serializers/ProtobufNetSerializer.cs new file mode 100644 index 000000000..7b44b5a75 --- /dev/null +++ b/benchmark/SerializerBenchmark/Serializers/ProtobufNetSerializer.cs @@ -0,0 +1,33 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System.IO; +using ProtoBuf; + +namespace Benchmark.Serializers +{ + public class ProtobufNetSerializer : SerializerBase + { + public override T Deserialize(object input) + { + using (var ms = new MemoryStream((byte[])input)) + { + return Serializer.Deserialize(ms); + } + } + + public override object Serialize(T input) + { + using (var ms = new MemoryStream()) + { + Serializer.Serialize(ms, input); + return ms.ToArray(); + } + } + + public override string ToString() + { + return "ProtobufNet"; + } + } +} diff --git a/benchmark/SerializerBenchmark/Serializers/ProtobufSerializer.cs b/benchmark/SerializerBenchmark/Serializers/ProtobufSerializer.cs deleted file mode 100644 index e9a4b8281..000000000 --- a/benchmark/SerializerBenchmark/Serializers/ProtobufSerializer.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) All contributors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -using System.IO; -using Benchmark.Serializers; -using ProtoBuf; - -public class -#pragma warning disable SA1649 // File name should match first type name - -ProtobufNet : SerializerBase -{ - public override T Deserialize(object input) - { - using (var ms = new MemoryStream((byte[])input)) - { - return Serializer.Deserialize(ms); - } - } - - public override object Serialize(T input) - { - using (var ms = new MemoryStream()) - { - Serializer.Serialize(ms, input); - return ms.ToArray(); - } - - public override string ToString() - { - return "ProtobufNet"; - } - } -} diff --git a/benchmark/SerializerBenchmark/Serializers/SpanJsonSerializer.cs b/benchmark/SerializerBenchmark/Serializers/SpanJsonSerializer.cs index 68e6d1815..33ccbd998 100644 --- a/benchmark/SerializerBenchmark/Serializers/SpanJsonSerializer.cs +++ b/benchmark/SerializerBenchmark/Serializers/SpanJsonSerializer.cs @@ -1,24 +1,23 @@ // Copyright (c) All contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -using Benchmark.Serializers; - -#pragma warning disable SA1649 // File name should match first type name - -public class SpanJson_ : SerializerBase +namespace Benchmark.Serializers { - public override object Serialize(T input) + public class SpanJsonSerializer : SerializerBase { - return SpanJson.JsonSerializer.Generic.Utf8.Serialize(input); - } + public override object Serialize(T input) + { + return SpanJson.JsonSerializer.Generic.Utf8.Serialize(input); + } - public override T Deserialize(object input) - { - return SpanJson.JsonSerializer.Generic.Utf8.Deserialize((byte[])input); - } + public override T Deserialize(object input) + { + return SpanJson.JsonSerializer.Generic.Utf8.Deserialize((byte[])input); + } - public override string ToString() - { - return "SpanJson"; + public override string ToString() + { + return "SpanJson"; + } } } diff --git a/benchmark/SerializerBenchmark/Serializers/SystemTextJsonSerializer.cs b/benchmark/SerializerBenchmark/Serializers/SystemTextJsonSerializer.cs index 7d892eb86..baf143f99 100644 --- a/benchmark/SerializerBenchmark/Serializers/SystemTextJsonSerializer.cs +++ b/benchmark/SerializerBenchmark/Serializers/SystemTextJsonSerializer.cs @@ -1,25 +1,24 @@ // Copyright (c) All contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -using Benchmark.Serializers; - -#pragma warning disable SA1649 // File name should match first type name - -public class SystemTextJson : SerializerBase +namespace Benchmark.Serializers { - public override object Serialize(T input) + public class SystemTextJsonSerializer : SerializerBase { - return System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(input); - } + public override object Serialize(T input) + { + return System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(input); + } - public override T Deserialize(object input) - { - var span = (byte[])input; - return System.Text.Json.JsonSerializer.Deserialize(span); - } + public override T Deserialize(object input) + { + var span = (byte[])input; + return System.Text.Json.JsonSerializer.Deserialize(span); + } - public override string ToString() - { - return "SystemTextJson"; + public override string ToString() + { + return "SystemTextJson"; + } } } diff --git a/benchmark/SerializerBenchmark/Serializers/Utf8JsonSerializer.cs b/benchmark/SerializerBenchmark/Serializers/Utf8JsonSerializer.cs index 124ef284f..fec69a81a 100644 --- a/benchmark/SerializerBenchmark/Serializers/Utf8JsonSerializer.cs +++ b/benchmark/SerializerBenchmark/Serializers/Utf8JsonSerializer.cs @@ -1,20 +1,19 @@ // Copyright (c) All contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -using Benchmark.Serializers; - -#pragma warning disable SA1649 // File name should match first type name - -public class Utf8Json_ : SerializerBase +namespace Benchmark.Serializers { - public override object Serialize(T input) + public class Utf8JsonSerializer : SerializerBase { - return Utf8Json.JsonSerializer.Serialize(input); - } + public override object Serialize(T input) + { + return Utf8Json.JsonSerializer.Serialize(input); + } - public override T Deserialize(object input) - { - return Utf8Json.JsonSerializer.Deserialize((byte[])input); + public override T Deserialize(object input) + { + return Utf8Json.JsonSerializer.Deserialize((byte[])input); + } public override string ToString() { From 6240389538cd56fca3b14d41465bd29d47504022 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 21 Dec 2020 12:15:45 -0700 Subject: [PATCH 036/161] Enable more tests on net472 --- .../ShareTests/DynamicObjectResolverTests.cs | 4 ---- tests/MessagePack.Tests/IsExternalInit.cs | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 tests/MessagePack.Tests/IsExternalInit.cs diff --git a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/DynamicObjectResolverTests.cs b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/DynamicObjectResolverTests.cs index 4051f5043..79a2f24be 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/DynamicObjectResolverTests.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/DynamicObjectResolverTests.cs @@ -312,7 +312,6 @@ public void DefaultValueIntKeyStructWithExplicitConstructorSetPropertyTest() Assert.Equal(-98, instance.Prop2); } -#if NET5_0 [Fact] public void RoundtripGenericClass_StandardResolverThrowsOnInitProperty() { @@ -356,7 +355,6 @@ public void RoundtripGenericClass_AllowPrivateStandardResolver() var deserialized = MessagePackSerializer.Deserialize>(msgpack, options); Assert.Equal(person.Name, deserialized.Name); } -#endif [MessagePackObject(true)] public class DefaultValueStringKeyClassWithoutExplicitConstructor @@ -644,7 +642,6 @@ public class DerivedClass : BaseClass public string Name { get; set; } } -#if NET5_0 [MessagePackObject] public class Person { @@ -668,7 +665,6 @@ public class GenericPersonWithCtor [Key(0)] public string Name { get; init; } } -#endif } } diff --git a/tests/MessagePack.Tests/IsExternalInit.cs b/tests/MessagePack.Tests/IsExternalInit.cs new file mode 100644 index 000000000..d7b8c2e01 --- /dev/null +++ b/tests/MessagePack.Tests/IsExternalInit.cs @@ -0,0 +1,18 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +#if !NET5_0 + +#pragma warning disable CA1812 + +namespace System.Runtime.CompilerServices +{ + /// + /// Used by C# 9 for property init accessors. + /// + internal sealed class IsExternalInit + { + } +} + +#endif From 0edc912736300c1a163b07c20f8cfcb485b1346e Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 21 Dec 2020 12:47:20 -0700 Subject: [PATCH 037/161] Adapt `CtorParameterAndPropertySetterExists` test for v2.3 behavior --- .../Scripts/Tests/ShareTests/DynamicObjectResolverTests.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/DynamicObjectResolverTests.cs b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/DynamicObjectResolverTests.cs index 2ad4f56ed..0ba662c5e 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/DynamicObjectResolverTests.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/DynamicObjectResolverTests.cs @@ -91,9 +91,8 @@ public void CtorParameterAndPropertySetterExists() byte[] bin = MessagePackSerializer.Serialize(m1); var m2 = MessagePackSerializer.Deserialize(bin); - // In this version of the deserializer, we expect the property setter to be invoked - // and reaffirm the value already passed to the constructor. - Assert.Equal(m1.MyProperty, m2.MyProperty); + // We do NOT use the property setter since the constructor is expected to set the property. + Assert.Equal(0, m2.MyProperty); } /// From 2efd33021dabf4feb633d18a128f519aca51e95c Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 21 Dec 2020 22:14:53 -0700 Subject: [PATCH 038/161] Fallback to dynamic methods in buggy CLR case --- .../Resolvers/DynamicObjectResolver.cs | 57 ++++++++++++++++--- .../ShareTests/DynamicObjectResolverTests.cs | 12 ++-- 2 files changed, 52 insertions(+), 17 deletions(-) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs index fc3d5d9e7..6e70e703c 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs @@ -94,7 +94,17 @@ static FormatterCache() return; } - TypeInfo formatterTypeInfo = DynamicObjectTypeBuilder.BuildType(DynamicAssembly.Value, typeof(T), false, false); + TypeInfo formatterTypeInfo; + try + { + formatterTypeInfo = DynamicObjectTypeBuilder.BuildType(DynamicAssembly.Value, typeof(T), false, false); + } + catch (InitAccessorInGenericClassNotSupportedException) + { + Formatter = (IMessagePackFormatter)DynamicObjectTypeBuilder.BuildFormatterToDynamicMethod(typeof(T), false, false, false); + return; + } + if (formatterTypeInfo == null) { return; @@ -341,7 +351,7 @@ public static TypeInfo BuildType(DynamicAssembly assembly, Type type, bool force return null; } - var serializationInfo = MessagePack.Internal.ObjectSerializationInfo.CreateOrNull(type, forceStringKey, contractless, false); + var serializationInfo = MessagePack.Internal.ObjectSerializationInfo.CreateOrNull(type, forceStringKey, contractless, false, dynamicMethod: false); if (serializationInfo == null) { return null; @@ -455,7 +465,7 @@ public static TypeInfo BuildType(DynamicAssembly assembly, Type type, bool force public static object BuildFormatterToDynamicMethod(Type type, bool forceStringKey, bool contractless, bool allowPrivate) { - var serializationInfo = ObjectSerializationInfo.CreateOrNull(type, forceStringKey, contractless, allowPrivate); + var serializationInfo = ObjectSerializationInfo.CreateOrNull(type, forceStringKey, contractless, allowPrivate, dynamicMethod: true); if (serializationInfo == null) { return null; @@ -1683,7 +1693,7 @@ private ObjectSerializationInfo() { } - public static ObjectSerializationInfo CreateOrNull(Type type, bool forceStringKey, bool contractless, bool allowPrivate) + public static ObjectSerializationInfo CreateOrNull(Type type, bool forceStringKey, bool contractless, bool allowPrivate, bool dynamicMethod) { TypeInfo ti = type.GetTypeInfo(); var isClass = ti.IsClass || ti.IsInterface || ti.IsAbstract; @@ -1739,7 +1749,7 @@ public static ObjectSerializationInfo CreateOrNull(Type type, bool forceStringKe MethodInfo getMethod = property.GetGetMethod(true); MethodInfo setMethod = property.GetSetMethod(true); - member = new EmittableMember(allowPrivate) + member = new EmittableMember(dynamicMethod) { PropertyInfo = property, IsReadable = (getMethod != null) && (allowPrivate || getMethod.IsPublic) && !getMethod.IsStatic, @@ -1759,7 +1769,7 @@ public static ObjectSerializationInfo CreateOrNull(Type type, bool forceStringKe continue; } - member = new EmittableMember(allowPrivate) + member = new EmittableMember(dynamicMethod) { FieldInfo = field, IsReadable = allowPrivate || field.IsPublic, @@ -1817,7 +1827,7 @@ public static ObjectSerializationInfo CreateOrNull(Type type, bool forceStringKe MethodInfo getMethod = item.GetGetMethod(true); MethodInfo setMethod = item.GetSetMethod(true); - var member = new EmittableMember(allowPrivate) + var member = new EmittableMember(dynamicMethod) { PropertyInfo = item, IsReadable = (getMethod != null) && (allowPrivate || getMethod.IsPublic) && !getMethod.IsStatic, @@ -1942,7 +1952,7 @@ public static ObjectSerializationInfo CreateOrNull(Type type, bool forceStringKe continue; } - var member = new EmittableMember(allowPrivate) + var member = new EmittableMember(dynamicMethod) { FieldInfo = item, IsReadable = allowPrivate || item.IsPublic, @@ -2456,7 +2466,7 @@ internal void ThrowIfNotWritable() { if (this.IsProblematicInitProperty && !this.dynamicMethod) { - throw new NotSupportedException( + throw new InitAccessorInGenericClassNotSupportedException( $"`init` property accessor {this.PropertyInfo.SetMethod.DeclaringType.FullName}.{this.PropertyInfo.Name} found in generic type, " + $"which is not supported with the DynamicObjectResolver. Use the AllowPrivate variety of the resolver instead. " + $"See https://github.com/neuecc/MessagePack-CSharp/issues/1134 for details."); @@ -2514,6 +2524,35 @@ public MessagePackDynamicObjectResolverException(string message) { } } + + /// + /// Identifies the unsupported scenario of an + /// property accessor within a generic class. + /// + [Serializable] + internal class InitAccessorInGenericClassNotSupportedException : NotSupportedException + { + public InitAccessorInGenericClassNotSupportedException() + { + } + + public InitAccessorInGenericClassNotSupportedException(string message) + : base(message) + { + } + + public InitAccessorInGenericClassNotSupportedException(string message, Exception inner) + : base(message, inner) + { + } + + protected InitAccessorInGenericClassNotSupportedException( + SerializationInfo info, + StreamingContext context) + : base(info, context) + { + } + } } #endif diff --git a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/DynamicObjectResolverTests.cs b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/DynamicObjectResolverTests.cs index 79a2f24be..6ec968956 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/DynamicObjectResolverTests.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/DynamicObjectResolverTests.cs @@ -313,17 +313,13 @@ public void DefaultValueIntKeyStructWithExplicitConstructorSetPropertyTest() } [Fact] - public void RoundtripGenericClass_StandardResolverThrowsOnInitProperty() + public void RoundtripGenericClass_StandardResolverFallsBackOnInitProperty() { var person = new GenericPerson { Name = "bob" }; var options = StandardResolver.Options; - var exception = Assert.Throws(() => - { - byte[] msgpack = MessagePackSerializer.Serialize(person, options); - var deserialized = MessagePackSerializer.Deserialize>(msgpack, options); - ////Assert.Equal(person.Name, deserialized.Name); - }); - Assert.Contains("https://github.com/neuecc/MessagePack-CSharp/issues/1134", exception.ToString()); + byte[] msgpack = MessagePackSerializer.Serialize(person, options); + var deserialized = MessagePackSerializer.Deserialize>(msgpack, options); + Assert.Equal(person.Name, deserialized.Name); } [Fact] From ad90a5946e146c8580deb4decdcb9ea797f2716f Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 21 Dec 2020 22:38:22 -0700 Subject: [PATCH 039/161] Fix unity build --- .../Scripts/Tests/ShareTests/DynamicObjectResolverTests.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/DynamicObjectResolverTests.cs b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/DynamicObjectResolverTests.cs index 6ec968956..0375880cd 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/DynamicObjectResolverTests.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/DynamicObjectResolverTests.cs @@ -312,6 +312,8 @@ public void DefaultValueIntKeyStructWithExplicitConstructorSetPropertyTest() Assert.Equal(-98, instance.Prop2); } +#if !UNITY_2018_3_OR_NEWER + [Fact] public void RoundtripGenericClass_StandardResolverFallsBackOnInitProperty() { @@ -352,6 +354,8 @@ public void RoundtripGenericClass_AllowPrivateStandardResolver() Assert.Equal(person.Name, deserialized.Name); } +#endif + [MessagePackObject(true)] public class DefaultValueStringKeyClassWithoutExplicitConstructor { @@ -638,6 +642,7 @@ public class DerivedClass : BaseClass public string Name { get; set; } } +#if !UNITY_2018_3_OR_NEWER [MessagePackObject] public class Person { @@ -661,6 +666,7 @@ public class GenericPersonWithCtor [Key(0)] public string Name { get; init; } } +#endif } } From 8e869d9c8cecbbf8f63e508cfb79d7339eca347d Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sat, 30 Jan 2021 18:27:09 -0700 Subject: [PATCH 040/161] Add doc about how to consume CI builds --- doc/consume_ci.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 doc/consume_ci.md diff --git a/doc/consume_ci.md b/doc/consume_ci.md new file mode 100644 index 000000000..763f6f496 --- /dev/null +++ b/doc/consume_ci.md @@ -0,0 +1,17 @@ +# Testing fixes prior to release + +To help us test changes prior to their release to nuget.org, you can of course build from source. +An easier approach may be to consume the built nuget packages from our CI/PR feed. + +Add this feed to your nuget.config file: + +```xml + +``` + +Then you can add or update your package reference to some version recently built in our CI or PR build. +PR builds always include a `-gCOMMITID` version suffix. +CI builds lack this, but may include a standard pre-release identifier such as `-alpha`. + +If the change you seek is already merged, look for the latest version without the `-gCOMMITID` suffix. +If the change you seek is in an open PR, navigate to the PR build to find the version of the built package (it will be the build number). From 42a4b43a77746b47bb49d87b911588ab4d35bd00 Mon Sep 17 00:00:00 2001 From: hankovich Date: Sun, 31 Jan 2021 15:13:47 +0300 Subject: [PATCH 041/161] Implement #1176 --- .../MessagePack.AspNetCoreMvcFormatter.csproj | 2 +- .../MessagePackInputFormatter.cs | 9 ++++----- .../MessagePackOutputFormatter.cs | 18 +++--------------- .../AspNetCoreMvcFormatterTest.cs | 14 ++++++++++++++ 4 files changed, 22 insertions(+), 21 deletions(-) diff --git a/src/MessagePack.AspNetCoreMvcFormatter/MessagePack.AspNetCoreMvcFormatter.csproj b/src/MessagePack.AspNetCoreMvcFormatter/MessagePack.AspNetCoreMvcFormatter.csproj index bd8a06bba..d68ddacda 100644 --- a/src/MessagePack.AspNetCoreMvcFormatter/MessagePack.AspNetCoreMvcFormatter.csproj +++ b/src/MessagePack.AspNetCoreMvcFormatter/MessagePack.AspNetCoreMvcFormatter.csproj @@ -15,7 +15,7 @@ - + diff --git a/src/MessagePack.AspNetCoreMvcFormatter/MessagePackInputFormatter.cs b/src/MessagePack.AspNetCoreMvcFormatter/MessagePackInputFormatter.cs index 95edae0ef..59c49a998 100644 --- a/src/MessagePack.AspNetCoreMvcFormatter/MessagePackInputFormatter.cs +++ b/src/MessagePack.AspNetCoreMvcFormatter/MessagePackInputFormatter.cs @@ -6,7 +6,7 @@ namespace MessagePack.AspNetCoreMvcFormatter { - public class MessagePackInputFormatter : IInputFormatter + public class MessagePackInputFormatter : InputFormatter { private const string ContentType = "application/x-msgpack"; private readonly MessagePackSerializerOptions options; @@ -19,12 +19,11 @@ public MessagePackInputFormatter() public MessagePackInputFormatter(MessagePackSerializerOptions options) { this.options = options; - } - public bool CanRead(InputFormatterContext context) => - context.HttpContext.Request.ContentType == ContentType; + SupportedMediaTypes.Add(ContentType); + } - public async Task ReadAsync(InputFormatterContext context) + public override async Task ReadRequestBodyAsync(InputFormatterContext context) { var request = context.HttpContext.Request; var result = await MessagePackSerializer.DeserializeAsync(context.ModelType, request.Body, this.options, context.HttpContext.RequestAborted).ConfigureAwait(false); diff --git a/src/MessagePack.AspNetCoreMvcFormatter/MessagePackOutputFormatter.cs b/src/MessagePack.AspNetCoreMvcFormatter/MessagePackOutputFormatter.cs index ec9940c6d..738f0684c 100644 --- a/src/MessagePack.AspNetCoreMvcFormatter/MessagePackOutputFormatter.cs +++ b/src/MessagePack.AspNetCoreMvcFormatter/MessagePackOutputFormatter.cs @@ -3,11 +3,10 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc.Formatters; -using Microsoft.Extensions.Primitives; namespace MessagePack.AspNetCoreMvcFormatter { - public class MessagePackOutputFormatter : IOutputFormatter + public class MessagePackOutputFormatter : OutputFormatter { private const string ContentType = "application/x-msgpack"; private readonly MessagePackSerializerOptions options; @@ -20,23 +19,12 @@ public MessagePackOutputFormatter() public MessagePackOutputFormatter(MessagePackSerializerOptions options) { this.options = options; - } - - public bool CanWriteResult(OutputFormatterCanWriteContext context) - { - if (!context.ContentType.HasValue) - { - context.ContentType = new StringSegment(ContentType); - return true; - } - return context.ContentType.Value == ContentType; + SupportedMediaTypes.Add(ContentType); } - public Task WriteAsync(OutputFormatterWriteContext context) + public override Task WriteResponseBodyAsync(OutputFormatterWriteContext context) { - context.HttpContext.Response.ContentType = ContentType; - if (context.ObjectType == typeof(object)) { if (context.Object == null) diff --git a/tests/MessagePack.AspNetCoreMvcFormatter.Tests/AspNetCoreMvcFormatterTest.cs b/tests/MessagePack.AspNetCoreMvcFormatter.Tests/AspNetCoreMvcFormatterTest.cs index 55726235e..96b54b315 100644 --- a/tests/MessagePack.AspNetCoreMvcFormatter.Tests/AspNetCoreMvcFormatterTest.cs +++ b/tests/MessagePack.AspNetCoreMvcFormatter.Tests/AspNetCoreMvcFormatterTest.cs @@ -181,6 +181,20 @@ public void LZ4MessagePackFormatterCanNotRead() inputFormatter.CanRead(inputFormatterContext).IsFalse(); } + [Fact] + public void MessagePackOutputFormatterSupportsXMsgPack() + { + var outputFormatter = new MessagePackOutputFormatter(); + outputFormatter.SupportedMediaTypes.Is(MsgPackContentType); + } + + [Fact] + public void MessagePackInputFormatterSupportsXMsgPack() + { + var inputFormatter = new MessagePackInputFormatter(); + inputFormatter.SupportedMediaTypes.Is(MsgPackContentType); + } + /// /// JsonOutputFormatterTests.cs#L453. /// From b9e9b603f982e3c606cac34d57e85096886a5fc5 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 15 Feb 2021 14:16:11 -0700 Subject: [PATCH 042/161] Define SPAN_BUILTIN for net5.0 --- src/MessagePack/MessagePack.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MessagePack/MessagePack.csproj b/src/MessagePack/MessagePack.csproj index 2c97b903c..fb14f336e 100644 --- a/src/MessagePack/MessagePack.csproj +++ b/src/MessagePack/MessagePack.csproj @@ -4,7 +4,7 @@ netstandard2.0;netcoreapp2.1;net5.0 $(NoWarn);CS0649 True - $(DefineConstants);SPAN_BUILTIN + $(DefineConstants);SPAN_BUILTIN True 8.0 From 5819382089867463b1566af7b0861de18b74cb87 Mon Sep 17 00:00:00 2001 From: Alex Zavadsky Date: Tue, 16 Feb 2021 23:00:56 +0300 Subject: [PATCH 043/161] Enable serialization IEnumerable and IReadOnlyDictionary descendants that have constructor with relevant collection --- .../Formatters/CollectionFormatter.cs | 19 ++ .../Formatters/DictionaryFormatter.cs | 19 ++ .../Resolvers/DynamicGenericResolver.cs | 40 ++++ .../Tests/ShareTests/CollectionTest.cs | 194 ++++++++++++++++++ 4 files changed, 272 insertions(+) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/CollectionFormatter.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/CollectionFormatter.cs index 590719e4e..7a50ae1dc 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/CollectionFormatter.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/CollectionFormatter.cs @@ -464,6 +464,25 @@ protected override void Add(TCollection collection, int index, TElement value, M } } + public sealed class GenericEnumerableFormatter : CollectionFormatterBase + where TCollection : IEnumerable + { + protected override TElement[] Create(int count, MessagePackSerializerOptions options) + { + return new TElement[count]; + } + + protected override void Add(TElement[] collection, int index, TElement value, MessagePackSerializerOptions options) + { + collection[index] = value; + } + + protected override TCollection Complete(TElement[] intermediateCollection) + { + return (TCollection)Activator.CreateInstance(typeof(TCollection), intermediateCollection); + } + } + public sealed class LinkedListFormatter : CollectionFormatterBase, LinkedList.Enumerator, LinkedList> { protected override void Add(LinkedList collection, int index, T value, MessagePackSerializerOptions options) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/DictionaryFormatter.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/DictionaryFormatter.cs index 4b9347a14..727d9d1df 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/DictionaryFormatter.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/DictionaryFormatter.cs @@ -174,6 +174,25 @@ protected override TDictionary Create(int count, MessagePackSerializerOptions op } } + public sealed class GenericReadOnlyDictionaryFormatter : DictionaryFormatterBase, TDictionary> + where TDictionary : IReadOnlyDictionary + { + protected override void Add(Dictionary collection, int index, TKey key, TValue value, MessagePackSerializerOptions options) + { + collection.Add(key, value); + } + + protected override Dictionary Create(int count, MessagePackSerializerOptions options) + { + return new Dictionary(count, options.Security.GetEqualityComparer()); + } + + protected override TDictionary Complete(Dictionary intermediateCollection) + { + return (TDictionary)Activator.CreateInstance(typeof(TDictionary), intermediateCollection); + } + } + public sealed class InterfaceDictionaryFormatter : DictionaryFormatterBase, IDictionary> { protected override void Add(Dictionary collection, int index, TKey key, TValue value, MessagePackSerializerOptions options) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicGenericResolver.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicGenericResolver.cs index bb555243e..7f9f44517 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicGenericResolver.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicGenericResolver.cs @@ -313,6 +313,29 @@ internal static object GetFormatter(Type t) return CreateInstance(typeof(GenericDictionaryFormatter<,,>), new[] { keyType, valueType, t }); } + // generic readonly dictionary + var readOnlyDictionaryDef = ti.ImplementedInterfaces.FirstOrDefault(x => x.GetTypeInfo().IsConstructedGenericType() && x.GetGenericTypeDefinition() == typeof(IReadOnlyDictionary<,>)); + if (readOnlyDictionaryDef != null) + { + Type keyType = readOnlyDictionaryDef.GenericTypeArguments[0]; + Type valueType = readOnlyDictionaryDef.GenericTypeArguments[1]; + Type[] allowedParameterTypes = new Type[] + { + typeof(IDictionary<,>).MakeGenericType(keyType, valueType), + typeof(IReadOnlyDictionary<,>).MakeGenericType(keyType, valueType), + typeof(IEnumerable<>).MakeGenericType(typeof(KeyValuePair<,>).MakeGenericType(keyType, valueType)), + }; + foreach (var constructor in ti.DeclaredConstructors) + { + ParameterInfo[] parameters = constructor.GetParameters(); + if (parameters.Length == 1 && + allowedParameterTypes.Any(allowedType => allowedType.IsAssignableFrom(parameters[0].ParameterType))) + { + return CreateInstance(typeof(GenericReadOnlyDictionaryFormatter<,,>), new[] { keyType, valueType, t }); + } + } + } + // generic collection var collectionDef = ti.ImplementedInterfaces.FirstOrDefault(x => x.GetTypeInfo().IsConstructedGenericType() && x.GetGenericTypeDefinition() == typeof(ICollection<>)); if (collectionDef != null && ti.DeclaredConstructors.Any(x => x.GetParameters().Length == 0)) @@ -320,6 +343,23 @@ internal static object GetFormatter(Type t) Type elemType = collectionDef.GenericTypeArguments[0]; return CreateInstance(typeof(GenericCollectionFormatter<,>), new[] { elemType, t }); } + + // generic IEnumerable collection + // looking for combination of IEnumerable and constructor that takes + // enumeration of the same type + foreach (var enumerableCollectionDef in ti.ImplementedInterfaces.Where(x => x.GetTypeInfo().IsConstructedGenericType() && x.GetGenericTypeDefinition() == typeof(IEnumerable<>))) + { + Type elemType = enumerableCollectionDef.GenericTypeArguments[0]; + Type paramInterface = typeof(IEnumerable<>).MakeGenericType(elemType); + foreach (var constructor in ti.DeclaredConstructors) + { + var parameters = constructor.GetParameters(); + if (parameters.Length == 1 && paramInterface.IsAssignableFrom(parameters[0].ParameterType)) + { + return CreateInstance(typeof(GenericEnumerableFormatter<,>), new[] { elemType, t }); + } + } + } } return null; diff --git a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/CollectionTest.cs b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/CollectionTest.cs index 121806e32..fce5184fc 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/CollectionTest.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/CollectionTest.cs @@ -251,6 +251,41 @@ public void CustomGenericInterfaceCollectionTest() } } + [Fact] + public void CustomGenericEnumerableCollectionTest() + { + { + var xs = new ImplGenericEnumerable(); + xs.Add(1); + xs.Add(2); + xs.Add(3); + + this.Convert(xs).Is(1, 2, 3); + } + } + + [Fact] + public void CustomGenericInterfaceReadOnlyCollectionTest() + { + { + var xs = new ImplGenericReadonlyCollection(); + xs.Add(1); + xs.Add(2); + xs.Add(3); + + this.Convert(xs).Is(1, 2, 3); + } + + { + var xs = new ImplGenericGenericReadOnlyCollection(); + xs.Add(1); + xs.Add(2); + xs.Add(3); + + this.Convert(xs).Is(1, 2, 3); + } + } + [Fact] public void CustomGenericDictionaryTest() { @@ -262,6 +297,18 @@ public void CustomGenericDictionaryTest() d2["foo"].Is(10); d2["bar"].Is(20); } + + [Fact] + public void CustomGenericReadOnlyDictionaryTest() + { + var d = new ImplReadonlyDictionary(); + d.Add("foo", 10); + d.Add("bar", 20); + + var d2 = this.Convert(d); + d2["foo"].Is(10); + d2["bar"].Is(20); + } } public class ImplNonGenericList : IList @@ -429,6 +476,38 @@ IEnumerator IEnumerable.GetEnumerator() } } + public class ImplGenericGenericReadOnlyCollection : IReadOnlyCollection + { + private readonly ICollection inner; + + public ImplGenericGenericReadOnlyCollection() + { + this.inner = new List(); + } + + public ImplGenericGenericReadOnlyCollection(IEnumerable items) + { + this.inner = new List(items); + } + + public IEnumerator GetEnumerator() + { + return inner.GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return ((IEnumerable)inner).GetEnumerator(); + } + + public int Count => inner.Count; + + public void Add(T item) + { + inner.Add(item); + } + } + public class ImplDictionary : IDictionary { private readonly Dictionary inner; @@ -503,4 +582,119 @@ IEnumerator IEnumerable.GetEnumerator() return ((IDictionary)inner).GetEnumerator(); } } + + public class ImplGenericReadonlyCollection : IReadOnlyCollection + { + private readonly ICollection inner; + + public ImplGenericReadonlyCollection() + { + this.inner = new List(); + } + + public ImplGenericReadonlyCollection(IEnumerable items) + { + this.inner = new List(items); + } + + public int Count => inner.Count; + + public IEnumerator GetEnumerator() + { + return inner.GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return inner.GetEnumerator(); + } + + public void Add(int item) + { + inner.Add(item); + } + } + + public class ImplReadonlyDictionary : IReadOnlyDictionary + { + private readonly Dictionary inner; + + public ImplReadonlyDictionary() + { + this.inner = new Dictionary(); + } + + public ImplReadonlyDictionary(IDictionary inner) + { + this.inner = new Dictionary(inner); + } + + public IEnumerator> GetEnumerator() + { + return inner.GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return ((IEnumerable)inner).GetEnumerator(); + } + + public int Count => inner.Count; + + public bool ContainsKey(string key) + { + return inner.ContainsKey(key); + } + + public bool TryGetValue(string key, out int value) + { + return inner.TryGetValue(key, out value); + } + + public int this[string key] => inner[key]; + + public IEnumerable Keys => inner.Keys; + + public IEnumerable Values => inner.Values; + + public void Add(string key, int value) + { + inner.Add(key, value); + } + } + + public class ImplGenericEnumerable : IEnumerable + { + private readonly List inner = new List(); + + public ImplGenericEnumerable() + { + } + + public ImplGenericEnumerable(IEnumerable values) + { + } + + public ImplGenericEnumerable(IEnumerable values) + { + inner.AddRange(values); + } + + public ImplGenericEnumerable(ICollection values) + { + inner.AddRange(values); + } + + public IEnumerator GetEnumerator() + { + return inner.GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return ((IEnumerable)inner).GetEnumerator(); + } + + public void Add(int item) => inner.Add(item); + } } From bd0c26a24ad1f463ae2ff589f4764f89884e0d52 Mon Sep 17 00:00:00 2001 From: Alex Zavadsky Date: Mon, 22 Feb 2021 18:02:20 +0300 Subject: [PATCH 044/161] Add new classes to PublicAPI --- src/MessagePack/PublicAPI.Unshipped.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/MessagePack/PublicAPI.Unshipped.txt b/src/MessagePack/PublicAPI.Unshipped.txt index d31186945..453d06bca 100644 --- a/src/MessagePack/PublicAPI.Unshipped.txt +++ b/src/MessagePack/PublicAPI.Unshipped.txt @@ -14,6 +14,10 @@ MessagePack.Formatters.ForceTypelessFormatter MessagePack.Formatters.ForceTypelessFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> T MessagePack.Formatters.ForceTypelessFormatter.ForceTypelessFormatter() -> void MessagePack.Formatters.ForceTypelessFormatter.Serialize(ref MessagePack.MessagePackWriter writer, T value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.GenericEnumerableFormatter +MessagePack.Formatters.GenericEnumerableFormatter.GenericEnumerableFormatter() -> void +MessagePack.Formatters.GenericReadOnlyDictionaryFormatter +MessagePack.Formatters.GenericReadOnlyDictionaryFormatter.GenericReadOnlyDictionaryFormatter() -> void MessagePack.Formatters.MemoryFormatter MessagePack.Formatters.MemoryFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Memory MessagePack.Formatters.MemoryFormatter.MemoryFormatter() -> void From e2beaadaa97ae3a53ce3f1a1103ee510cdd2a3f2 Mon Sep 17 00:00:00 2001 From: "g.shinohara" Date: Wed, 24 Feb 2021 18:43:27 +0900 Subject: [PATCH 045/161] rename TempProject -> TempTargetProject in GeneratorTest --- .../GenerateEnumFormatterTest.cs | 2 +- .../GenerateGenericsFormatterTest.cs | 28 +++++++++---------- .../GenerateMessagePackFormatterAttrTest.cs | 2 +- .../TemporaryProjectWorkarea.cs | 23 ++++++++------- 4 files changed, 29 insertions(+), 26 deletions(-) diff --git a/tests/MessagePack.Generator.Tests/GenerateEnumFormatterTest.cs b/tests/MessagePack.Generator.Tests/GenerateEnumFormatterTest.cs index ac735c3e3..2ad23fcbe 100644 --- a/tests/MessagePack.Generator.Tests/GenerateEnumFormatterTest.cs +++ b/tests/MessagePack.Generator.Tests/GenerateEnumFormatterTest.cs @@ -43,7 +43,7 @@ public enum MyEnum } } "; - tempWorkarea.AddFileToProject("MyMessagePackObject.cs", contents); + tempWorkarea.AddFileToTargetProject("MyMessagePackObject.cs", contents); var compiler = new MessagePackCompiler.CodeGenerator(testOutputHelper.WriteLine, CancellationToken.None); await compiler.GenerateFileAsync( diff --git a/tests/MessagePack.Generator.Tests/GenerateGenericsFormatterTest.cs b/tests/MessagePack.Generator.Tests/GenerateGenericsFormatterTest.cs index 05040322a..f906f93e0 100644 --- a/tests/MessagePack.Generator.Tests/GenerateGenericsFormatterTest.cs +++ b/tests/MessagePack.Generator.Tests/GenerateGenericsFormatterTest.cs @@ -53,7 +53,7 @@ public enum MyEnum } } "; - tempWorkarea.AddFileToProject("MyMessagePackObject.cs", contents); + tempWorkarea.AddFileToTargetProject("MyMessagePackObject.cs", contents); var compiler = new MessagePackCompiler.CodeGenerator(testOutputHelper.WriteLine, CancellationToken.None); await compiler.GenerateFileAsync( @@ -100,7 +100,7 @@ public class MyObject } } "; - tempWorkarea.AddFileToProject("MyMessagePackObject.cs", contents); + tempWorkarea.AddFileToTargetProject("MyMessagePackObject.cs", contents); var compiler = new MessagePackCompiler.CodeGenerator(testOutputHelper.WriteLine, CancellationToken.None); await compiler.GenerateFileAsync( @@ -148,7 +148,7 @@ public class Wrapper } } "; - tempWorkarea.AddFileToProject("MyMessagePackObject.cs", contents); + tempWorkarea.AddFileToTargetProject("MyMessagePackObject.cs", contents); var compiler = new MessagePackCompiler.CodeGenerator(testOutputHelper.WriteLine, CancellationToken.None); await compiler.GenerateFileAsync( @@ -213,7 +213,7 @@ public class MyInnerGenericObject } } "; - tempWorkarea.AddFileToProject("MyMessagePackObject.cs", contents); + tempWorkarea.AddFileToTargetProject("MyMessagePackObject.cs", contents); var compiler = new MessagePackCompiler.CodeGenerator(testOutputHelper.WriteLine, CancellationToken.None); await compiler.GenerateFileAsync( @@ -297,7 +297,7 @@ public class MyInnerGenericObject } } "; - tempWorkarea.AddFileToProject("MyMessagePackObject.cs", contents); + tempWorkarea.AddFileToTargetProject("MyMessagePackObject.cs", contents); var compiler = new MessagePackCompiler.CodeGenerator(testOutputHelper.WriteLine, CancellationToken.None); await compiler.GenerateFileAsync( @@ -365,7 +365,7 @@ public class MyGenericObject } } "; - tempWorkarea.AddFileToProject("MyMessagePackObject.cs", contents); + tempWorkarea.AddFileToTargetProject("MyMessagePackObject.cs", contents); var compiler = new MessagePackCompiler.CodeGenerator(testOutputHelper.WriteLine, CancellationToken.None); await compiler.GenerateFileAsync( @@ -434,7 +434,7 @@ public class MyObjectNested } } "; - tempWorkarea.AddFileToProject("MyMessagePackObject.cs", contents); + tempWorkarea.AddFileToTargetProject("MyMessagePackObject.cs", contents); var compiler = new MessagePackCompiler.CodeGenerator(testOutputHelper.WriteLine, CancellationToken.None); await compiler.GenerateFileAsync( @@ -503,7 +503,7 @@ public class MyObjectNested } } "; - tempWorkarea.AddFileToProject("MyMessagePackObject.cs", contents); + tempWorkarea.AddFileToTargetProject("MyMessagePackObject.cs", contents); var compiler = new MessagePackCompiler.CodeGenerator(testOutputHelper.WriteLine, CancellationToken.None); await compiler.GenerateFileAsync( @@ -558,7 +558,7 @@ public class MyGenericObject } } "; - tempWorkarea.AddFileToProject("MyMessagePackObject.cs", contents); + tempWorkarea.AddFileToTargetProject("MyMessagePackObject.cs", contents); var compiler = new MessagePackCompiler.CodeGenerator(testOutputHelper.WriteLine, CancellationToken.None); await compiler.GenerateFileAsync( @@ -607,7 +607,7 @@ public class MyGenericObject } } "; - tempWorkarea.AddFileToProject("MyMessagePackObject.cs", contents); + tempWorkarea.AddFileToTargetProject("MyMessagePackObject.cs", contents); var compiler = new MessagePackCompiler.CodeGenerator(testOutputHelper.WriteLine, CancellationToken.None); await compiler.GenerateFileAsync( @@ -664,7 +664,7 @@ public class MyGenericClass {} public interface IMyInterface {} } "; - tempWorkarea.AddFileToProject("MyMessagePackObject.cs", contents); + tempWorkarea.AddFileToTargetProject("MyMessagePackObject.cs", contents); var compiler = new MessagePackCompiler.CodeGenerator(testOutputHelper.WriteLine, CancellationToken.None); await compiler.GenerateFileAsync( @@ -722,7 +722,7 @@ public class MyGenericObject } } "; - tempWorkarea.AddFileToProject("MyMessagePackObject.cs", contents); + tempWorkarea.AddFileToTargetProject("MyMessagePackObject.cs", contents); var compiler = new MessagePackCompiler.CodeGenerator(testOutputHelper.WriteLine, CancellationToken.None); await compiler.GenerateFileAsync( @@ -781,7 +781,7 @@ public class MyGenericObject } } "; - tempWorkarea.AddFileToProject("MyMessagePackObject.cs", contents); + tempWorkarea.AddFileToTargetProject("MyMessagePackObject.cs", contents); var compiler = new MessagePackCompiler.CodeGenerator(testOutputHelper.WriteLine, CancellationToken.None); await compiler.GenerateFileAsync( @@ -855,7 +855,7 @@ public class MyGenericObject } } "; - tempWorkarea.AddFileToProject("MyMessagePackObject.cs", contents); + tempWorkarea.AddFileToTargetProject("MyMessagePackObject.cs", contents); var compiler = new MessagePackCompiler.CodeGenerator(testOutputHelper.WriteLine, CancellationToken.None); await compiler.GenerateFileAsync( diff --git a/tests/MessagePack.Generator.Tests/GenerateMessagePackFormatterAttrTest.cs b/tests/MessagePack.Generator.Tests/GenerateMessagePackFormatterAttrTest.cs index 44a778f1a..38e08f67b 100644 --- a/tests/MessagePack.Generator.Tests/GenerateMessagePackFormatterAttrTest.cs +++ b/tests/MessagePack.Generator.Tests/GenerateMessagePackFormatterAttrTest.cs @@ -56,7 +56,7 @@ public class Bar } } "; - tempWorkarea.AddFileToProject("MyMessagePackObject.cs", contents); + tempWorkarea.AddFileToTargetProject("MyMessagePackObject.cs", contents); var compiler = new MessagePackCompiler.CodeGenerator(testOutputHelper.WriteLine, CancellationToken.None); diff --git a/tests/MessagePack.Generator.Tests/TemporaryProjectWorkarea.cs b/tests/MessagePack.Generator.Tests/TemporaryProjectWorkarea.cs index f32776659..39c2b1176 100644 --- a/tests/MessagePack.Generator.Tests/TemporaryProjectWorkarea.cs +++ b/tests/MessagePack.Generator.Tests/TemporaryProjectWorkarea.cs @@ -20,12 +20,15 @@ namespace MessagePack.Generator.Tests public class TemporaryProjectWorkarea : IDisposable { private readonly string tempDirPath; - private readonly string csprojFileName = "TempProject.csproj"; + private readonly string targetCsprojFileName = "TempTargetProject.csproj"; private readonly bool cleanOnDisposing; - public string CsProjectPath { get; } + /// + /// Generator target csproj + /// + public string TargetCsProjectPath { get; } - public string ProjectDirectory { get; } + public string TargetProjectDirectory { get; } public string OutputDirectory { get; } @@ -39,17 +42,17 @@ private TemporaryProjectWorkarea(bool cleanOnDisposing) this.cleanOnDisposing = cleanOnDisposing; this.tempDirPath = Path.Combine(Path.GetTempPath(), $"MessagePack.Generator.Tests-{Guid.NewGuid()}"); - ProjectDirectory = Path.Combine(tempDirPath, "Project"); + TargetProjectDirectory = Path.Combine(tempDirPath, "TargetProject"); OutputDirectory = Path.Combine(tempDirPath, "Output"); - Directory.CreateDirectory(ProjectDirectory); + Directory.CreateDirectory(TargetProjectDirectory); Directory.CreateDirectory(OutputDirectory); var solutionRootDir = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "../../../..")); var messagePackProjectDir = Path.Combine(solutionRootDir, "src/MessagePack/MessagePack.csproj"); var annotationsProjectDir = Path.Combine(solutionRootDir, "src/MessagePack.Annotations/MessagePack.Annotations.csproj"); - CsProjectPath = Path.Combine(ProjectDirectory, csprojFileName); + TargetCsProjectPath = Path.Combine(TargetProjectDirectory, targetCsprojFileName); var csprojContents = @" @@ -62,12 +65,12 @@ private TemporaryProjectWorkarea(bool cleanOnDisposing) "; - AddFileToProject(csprojFileName, csprojContents); + AddFileToTargetProject(targetCsprojFileName, csprojContents); } - public void AddFileToProject(string fileName, string contents) + public void AddFileToTargetProject(string fileName, string contents) { - File.WriteAllText(Path.Combine(ProjectDirectory, fileName), contents.Trim()); + File.WriteAllText(Path.Combine(TargetProjectDirectory, fileName), contents.Trim()); } public OutputCompilation GetOutputCompilation() @@ -76,7 +79,7 @@ public OutputCompilation GetOutputCompilation() var compilation = CSharpCompilation.Create(Guid.NewGuid().ToString()) .AddSyntaxTrees( - Directory.EnumerateFiles(ProjectDirectory, "*.cs", SearchOption.AllDirectories) + Directory.EnumerateFiles(TargetProjectDirectory, "*.cs", SearchOption.AllDirectories) .Concat(Directory.EnumerateFiles(OutputDirectory, "*.cs", SearchOption.AllDirectories)) .Select(x => CSharpSyntaxTree.ParseText(File.ReadAllText(x), CSharpParseOptions.Default, x))) .AddReferences(MetadataReference.CreateFromFile(Path.Combine(refAsmDir, "System.Private.CoreLib.dll"))) From b75bdd23557a7484a0bccce3dbdd3db22a97cf7f Mon Sep 17 00:00:00 2001 From: "g.shinohara" Date: Wed, 24 Feb 2021 18:44:10 +0900 Subject: [PATCH 046/161] Add TempReferencedProject in GeneratorTest --- .../TemporaryProjectWorkarea.cs | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/tests/MessagePack.Generator.Tests/TemporaryProjectWorkarea.cs b/tests/MessagePack.Generator.Tests/TemporaryProjectWorkarea.cs index 39c2b1176..9e002fab4 100644 --- a/tests/MessagePack.Generator.Tests/TemporaryProjectWorkarea.cs +++ b/tests/MessagePack.Generator.Tests/TemporaryProjectWorkarea.cs @@ -21,6 +21,7 @@ public class TemporaryProjectWorkarea : IDisposable { private readonly string tempDirPath; private readonly string targetCsprojFileName = "TempTargetProject.csproj"; + private readonly string referencedCsprojFileName = "TempReferencedProject.csproj"; private readonly bool cleanOnDisposing; /// @@ -28,8 +29,15 @@ public class TemporaryProjectWorkarea : IDisposable /// public string TargetCsProjectPath { get; } + /// + /// Referenced from csproj + /// + public string ReferencedCsProjectPath { get; } + public string TargetProjectDirectory { get; } + public string ReferencedProjectDirectory { get; } + public string OutputDirectory { get; } public static TemporaryProjectWorkarea Create(bool cleanOnDisposing = true) @@ -43,15 +51,31 @@ private TemporaryProjectWorkarea(bool cleanOnDisposing) this.tempDirPath = Path.Combine(Path.GetTempPath(), $"MessagePack.Generator.Tests-{Guid.NewGuid()}"); TargetProjectDirectory = Path.Combine(tempDirPath, "TargetProject"); + ReferencedProjectDirectory = Path.Combine(tempDirPath, "ReferencedProject"); OutputDirectory = Path.Combine(tempDirPath, "Output"); Directory.CreateDirectory(TargetProjectDirectory); + Directory.CreateDirectory(ReferencedProjectDirectory); Directory.CreateDirectory(OutputDirectory); var solutionRootDir = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "../../../..")); var messagePackProjectDir = Path.Combine(solutionRootDir, "src/MessagePack/MessagePack.csproj"); var annotationsProjectDir = Path.Combine(solutionRootDir, "src/MessagePack.Annotations/MessagePack.Annotations.csproj"); + ReferencedCsProjectPath = Path.Combine(ReferencedProjectDirectory, referencedCsprojFileName); + var referencedCsprojContents = @" + + + netstandard2.0 + + + + + + +"; + AddFileToReferencedProject(referencedCsprojFileName, referencedCsprojContents); + TargetCsProjectPath = Path.Combine(TargetProjectDirectory, targetCsprojFileName); var csprojContents = @" @@ -62,26 +86,56 @@ private TemporaryProjectWorkarea(bool cleanOnDisposing) + "; AddFileToTargetProject(targetCsprojFileName, csprojContents); } + /// + /// Add file to Generator target project. + /// public void AddFileToTargetProject(string fileName, string contents) { File.WriteAllText(Path.Combine(TargetProjectDirectory, fileName), contents.Trim()); } + /// + /// Add file to project, referenced by Generator target project. + /// + public void AddFileToReferencedProject(string fileName, string contents) + { + File.WriteAllText(Path.Combine(ReferencedProjectDirectory, fileName), contents.Trim()); + } + public OutputCompilation GetOutputCompilation() { var refAsmDir = Path.GetDirectoryName(typeof(object).Assembly.Location); + var referenceCompilation = CSharpCompilation.Create(Guid.NewGuid().ToString()) + .AddSyntaxTrees( + Directory.EnumerateFiles(ReferencedProjectDirectory, "*.cs", SearchOption.AllDirectories) + .Select(x => CSharpSyntaxTree.ParseText(File.ReadAllText(x), CSharpParseOptions.Default, x))) + .AddReferences(MetadataReference.CreateFromFile(Path.Combine(refAsmDir, "System.Private.CoreLib.dll"))) + .AddReferences(MetadataReference.CreateFromFile(Path.Combine(refAsmDir, "System.Runtime.Extensions.dll"))) + .AddReferences(MetadataReference.CreateFromFile(Path.Combine(refAsmDir, "System.Collections.dll"))) + .AddReferences(MetadataReference.CreateFromFile(Path.Combine(refAsmDir, "System.Linq.dll"))) + .AddReferences(MetadataReference.CreateFromFile(Path.Combine(refAsmDir, "System.Console.dll"))) + .AddReferences(MetadataReference.CreateFromFile(Path.Combine(refAsmDir, "System.Runtime.dll"))) + .AddReferences(MetadataReference.CreateFromFile(Path.Combine(refAsmDir, "System.Memory.dll"))) + .AddReferences(MetadataReference.CreateFromFile(Path.Combine(refAsmDir, "netstandard.dll"))) + .AddReferences(MetadataReference.CreateFromFile(typeof(object).Assembly.Location)) + .AddReferences(MetadataReference.CreateFromFile(typeof(MessagePack.MessagePackObjectAttribute).Assembly.Location)) + .AddReferences(MetadataReference.CreateFromFile(typeof(IMessagePackFormatter<>).Assembly.Location)) + .WithOptions(new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary)); + var compilation = CSharpCompilation.Create(Guid.NewGuid().ToString()) .AddSyntaxTrees( Directory.EnumerateFiles(TargetProjectDirectory, "*.cs", SearchOption.AllDirectories) .Concat(Directory.EnumerateFiles(OutputDirectory, "*.cs", SearchOption.AllDirectories)) .Select(x => CSharpSyntaxTree.ParseText(File.ReadAllText(x), CSharpParseOptions.Default, x))) + .AddReferences(referenceCompilation.ToMetadataReference()) .AddReferences(MetadataReference.CreateFromFile(Path.Combine(refAsmDir, "System.Private.CoreLib.dll"))) .AddReferences(MetadataReference.CreateFromFile(Path.Combine(refAsmDir, "System.Runtime.Extensions.dll"))) .AddReferences(MetadataReference.CreateFromFile(Path.Combine(refAsmDir, "System.Collections.dll"))) From e4a7acb4f7b30d5c0cbf9fb8fde68a24f1c5badd Mon Sep 17 00:00:00 2001 From: "g.shinohara" Date: Wed, 24 Feb 2021 20:16:01 +0900 Subject: [PATCH 047/161] add Test for #1111 GenericType referenced in project --- .../GenerateGenericsFormatterTest.cs | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/tests/MessagePack.Generator.Tests/GenerateGenericsFormatterTest.cs b/tests/MessagePack.Generator.Tests/GenerateGenericsFormatterTest.cs index f906f93e0..675817fcc 100644 --- a/tests/MessagePack.Generator.Tests/GenerateGenericsFormatterTest.cs +++ b/tests/MessagePack.Generator.Tests/GenerateGenericsFormatterTest.cs @@ -883,5 +883,82 @@ await compiler.GenerateFileAsync( formatterType.TypeParameters[1].ConstraintTypes.Should().BeEmpty(); formatterType.TypeParameters[1].ReferenceTypeConstraintNullableAnnotation.Should().Be(NullableAnnotation.None); } + + [Theory] + [InlineData(true)] + [InlineData(false)] + public async Task Generics_Defined_In_ReferencedProject(bool isSingleFileOutput) + { + using var tempWorkarea = TemporaryProjectWorkarea.Create(); + var defineContents = @" +using System; +using System.Collections.Generic; +using MessagePack; + +namespace TempProject +{ + [MessagePackObject] + public class MyGenericObject + { + [Key(0)] + public T Content { get; set; } + } +} + "; + tempWorkarea.AddFileToReferencedProject("MyGenericObject.cs", defineContents); + + var usageContents = @" +using System; +using System.Collections.Generic; +using MessagePack; + +namespace TempProject +{ + [MessagePackObject] + public class MyObject + { + [Key(0)] + public MyGenericObject Value { get; set; } + } + + [MessagePackObject] + public class MyObjectNested + { + [Key(0)] + public MyGenericObject> Value { get; set; } + } +} + "; + tempWorkarea.AddFileToTargetProject("MyObject.cs", usageContents); + + var compiler = new MessagePackCompiler.CodeGenerator(testOutputHelper.WriteLine, CancellationToken.None); + await compiler.GenerateFileAsync( + tempWorkarea.GetOutputCompilation().Compilation, + isSingleFileOutput ? Path.Combine(tempWorkarea.OutputDirectory, "Generated.cs") : tempWorkarea.OutputDirectory, + "TempProjectResolver", + "TempProject.Generated", + false, + string.Empty, + Array.Empty()); + + var compilation = tempWorkarea.GetOutputCompilation(); + compilation.Compilation.GetDiagnostics().Where(x => x.WarningLevel == 0).Should().BeEmpty(); + + var symbols = compilation.GetNamedTypeSymbolsFromGenerated(); + + var types = symbols.Select(x => x.ToDisplayString()).ToArray(); + types.Should().Contain("TempProject.Generated.Formatters.TempProject.MyGenericObjectFormatter"); + + var formatters = symbols.SelectMany(x => x.Interfaces).Select(x => x.ToDisplayString()).ToArray(); + formatters.Should().Contain("MessagePack.Formatters.IMessagePackFormatter>"); + + compilation.GetResolverKnownFormatterTypes().Should().Contain(new[] + { + "TempProject.Generated.Formatters.TempProject.MyGenericObjectFormatter>", + "TempProject.Generated.Formatters.TempProject.MyGenericObjectFormatter", + "TempProject.Generated.Formatters.TempProject.MyObjectFormatter", + "TempProject.Generated.Formatters.TempProject.MyObjectNestedFormatter", + }); + } } } From 29d74499dc9c59ed2f222d53a5d82cfedbdb1aed Mon Sep 17 00:00:00 2001 From: "g.shinohara" Date: Wed, 24 Feb 2021 20:16:18 +0900 Subject: [PATCH 048/161] Fix #1111 GenericType referenced in project --- src/MessagePack.GeneratorCore/CodeAnalysis/TypeCollector.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/MessagePack.GeneratorCore/CodeAnalysis/TypeCollector.cs b/src/MessagePack.GeneratorCore/CodeAnalysis/TypeCollector.cs index b65a9f7d3..7f527785a 100644 --- a/src/MessagePack.GeneratorCore/CodeAnalysis/TypeCollector.cs +++ b/src/MessagePack.GeneratorCore/CodeAnalysis/TypeCollector.cs @@ -593,6 +593,9 @@ private void CollectGeneric(INamedTypeSymbol type) // NOTE: It is used to register formatters from nested generic type. // However, closed generic types such as `Foo` are not registered as a formatter. GetObjectInfo(type); + + // Collect generic type definition, that is not collected when it is defined outside target project. + CollectCore(type.OriginalDefinition); } // Collect substituted types for the type parameters (e.g. Bar in Foo) From c5cffb7785c9774597c01c2fed71d41ac4068478 Mon Sep 17 00:00:00 2001 From: "g.shinohara" Date: Thu, 25 Feb 2021 13:42:17 +0900 Subject: [PATCH 049/161] fix CI build error. --- tests/MessagePack.Generator.Tests/TemporaryProjectWorkarea.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/MessagePack.Generator.Tests/TemporaryProjectWorkarea.cs b/tests/MessagePack.Generator.Tests/TemporaryProjectWorkarea.cs index 9e002fab4..42791bfd9 100644 --- a/tests/MessagePack.Generator.Tests/TemporaryProjectWorkarea.cs +++ b/tests/MessagePack.Generator.Tests/TemporaryProjectWorkarea.cs @@ -25,12 +25,12 @@ public class TemporaryProjectWorkarea : IDisposable private readonly bool cleanOnDisposing; /// - /// Generator target csproj + /// Gets Generator target csproj file path. /// public string TargetCsProjectPath { get; } /// - /// Referenced from csproj + /// Gets csproj file path Referenced from TargetProject. /// public string ReferencedCsProjectPath { get; } From 6f42a8669e2768debef0e508c10cb5f199d7efd5 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sat, 6 Mar 2021 11:30:56 -0700 Subject: [PATCH 050/161] Remove assembly version info from generic type arguments Fixes #1190 --- .../Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs index 8eb9835ef..ee7f8437d 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs @@ -15,7 +15,7 @@ namespace MessagePack public class MessagePackSerializerOptions { // see:http://msdn.microsoft.com/en-us/library/w3f99sx1.aspx - internal static readonly Regex AssemblyNameVersionSelectorRegex = new Regex(@", Version=\d+.\d+.\d+.\d+, Culture=[\w-]+, PublicKeyToken=(?:null|[a-f0-9]{16})$", RegexOptions.Compiled); + internal static readonly Regex AssemblyNameVersionSelectorRegex = new Regex(@", Version=\d+.\d+.\d+.\d+, Culture=[\w-]+, PublicKeyToken=(?:null|[a-f0-9]{16})", RegexOptions.Compiled); /// /// A collection of known dangerous types that are not expected in a typical MessagePack stream, From 95326ac30cc50f06fa146808e5fbd482719113fb Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sat, 6 Mar 2021 08:25:54 -0700 Subject: [PATCH 051/161] Make cctor defer Reflection that fails in AOT This makes it possible that the reflection is never called. In AOT environments where it may still be called (just later) then this too can be avoided in the app by overriding the `MessagePackSecurity.GetHashCollisionResistantEqualityComparer` method and implementing it such that when `T` is `object` it can do something other than invoking the reflection-invoking `ObjectFallbackEqualityComparer` class. Fixes #1168 --- .../Assets/Scripts/MessagePack/MessagePackSecurity.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSecurity.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSecurity.cs index c362f9157..2136d1250 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSecurity.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSecurity.cs @@ -255,7 +255,7 @@ private class CollisionResistantHasher : IEqualityComparer, IEqualityCompa /// private class ObjectFallbackEqualityComparer : IEqualityComparer, IEqualityComparer { - private static readonly MethodInfo GetHashCollisionResistantEqualityComparerOpenGenericMethod = typeof(MessagePackSecurity).GetTypeInfo().DeclaredMethods.Single(m => m.Name == nameof(MessagePackSecurity.GetHashCollisionResistantEqualityComparer) && m.IsGenericMethod); + private static readonly Lazy GetHashCollisionResistantEqualityComparerOpenGenericMethod = new Lazy(() => typeof(MessagePackSecurity).GetTypeInfo().DeclaredMethods.Single(m => m.Name == nameof(MessagePackSecurity.GetHashCollisionResistantEqualityComparer) && m.IsGenericMethod)); private readonly MessagePackSecurity security; private readonly ThreadsafeTypeKeyHashTable equalityComparerCache = new ThreadsafeTypeKeyHashTable(); @@ -288,7 +288,7 @@ public int GetHashCode(object value) { try { - equalityComparer = (IEqualityComparer)GetHashCollisionResistantEqualityComparerOpenGenericMethod.MakeGenericMethod(valueType).Invoke(this.security, Array.Empty()); + equalityComparer = (IEqualityComparer)GetHashCollisionResistantEqualityComparerOpenGenericMethod.Value.MakeGenericMethod(valueType).Invoke(this.security, Array.Empty()); } catch (TargetInvocationException ex) { From 968797bec4e1715a5551f6ff7b54a3b7e61e2979 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sat, 6 Mar 2021 11:51:42 -0700 Subject: [PATCH 052/161] Update PublicAPI analyzers --- src/MessagePack/MessagePack.csproj | 2 +- src/MessagePack/net5.0/PublicAPI.Unshipped.txt | 4 ++++ src/MessagePack/netcoreapp2.1/PublicAPI.Unshipped.txt | 4 ++++ src/MessagePack/netcoreapp3.1/PublicAPI.Unshipped.txt | 4 ++++ src/MessagePack/netstandard2.0/PublicAPI.Unshipped.txt | 4 ++++ 5 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/MessagePack/MessagePack.csproj b/src/MessagePack/MessagePack.csproj index 597aafbd8..7a2df01dd 100644 --- a/src/MessagePack/MessagePack.csproj +++ b/src/MessagePack/MessagePack.csproj @@ -33,7 +33,7 @@ - + diff --git a/src/MessagePack/net5.0/PublicAPI.Unshipped.txt b/src/MessagePack/net5.0/PublicAPI.Unshipped.txt index 5e0d2fd96..2885c6eea 100644 --- a/src/MessagePack/net5.0/PublicAPI.Unshipped.txt +++ b/src/MessagePack/net5.0/PublicAPI.Unshipped.txt @@ -1,3 +1,5 @@ +MessagePack.ExtensionHeader.ExtensionHeader() -> void +MessagePack.ExtensionResult.ExtensionResult() -> void MessagePack.FormatterNotRegisteredException.FormatterNotRegisteredException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) -> void MessagePack.Formatters.ByteMemoryFormatter MessagePack.Formatters.ByteMemoryFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Memory @@ -76,9 +78,11 @@ MessagePack.ImmutableCollection.InterfaceImmutableSetFormatter MessagePack.ImmutableCollection.InterfaceImmutableSetFormatter.InterfaceImmutableSetFormatter() -> void MessagePack.ImmutableCollection.InterfaceImmutableStackFormatter MessagePack.ImmutableCollection.InterfaceImmutableStackFormatter.InterfaceImmutableStackFormatter() -> void +MessagePack.MessagePackReader.MessagePackReader() -> void MessagePack.MessagePackSerializerOptions.SequencePool.get -> MessagePack.SequencePool MessagePack.MessagePackSerializerOptions.WithPool(MessagePack.SequencePool pool) -> MessagePack.MessagePackSerializerOptions MessagePack.MessagePackStreamReader.MessagePackStreamReader(System.IO.Stream stream, bool leaveOpen, MessagePack.SequencePool sequencePool) -> void +MessagePack.MessagePackWriter.MessagePackWriter() -> void MessagePack.Resolvers.ExpandoObjectResolver MessagePack.SequencePool MessagePack.SequencePool.SequencePool() -> void diff --git a/src/MessagePack/netcoreapp2.1/PublicAPI.Unshipped.txt b/src/MessagePack/netcoreapp2.1/PublicAPI.Unshipped.txt index 8481f014d..dc7b96489 100644 --- a/src/MessagePack/netcoreapp2.1/PublicAPI.Unshipped.txt +++ b/src/MessagePack/netcoreapp2.1/PublicAPI.Unshipped.txt @@ -1,3 +1,5 @@ +MessagePack.ExtensionHeader.ExtensionHeader() -> void +MessagePack.ExtensionResult.ExtensionResult() -> void MessagePack.FormatterNotRegisteredException.FormatterNotRegisteredException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) -> void MessagePack.Formatters.ByteMemoryFormatter MessagePack.Formatters.ByteMemoryFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Memory @@ -73,8 +75,10 @@ MessagePack.ImmutableCollection.InterfaceImmutableSetFormatter MessagePack.ImmutableCollection.InterfaceImmutableSetFormatter.InterfaceImmutableSetFormatter() -> void MessagePack.ImmutableCollection.InterfaceImmutableStackFormatter MessagePack.ImmutableCollection.InterfaceImmutableStackFormatter.InterfaceImmutableStackFormatter() -> void +MessagePack.MessagePackReader.MessagePackReader() -> void MessagePack.MessagePackSerializerOptions.SequencePool.get -> MessagePack.SequencePool MessagePack.MessagePackStreamReader.MessagePackStreamReader(System.IO.Stream stream, bool leaveOpen, MessagePack.SequencePool sequencePool) -> void +MessagePack.MessagePackWriter.MessagePackWriter() -> void MessagePack.Resolvers.ExpandoObjectResolver MessagePack.SequencePool MessagePack.SequencePool.SequencePool() -> void diff --git a/src/MessagePack/netcoreapp3.1/PublicAPI.Unshipped.txt b/src/MessagePack/netcoreapp3.1/PublicAPI.Unshipped.txt index 8481f014d..dc7b96489 100644 --- a/src/MessagePack/netcoreapp3.1/PublicAPI.Unshipped.txt +++ b/src/MessagePack/netcoreapp3.1/PublicAPI.Unshipped.txt @@ -1,3 +1,5 @@ +MessagePack.ExtensionHeader.ExtensionHeader() -> void +MessagePack.ExtensionResult.ExtensionResult() -> void MessagePack.FormatterNotRegisteredException.FormatterNotRegisteredException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) -> void MessagePack.Formatters.ByteMemoryFormatter MessagePack.Formatters.ByteMemoryFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Memory @@ -73,8 +75,10 @@ MessagePack.ImmutableCollection.InterfaceImmutableSetFormatter MessagePack.ImmutableCollection.InterfaceImmutableSetFormatter.InterfaceImmutableSetFormatter() -> void MessagePack.ImmutableCollection.InterfaceImmutableStackFormatter MessagePack.ImmutableCollection.InterfaceImmutableStackFormatter.InterfaceImmutableStackFormatter() -> void +MessagePack.MessagePackReader.MessagePackReader() -> void MessagePack.MessagePackSerializerOptions.SequencePool.get -> MessagePack.SequencePool MessagePack.MessagePackStreamReader.MessagePackStreamReader(System.IO.Stream stream, bool leaveOpen, MessagePack.SequencePool sequencePool) -> void +MessagePack.MessagePackWriter.MessagePackWriter() -> void MessagePack.Resolvers.ExpandoObjectResolver MessagePack.SequencePool MessagePack.SequencePool.SequencePool() -> void diff --git a/src/MessagePack/netstandard2.0/PublicAPI.Unshipped.txt b/src/MessagePack/netstandard2.0/PublicAPI.Unshipped.txt index 991ca2174..1a59fbcf7 100644 --- a/src/MessagePack/netstandard2.0/PublicAPI.Unshipped.txt +++ b/src/MessagePack/netstandard2.0/PublicAPI.Unshipped.txt @@ -1,3 +1,5 @@ +MessagePack.ExtensionHeader.ExtensionHeader() -> void +MessagePack.ExtensionResult.ExtensionResult() -> void MessagePack.FormatterNotRegisteredException.FormatterNotRegisteredException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) -> void MessagePack.Formatters.ByteMemoryFormatter MessagePack.Formatters.ByteMemoryFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Memory @@ -73,9 +75,11 @@ MessagePack.ImmutableCollection.InterfaceImmutableSetFormatter MessagePack.ImmutableCollection.InterfaceImmutableSetFormatter.InterfaceImmutableSetFormatter() -> void MessagePack.ImmutableCollection.InterfaceImmutableStackFormatter MessagePack.ImmutableCollection.InterfaceImmutableStackFormatter.InterfaceImmutableStackFormatter() -> void +MessagePack.MessagePackReader.MessagePackReader() -> void MessagePack.MessagePackSerializerOptions.SequencePool.get -> MessagePack.SequencePool MessagePack.MessagePackSerializerOptions.WithPool(MessagePack.SequencePool pool) -> MessagePack.MessagePackSerializerOptions MessagePack.MessagePackStreamReader.MessagePackStreamReader(System.IO.Stream stream, bool leaveOpen, MessagePack.SequencePool sequencePool) -> void +MessagePack.MessagePackWriter.MessagePackWriter() -> void MessagePack.Resolvers.ExpandoObjectResolver MessagePack.SequencePool MessagePack.SequencePool.SequencePool() -> void From a541c3a245bcd7b155c76d28529fdc6216781dc6 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sun, 7 Mar 2021 10:53:40 -0700 Subject: [PATCH 053/161] Fix code snippet bug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thank you to Сергей Шатров for reporting. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 87d4c0f32..de9aeea18 100644 --- a/README.md +++ b/README.md @@ -1343,7 +1343,7 @@ internal static class SampleCustomResolverGetFormatterHelper } // If target type is generics, use MakeGenericType. - if (t.IsGenericParameter && t.GetGenericTypeDefinition() == typeof(ValueTuple<,>)) + if (t.IsGeneric && t.GetGenericTypeDefinition() == typeof(ValueTuple<,>)) { return Activator.CreateInstance(typeof(ValueTupleFormatter<,>).MakeGenericType(t.GenericTypeArguments)); } From 7226ee97bd84cccd23b8d7e712fab39830a55cdf Mon Sep 17 00:00:00 2001 From: Rasmus Melchior Jacobsen Date: Tue, 16 Mar 2021 15:19:32 +0100 Subject: [PATCH 054/161] Add ReadArrayHeaderAsync() and ReadMapHeaderAsync() to MessagePackStreamReader Add the two function which only reads the respective headers. This allows for custom streaming of the items within the containers, instead of e.g. ReadArrayAsync() which completely reads each item into memory. --- .../MessagePackStreamReader.Arrays.cs | 28 ++++++++- .../MessagePackStreamReader.Maps.cs | 62 +++++++++++++++++++ .../MessagePackStreamReaderArrayTests.cs | 13 ++++ .../MessagePackStreamReaderMapTests.cs | 48 ++++++++++++++ 4 files changed, 150 insertions(+), 1 deletion(-) create mode 100644 src/MessagePack/MessagePackStreamReader.Maps.cs create mode 100644 tests/MessagePack.Tests/MessagePackStreamReaderMapTests.cs diff --git a/src/MessagePack/MessagePackStreamReader.Arrays.cs b/src/MessagePack/MessagePackStreamReader.Arrays.cs index 2735e27ee..c44095b6b 100644 --- a/src/MessagePack/MessagePackStreamReader.Arrays.cs +++ b/src/MessagePack/MessagePackStreamReader.Arrays.cs @@ -8,12 +8,38 @@ using System.Runtime.CompilerServices; using System.Threading; using System.Threading.Tasks; -using Nerdbank.Streams; namespace MessagePack { public partial class MessagePackStreamReader : IDisposable { + /// + /// Reads the next messagepack array header. + /// + /// A cancellation token. + /// + /// A task whose result is the length of the next array from the stream. + /// + /// + /// Any extra bytes read (between the last complete message and the end of the stream) will be available via the property. + /// + public async ValueTask ReadArrayHeaderAsync(CancellationToken cancellationToken) + { + this.RecycleLastMessage(); + + cancellationToken.ThrowIfCancellationRequested(); + int count; + while (!this.TryReadArrayHeader(out count)) + { + if (!await this.TryReadMoreDataAsync(cancellationToken).ConfigureAwait(false)) + { + throw new EndOfStreamException("The stream ended before a map header could be found."); + } + } + + return count; + } + /// /// Reads the next messagepack array and produces each element individually. /// diff --git a/src/MessagePack/MessagePackStreamReader.Maps.cs b/src/MessagePack/MessagePackStreamReader.Maps.cs new file mode 100644 index 000000000..7fa4f28d3 --- /dev/null +++ b/src/MessagePack/MessagePackStreamReader.Maps.cs @@ -0,0 +1,62 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.IO; +using System.Threading; +using System.Threading.Tasks; + +namespace MessagePack +{ + public partial class MessagePackStreamReader : IDisposable + { + /// + /// Reads the next messagepack map header. + /// + /// A cancellation token. + /// + /// A task whose result is the size of the next map from the stream. + /// + /// + /// Any extra bytes read (between the last complete message and the end of the stream) will be available via the property. + /// + public async ValueTask ReadMapHeaderAsync(CancellationToken cancellationToken) + { + this.RecycleLastMessage(); + + cancellationToken.ThrowIfCancellationRequested(); + int count; + while (!this.TryReadMapHeader(out count)) + { + if (!await this.TryReadMoreDataAsync(cancellationToken).ConfigureAwait(false)) + { + throw new EndOfStreamException("The stream ended before a map header could be found."); + } + } + + return count; + } + + /// + /// Reads a map header from if there are enough bytes to do so. + /// + /// Receives the size of the map, if its header could be read. + /// true if the map header was found and complete; false if there were insufficient bytes to read the header. + /// Thrown if the next msgpack structure is not a map header. + private bool TryReadMapHeader(out int count) + { + if (this.ReadData.Length > 0) + { + var reader = new MessagePackReader(this.ReadData); + if (reader.TryReadMapHeader(out count)) + { + this.endOfLastMessage = reader.Position; + return true; + } + } + + count = 0; + return false; + } + } +} diff --git a/tests/MessagePack.Tests/MessagePackStreamReaderArrayTests.cs b/tests/MessagePack.Tests/MessagePackStreamReaderArrayTests.cs index 69d5c0ded..80f38fef9 100644 --- a/tests/MessagePack.Tests/MessagePackStreamReaderArrayTests.cs +++ b/tests/MessagePack.Tests/MessagePackStreamReaderArrayTests.cs @@ -32,6 +32,19 @@ public MessagePackStreamReaderArrayTests() this.arraySequence = sequence; } + [Fact] + public async Task ReadArrayHeader() + { + var reader = new MessagePackStreamReader(this.arraySequence.AsStream()); + var length = await reader.ReadArrayHeaderAsync(this.TimeoutToken); + Assert.Equal(ArrayContent.Count, length); + for (var i = 0; i < length; i++) + { + var elementSequence = await reader.ReadAsync(this.TimeoutToken); + Assert.Equal(ArrayContent[i], MessagePackSerializer.Deserialize(elementSequence.Value)); + } + } + [Fact] public async Task EnumerateArrayElements_AllAtOnce() { diff --git a/tests/MessagePack.Tests/MessagePackStreamReaderMapTests.cs b/tests/MessagePack.Tests/MessagePackStreamReaderMapTests.cs new file mode 100644 index 000000000..ef33055e7 --- /dev/null +++ b/tests/MessagePack.Tests/MessagePackStreamReaderMapTests.cs @@ -0,0 +1,48 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Buffers; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Nerdbank.Streams; +using Xunit; + +namespace MessagePack.Tests +{ + public class MessagePackStreamReaderMapTests : TestBase + { + private static readonly IReadOnlyList MapContent = new object[] { (byte)5, "2", "23", "234", "2345" }; + private readonly ReadOnlySequence arraySequence; + + public MessagePackStreamReaderMapTests() + { + var sequence = new Sequence(); + var writer = new MessagePackWriter(sequence); + + writer.WriteMapHeader(MapContent.Count); + + for (int i = 0; i < MapContent.Count; i++) + { + MessagePackSerializer.Serialize(ref writer, MapContent[i]); + writer.Flush(); + } + + this.arraySequence = sequence; + } + + [Fact] + public async Task ReadMapHeader() + { + var reader = new MessagePackStreamReader(this.arraySequence.AsStream()); + var count = await reader.ReadMapHeaderAsync(this.TimeoutToken); + Assert.Equal(MapContent.Count, count); + for (var i = 0; i < count; i++) + { + var elementSequence = await reader.ReadAsync(this.TimeoutToken); + Assert.Equal(MapContent[i], MessagePackSerializer.Deserialize(elementSequence.Value)); + } + } + } +} From 454ec5e0590d5a6171421c61f9dbc62dafeed253 Mon Sep 17 00:00:00 2001 From: Rasmus Melchior Jacobsen Date: Tue, 16 Mar 2021 15:39:09 +0100 Subject: [PATCH 055/161] Add ReadArrayHeaderAsync and ReadMapHeaderAsync to PublicAPI To make CI pass check --- src/MessagePack/PublicAPI.Shipped.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/MessagePack/PublicAPI.Shipped.txt b/src/MessagePack/PublicAPI.Shipped.txt index 055787782..16c077aa3 100644 --- a/src/MessagePack/PublicAPI.Shipped.txt +++ b/src/MessagePack/PublicAPI.Shipped.txt @@ -1015,7 +1015,9 @@ MessagePack.MessagePackSerializerOptions.Security.get -> MessagePack.MessagePack MessagePack.MessagePackSerializerOptions.WithSecurity(MessagePack.MessagePackSecurity security) -> MessagePack.MessagePackSerializerOptions MessagePack.MessagePackStreamReader.DiscardBufferedData() -> void MessagePack.MessagePackStreamReader.MessagePackStreamReader(System.IO.Stream stream, bool leaveOpen) -> void +MessagePack.MessagePackStreamReader.ReadArrayHeaderAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask MessagePack.MessagePackStreamReader.ReadArrayAsync(System.Threading.CancellationToken cancellationToken) -> System.Collections.Generic.IAsyncEnumerable> +MessagePack.MessagePackStreamReader.ReadMapHeaderAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask MessagePack.MessagePackWriter.WriteBinHeader(int length) -> void MessagePack.MessagePackWriter.WriteStringHeader(int byteCount) -> void static readonly MessagePack.MessagePackSecurity.TrustedData -> MessagePack.MessagePackSecurity From a681d2c4a872cfb7f1e422b40b1f17e50ac53258 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 19 Mar 2021 09:24:45 -0600 Subject: [PATCH 056/161] Add `prepare_release.ps1` script Fixes #1195 --- prepare_release.ps1 | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 prepare_release.ps1 diff --git a/prepare_release.ps1 b/prepare_release.ps1 new file mode 100644 index 000000000..d5dc21d6f --- /dev/null +++ b/prepare_release.ps1 @@ -0,0 +1,14 @@ +# Calculate the NPM package version, assuming the version change is in a new commit. +git commit --allow-empty -m "Dummy commit" -q +$NpmPackageVersion = (nbgv get-version -f json | ConvertFrom-Json).NpmPackageVersion +git reset --mixed HEAD~ -q + +# Stamp the version into the package.json file and commit. +pushd $PSScriptRoot/src/MessagePack.UnityClient/Assets/Scripts/MessagePack +npm version $NpmPackageVersion --no-git-tag-version --allow-same-version +git add package.json +popd +git commit -m "Stamp unity package version as $NpmPackageVersion" + +# Tag the release +nbgv tag From b07d0d106253e6622cc8f4220c4daed1bacb974b Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 19 Mar 2021 16:18:00 -0600 Subject: [PATCH 057/161] Promote all APIs as shipped --- src/MessagePack/PublicAPI.Shipped.txt | 129 +++++++++++++++++++++++- src/MessagePack/PublicAPI.Unshipped.txt | 127 ----------------------- 2 files changed, 128 insertions(+), 128 deletions(-) diff --git a/src/MessagePack/PublicAPI.Shipped.txt b/src/MessagePack/PublicAPI.Shipped.txt index 055787782..25b01a77c 100644 --- a/src/MessagePack/PublicAPI.Shipped.txt +++ b/src/MessagePack/PublicAPI.Shipped.txt @@ -1,4 +1,4 @@ -MessagePack.ExtensionHeader +MessagePack.ExtensionHeader MessagePack.ExtensionHeader.ExtensionHeader(sbyte typeCode, int length) -> void MessagePack.ExtensionHeader.ExtensionHeader(sbyte typeCode, uint length) -> void MessagePack.ExtensionHeader.Length.get -> uint @@ -1023,3 +1023,130 @@ static readonly MessagePack.MessagePackSecurity.UntrustedData -> MessagePack.Mes virtual MessagePack.MessagePackSecurity.Clone() -> MessagePack.MessagePackSecurity virtual MessagePack.MessagePackSecurity.GetHashCollisionResistantEqualityComparer() -> System.Collections.IEqualityComparer virtual MessagePack.MessagePackSecurity.GetHashCollisionResistantEqualityComparer() -> System.Collections.Generic.IEqualityComparer +MessagePack.Formatters.ByteMemoryFormatter +MessagePack.Formatters.ByteMemoryFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Memory +MessagePack.Formatters.ByteMemoryFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Memory value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ByteReadOnlyMemoryFormatter +MessagePack.Formatters.ByteReadOnlyMemoryFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.ReadOnlyMemory +MessagePack.Formatters.ByteReadOnlyMemoryFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.ReadOnlyMemory value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ByteReadOnlySequenceFormatter +MessagePack.Formatters.ByteReadOnlySequenceFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Buffers.ReadOnlySequence +MessagePack.Formatters.ByteReadOnlySequenceFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Buffers.ReadOnlySequence value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ExpandoObjectFormatter +MessagePack.Formatters.ExpandoObjectFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Dynamic.ExpandoObject +MessagePack.Formatters.ExpandoObjectFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Dynamic.ExpandoObject value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ForceTypelessFormatter +MessagePack.Formatters.ForceTypelessFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> T +MessagePack.Formatters.ForceTypelessFormatter.ForceTypelessFormatter() -> void +MessagePack.Formatters.ForceTypelessFormatter.Serialize(ref MessagePack.MessagePackWriter writer, T value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.MemoryFormatter +MessagePack.Formatters.MemoryFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Memory +MessagePack.Formatters.MemoryFormatter.MemoryFormatter() -> void +MessagePack.Formatters.MemoryFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Memory value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NonGenericInterfaceCollectionFormatter +MessagePack.Formatters.NonGenericInterfaceCollectionFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Collections.ICollection +MessagePack.Formatters.NonGenericInterfaceCollectionFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Collections.ICollection value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.NonGenericInterfaceEnumerableFormatter +MessagePack.Formatters.NonGenericInterfaceEnumerableFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Collections.IEnumerable +MessagePack.Formatters.NonGenericInterfaceEnumerableFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Collections.IEnumerable value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.PrimitiveObjectFormatter.PrimitiveObjectFormatter() -> void +MessagePack.Formatters.ReadOnlyMemoryFormatter +MessagePack.Formatters.ReadOnlyMemoryFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.ReadOnlyMemory +MessagePack.Formatters.ReadOnlyMemoryFormatter.ReadOnlyMemoryFormatter() -> void +MessagePack.Formatters.ReadOnlyMemoryFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.ReadOnlyMemory value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.ReadOnlySequenceFormatter +MessagePack.Formatters.ReadOnlySequenceFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Buffers.ReadOnlySequence +MessagePack.Formatters.ReadOnlySequenceFormatter.ReadOnlySequenceFormatter() -> void +MessagePack.Formatters.ReadOnlySequenceFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Buffers.ReadOnlySequence value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.TypeFormatter +MessagePack.Formatters.TypeFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> T +MessagePack.Formatters.TypeFormatter.Serialize(ref MessagePack.MessagePackWriter writer, T value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.TypelessFormatter.TypelessFormatter() -> void +MessagePack.ImmutableCollection.ImmutableArrayFormatter +MessagePack.ImmutableCollection.ImmutableArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Collections.Immutable.ImmutableArray +MessagePack.ImmutableCollection.ImmutableArrayFormatter.ImmutableArrayFormatter() -> void +MessagePack.ImmutableCollection.ImmutableArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Collections.Immutable.ImmutableArray value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.ImmutableCollection.ImmutableCollectionResolver +MessagePack.ImmutableCollection.ImmutableCollectionResolver.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter +MessagePack.ImmutableCollection.ImmutableDictionaryFormatter +MessagePack.ImmutableCollection.ImmutableDictionaryFormatter.ImmutableDictionaryFormatter() -> void +MessagePack.ImmutableCollection.ImmutableHashSetFormatter +MessagePack.ImmutableCollection.ImmutableHashSetFormatter.ImmutableHashSetFormatter() -> void +MessagePack.ImmutableCollection.ImmutableListFormatter +MessagePack.ImmutableCollection.ImmutableListFormatter.ImmutableListFormatter() -> void +MessagePack.ImmutableCollection.ImmutableQueueBuilder +MessagePack.ImmutableCollection.ImmutableQueueBuilder.Add(T value) -> void +MessagePack.ImmutableCollection.ImmutableQueueBuilder.ImmutableQueueBuilder() -> void +MessagePack.ImmutableCollection.ImmutableQueueBuilder.Q.get -> System.Collections.Immutable.ImmutableQueue +MessagePack.ImmutableCollection.ImmutableQueueBuilder.Q.set -> void +MessagePack.ImmutableCollection.ImmutableQueueFormatter +MessagePack.ImmutableCollection.ImmutableQueueFormatter.ImmutableQueueFormatter() -> void +MessagePack.ImmutableCollection.ImmutableSortedDictionaryFormatter +MessagePack.ImmutableCollection.ImmutableSortedDictionaryFormatter.ImmutableSortedDictionaryFormatter() -> void +MessagePack.ImmutableCollection.ImmutableSortedSetFormatter +MessagePack.ImmutableCollection.ImmutableSortedSetFormatter.ImmutableSortedSetFormatter() -> void +MessagePack.ImmutableCollection.ImmutableStackFormatter +MessagePack.ImmutableCollection.ImmutableStackFormatter.ImmutableStackFormatter() -> void +MessagePack.ImmutableCollection.InterfaceImmutableDictionaryFormatter +MessagePack.ImmutableCollection.InterfaceImmutableDictionaryFormatter.InterfaceImmutableDictionaryFormatter() -> void +MessagePack.ImmutableCollection.InterfaceImmutableListFormatter +MessagePack.ImmutableCollection.InterfaceImmutableListFormatter.InterfaceImmutableListFormatter() -> void +MessagePack.ImmutableCollection.InterfaceImmutableQueueFormatter +MessagePack.ImmutableCollection.InterfaceImmutableQueueFormatter.InterfaceImmutableQueueFormatter() -> void +MessagePack.ImmutableCollection.InterfaceImmutableSetFormatter +MessagePack.ImmutableCollection.InterfaceImmutableSetFormatter.InterfaceImmutableSetFormatter() -> void +MessagePack.ImmutableCollection.InterfaceImmutableStackFormatter +MessagePack.ImmutableCollection.InterfaceImmutableStackFormatter.InterfaceImmutableStackFormatter() -> void +MessagePack.Resolvers.ExpandoObjectResolver +override MessagePack.ImmutableCollection.ImmutableDictionaryFormatter.Add(System.Collections.Immutable.ImmutableDictionary.Builder collection, int index, TKey key, TValue value, MessagePack.MessagePackSerializerOptions options) -> void +override MessagePack.ImmutableCollection.ImmutableDictionaryFormatter.Complete(System.Collections.Immutable.ImmutableDictionary.Builder intermediateCollection) -> System.Collections.Immutable.ImmutableDictionary +override MessagePack.ImmutableCollection.ImmutableDictionaryFormatter.Create(int count, MessagePack.MessagePackSerializerOptions options) -> System.Collections.Immutable.ImmutableDictionary.Builder +override MessagePack.ImmutableCollection.ImmutableDictionaryFormatter.GetSourceEnumerator(System.Collections.Immutable.ImmutableDictionary source) -> System.Collections.Immutable.ImmutableDictionary.Enumerator +override MessagePack.ImmutableCollection.ImmutableHashSetFormatter.Add(System.Collections.Immutable.ImmutableHashSet.Builder collection, int index, T value, MessagePack.MessagePackSerializerOptions options) -> void +override MessagePack.ImmutableCollection.ImmutableHashSetFormatter.Complete(System.Collections.Immutable.ImmutableHashSet.Builder intermediateCollection) -> System.Collections.Immutable.ImmutableHashSet +override MessagePack.ImmutableCollection.ImmutableHashSetFormatter.Create(int count, MessagePack.MessagePackSerializerOptions options) -> System.Collections.Immutable.ImmutableHashSet.Builder +override MessagePack.ImmutableCollection.ImmutableHashSetFormatter.GetSourceEnumerator(System.Collections.Immutable.ImmutableHashSet source) -> System.Collections.Immutable.ImmutableHashSet.Enumerator +override MessagePack.ImmutableCollection.ImmutableListFormatter.Add(System.Collections.Immutable.ImmutableList.Builder collection, int index, T value, MessagePack.MessagePackSerializerOptions options) -> void +override MessagePack.ImmutableCollection.ImmutableListFormatter.Complete(System.Collections.Immutable.ImmutableList.Builder intermediateCollection) -> System.Collections.Immutable.ImmutableList +override MessagePack.ImmutableCollection.ImmutableListFormatter.Create(int count, MessagePack.MessagePackSerializerOptions options) -> System.Collections.Immutable.ImmutableList.Builder +override MessagePack.ImmutableCollection.ImmutableListFormatter.GetSourceEnumerator(System.Collections.Immutable.ImmutableList source) -> System.Collections.Immutable.ImmutableList.Enumerator +override MessagePack.ImmutableCollection.ImmutableQueueFormatter.Add(MessagePack.ImmutableCollection.ImmutableQueueBuilder collection, int index, T value, MessagePack.MessagePackSerializerOptions options) -> void +override MessagePack.ImmutableCollection.ImmutableQueueFormatter.Complete(MessagePack.ImmutableCollection.ImmutableQueueBuilder intermediateCollection) -> System.Collections.Immutable.ImmutableQueue +override MessagePack.ImmutableCollection.ImmutableQueueFormatter.Create(int count, MessagePack.MessagePackSerializerOptions options) -> MessagePack.ImmutableCollection.ImmutableQueueBuilder +override MessagePack.ImmutableCollection.ImmutableSortedDictionaryFormatter.Add(System.Collections.Immutable.ImmutableSortedDictionary.Builder collection, int index, TKey key, TValue value, MessagePack.MessagePackSerializerOptions options) -> void +override MessagePack.ImmutableCollection.ImmutableSortedDictionaryFormatter.Complete(System.Collections.Immutable.ImmutableSortedDictionary.Builder intermediateCollection) -> System.Collections.Immutable.ImmutableSortedDictionary +override MessagePack.ImmutableCollection.ImmutableSortedDictionaryFormatter.Create(int count, MessagePack.MessagePackSerializerOptions options) -> System.Collections.Immutable.ImmutableSortedDictionary.Builder +override MessagePack.ImmutableCollection.ImmutableSortedDictionaryFormatter.GetSourceEnumerator(System.Collections.Immutable.ImmutableSortedDictionary source) -> System.Collections.Immutable.ImmutableSortedDictionary.Enumerator +override MessagePack.ImmutableCollection.ImmutableSortedSetFormatter.Add(System.Collections.Immutable.ImmutableSortedSet.Builder collection, int index, T value, MessagePack.MessagePackSerializerOptions options) -> void +override MessagePack.ImmutableCollection.ImmutableSortedSetFormatter.Complete(System.Collections.Immutable.ImmutableSortedSet.Builder intermediateCollection) -> System.Collections.Immutable.ImmutableSortedSet +override MessagePack.ImmutableCollection.ImmutableSortedSetFormatter.Create(int count, MessagePack.MessagePackSerializerOptions options) -> System.Collections.Immutable.ImmutableSortedSet.Builder +override MessagePack.ImmutableCollection.ImmutableSortedSetFormatter.GetSourceEnumerator(System.Collections.Immutable.ImmutableSortedSet source) -> System.Collections.Immutable.ImmutableSortedSet.Enumerator +override MessagePack.ImmutableCollection.ImmutableStackFormatter.Add(T[] collection, int index, T value, MessagePack.MessagePackSerializerOptions options) -> void +override MessagePack.ImmutableCollection.ImmutableStackFormatter.Complete(T[] intermediateCollection) -> System.Collections.Immutable.ImmutableStack +override MessagePack.ImmutableCollection.ImmutableStackFormatter.Create(int count, MessagePack.MessagePackSerializerOptions options) -> T[] +override MessagePack.ImmutableCollection.InterfaceImmutableDictionaryFormatter.Add(System.Collections.Immutable.ImmutableDictionary.Builder collection, int index, TKey key, TValue value, MessagePack.MessagePackSerializerOptions options) -> void +override MessagePack.ImmutableCollection.InterfaceImmutableDictionaryFormatter.Complete(System.Collections.Immutable.ImmutableDictionary.Builder intermediateCollection) -> System.Collections.Immutable.IImmutableDictionary +override MessagePack.ImmutableCollection.InterfaceImmutableDictionaryFormatter.Create(int count, MessagePack.MessagePackSerializerOptions options) -> System.Collections.Immutable.ImmutableDictionary.Builder +override MessagePack.ImmutableCollection.InterfaceImmutableListFormatter.Add(System.Collections.Immutable.ImmutableList.Builder collection, int index, T value, MessagePack.MessagePackSerializerOptions options) -> void +override MessagePack.ImmutableCollection.InterfaceImmutableListFormatter.Complete(System.Collections.Immutable.ImmutableList.Builder intermediateCollection) -> System.Collections.Immutable.IImmutableList +override MessagePack.ImmutableCollection.InterfaceImmutableListFormatter.Create(int count, MessagePack.MessagePackSerializerOptions options) -> System.Collections.Immutable.ImmutableList.Builder +override MessagePack.ImmutableCollection.InterfaceImmutableQueueFormatter.Add(MessagePack.ImmutableCollection.ImmutableQueueBuilder collection, int index, T value, MessagePack.MessagePackSerializerOptions options) -> void +override MessagePack.ImmutableCollection.InterfaceImmutableQueueFormatter.Complete(MessagePack.ImmutableCollection.ImmutableQueueBuilder intermediateCollection) -> System.Collections.Immutable.IImmutableQueue +override MessagePack.ImmutableCollection.InterfaceImmutableQueueFormatter.Create(int count, MessagePack.MessagePackSerializerOptions options) -> MessagePack.ImmutableCollection.ImmutableQueueBuilder +override MessagePack.ImmutableCollection.InterfaceImmutableSetFormatter.Add(System.Collections.Immutable.ImmutableHashSet.Builder collection, int index, T value, MessagePack.MessagePackSerializerOptions options) -> void +override MessagePack.ImmutableCollection.InterfaceImmutableSetFormatter.Complete(System.Collections.Immutable.ImmutableHashSet.Builder intermediateCollection) -> System.Collections.Immutable.IImmutableSet +override MessagePack.ImmutableCollection.InterfaceImmutableSetFormatter.Create(int count, MessagePack.MessagePackSerializerOptions options) -> System.Collections.Immutable.ImmutableHashSet.Builder +override MessagePack.ImmutableCollection.InterfaceImmutableStackFormatter.Add(T[] collection, int index, T value, MessagePack.MessagePackSerializerOptions options) -> void +override MessagePack.ImmutableCollection.InterfaceImmutableStackFormatter.Complete(T[] intermediateCollection) -> System.Collections.Immutable.IImmutableStack +override MessagePack.ImmutableCollection.InterfaceImmutableStackFormatter.Create(int count, MessagePack.MessagePackSerializerOptions options) -> T[] +static readonly MessagePack.Formatters.ByteMemoryFormatter.Instance -> MessagePack.Formatters.ByteMemoryFormatter +static readonly MessagePack.Formatters.ByteReadOnlyMemoryFormatter.Instance -> MessagePack.Formatters.ByteReadOnlyMemoryFormatter +static readonly MessagePack.Formatters.ByteReadOnlySequenceFormatter.Instance -> MessagePack.Formatters.ByteReadOnlySequenceFormatter +static readonly MessagePack.Formatters.ExpandoObjectFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter +static readonly MessagePack.Formatters.NonGenericInterfaceCollectionFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter +static readonly MessagePack.Formatters.NonGenericInterfaceEnumerableFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter +static readonly MessagePack.Formatters.TypeFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter +static readonly MessagePack.ImmutableCollection.ImmutableCollectionResolver.Instance -> MessagePack.ImmutableCollection.ImmutableCollectionResolver +static readonly MessagePack.Resolvers.ExpandoObjectResolver.Instance -> MessagePack.IFormatterResolver +static readonly MessagePack.Resolvers.ExpandoObjectResolver.Options -> MessagePack.MessagePackSerializerOptions +virtual MessagePack.Formatters.PrimitiveObjectFormatter.DeserializeMap(ref MessagePack.MessagePackReader reader, int length, MessagePack.MessagePackSerializerOptions options) -> object diff --git a/src/MessagePack/PublicAPI.Unshipped.txt b/src/MessagePack/PublicAPI.Unshipped.txt index d31186945..e69de29bb 100644 --- a/src/MessagePack/PublicAPI.Unshipped.txt +++ b/src/MessagePack/PublicAPI.Unshipped.txt @@ -1,127 +0,0 @@ -MessagePack.Formatters.ByteMemoryFormatter -MessagePack.Formatters.ByteMemoryFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Memory -MessagePack.Formatters.ByteMemoryFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Memory value, MessagePack.MessagePackSerializerOptions options) -> void -MessagePack.Formatters.ByteReadOnlyMemoryFormatter -MessagePack.Formatters.ByteReadOnlyMemoryFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.ReadOnlyMemory -MessagePack.Formatters.ByteReadOnlyMemoryFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.ReadOnlyMemory value, MessagePack.MessagePackSerializerOptions options) -> void -MessagePack.Formatters.ByteReadOnlySequenceFormatter -MessagePack.Formatters.ByteReadOnlySequenceFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Buffers.ReadOnlySequence -MessagePack.Formatters.ByteReadOnlySequenceFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Buffers.ReadOnlySequence value, MessagePack.MessagePackSerializerOptions options) -> void -MessagePack.Formatters.ExpandoObjectFormatter -MessagePack.Formatters.ExpandoObjectFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Dynamic.ExpandoObject -MessagePack.Formatters.ExpandoObjectFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Dynamic.ExpandoObject value, MessagePack.MessagePackSerializerOptions options) -> void -MessagePack.Formatters.ForceTypelessFormatter -MessagePack.Formatters.ForceTypelessFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> T -MessagePack.Formatters.ForceTypelessFormatter.ForceTypelessFormatter() -> void -MessagePack.Formatters.ForceTypelessFormatter.Serialize(ref MessagePack.MessagePackWriter writer, T value, MessagePack.MessagePackSerializerOptions options) -> void -MessagePack.Formatters.MemoryFormatter -MessagePack.Formatters.MemoryFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Memory -MessagePack.Formatters.MemoryFormatter.MemoryFormatter() -> void -MessagePack.Formatters.MemoryFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Memory value, MessagePack.MessagePackSerializerOptions options) -> void -MessagePack.Formatters.NonGenericInterfaceCollectionFormatter -MessagePack.Formatters.NonGenericInterfaceCollectionFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Collections.ICollection -MessagePack.Formatters.NonGenericInterfaceCollectionFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Collections.ICollection value, MessagePack.MessagePackSerializerOptions options) -> void -MessagePack.Formatters.NonGenericInterfaceEnumerableFormatter -MessagePack.Formatters.NonGenericInterfaceEnumerableFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Collections.IEnumerable -MessagePack.Formatters.NonGenericInterfaceEnumerableFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Collections.IEnumerable value, MessagePack.MessagePackSerializerOptions options) -> void -MessagePack.Formatters.PrimitiveObjectFormatter.PrimitiveObjectFormatter() -> void -MessagePack.Formatters.ReadOnlyMemoryFormatter -MessagePack.Formatters.ReadOnlyMemoryFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.ReadOnlyMemory -MessagePack.Formatters.ReadOnlyMemoryFormatter.ReadOnlyMemoryFormatter() -> void -MessagePack.Formatters.ReadOnlyMemoryFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.ReadOnlyMemory value, MessagePack.MessagePackSerializerOptions options) -> void -MessagePack.Formatters.ReadOnlySequenceFormatter -MessagePack.Formatters.ReadOnlySequenceFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Buffers.ReadOnlySequence -MessagePack.Formatters.ReadOnlySequenceFormatter.ReadOnlySequenceFormatter() -> void -MessagePack.Formatters.ReadOnlySequenceFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Buffers.ReadOnlySequence value, MessagePack.MessagePackSerializerOptions options) -> void -MessagePack.Formatters.TypeFormatter -MessagePack.Formatters.TypeFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> T -MessagePack.Formatters.TypeFormatter.Serialize(ref MessagePack.MessagePackWriter writer, T value, MessagePack.MessagePackSerializerOptions options) -> void -MessagePack.Formatters.TypelessFormatter.TypelessFormatter() -> void -MessagePack.ImmutableCollection.ImmutableArrayFormatter -MessagePack.ImmutableCollection.ImmutableArrayFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Collections.Immutable.ImmutableArray -MessagePack.ImmutableCollection.ImmutableArrayFormatter.ImmutableArrayFormatter() -> void -MessagePack.ImmutableCollection.ImmutableArrayFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Collections.Immutable.ImmutableArray value, MessagePack.MessagePackSerializerOptions options) -> void -MessagePack.ImmutableCollection.ImmutableCollectionResolver -MessagePack.ImmutableCollection.ImmutableCollectionResolver.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter -MessagePack.ImmutableCollection.ImmutableDictionaryFormatter -MessagePack.ImmutableCollection.ImmutableDictionaryFormatter.ImmutableDictionaryFormatter() -> void -MessagePack.ImmutableCollection.ImmutableHashSetFormatter -MessagePack.ImmutableCollection.ImmutableHashSetFormatter.ImmutableHashSetFormatter() -> void -MessagePack.ImmutableCollection.ImmutableListFormatter -MessagePack.ImmutableCollection.ImmutableListFormatter.ImmutableListFormatter() -> void -MessagePack.ImmutableCollection.ImmutableQueueBuilder -MessagePack.ImmutableCollection.ImmutableQueueBuilder.Add(T value) -> void -MessagePack.ImmutableCollection.ImmutableQueueBuilder.ImmutableQueueBuilder() -> void -MessagePack.ImmutableCollection.ImmutableQueueBuilder.Q.get -> System.Collections.Immutable.ImmutableQueue -MessagePack.ImmutableCollection.ImmutableQueueBuilder.Q.set -> void -MessagePack.ImmutableCollection.ImmutableQueueFormatter -MessagePack.ImmutableCollection.ImmutableQueueFormatter.ImmutableQueueFormatter() -> void -MessagePack.ImmutableCollection.ImmutableSortedDictionaryFormatter -MessagePack.ImmutableCollection.ImmutableSortedDictionaryFormatter.ImmutableSortedDictionaryFormatter() -> void -MessagePack.ImmutableCollection.ImmutableSortedSetFormatter -MessagePack.ImmutableCollection.ImmutableSortedSetFormatter.ImmutableSortedSetFormatter() -> void -MessagePack.ImmutableCollection.ImmutableStackFormatter -MessagePack.ImmutableCollection.ImmutableStackFormatter.ImmutableStackFormatter() -> void -MessagePack.ImmutableCollection.InterfaceImmutableDictionaryFormatter -MessagePack.ImmutableCollection.InterfaceImmutableDictionaryFormatter.InterfaceImmutableDictionaryFormatter() -> void -MessagePack.ImmutableCollection.InterfaceImmutableListFormatter -MessagePack.ImmutableCollection.InterfaceImmutableListFormatter.InterfaceImmutableListFormatter() -> void -MessagePack.ImmutableCollection.InterfaceImmutableQueueFormatter -MessagePack.ImmutableCollection.InterfaceImmutableQueueFormatter.InterfaceImmutableQueueFormatter() -> void -MessagePack.ImmutableCollection.InterfaceImmutableSetFormatter -MessagePack.ImmutableCollection.InterfaceImmutableSetFormatter.InterfaceImmutableSetFormatter() -> void -MessagePack.ImmutableCollection.InterfaceImmutableStackFormatter -MessagePack.ImmutableCollection.InterfaceImmutableStackFormatter.InterfaceImmutableStackFormatter() -> void -MessagePack.Resolvers.ExpandoObjectResolver -override MessagePack.ImmutableCollection.ImmutableDictionaryFormatter.Add(System.Collections.Immutable.ImmutableDictionary.Builder collection, int index, TKey key, TValue value, MessagePack.MessagePackSerializerOptions options) -> void -override MessagePack.ImmutableCollection.ImmutableDictionaryFormatter.Complete(System.Collections.Immutable.ImmutableDictionary.Builder intermediateCollection) -> System.Collections.Immutable.ImmutableDictionary -override MessagePack.ImmutableCollection.ImmutableDictionaryFormatter.Create(int count, MessagePack.MessagePackSerializerOptions options) -> System.Collections.Immutable.ImmutableDictionary.Builder -override MessagePack.ImmutableCollection.ImmutableDictionaryFormatter.GetSourceEnumerator(System.Collections.Immutable.ImmutableDictionary source) -> System.Collections.Immutable.ImmutableDictionary.Enumerator -override MessagePack.ImmutableCollection.ImmutableHashSetFormatter.Add(System.Collections.Immutable.ImmutableHashSet.Builder collection, int index, T value, MessagePack.MessagePackSerializerOptions options) -> void -override MessagePack.ImmutableCollection.ImmutableHashSetFormatter.Complete(System.Collections.Immutable.ImmutableHashSet.Builder intermediateCollection) -> System.Collections.Immutable.ImmutableHashSet -override MessagePack.ImmutableCollection.ImmutableHashSetFormatter.Create(int count, MessagePack.MessagePackSerializerOptions options) -> System.Collections.Immutable.ImmutableHashSet.Builder -override MessagePack.ImmutableCollection.ImmutableHashSetFormatter.GetSourceEnumerator(System.Collections.Immutable.ImmutableHashSet source) -> System.Collections.Immutable.ImmutableHashSet.Enumerator -override MessagePack.ImmutableCollection.ImmutableListFormatter.Add(System.Collections.Immutable.ImmutableList.Builder collection, int index, T value, MessagePack.MessagePackSerializerOptions options) -> void -override MessagePack.ImmutableCollection.ImmutableListFormatter.Complete(System.Collections.Immutable.ImmutableList.Builder intermediateCollection) -> System.Collections.Immutable.ImmutableList -override MessagePack.ImmutableCollection.ImmutableListFormatter.Create(int count, MessagePack.MessagePackSerializerOptions options) -> System.Collections.Immutable.ImmutableList.Builder -override MessagePack.ImmutableCollection.ImmutableListFormatter.GetSourceEnumerator(System.Collections.Immutable.ImmutableList source) -> System.Collections.Immutable.ImmutableList.Enumerator -override MessagePack.ImmutableCollection.ImmutableQueueFormatter.Add(MessagePack.ImmutableCollection.ImmutableQueueBuilder collection, int index, T value, MessagePack.MessagePackSerializerOptions options) -> void -override MessagePack.ImmutableCollection.ImmutableQueueFormatter.Complete(MessagePack.ImmutableCollection.ImmutableQueueBuilder intermediateCollection) -> System.Collections.Immutable.ImmutableQueue -override MessagePack.ImmutableCollection.ImmutableQueueFormatter.Create(int count, MessagePack.MessagePackSerializerOptions options) -> MessagePack.ImmutableCollection.ImmutableQueueBuilder -override MessagePack.ImmutableCollection.ImmutableSortedDictionaryFormatter.Add(System.Collections.Immutable.ImmutableSortedDictionary.Builder collection, int index, TKey key, TValue value, MessagePack.MessagePackSerializerOptions options) -> void -override MessagePack.ImmutableCollection.ImmutableSortedDictionaryFormatter.Complete(System.Collections.Immutable.ImmutableSortedDictionary.Builder intermediateCollection) -> System.Collections.Immutable.ImmutableSortedDictionary -override MessagePack.ImmutableCollection.ImmutableSortedDictionaryFormatter.Create(int count, MessagePack.MessagePackSerializerOptions options) -> System.Collections.Immutable.ImmutableSortedDictionary.Builder -override MessagePack.ImmutableCollection.ImmutableSortedDictionaryFormatter.GetSourceEnumerator(System.Collections.Immutable.ImmutableSortedDictionary source) -> System.Collections.Immutable.ImmutableSortedDictionary.Enumerator -override MessagePack.ImmutableCollection.ImmutableSortedSetFormatter.Add(System.Collections.Immutable.ImmutableSortedSet.Builder collection, int index, T value, MessagePack.MessagePackSerializerOptions options) -> void -override MessagePack.ImmutableCollection.ImmutableSortedSetFormatter.Complete(System.Collections.Immutable.ImmutableSortedSet.Builder intermediateCollection) -> System.Collections.Immutable.ImmutableSortedSet -override MessagePack.ImmutableCollection.ImmutableSortedSetFormatter.Create(int count, MessagePack.MessagePackSerializerOptions options) -> System.Collections.Immutable.ImmutableSortedSet.Builder -override MessagePack.ImmutableCollection.ImmutableSortedSetFormatter.GetSourceEnumerator(System.Collections.Immutable.ImmutableSortedSet source) -> System.Collections.Immutable.ImmutableSortedSet.Enumerator -override MessagePack.ImmutableCollection.ImmutableStackFormatter.Add(T[] collection, int index, T value, MessagePack.MessagePackSerializerOptions options) -> void -override MessagePack.ImmutableCollection.ImmutableStackFormatter.Complete(T[] intermediateCollection) -> System.Collections.Immutable.ImmutableStack -override MessagePack.ImmutableCollection.ImmutableStackFormatter.Create(int count, MessagePack.MessagePackSerializerOptions options) -> T[] -override MessagePack.ImmutableCollection.InterfaceImmutableDictionaryFormatter.Add(System.Collections.Immutable.ImmutableDictionary.Builder collection, int index, TKey key, TValue value, MessagePack.MessagePackSerializerOptions options) -> void -override MessagePack.ImmutableCollection.InterfaceImmutableDictionaryFormatter.Complete(System.Collections.Immutable.ImmutableDictionary.Builder intermediateCollection) -> System.Collections.Immutable.IImmutableDictionary -override MessagePack.ImmutableCollection.InterfaceImmutableDictionaryFormatter.Create(int count, MessagePack.MessagePackSerializerOptions options) -> System.Collections.Immutable.ImmutableDictionary.Builder -override MessagePack.ImmutableCollection.InterfaceImmutableListFormatter.Add(System.Collections.Immutable.ImmutableList.Builder collection, int index, T value, MessagePack.MessagePackSerializerOptions options) -> void -override MessagePack.ImmutableCollection.InterfaceImmutableListFormatter.Complete(System.Collections.Immutable.ImmutableList.Builder intermediateCollection) -> System.Collections.Immutable.IImmutableList -override MessagePack.ImmutableCollection.InterfaceImmutableListFormatter.Create(int count, MessagePack.MessagePackSerializerOptions options) -> System.Collections.Immutable.ImmutableList.Builder -override MessagePack.ImmutableCollection.InterfaceImmutableQueueFormatter.Add(MessagePack.ImmutableCollection.ImmutableQueueBuilder collection, int index, T value, MessagePack.MessagePackSerializerOptions options) -> void -override MessagePack.ImmutableCollection.InterfaceImmutableQueueFormatter.Complete(MessagePack.ImmutableCollection.ImmutableQueueBuilder intermediateCollection) -> System.Collections.Immutable.IImmutableQueue -override MessagePack.ImmutableCollection.InterfaceImmutableQueueFormatter.Create(int count, MessagePack.MessagePackSerializerOptions options) -> MessagePack.ImmutableCollection.ImmutableQueueBuilder -override MessagePack.ImmutableCollection.InterfaceImmutableSetFormatter.Add(System.Collections.Immutable.ImmutableHashSet.Builder collection, int index, T value, MessagePack.MessagePackSerializerOptions options) -> void -override MessagePack.ImmutableCollection.InterfaceImmutableSetFormatter.Complete(System.Collections.Immutable.ImmutableHashSet.Builder intermediateCollection) -> System.Collections.Immutable.IImmutableSet -override MessagePack.ImmutableCollection.InterfaceImmutableSetFormatter.Create(int count, MessagePack.MessagePackSerializerOptions options) -> System.Collections.Immutable.ImmutableHashSet.Builder -override MessagePack.ImmutableCollection.InterfaceImmutableStackFormatter.Add(T[] collection, int index, T value, MessagePack.MessagePackSerializerOptions options) -> void -override MessagePack.ImmutableCollection.InterfaceImmutableStackFormatter.Complete(T[] intermediateCollection) -> System.Collections.Immutable.IImmutableStack -override MessagePack.ImmutableCollection.InterfaceImmutableStackFormatter.Create(int count, MessagePack.MessagePackSerializerOptions options) -> T[] -static readonly MessagePack.Formatters.ByteMemoryFormatter.Instance -> MessagePack.Formatters.ByteMemoryFormatter -static readonly MessagePack.Formatters.ByteReadOnlyMemoryFormatter.Instance -> MessagePack.Formatters.ByteReadOnlyMemoryFormatter -static readonly MessagePack.Formatters.ByteReadOnlySequenceFormatter.Instance -> MessagePack.Formatters.ByteReadOnlySequenceFormatter -static readonly MessagePack.Formatters.ExpandoObjectFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter -static readonly MessagePack.Formatters.NonGenericInterfaceCollectionFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter -static readonly MessagePack.Formatters.NonGenericInterfaceEnumerableFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter -static readonly MessagePack.Formatters.TypeFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter -static readonly MessagePack.ImmutableCollection.ImmutableCollectionResolver.Instance -> MessagePack.ImmutableCollection.ImmutableCollectionResolver -static readonly MessagePack.Resolvers.ExpandoObjectResolver.Instance -> MessagePack.IFormatterResolver -static readonly MessagePack.Resolvers.ExpandoObjectResolver.Options -> MessagePack.MessagePackSerializerOptions -virtual MessagePack.Formatters.PrimitiveObjectFormatter.DeserializeMap(ref MessagePack.MessagePackReader reader, int length, MessagePack.MessagePackSerializerOptions options) -> object From 8920a17a626057218b79b9ceceb953d5d36d9247 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 19 Mar 2021 16:27:18 -0600 Subject: [PATCH 058/161] Add new APIs to the extra files --- src/MessagePack/net5.0/PublicAPI.Unshipped.txt | 2 ++ src/MessagePack/netcoreapp3.1/PublicAPI.Unshipped.txt | 2 ++ src/MessagePack/netstandard2.0/PublicAPI.Unshipped.txt | 2 ++ 3 files changed, 6 insertions(+) diff --git a/src/MessagePack/net5.0/PublicAPI.Unshipped.txt b/src/MessagePack/net5.0/PublicAPI.Unshipped.txt index 51e7070a4..1525d0ccb 100644 --- a/src/MessagePack/net5.0/PublicAPI.Unshipped.txt +++ b/src/MessagePack/net5.0/PublicAPI.Unshipped.txt @@ -8,6 +8,8 @@ MessagePack.MessagePackReader.MessagePackReader() -> void MessagePack.MessagePackSerializerOptions.SequencePool.get -> MessagePack.SequencePool MessagePack.MessagePackSerializerOptions.WithPool(MessagePack.SequencePool pool) -> MessagePack.MessagePackSerializerOptions MessagePack.MessagePackStreamReader.MessagePackStreamReader(System.IO.Stream stream, bool leaveOpen, MessagePack.SequencePool sequencePool) -> void +MessagePack.MessagePackStreamReader.ReadArrayHeaderAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask +MessagePack.MessagePackStreamReader.ReadMapHeaderAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask MessagePack.MessagePackWriter.MessagePackWriter() -> void MessagePack.SequencePool MessagePack.SequencePool.SequencePool() -> void diff --git a/src/MessagePack/netcoreapp3.1/PublicAPI.Unshipped.txt b/src/MessagePack/netcoreapp3.1/PublicAPI.Unshipped.txt index 367e23039..5c253f312 100644 --- a/src/MessagePack/netcoreapp3.1/PublicAPI.Unshipped.txt +++ b/src/MessagePack/netcoreapp3.1/PublicAPI.Unshipped.txt @@ -5,6 +5,8 @@ MessagePack.MessagePackReader.MessagePackReader() -> void MessagePack.MessagePackSerializerOptions.SequencePool.get -> MessagePack.SequencePool MessagePack.MessagePackSerializerOptions.WithPool(MessagePack.SequencePool pool) -> MessagePack.MessagePackSerializerOptions MessagePack.MessagePackStreamReader.MessagePackStreamReader(System.IO.Stream stream, bool leaveOpen, MessagePack.SequencePool sequencePool) -> void +MessagePack.MessagePackStreamReader.ReadArrayHeaderAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask +MessagePack.MessagePackStreamReader.ReadMapHeaderAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask MessagePack.MessagePackWriter.MessagePackWriter() -> void MessagePack.SequencePool MessagePack.SequencePool.SequencePool() -> void diff --git a/src/MessagePack/netstandard2.0/PublicAPI.Unshipped.txt b/src/MessagePack/netstandard2.0/PublicAPI.Unshipped.txt index 367e23039..5c253f312 100644 --- a/src/MessagePack/netstandard2.0/PublicAPI.Unshipped.txt +++ b/src/MessagePack/netstandard2.0/PublicAPI.Unshipped.txt @@ -5,6 +5,8 @@ MessagePack.MessagePackReader.MessagePackReader() -> void MessagePack.MessagePackSerializerOptions.SequencePool.get -> MessagePack.SequencePool MessagePack.MessagePackSerializerOptions.WithPool(MessagePack.SequencePool pool) -> MessagePack.MessagePackSerializerOptions MessagePack.MessagePackStreamReader.MessagePackStreamReader(System.IO.Stream stream, bool leaveOpen, MessagePack.SequencePool sequencePool) -> void +MessagePack.MessagePackStreamReader.ReadArrayHeaderAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask +MessagePack.MessagePackStreamReader.ReadMapHeaderAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask MessagePack.MessagePackWriter.MessagePackWriter() -> void MessagePack.SequencePool MessagePack.SequencePool.SequencePool() -> void From a6b2846d7b04a022df1eb448293300f51ac595be Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 19 Mar 2021 21:47:39 -0600 Subject: [PATCH 059/161] Stamp unity package version as 2.3.58-alpha --- .../Assets/Scripts/MessagePack/package.json | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/package.json b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/package.json index b25f689a9..aeb8a8b39 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/package.json +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/package.json @@ -1,11 +1,12 @@ { "name": "com.neuecc.messagepack", "displayName": "MessagePack", - "version": "2.3", + "version": "2.3.58-alpha", "unity": "2018.4", "description": "Extremely Fast MessagePack Serializer for C#.", - "keywords": [ "Serializer" ], + "keywords": [ + "Serializer" + ], "license": "MIT", - "category": "Scripting", - "dependencies": {} + "category": "Scripting" } From 8ca7fc27b1d9e358c7df866e7376538ab1a7c851 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 19 Mar 2021 22:15:13 -0600 Subject: [PATCH 060/161] Drop vsix artifact from github release --- azure-pipelines/release.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/azure-pipelines/release.yml b/azure-pipelines/release.yml index 4f6ebd829..70b98fd00 100644 --- a/azure-pipelines/release.yml +++ b/azure-pipelines/release.yml @@ -27,9 +27,6 @@ stages: - download: CI artifact: unity displayName: 'Downloading artifact: unity' - - download: CI - artifact: vsix - displayName: 'Downloading artifact: vsix' - task: GitHubRelease@1 displayName: GitHub release (create) inputs: @@ -41,7 +38,6 @@ stages: title: v$(resources.pipeline.CI.runName) assets: | $(Pipeline.Workspace)/CI/unity/*.unitypackage - $(Pipeline.Workspace)/CI/vsix/* isDraft: true # After running this step, visit the new draft release, edit, and publish. changeLogCompareToRelease: lastNonDraftRelease changeLogType: issueBased From 2e6fd46243ebd791354f3356f53c505a53581cbb Mon Sep 17 00:00:00 2001 From: Alex Zavadsky Date: Mon, 22 Mar 2021 10:49:44 +0300 Subject: [PATCH 061/161] Fix for possible incorrect constructor search. Allow serialization IDictionary<> descendants --- .../Resolvers/DynamicGenericResolver.cs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicGenericResolver.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicGenericResolver.cs index 7f9f44517..fbfb7de3a 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicGenericResolver.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicGenericResolver.cs @@ -313,12 +313,13 @@ internal static object GetFormatter(Type t) return CreateInstance(typeof(GenericDictionaryFormatter<,,>), new[] { keyType, valueType, t }); } - // generic readonly dictionary - var readOnlyDictionaryDef = ti.ImplementedInterfaces.FirstOrDefault(x => x.GetTypeInfo().IsConstructedGenericType() && x.GetGenericTypeDefinition() == typeof(IReadOnlyDictionary<,>)); - if (readOnlyDictionaryDef != null) + // generic dictionary with collection ctor + var dictionaryInterfaceDef = ti.ImplementedInterfaces.FirstOrDefault(x => x.GetTypeInfo().IsConstructedGenericType() && + (x.GetGenericTypeDefinition() == typeof(IDictionary<,>) || x.GetGenericTypeDefinition() == typeof(IReadOnlyDictionary<,>))); + if (dictionaryInterfaceDef != null) { - Type keyType = readOnlyDictionaryDef.GenericTypeArguments[0]; - Type valueType = readOnlyDictionaryDef.GenericTypeArguments[1]; + Type keyType = dictionaryInterfaceDef.GenericTypeArguments[0]; + Type valueType = dictionaryInterfaceDef.GenericTypeArguments[1]; Type[] allowedParameterTypes = new Type[] { typeof(IDictionary<,>).MakeGenericType(keyType, valueType), @@ -329,7 +330,7 @@ internal static object GetFormatter(Type t) { ParameterInfo[] parameters = constructor.GetParameters(); if (parameters.Length == 1 && - allowedParameterTypes.Any(allowedType => allowedType.IsAssignableFrom(parameters[0].ParameterType))) + allowedParameterTypes.Any(allowedType => parameters[0].ParameterType.IsAssignableFrom(allowedType))) { return CreateInstance(typeof(GenericReadOnlyDictionaryFormatter<,,>), new[] { keyType, valueType, t }); } @@ -354,7 +355,7 @@ internal static object GetFormatter(Type t) foreach (var constructor in ti.DeclaredConstructors) { var parameters = constructor.GetParameters(); - if (parameters.Length == 1 && paramInterface.IsAssignableFrom(parameters[0].ParameterType)) + if (parameters.Length == 1 && parameters[0].ParameterType.IsAssignableFrom(paramInterface)) { return CreateInstance(typeof(GenericEnumerableFormatter<,>), new[] { elemType, t }); } From f5e5bf9acb04919e362e597c79a01219d6c7f877 Mon Sep 17 00:00:00 2001 From: Alex Zavadsky Date: Mon, 22 Mar 2021 11:13:25 +0300 Subject: [PATCH 062/161] Add new classes to PublicAPI --- src/MessagePack/net5.0/PublicAPI.Unshipped.txt | 4 ++++ src/MessagePack/netcoreapp2.1/PublicAPI.Unshipped.txt | 6 +++++- src/MessagePack/netcoreapp3.1/PublicAPI.Unshipped.txt | 6 +++++- src/MessagePack/netstandard2.0/PublicAPI.Unshipped.txt | 6 +++++- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/MessagePack/net5.0/PublicAPI.Unshipped.txt b/src/MessagePack/net5.0/PublicAPI.Unshipped.txt index 1525d0ccb..4b94f00b2 100644 --- a/src/MessagePack/net5.0/PublicAPI.Unshipped.txt +++ b/src/MessagePack/net5.0/PublicAPI.Unshipped.txt @@ -20,3 +20,7 @@ static MessagePack.Nil.operator !=(MessagePack.Nil left, MessagePack.Nil right) static MessagePack.Nil.operator ==(MessagePack.Nil left, MessagePack.Nil right) -> bool static readonly MessagePack.Formatters.HalfFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter virtual MessagePack.MessagePackStreamReader.Dispose(bool disposing) -> void +MessagePack.Formatters.GenericEnumerableFormatter +MessagePack.Formatters.GenericEnumerableFormatter.GenericEnumerableFormatter() -> void +MessagePack.Formatters.GenericReadOnlyDictionaryFormatter +MessagePack.Formatters.GenericReadOnlyDictionaryFormatter.GenericReadOnlyDictionaryFormatter() -> void \ No newline at end of file diff --git a/src/MessagePack/netcoreapp2.1/PublicAPI.Unshipped.txt b/src/MessagePack/netcoreapp2.1/PublicAPI.Unshipped.txt index 367e23039..f053d3cd8 100644 --- a/src/MessagePack/netcoreapp2.1/PublicAPI.Unshipped.txt +++ b/src/MessagePack/netcoreapp2.1/PublicAPI.Unshipped.txt @@ -13,4 +13,8 @@ MessagePack.SequencePool.SequencePool(int maxSize, System.Buffers.ArrayPool void static MessagePack.Nil.operator !=(MessagePack.Nil left, MessagePack.Nil right) -> bool static MessagePack.Nil.operator ==(MessagePack.Nil left, MessagePack.Nil right) -> bool -virtual MessagePack.MessagePackStreamReader.Dispose(bool disposing) -> void \ No newline at end of file +virtual MessagePack.MessagePackStreamReader.Dispose(bool disposing) -> void +MessagePack.Formatters.GenericEnumerableFormatter +MessagePack.Formatters.GenericEnumerableFormatter.GenericEnumerableFormatter() -> void +MessagePack.Formatters.GenericReadOnlyDictionaryFormatter +MessagePack.Formatters.GenericReadOnlyDictionaryFormatter.GenericReadOnlyDictionaryFormatter() -> void \ No newline at end of file diff --git a/src/MessagePack/netcoreapp3.1/PublicAPI.Unshipped.txt b/src/MessagePack/netcoreapp3.1/PublicAPI.Unshipped.txt index 5c253f312..73b4e7c06 100644 --- a/src/MessagePack/netcoreapp3.1/PublicAPI.Unshipped.txt +++ b/src/MessagePack/netcoreapp3.1/PublicAPI.Unshipped.txt @@ -15,4 +15,8 @@ MessagePack.SequencePool.SequencePool(int maxSize, System.Buffers.ArrayPool void static MessagePack.Nil.operator !=(MessagePack.Nil left, MessagePack.Nil right) -> bool static MessagePack.Nil.operator ==(MessagePack.Nil left, MessagePack.Nil right) -> bool -virtual MessagePack.MessagePackStreamReader.Dispose(bool disposing) -> void \ No newline at end of file +virtual MessagePack.MessagePackStreamReader.Dispose(bool disposing) -> void +MessagePack.Formatters.GenericEnumerableFormatter +MessagePack.Formatters.GenericEnumerableFormatter.GenericEnumerableFormatter() -> void +MessagePack.Formatters.GenericReadOnlyDictionaryFormatter +MessagePack.Formatters.GenericReadOnlyDictionaryFormatter.GenericReadOnlyDictionaryFormatter() -> void \ No newline at end of file diff --git a/src/MessagePack/netstandard2.0/PublicAPI.Unshipped.txt b/src/MessagePack/netstandard2.0/PublicAPI.Unshipped.txt index 5c253f312..73b4e7c06 100644 --- a/src/MessagePack/netstandard2.0/PublicAPI.Unshipped.txt +++ b/src/MessagePack/netstandard2.0/PublicAPI.Unshipped.txt @@ -15,4 +15,8 @@ MessagePack.SequencePool.SequencePool(int maxSize, System.Buffers.ArrayPool void static MessagePack.Nil.operator !=(MessagePack.Nil left, MessagePack.Nil right) -> bool static MessagePack.Nil.operator ==(MessagePack.Nil left, MessagePack.Nil right) -> bool -virtual MessagePack.MessagePackStreamReader.Dispose(bool disposing) -> void \ No newline at end of file +virtual MessagePack.MessagePackStreamReader.Dispose(bool disposing) -> void +MessagePack.Formatters.GenericEnumerableFormatter +MessagePack.Formatters.GenericEnumerableFormatter.GenericEnumerableFormatter() -> void +MessagePack.Formatters.GenericReadOnlyDictionaryFormatter +MessagePack.Formatters.GenericReadOnlyDictionaryFormatter.GenericReadOnlyDictionaryFormatter() -> void \ No newline at end of file From 63349285924d94e205c6cd6f971f8c2c8d9ef176 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 5 Apr 2021 15:54:38 +0000 Subject: [PATCH 063/161] Bump Microsoft.AspNetCore.Mvc.Abstractions Bumps Microsoft.AspNetCore.Mvc.Abstractions from 1.1.2 to 1.1.3. Signed-off-by: dependabot[bot] --- .../MessagePack.AspNetCoreMvcFormatter.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MessagePack.AspNetCoreMvcFormatter/MessagePack.AspNetCoreMvcFormatter.csproj b/src/MessagePack.AspNetCoreMvcFormatter/MessagePack.AspNetCoreMvcFormatter.csproj index 32229c1d7..ef0f8f330 100644 --- a/src/MessagePack.AspNetCoreMvcFormatter/MessagePack.AspNetCoreMvcFormatter.csproj +++ b/src/MessagePack.AspNetCoreMvcFormatter/MessagePack.AspNetCoreMvcFormatter.csproj @@ -15,7 +15,7 @@ - + From 1e337a230165589b1ad9d6bd74fedf60668df9ba Mon Sep 17 00:00:00 2001 From: kyubuns Date: Wed, 14 Apr 2021 10:42:02 +0900 Subject: [PATCH 064/161] Fix readme about mpc --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index de9aeea18..628d85eec 100644 --- a/README.md +++ b/README.md @@ -1526,7 +1526,7 @@ Check in your `.config\dotnet-tools.json` file. On another machine you can "rest Once you have the tool installed, simply invoke using `dotnet mpc` within your repo: ``` -dotnet mpc -h +dotnet mpc --help ``` Alternatively, you can download mpc from the [releases][Releases] page, that includes platform native binaries (that don't require a separate dotnet runtime). @@ -1535,7 +1535,7 @@ Alternatively, you can download mpc from the [releases][Releases] page, that inc Usage: mpc [options...] Options: - -i, -input Input path of analyze csproj or directory, if input multiple csproj split with ','. (Required) + -i, -input Input path to MSBuild project file or the directory containing Unity source files. (Required) -o, -output Output file path(.cs) or directory(multiple generate file). (Required) -c, -conditionalSymbol Conditional compiler symbols, split with ','. (Default: null) -r, -resolverName Set resolver name. (Default: GeneratedResolver) From 827abd99cf8319b8b44e571668d2d2e8db273bdb Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sat, 17 Apr 2021 11:35:58 -0600 Subject: [PATCH 065/161] Update .NET SDK to 5.0.201 This also gives us a new preprocessor symbol: `NET5_0_OR_GREATER`, which we now use to future-proof against targeting newer .NET versions. --- global.json | 2 +- .../MessagePack/Formatters/StandardClassLibraryFormatter.cs | 2 +- .../Assets/Scripts/MessagePack/Resolvers/BuiltinResolver.cs | 2 +- .../Assets/Scripts/Tests/ShareTests/FormatterTest.cs | 2 +- tests/MessagePack.Tests/DynamicObjectResolverRecordsTests.cs | 2 +- tests/MessagePack.Tests/IsExternalInit.cs | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/global.json b/global.json index e6e7ee5c0..e8e7c67eb 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "5.0.100", + "version": "5.0.201", "rollForward": "patch", "allowPrerelease": false } diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/StandardClassLibraryFormatter.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/StandardClassLibraryFormatter.cs index db75c5c4b..921d6cd47 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/StandardClassLibraryFormatter.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/StandardClassLibraryFormatter.cs @@ -636,7 +636,7 @@ public T Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions } } -#if NET5_0 +#if NET5_0_OR_GREATER public sealed class HalfFormatter : IMessagePackFormatter { diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/BuiltinResolver.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/BuiltinResolver.cs index 050b9bcdd..000b9fbdb 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/BuiltinResolver.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/BuiltinResolver.cs @@ -152,7 +152,7 @@ internal static class BuiltinResolverGetFormatterHelper { typeof(System.Numerics.Complex), ComplexFormatter.Instance }, { typeof(System.Numerics.Complex?), new StaticNullableFormatter(ComplexFormatter.Instance) }, -#if NET5_0 +#if NET5_0_OR_GREATER { typeof(System.Half), HalfFormatter.Instance }, #endif }; diff --git a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/FormatterTest.cs b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/FormatterTest.cs index d98e94178..d74e4ba5e 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/FormatterTest.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/FormatterTest.cs @@ -313,7 +313,7 @@ public void UriTest_Relative() this.Convert(relative).ToString().Is("/me/"); } -#if NET5_0 +#if NET5_0_OR_GREATER [Fact] public void HalfTest() diff --git a/tests/MessagePack.Tests/DynamicObjectResolverRecordsTests.cs b/tests/MessagePack.Tests/DynamicObjectResolverRecordsTests.cs index a9bf1b1a8..340ef63e8 100644 --- a/tests/MessagePack.Tests/DynamicObjectResolverRecordsTests.cs +++ b/tests/MessagePack.Tests/DynamicObjectResolverRecordsTests.cs @@ -3,7 +3,7 @@ using Xunit; -#if NET5_0 +#if NET5_0_OR_GREATER namespace MessagePack.Tests { diff --git a/tests/MessagePack.Tests/IsExternalInit.cs b/tests/MessagePack.Tests/IsExternalInit.cs index d7b8c2e01..62f1255f8 100644 --- a/tests/MessagePack.Tests/IsExternalInit.cs +++ b/tests/MessagePack.Tests/IsExternalInit.cs @@ -1,7 +1,7 @@ // Copyright (c) All contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -#if !NET5_0 +#if !NET5_0_OR_GREATER #pragma warning disable CA1812 From 752022ee894cf53ad0b537d51e57d3e111b88fa8 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sat, 17 Apr 2021 11:36:54 -0600 Subject: [PATCH 066/161] Add support for `IReadOnlySet` Closes #1217 --- .../Formatters/CollectionFormatter.cs | 22 +++++++++++++++++++ .../Resolvers/DynamicGenericResolver.cs | 3 +++ .../net5.0/PublicAPI.Unshipped.txt | 2 ++ 3 files changed, 27 insertions(+) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/CollectionFormatter.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/CollectionFormatter.cs index f6bf5d23f..2255cd707 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/CollectionFormatter.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/CollectionFormatter.cs @@ -1271,6 +1271,28 @@ protected override HashSet Create(int count, MessagePackSerializerOptions opt } } +#if NET5_0_OR_GREATER + + public sealed class InterfaceReadOnlySetFormatter : CollectionFormatterBase, IReadOnlySet> + { + protected override void Add(HashSet collection, int index, T value, MessagePackSerializerOptions options) + { + collection.Add(value); + } + + protected override IReadOnlySet Complete(HashSet intermediateCollection) + { + return intermediateCollection; + } + + protected override HashSet Create(int count, MessagePackSerializerOptions options) + { + return new HashSet(options.Security.GetEqualityComparer()); + } + } + +#endif + public sealed class ConcurrentBagFormatter : CollectionFormatterBase> { protected override int? GetCount(ConcurrentBag sequence) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicGenericResolver.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicGenericResolver.cs index bb555243e..dc54e6268 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicGenericResolver.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicGenericResolver.cs @@ -70,6 +70,9 @@ 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<>) }, diff --git a/src/MessagePack/net5.0/PublicAPI.Unshipped.txt b/src/MessagePack/net5.0/PublicAPI.Unshipped.txt index 1525d0ccb..519b17eec 100644 --- a/src/MessagePack/net5.0/PublicAPI.Unshipped.txt +++ b/src/MessagePack/net5.0/PublicAPI.Unshipped.txt @@ -4,6 +4,8 @@ MessagePack.FormatterNotRegisteredException.FormatterNotRegisteredException(Syst MessagePack.Formatters.HalfFormatter MessagePack.Formatters.HalfFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Half MessagePack.Formatters.HalfFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Half value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.InterfaceReadOnlySetFormatter +MessagePack.Formatters.InterfaceReadOnlySetFormatter.InterfaceReadOnlySetFormatter() -> void MessagePack.MessagePackReader.MessagePackReader() -> void MessagePack.MessagePackSerializerOptions.SequencePool.get -> MessagePack.SequencePool MessagePack.MessagePackSerializerOptions.WithPool(MessagePack.SequencePool pool) -> MessagePack.MessagePackSerializerOptions From db1f36e848e9d05681d5db3def77c911083a8b26 Mon Sep 17 00:00:00 2001 From: josh Date: Mon, 17 May 2021 17:15:28 -0700 Subject: [PATCH 067/161] allow the ContractlessStandardResolver to also honor explicitly marked private constructors --- .../Internal/ReflectionExtensions.cs | 7 +++++ .../Resolvers/DynamicObjectResolver.cs | 2 +- .../Tests/ShareTests/AllowPrivateTest.cs | 30 +++++++++++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Internal/ReflectionExtensions.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Internal/ReflectionExtensions.cs index dba621351..8c9956bdd 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Internal/ReflectionExtensions.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Internal/ReflectionExtensions.cs @@ -2,6 +2,7 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; +using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; @@ -48,5 +49,11 @@ public static MethodInfo GetSetMethod(this PropertyInfo propInfo) { return propInfo.SetMethod; } + + public static bool HasPrivateCtorForSerialization(this TypeInfo type) + { + var markedCtor = type.DeclaredConstructors.SingleOrDefault(x => x.GetCustomAttribute(false) != null); + return markedCtor?.Attributes.HasFlag(MethodAttributes.Private) ?? false; + } } } diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs index f285082dc..5b9e3a796 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs @@ -224,7 +224,7 @@ static FormatterCache() return; } - if (ti.IsAnonymous()) + if (ti.IsAnonymous() || ti.HasPrivateCtorForSerialization()) { Formatter = (IMessagePackFormatter)DynamicObjectTypeBuilder.BuildFormatterToDynamicMethod(typeof(T), true, true, false); return; diff --git a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/AllowPrivateTest.cs b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/AllowPrivateTest.cs index 7c418e7ea..505db369e 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/AllowPrivateTest.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/AllowPrivateTest.cs @@ -193,6 +193,25 @@ public ImmutablePrivateClass(int x, int y, bool dummy) public bool CreatedUsingPrivateCtor { get; } } + public class ContractlessClassPrivateCtor + { + public int X { get; private set; } + + public int Y { get; private set; } + + [SerializationConstructor] + private ContractlessClassPrivateCtor(int x, int y) + { + X = x; + Y = y; + } + + public static ContractlessClassPrivateCtor Create(int x, int y) + { + return new ContractlessClassPrivateCtor(x, y); + } + } + [MessagePackObject] public class CompletelyPrivateConstructor { @@ -335,6 +354,17 @@ public void PrivateConstructor2() Assert.Equal(p1.X, p2.X); Assert.Equal(p1.Y, p2.Y); } + + [Fact] + public void ContractlessAttributedPrivateConstructor() + { + var p1 = ContractlessClassPrivateCtor.Create(10, 20); + var bin = MessagePackSerializer.Serialize(p1, ContractlessStandardResolver.Options); + var p2 = MessagePackSerializer.Deserialize(bin, ContractlessStandardResolver.Options); + + Assert.Equal(p1.X, p2.X); + Assert.Equal(p1.Y, p2.Y); + } #endif } } From e94dbb5a1769a3d95071c0da1b96050e761a381f Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sat, 29 May 2021 14:15:21 -0600 Subject: [PATCH 068/161] Allow deserializing `byte[]` from a msgpack array Prior to this change, we only could deserialize `byte[]` from a msgpack `bin` type. We still always serialize `byte[]` with the `bin` type. Fixes #1251 --- .../StandardClassLibraryFormatter.cs | 35 ++++++++++++- .../StandardClassLibraryFormatterTests.cs | 52 +++++++++++++++++++ 2 files changed, 85 insertions(+), 2 deletions(-) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/StandardClassLibraryFormatter.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/StandardClassLibraryFormatter.cs index a227aaca2..baf528224 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/StandardClassLibraryFormatter.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/StandardClassLibraryFormatter.cs @@ -15,7 +15,10 @@ namespace MessagePack.Formatters { // NET40 -> BigInteger, Complex, Tuple - // byte[] is special. represents bin type. + /// + /// Serializes a array as a bin type. + /// Deserializes a bin type or an array of byte-sized integers into a array. + /// public sealed class ByteArrayFormatter : IMessagePackFormatter { public static readonly ByteArrayFormatter Instance = new ByteArrayFormatter(); @@ -31,7 +34,35 @@ public void Serialize(ref MessagePackWriter writer, byte[] value, MessagePackSer public byte[] Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) { - return reader.ReadBytes()?.ToArray(); + if (reader.NextMessagePackType == MessagePackType.Array) + { + int len = reader.ReadArrayHeader(); + if (len == 0) + { + return Array.Empty(); + } + + byte[] array = new byte[len]; + options.Security.DepthStep(ref reader); + try + { + for (int i = 0; i < len; i++) + { + reader.CancellationToken.ThrowIfCancellationRequested(); + array[i] = reader.ReadByte(); + } + } + finally + { + reader.Depth--; + } + + return array; + } + else + { + return reader.ReadBytes()?.ToArray(); + } } } diff --git a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/StandardClassLibraryFormatterTests.cs b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/StandardClassLibraryFormatterTests.cs index 6d4d9b34a..12abda441 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/StandardClassLibraryFormatterTests.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/StandardClassLibraryFormatterTests.cs @@ -2,12 +2,21 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; +using System.Linq; using Xunit; +using Xunit.Abstractions; namespace MessagePack.Tests { public class StandardClassLibraryFormatterTests : TestBase { + private readonly ITestOutputHelper logger; + + public StandardClassLibraryFormatterTests(ITestOutputHelper logger) + { + this.logger = logger; + } + [Fact] public void SystemType_Serializable() { @@ -25,5 +34,48 @@ public void SystemType_Serializable_Null() Type type2 = MessagePackSerializer.Deserialize(msgpack, MessagePackSerializerOptions.Standard); Assert.Equal(type, type2); } + + [Fact] + public void DeserializeByteArrayFromFixArray() + { + var input = new byte[] { 0x93, 0x01, 0x02, 0x03 }; + byte[] byte_array = MessagePackSerializer.Deserialize(input); + Assert.Equal(new byte[] { 1, 2, 3 }, byte_array); + } + + [Fact] + public void DeserializeByteArrayFromFixArray_LargerNumbers() + { + var input = new byte[] { 0x93, 0x01, 0x02, 0xCC, 0xD4 }; + byte[] byte_array = MessagePackSerializer.Deserialize(input); + Assert.Equal(new byte[] { 1, 2, 212 }, byte_array); + } + + [Fact] + public void DeserializeByteArrayFromFixArray_LargerThanByte() + { + var input = new byte[] { 0x93, 0x01, 0x02, 0xCD, 0x08, 0x48 }; // 1, 2, 2120 + var ex = Assert.Throws(() => MessagePackSerializer.Deserialize(input)); + this.logger.WriteLine(ex.ToString()); + } + + [Fact] + public void DeserializeByteArrayFromFixArray_ZeroLength() + { + var input = new byte[] { 0x90 }; // [ ] + byte[] actual = MessagePackSerializer.Deserialize(input); + Assert.Empty(actual); + + // Make sure we're optimized to reuse singleton empty arrays. + Assert.Same(Array.Empty(), actual); + } + + [Fact] + public void DeserializeByteArrayFromFixArray_Array32() + { + var input = new byte[] { 0xDD, 0, 0, 0, 3, 1, 2, 3 }; + byte[] byte_array = MessagePackSerializer.Deserialize(input); + Assert.Equal(new byte[] { 1, 2, 3 }, byte_array); + } } } From 83f7cb6ea003b289ff70783e1de1fa12edab0f2c Mon Sep 17 00:00:00 2001 From: Jesse Talavera-Greenberg Date: Sat, 29 May 2021 16:53:33 -0400 Subject: [PATCH 069/161] Add Odin Serializer to the benchmark (round 2) (#1248) * Add OdinSerializer to SerializerBenchmark * Add OdinSerializer benchmark * Set Odin's serialization policy to Everything - Benchmark results should now be correct * Add a comment about Odin * Update Odin - Fix the issue where an exception stopped the entire benchmark suite - The exception still occurs but outside of Odin's code; it is now logged * Don't use an alias for the Odin assembly * Simplify the reference to Odin --- .../SerializerBenchmark/OdinSerializer.dll | Bin 0 -> 268288 bytes .../SerializerBenchmark.cs | 2 ++ .../SerializerBenchmark.csproj | 3 +- .../Serializers/OdinSerializer.cs | 29 ++++++++++++++++++ 4 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 benchmark/SerializerBenchmark/OdinSerializer.dll create mode 100644 benchmark/SerializerBenchmark/Serializers/OdinSerializer.cs diff --git a/benchmark/SerializerBenchmark/OdinSerializer.dll b/benchmark/SerializerBenchmark/OdinSerializer.dll new file mode 100644 index 0000000000000000000000000000000000000000..c46f549364ae8b2384e0fe6c3a85e35d55713f74 GIT binary patch literal 268288 zcmeFa37lL-wLgC6-rKjkZ+Fkko$l$LC7GUt%;eI`B$;8Ege76$Av;NA4Qm4CLU$sV zVVXg40U>}ODh5Pw1vgv}7u?@daT^wWPb6bhRP^~=-=a?){@-(|?$XOF3DL*r{eSbB z?yg&>mQ&}PI#qS*RNXT+-L7bgqUiX%_@bgbhF|(y!Qaz=jRD-8{YB3j`UUcEMZO-=I&6o6+c5Lh2vaR>{v)1&!(z*DOfkeVwAd6mk zf})(>q$%&rKe@}TZLc!FH`cURQCfkOA!6?tK)4s-6@;nM%3)RDO%WVRfiZ*-Pk)+n z!Rsg~{rkW2k)rT-63RV`0x0)$M2OnI3v?xpxV1%HSz8O6?zvY{A^~^=&nE|-2ew~w z?RGrh-y+*ZZIyVt$&lrOfl|425h55j;HcnVX`?UyZw0U)C|z=;gM@^u0-U+5bX~e* z{ahk6LUhF+;if7fr6Z{-M|P=76UXlRS62l&^<0)GdhWeiF;+rh zSC!91={q$CEHx38ps1A;rD~&`a;rK*wG?A&`TM|-s}xbW`A9>sT=!y4u}~WRE!A0q zT1{i_3hEh|xZ2j_BoWgePT8waaA8~6{v!%1Zq_4$SuI`U?RW9XwhVL`Jp*YYn;43!&LE+b z|B31p5y(F~u^}Db8384o6ak(yvhkrqWvW04gOocW<8wxjU(&O(q^FQ#Acl%i6xWdh z6`JOdTy!e$d`!{KhuEkHKk!*4MzLVi(Wo-_6Lp6PP{9(vj*b>OYtYu5x&y3d0R1|9 zk=l6{EzeaJ5=)4jkj$?4I@!1HVpyd zG`X8)+EjJg2Pti?5~9QtB8f<_Ys(P$cLdN3X3*YE=~Y?NhEb|MH#v)ZdMI6PL2DZ2 z2mO+Z4ds6PLJ+N~O5>(>1+fV>wJ;|LNwudketr3)g0Rd+ZnPPUGe)Rmi9TnHL=X;S zuW4>_v95qFG=2bABK)o`9h+_?!pJgX>3F`)h=e0t5jQ!K*$|I}cWoJbK{ZAxkIN8r z*Q2PruIBD43A<4cmgu4>C!sF-6R_&^Q}7*$%2O3OUrmeBSF71x#+vbw8p_v77=ff# zI+i3Gaug=C>vYZ

rM&>Ksl9okL}i&N&O5AEgHo#X5%`q3fJus3%~IF-g~PCwfBd zRc>!mZpFyhG>Yz|tJ&7_I;0qde$>@e%0{0vz!idxqC4ri8M0`4eHMfIbaHV>d5i>$ zczGT4rf#oCMTL~6jK7Yf+B)pYWN$=MVVAAhB6|hVeNapG)w0 zH9l{~=e_uR0iUPw`87U&!zT&67swB2qzs_Glkpio3XxiBm6{qQ8mZZq@&@7#k#Bet z!BqP-pwlXKZUAtM%oL2n?1BsG38d?kaoKnvQg-Mn2>`MLi{NIql+6MlV;#{@| zTmD3Y#E%9OcLnHtuS^__yJ@P#S2aj{&QytyYmj(RFmWb;Mp`Bg#;H>!{v~=QQ6rf6 zdlctVqa#rA=Vanw-1~!xy90@DlZgXy`HENU96x3LazY>&aW)1S)`Mw3Rq5ZnA&HVV zNbr*;{p<$$Yc{jr0LHuoTb`O%$V!Efxb2S&G;z{Yp18TE?TUmx2_A$T93gv zR{9W7((H2xJIulacFt*lq;nZexWp8aa;9?_Uvvcp(sFJ}+=xz@fv9MB$IyVl1ay8q z@~y(m+eYh*VhBV->0(?8Yb))gh|T0gwoW&H*HE@5zsS(;XW+>)7e?css-WF#d{Ck3bTph9oH0CXk#vfcX)%HoIi#AsIE)EYsPT1)(`iGgaBu0H?Ej zoQ`)nnwT9@S87ut)g3_U0|Ke;p_D{QwSlf-AL*i|bT1Ao&!Q({f@6&zrzqX_xsU_< zKQJ3FE-3vO)%dZ_c_bns-4$T5AoC{~4Ft5gL35T~g!&{tZ5qo$!BpGypj1RHeN!@| zS|Kq%u^=T_i0M2dVNUy4jf1pJ0&6T{%)(MD#1pL~=J`C=;`xkaq*2%fNT6B9_T$me zRdS|dg~UWBlhdNN5(QROE~IicYb!hL%?KsKqM*KHv|w1#U0aGqdT%n4k6F?5ZB#iP ztcaL4ZAhAJVf!M=6>p2%7gHc+nN|#y_l6W>Vq+>9eGW-30pz(#1a0zL;#`Wz?I!|- zWFnnx&fD5btJz9aHKQ4X+2CA;gzqL?t>(;zWV6*A9eld3IkMkUClhNutnZpmzoZE> z4_cRWHm%&!1O&vK@oN0yVah(u`lh=9Hw#0Om0~Jc$YP?&WETWUMCCj(dPiomX*GzP zUhS(C1W|7{`s`f%V&ZF2mpBO0S!mXbkFTCE`jLJ@k=c-@2{UFiUNKq~V?G|;yr`1% zE|hs+zYlq9>;2>!u6K>7cMan>+j`%y4|!|r{nT2ncde**?LO7}##!dQ4}A~Q`sw-H z*?`YWH&U-u2DTYY7Zupb zl+~d88}WgT=0B48yYUQ-xF396qE~}il#tm#E2D@wwgN-M+khR2Mo*%Vak@VI<18iQGht9!VCuvR`>IMp6 zH}SU^qiBzRW@G-DHT*jj6ekm@%RjP#To3f2Q>Ww~hG{+9=MClk-n2rqG33DdCgvRr zy%hG4Efp~@Rb$~oBb*+r z5jXrhCH&ta%;ONCEi=(ENF{fws4uS))6+KL^~B~tUx&s8ZQa_t1odWJ=D}W>x!II?+-&fSd1b}}WnxJ8@NB196ybQv zY|0z-${QMj!BpD(cpa^+OigNT>&29s%Ow-&jPxvePWVr?7lF*em^|5jEGF@;@l={YM$m(G=PJlB3?rCv>iD509F{4V_v&m0 z=eBD~1tqqTO!68}EFZ920|SDIlxBX70Pw2L6p?-LLMVcjSSY_~H1SP^zW7ig5gQb#sDqdQJWvr30yJ6`bJx+h7vv?)B5DXOWQ zXR$yy9WIxUI&Lg`2v|#GrmQql)YE(Ov4~wpo@B@h?M0)A7#osCGA!1ab{cERIaat2 zE4i>`(2sG_YAei-*kz%`Wq9yM`Tle=O6fShHZ@jRNzCSu4olMzS}0e8VX?N2D^zNR0cn_@ou?p8JN;4^l{_e`UpSzyaOLvs8QHWyXV(< z5T?9-wab1Tw7{})MD2OTkKglk3imLuf6r&>0o{r8G8uYY^WUBa2w;Ra$#hf$Hl(P; z{ynd!hYs;Dah1;I&rxdI#0Dr8h$(8q=8P9WMZRC@nJzAkB3s3z$I zcK6?aVxP--YcXgvg2KDi4=s%8q?iD_gPuXsDr1a@R1B$Y#YkZ4EK<%XEoH!5;n3g# z>{p>6rtUCSB#Mz;G=z0<06QK&le(oB7D%+nJ-~uvL^Y1i^*}V=l!AVtF$2pM>>--@ zBaQ69ke-U=hXAR`QaTMNwJDS72%79%i{v$y>u_${)MJyNze@HdF?LI{x*Ol(#@n!5 z7_O0)<`E%<(lD>3xob|fxht@3>e{*luk$te=1!UKGA|?9+R+;nnEWmDg|`Bk!WDAJ zi4{WFe5X;)%tym=kTZphw# zX2-r$*XECB_H|CfzG`MxKMB^Z^;p~0n6;QB6JH5mn4R_?-_!oF_&yDMF`Rn%er$I1 zEmR&w-zfOK)uIZ*M0$iwna{4!vh1bX$lzQ3&&q z8J{hr(xU5UUcAo`}0pW`Z@qV~0VTHy3`!!!n`w^IA6 z^g!1J(gR&++No=y2dK^KhB0CwZ8Fpr+B+9>QLoWFIo+5v!&rV3-vw7nO- zIMA1?pG40V1$Iz@Az5H(Z?@%sxr_h3Rme=`OBKV!@felQX*bZ<@MV(U^zc&o%>`0tCVq2)p}n>G9Ne$c=l{FU0aWG?CI@_gak)*@n3>y@ zDxJGotmcaFsCgT$2Y70&Z4j}OYI?E>i-K;F2O2m@9;Cs`!9v2=0poI0;aFAmpPW}? z!6N)XMXa+E5nH5rjMF(I97B`%J#Rv>{S$Cf_6=u&Y%)mcH*S#@o?Tmv!L$GfJ)Sn4 z>yV&7e~4-XyimES>J&z=qTH`6j-xgcm9sOd+a7~4%*j3Yl(Kw{Lc0e|v@Rl7PWmg4 zqMp8S5K8!DRN&{SPa1vjeJED|a$uhT94p2uct63%d^nc6Rq%xbzrly!Qv&nA1cNEY&G*g#>>z^O?8EL4z!ne;LgMBlsddZjC)h16 zYz)g~9WMRZRv`pQJgNcLWEjWDHMz1CJS*RdT%!T1)UbUbYd5>>02>( zx4_eO^JwhcHGQV;-MrpA3wh9gEp5koC@@paMx6j*`P9^yrWtZZg73WqNTO2Lez)Al?l8PQr9nT~LaC*oGL5Jnt?+l0N4e1%lyi%S2` z#W60I9(_!YjsLs!AkFzQpvM^)FZ!7tn}{AAFHt_0LR%?vqhfz0g~qIXq6}@ww5pJh zJDn#WGM3zgfus-qvRaI!VXn=v%qnTh=VU|@jwSJYJNyLW;Z24Wztgs%xve;?3vnw> zB|a}DPZZ!wo(ah_UCBcWSoVIQY+TU<6EsMRzDTr&PC-9^#mj}(G(PVit>5f?^8nNO z&Gy0rOKa$2(E1#rb=S*4u4%rrf3&`fRq%n7>$~iO4=k+@W?EyE?lyZ~2DHXdv7fZQ z+ZjK=a(%a*Kd`jUF|Dyl`0~)#G#}qTxxUl+)&ZvV0oT`gruF$R7ac|zb6U*bF)HV(}FE_%7>lKc0Y)^B&7I>5Ak zyFGB=XuS!#WHHnFVxslr9I|@74D<=1vCqOS^a*8ko~a@FOV%e;stsqgs>S5K=#$?m z=bj<-37uPjZA4iDx>w+o5;(dB4;mrCu#oz1m%&R%w6UY*iLuCt9ir*==v$vD+WhGJoxcKL{#Q%VcM-sMh( z+zgU5=+>T}H$%!Hs*sHSY}cNB`@GEpcMo88?c=S3`u1ssnfhY4+akF1$gV-F{u$*I zTOvAdiE#VQ^!mjNdm-7PTi;Bi9)McmJ~w;XMcuOZjdo_WY+%1j_VH6^;Bkvr-?U?d z{?v@hwRKA6ioCL4&YliQ4=+!@l7(_6{hA^=aKe40d)BMZ>ytDqo~cjvQhl6|>%)$Z zr29;wvCyq=#$ISs72FH=RhGQXGhdd-YA{oqcq@$)?&Ekd*KL#E4{7B*V?V_Hlx}lM z8ZTxqBkf*&o{W$MY9<*;Q+1s1Qq{(q8NLUYC+Q9*OmwP-<}9wfj)0$om_vz$qPRED zDCMASu^>GLS)IFReum3FL=@(6axaTr4NT)1-V%<9#ObZhTc{4s8BQBpg!_PaHWI-<8~fdqTiV7 zz{J_PrM$7V^j#=^=DjUV968d&kt4X!?De-k!`S=`hjCH}2WrANsdGOHq(es$FC4j= z;%=ZXD=ZUO(Zim!!Z`FF!C|3R%k0CU8{B9?Ke1ER;Bt%T;lHB&R&1r_w>LsC9^9sl zH$X7%?#(8W&1pVUl%R_(;9;7;ai3=VHls3}F2Z-hYQcAl)gq4jP_1(Mj&v33jC=MQH~@KxKRv@8a?u045G6wel7n4klSz#?E5T7ne0s53;Oum{ab- zMV5-yijB8cvGFDf#?c|k*}~aVuoWFTz}9rKEx&Mzl$zDXLiN;cI{1X6PHo}AXQXXO zpp%|`(`22uffP6{l@#qurIYP>9GkM*HLKmNs~vTlso($|c z&Vjfn6HN<4Y8*0(@aNTI6^+B67pzS$$+{#@5i3M2mnRjOYLiOh`OO6=<51FNV#|Lz zU*|YfA~Ah~wkDr-!||3TI`9yIZ+4u|I-ImR5AU3_RMt9B}w&(BZJz$&&PE_C;!az5+?|o)eHINfDfynJOGP zX?6Z2mx@Up1>ocWpBI3aJ)IZW=$;pt{+Z4TcoOSURm`jY18q8dc5NCKuEi}bLfX3F z4Z`u~N_QQKMm z(a%+#licOGcMAQ4t8Vw7KV+{SUa{Z&!L7&D{HbD&cUDVkrvKe%%xgn%bN@R?Ph;-T zJs7lJ#7ardt#)lOHDgJvWJO?=y9d+5ouZ#;8;m8GBlC=mc&gGlhq`rhQDHRT6<7&)Q1Fml-| zKj_2AX~Kn(%R>3xJ}l@IPFw8d_xLc{Sa$Q#PH_3XK8!X`T^Ma$mfz>Y&>Rm&TW#g{ z`!L=HBHF^yoOXlCm<9;Cj9E~Of=v%0F5tW0!HemDvwlWKc#Lo(Jj%Nf9;w|jJo?~41Es299tQyXa1G3324Eklf{oGsVy>U=Mqhwe z4q#nqC?9}sr$6uZ^mC9#b+1CNJ$a%|8Yd%X8Fjh}z+)d^rw|Nvx-gG@fZ@V6qx?}H z=CKd3(+Kv65A)au*y#lOm=E*V2iO?|`?wGD*az5|1p9;!^VkR2Sp@r}5A)au*h+#u z>cc$t0fuY-jPj>^n8!ZAaG{`4e$0n?>;nu&DWm*pA9la1Q~+B`u+R7~k9~mQG7F>p zSr;}6Rm1Q4XaQGq6&%TEMF93TdKR}ily5+e(G8StP#vLP=e3C8@k3Wm1D}U!oVso! zApRZpoA9(sMxKq@Fal9lO}*|F_`x>xjVMFKrOK30HN<7jR0Quug%!G&dnuL6?*r*q zM+j!ljp2S06kvvNXPhGLj9dB#h?_b><;2?)?n^iLxpW%FOZ#(3UpPq}p^AH7L}L4K z#NghH&*P`KuL-@2iEBbyD0A(78aJU{dE-av#}wB2_7D3DXo|Sw<6o)F+HAk@ zv-xep{k+3aI!Y!PYNv@ewIO?*^FiK zANR<4Gnpu$LRas7vx`8OEr$Ir*d2Tf=4WLV}#SNp=r}F&n0OiL76>&8_QX$ioyO(<6`}FHG24w;H`hN^uFBZU8NYa z&5Z;i$|?li0y0ecvGjhAAGoZYyX*6~>W8;cO1?nwb?;NiL#{4gLwVpLszl*4(^UN( zPZT&`kVPXjK=}j`S8u--u4D-H6 zDS0O#-3xXmWa_B8zSZ4;k_Ea3h&o8=+?X6uR%hZ9xJBti3}fD{z_=!x?l2SnoePxo zGI9MB-IaMX)8;w z_FB}g$;V)uRtXfVrHy3mRA5#wYnevXb;{~8yxFs+ft=w&;Gmqf9p=hGNWoldw)OP8 z^$2$HFx?@>=vDQVQor$JZ-J6M&aG4BYw_ya*3qbKN6I<_e2>@gJzm52_{21PCo)LB zFHqW-x_n3Y6qoM{ltVZAxXwlTD9Q1D-d|svcVF(HugyEVd*pS#ce9?pjb@aE(*-a6 zaa^;%fgV-R!O$b?RQF8~W|6@k%F}VWEW1jr(XBl}c{^cCH9bv9&xKI5^ge)nxzoQk z@4np2Uz>M!ck91YdOk5VJ-_r)>8UGN;x*{MT@CtDajsNa4F%y0xe^IV0=$@nBrLC! zgugV#JY6jb?!79W9ynGx;SH`V{C#o%*3`H!jW?9y8r(4m@V(|!;0`O%-;M5Yf)R8- zu8!{I#<X zdI+a+CxGk0L=n=1sU?9q*LRRrB={~utgmutGqoLhwc-7c*y@mXJ_j0BbBE-~F5RYC zE*1}-X0cI>2j}?g7x7_~xg1rulh+Ym*GH5Tu1DErLwdx_x3S+*VAvge)@UDSm1}UZ zUfwv=S0^oVL5Ny?EuQffK%P^@!odzt29AOXM%T{u$;1)%b-u>eZ!;}pz#eXFTnj46j0U&E@ZMlfC>x^;3zplI`+`7pBcuESAJ`oP!gOYopY?(F1cB!h@P|GSgRD=Xa|!sI z54=AJJdc2Td|+1)xQ2ieE^u@+7=#y$3Wnw2P<06+0uEKgT{u)xtm{xkVd+ryb5$#? zB1Lx%1jf7E2Blp{Y1on(a)>9od=YXOKBuoH;d-<>r@X92=B!H%`J?sEV*GOd^zNbA zN%dyz5&9WnNffy9X&XY+$d2yLJ*1Y%s-!t20V*4KO6xqdCANY4fEKy+xOe2tqMCEz z-Ay<`zR143fA$f2L-j@=Cf-o3ju3Zh?FetCBWWsIMYLU8w#qh$@zhxly{$$D5FU~0-J3PowJP4I3S|_u=+Dr6PFVSHTBfLpf z2q50@td-t?C)DL9ex4Fv?d1p*8wl2-@iQ+y@szCEL!>9uHc5iE^f545I$P>I@@<&2 zVOk-azZ+awFolT1v3M)$duq4f3m1r2u1z7&I94j$e3*h+A)&fm@X3!P+!jkI&K9S0DXBj!z+nUc+-K zo+OLX+nok7;q5N9ANp@d83k*_-0&DkuIuam4U~wvAxGVX7QokCP8T_91X26pR#PwmMPW(@84oKTz%P%ZBQ!rNz^|VAf`(b|-4NtLLM_o&p}`|JbP0D9OtY{e z5(y1=xFmeIm9f5Z@1#%iK zb}mE+TOZR;25=}hEhZ;IQ|?sl!_dvU@M?|=vpbI$qFb56cOzOe zcsz+=H#8E?UVk+7r8`;~8yj^Hc!`DNFmHvj=Tr|c)xaIQ!#x+p!%rnDm}Tmbx8P+k z!IoAfws2f-I%u}_;-_|VInkG1&M>{h9Y?ZhDj3ct4qX&pT0~5E?#2_sXg_963YHtn zx1mDd^`M*pSSx;a;WNB~5@zQQnBnX>1IG_9p^~O-)%5h4zk9glC1gKm_wYC{+TYqQ z+&z59OUS-?_b|LS_Ph2=cMm6DLiTODhp}?o@7hbdhu`uNvTxs=-?+bIU%WdHyJn!n zS9OE%Q@dg5Fb&aBm!J377hmK)9O8GGo`pW#OWQuT-iu|LiQzim)>JwT+Eh%HY5E#B z!V&R;#faEn$+m9Za39YWIqTrJjof;B6p}wiz0!UGdB#Yc<)DYIqTl(dHp&6$e^tS9 zmj6^y@!L@G=#@yO+R&~hEkahIez6Fl$<_JZlO`rau~LHGPQDVUcdA46-@J)b`OU03JRLajN|$ zl#&Q9b+{|N67fl+&9MIsS&Q+u@MJqU-ED>QaYX(ak>!8KS5nWOgDc*3`!{&7LU6Xx z?cXAJ{!$yoM6>4%Wz_4aEQywV3o03Y8VWO--F#>&nq53_cr<(Az#tw6io<^dPomjN z2M&s6w+-|}v!#tE05yKy5_QoK!WcS~;cw!hvIWIPo!_Chgc>dX9>1ehlRCm=9if&* z?^Q*O7otWHRBia88cEnT`8O(mP5B#Bt%&`4q`(e|6&0alRm&8iVbzL>&;Zg|QF;-y z{YIkO)EEr^j0kF9k5v9^e6k7mJw6WjjQ9AcBg9MR4`>CS-{iMV!&bp>_W25@>BOr| z|Hv_2r6)P28*ix_?h+%{9j^vIZOv@Is1vS#UfoG%NxAR@uYKvc?XDE|kSn~j(L zMhW~k0aY=NWeH}??(%;k`6x-2kgx0x=f4mm9;`_4AsT!zgAXx&7^e3xg^O)bSUeL( zJG~=Lpkzj~^M|ev)BAB=sw@^3s@eIC1tdG)m5}AYL$z-Lm-@rF0X#N5K!_FMGHy7F z$Ef|^XeN4<5UMz$Dwl%_(Kglj6Cg{$3|#Kd?q=jKM#3)I(|!bO0GJTyA)_rJEaz6j zejVVs5Hi3=bG20SA4Gkij=L6`Wt7vY;nbOODk6zP^%$Kx;gtOp5R7xYc zT@^wSreJQ$B&xpB#>M4^DV+feW(XmXDU=3UqCeaTnZtV%`61J+cWmU2u`1sxH# zh{2A26xN>(`!8s0VSaNcmW?-f$95qCDu=T1)j4D!bI~j_G;;>L65Y+vGiA#{*(fJ& zn_Xg)6O+4zL}j{?W1N^g8D^2Vm8eJzZ`KFrNJce7x44lmEj5rtU%Avm=K)d3Mkosp zxr8F;BR>wb&{y(&yO?xk!Sq?KuViCXr{IJhnnTIiKq`ySLvuN*$0v{;>ftD|NBR|k zOUOCjPX>e%9LJ1s{z|My9O#X7Om8m^WJMg4)r$l55XaQ>;)qC66zRQd>#0bHq9#Sr zZC|VGF`i(%U1?73KvL=lzU&>BAFhL42Uw#XQ+gHvo7aV>;phNKZ%ZTT4R&0K5&FtK zT6XbZNXsr=(xqiDq|l{HTD9ykgHbJeqIi8mIw#+Wrz*#wf1iMUoi-_3GqNp4y2Tsy zO=dnvxh&*b97kwl*4#j`DJr!Er7lL63uP>Ajqu&aummZvZ(2`_JA5cQu0sAelrX{@A{(L`o=oZ!XT#~QdNA&G$Kt&p3&!G>COKesz^W?7*UlDA zhPqmG5%LGgY%hvcEImj5R*Ev9#Fr^&=P|(}y;efZ8p2nw5KBJlBjQ2uX4jU?#=%8y zxMS0;G&gid=rG1;8mf0~>DXjn0C7>na@t6G97C=@*)i^gd$czV5_?IS@;TJM7WE68 zt?VY@Ijn$lVtU*$xIhzAU8uiKO+>l z;$kkG>lhr^+#>^*X5%unEo;h9DVva??RXJ^$gnugfiar9lYP+k6N55Fe|;Nrq1m?4v&HtpV6$1bf7X-5!8_nqVLE zVY>pb&k*e6J`58zufER`>=QnW7MU(CpCi~Oeb{{g7~VEC<>`;l6YNudzIy`szCf_Y zeAqh!urCtq(?0C}0PITy`-~6k3c$Whu+O@%(N`0{?o&su#cu)YZemq>FeL&a+6hA> zCiPr8w^c+GV`>?vYt2#0B%*RBYDJ?AZ(~}*a(r%}Gyr8$HYqL`J{m41oKeU{ZkhBw zk&loajb$A}DEiY5R3S!Fn!atv6V8-y2v8>p}_+W05at4Ni^E z&yY&w;&FZk^MQzs6_B~?tBA%6sv~TU?r;)_BU?;*aC?MIoa}A_aM}tvUjpuQWW;X| zj0vAdWFcf3iF{p)ypj2fXc4G?NLeSK%>(5}Sd7C{c@u_tgdu zolNn*D24BJc`x^c$hy<9bqmuI`z@uG=+b@K-4A=jtD_$c(MTIBmr%7 za-?vB3vHCQfaM;yDR7{G#y9lqsx}-yZ6UpNa^|0bsc%FhIuvKuhDKQnDVHrZhh7@` zN;9Dv`sJt5DY;`*`QDBOK#hamtOwYk(PWsG;m1W1c{)#HU;@hM?g58>h7@TJB zyQ(SBoYnq~9Pze{U$3m#Nd9ky2jTgip$1qe{@Li^x| z8ARWAA{FNtj#W;*#mE2s4e5Gd@c(vW{J%8~{yo4S&X_^`4+4h#$Ih7bZP1jv0Nzl? zgT`kiHc4?{hxoqu4K!Fs_+*0(R|#?(O-!6peJo-Y$0UOIRv(iPXC(TRp$)FDJi?bN z@{B~EvgTUB3(_Ym(2jskbhSytGZJJpGL-fK}-ycDoq86Fj8QKFUV$-FI=@m$QU& zD$?i>A*TC0nZd*`o%2ig-wY}4kEHoI^?!Q~hOO<#!>F^05L^Ng#4=vYbQ%_4s^z*j zIeZAj#pICY(M^--(=kbPuyWv?ljj)JDGSDWH+?K>l;FDAqdRWO^MY7w6Q;g;ftFwa z#9G7xzW#Pj>D2Zq_*+*b3!<3YYmsL}P3j1(uY8&X4lho3XmM*~@MqqsMLIh;7qU^? zr$4@W0_Oho>Io&2quGu-9{_b}?hp>}u47;)suoIwj3uV)2 zSw&|x2r3MaY=1<*YIt^}#f=vo+dDNv^}>)vb0c0ipl?>40f1ec<9lo3p`SQ@UQK*j z#-kThl@sjm!7~iU$@B|q(nI5N`F%CY%X0%g=26miC2 z6#)P5Lp%ZJ_iJy0>cy^uyGLbv_rro@B!Q3g$Fqxkk@}z*bVw9HV5lYg4lEQBoaka2^+q zJnaM{bzwMoZ905BmZ4suUZV6fU zQNVjz3MV941lfJkqR$1&k!MAwVO7sm<@5+waW3x&53g#TyFBW4c~pHqBG6*ub%^FQ z)6%w6mQ!_xp`%)Mpr2R{X)KwJPZ_T)AufBXxsG5f9VH z!#^?cd;>gYrcZ}o)O1bSf0^uTB$G4a)lk0co4EgY{j`o;T-J=VkNO0gp7t8OqiWiI zH%As#r8OI++89XL47R60`kp3EKUo^&Ilu-S-O87&5}3Y z(2+E}Jq*(=aZY84mS?W6tm(GHDDsF2~daql$hj$&yexYO| zd5@+j=McZn06)h@K|XQK>Om-Xtl~aau%&92`zY>u#FhIgG)AF?6uJQ++eXMa7+>(h z9!{ZHBYaOh;^ZhgkFP|u^g9fSd?iwGVYH-V+=s4csl$6fvc-51Hy4KXd`(r9Kp~}L zU05+089&Wyt$m0NdvDyngnmMM?x0-b=lbA75ueo4$q=6nuyD!!J=+PK#LGvVL745F z0#ID~2q^4E6cMrPem|lD?^)AXgs+snm|!>huK5^)aqTK*vd$_Q@xZa<=~`_Sq=gmHgRR+>6oIqE895so;AQi0#0Xj-}0aN0K}E}t^b+dHSqbI5+=QP`+s zfJZ;Y(G3=m%3Wyuq_KqVfIbYUIfvtm=_etB1Q{j>&Mfk~D37@qt;FA{knkh%`+EFB z6VZpQ1Mqu**;Y}g-;iB>aZUVRWIWVRReIdv%;^Ua-&J0Q+IGsHP5v0H+P}d6|Y2%!gJC+gE_ZtxXkDEU|Pv40H1l)JD=GDxDNO5>Lev zE`9q0N;W4pC8Ewzh}v-|@F*nJz?1!3q{yq$ofC(W14JNMN)0}WbeI_IoQUJSJ64Dz zCKOqx;T(pUV-xLWAJ6paXm0E1wEkRRXc-DPQD&ba71V69dmIw(moc6 z$?M~tczU3(TXT-12=>He`7C|82Mp!Rz6VVCNRV~s(b>uJ5G15e9eq0l344u(G6w#h z&-nZiw;LAHr8!w-cYvZWJBq_L<>LuOSU4{h-8Jl-fQS+5nQB^t>;HeDF@>-ZaZW`1 z#Il_`cP2_Vq9hhhk@^=~VaAXt0~I&~q*aHyxXUw_)-&jDbYq4gkKLg4kpz zg-cki&hz*Ri;NctS+PUB=7Hsyk9V*yr)f9(v1MoAn8p~(!=pR7oenCNf)W7q*#@t^WnT& zNr$}s|4-8Gprm(CA?cbG%{376@6Jxhtyp{yP3b2NypW4IWGjZGrRb4(ms_HsS&5v8 z?kfGp)2F4yz3xQfDX8OF^bK5KCi=xeO5e$Dzd-mDw_hN9s@pFRKF#eHPc<$4bCc{B z2>(x$>=y|CrAhV+g#X$k`-Mj5j+6`0FDexpX)(~A1r<_Uq55kVQ-BO-B_I?1P!_S$ zYtW+Fu_heU3N%#8v9d+!I@oOk!nm4M^i_oOZW|CTCWrb?YLSIIH!RHbc2YKl-C};yBD9 zBDX9TFBQ>?5e+LIC12E0wT-3M;cg;#7;02S+C%>4aavgN8nYJL@_isopq*w)*nGbX zd@dsTft@d4eU*)`_#mQmXfaqnu_YdU=2i^K-K%i7yl$@oTXFZmsFyl1bf)g?MM8g* z-}5*4H5iXc3Z`c}FjJse%7S?m)7jQ!V|mCkloKh&KO&OPYbzs_)u=^x*5LcyRJB)G z%K%;Z6OU{SFCW3=Tz6mwHTrWp9kL)HB40;PjPH-owUu-O5!{sxDC!KCsjV~~ztUGa}e9pZKSWyyS7%KnHd6V}x3cXxEK-+OO(q_e?eI zwv^W+gP`5n2&Lo0_j3wK>;p``iSx9TmDhrMy0ZbbIUDiSuRG6yJjI2zd@5ZF+Uw3w z02I5#bjE37j!WSUpzuVqr15hejfGD^i}I}>DiO4VX%0UbdS^Lq+F$8xLX{rbhZM#J zba!5Xc-=V%-xHlNolZ^!Hh#j+=~Op-aF``r$lzB3T!B>2q1uv4yRCFm-v>98RjY(Q z5_ohj3I>lf;t>%5`v6gm6is4kC_Th47?tHNMLweC4pl%nY3XgMw4WSSVl$Z;TD6!YO;g2Ype^%0B&a3ggJ6k|Q(KTrqw@9gw_=fLk z0eDtr_Io?FZu`ZGjFJPjuPJIvlkVJrC#Hs%+NFkUKJ@}Lzq)vCzL%rE`IL#8 zPjW2U7gy5r-8P+|#8$fDtxDzw(Z1y3Caka(Wh>ezqyp!g*_PC8!D4?mAsso)5z#d6;7~+KW_%#~s+1$AM*F|c?QaEwxb306OSIXa!>GzUK&~Ku%5lAO zsGY|2KLR(5>Go?;=?%w$gt=upJU?#4qtgkUOjC*1;Q{(n_;)1&Wn_j>T$A$~Dg)i& z^+?yB+l>6Bjs@t!kCQ#%4OCJ}mh?s{Nzjt~`{_@p=$inrF;~ft-Ath{h2BIVj4AoC zTPPHz(5(phmT8|=!bF`f%|X3>Y+q6DPvt}G(o|YZC~X2t!a70p>c+huhoi15(I!7v zJe9z)9K22$_JUM0oJvN9p}jCD&W9N!8MorSuiWzR`G@u+aPk{37#z41fwum|ha3S- ztw`t*cOyIuqZ&or*L}si4$UC&Lu2x)fj${CuwuAFz;m0PdU{|zqVL>U`tiUK!%b9M zX#?T=IpABodib{}%_zOfi`h23hhuK^Vy+neCdb_G#q1dVG{-#Z#gvBM$1&qx%yoPX zjZu2ui+T0%YmtWDJBQI3wh>q$@;fWU9x;W0qPn6&oY5WFQA}F7NYlewE0M^bRU!WA z4$KZPxa3y^lj4#FneDro?hM76BA z8tXSJvXt7F!W*z7Hf%~}vSs3kWNTeVH2PrbZFTNM3Sr;+f`}jsnEzHEn0i|ZS7=rX zclR4;Fqt?9Go`(tyWjJ?nd~o624=EWi*u4&E=^~b_w#ht7bR(q>tg$|oYs<3m{4+2 zY0Iov9oL`~p*pNku^zmKz%(_>!A_G-#w?>?XDDRlJ1o4L`yN?vh|D<6mIVt7-r#Lv zydKSY@$P9nDZ79A9dpu3&`G$$fbV<#VvE` z+woINn;zE`dDKFt4O<~^;&5l_R{UB<<*g{AubAntybXa#KFCQm*g)Tj)+D2QJ_$)l zrfMmbHC+f&er2EF=a;od*zI=+tmsQQCeGVP7>2-$4B!>bx7VcuTxqJg>HebN8Wvs~D4R zt6d7?oKj?%IeERWZ@m9-*bd7`cgW(J?Wei zJRHi>sfw!jl2sFT->_Pg^OvR-poQ|8rr19<9YJ$PXa=<-Z8xKl6EMj&3KE&q?=l%G> z{x4}^-hL>xEP{5N#Hd*qtX))=FoV4+QZ*;|q3SL)SfNI^gEz?ea9z%m7gyypoDTqn zLYhZP9;ii(?mUEe9tBG@SVvf9bmw7;rJ=G!19pUQ*PRb~X=%_lxLG1?#Q6|lh31I! zVf^wEEs+mLL?F6r3vcuD-g7=h+pkdMVqx|`a0_$rc^+g-Gy$++6ZiP*Vd09i5;i8+s7z`>0^HE z;}mM9&?gY`hfCL}MGIt6#sl^uq!{}ozRHi{tDokhTx(;TkPr5{UqGI=0athS5W^a! z^rj{5d`b_`9cr%-I=b^Ie8;_XVOYB$S+I6#!rB!n3{HdK3-dI7%G{cUboQkq z4>+Gjw67TQF^yjAnCA&ZRj(nhfMr~=XX#m0+h@H2#5I(K>I`MtREDxW{{`A-l7^1A z9sU%Pmi`J6S$95*?_{__bk?2E(LNBN6%VaNqjWDQ<+D+2ynUCbN3&<1 znM_=%VKj+Mrbz=ikE6Vad^&0DOh#)9gO=p=Y8=xPblc|%H5iZf#R8ReMR;p;`Qw=R z)f=JQ{c0>`l%4p%uA#taL3@;B7E;`JST7X#(eOSt0Vtm4GMI=e5K;c4_@($@08{=I zA1pxlkM^OzkB~!pN;drSXn0``OA?D$FkW}Q0I2RpeGw1B4Ccms2{C4V3oJulMktnv z>#39z#X^ZWS2|`8FQ058FE=pmtN3OfmQE7U|HRS%jPHqs>G;k>t*(<)k3~TAlw+dQ z=TOntkiNKUqMgojeTp~-F*d=CIKi9awQdf{n)>>CsUZS!MKP>9vQHxVj-3t!x;zl{J}Qh^xs z2|AW?)zp1BgswW!UZG-j=R5eW?!?z3x7UfaNWqM5iIl&KWchG(OL-gtVS{}VA?lik za{9kh*Ze)mRMjjtxH=UjKf<7`#GT!y%-5cd#1!G8H=#9vMQ za;5V$T3yJnT!=0yqIBmOA~O{cb;RS@!iDB5b0N)42 zAWq-SYIAGP2T*t>sq65C`6-XtL|v&ELKUK^?)(zpc=_*2xZWAgukb*9THl$(V7j-; zIDti%9BK9a9ckzAec#wkGaK*qxc&Jy;Jp~1FW?jG&u;uz5FZ?8DgG>cU@ood&nJ%(4PW8v~^l;ceyF_rvxdY+G6t-m1$Zu&*kZzu}*W4zxDJfOE`@H1%JL28 zcPPHbt4!>Jty5YqR_4%pO2w(o4Y#|#V;b$l@n7Ygs4Zpx9wihGE!jixpZf#CeQc$5 z{z$>J^B?q+asHEjI>~Fr%-H{p?=i~E_@?YX;kl6F;rb7n5m+_A$?{xsrNs2e>>DG9-3A40C-LQgFXkxL@4C!s z!Tz;@QmX*iDJ1E)%n?f9Xoyi^$qQNGsC_gVQQjyF&l0&W2aroxaUhp)kxK~V5(2po zptJyT=lRGHq!u}>v~`q3&9dT?#-#@~uGJbw|ZyAHXUvT!j~ru`OzK2Q#!Fvq|bJb19aj4BsHuC58lm6VSK zG zAl{r$Nmf-b7YZ`@e4oh#@tK?{M}hw+%m^NrW0S^3HC&F3Py)w9Qn*UOl3+ww1T6uu z;!cdH5Gh|wO=uqf&{R!mK@)<4+G;hIa|D;brUY|n?R7dCVZHhAhKG`lg1@A zO=upW1hNTeKvc-7h=#?U8vqk!mDpL)2kban#s@Co<7z6u#yEr9Ff3JL1>z(CHJc;l zX8f)SIe2k`8P6XBUzS#c63vm7IA~-ci1l|Heu^FCBz}^*55ZPy3Q@31Xm&dSP8we* zAcLRcqZ7?->SP)-UpXUe4jZMDL9p>}A&PrT_AsXdNmrpnrxSt72dn9JArYbrfW9$; z*zKfzu)@pR8GOZ>^{_J+&~gtK5~_MK<-{q z{K7bf{pvnpN$0F&v{_#Xtr#s`hkCPVR?bczvNnfA{Ouf{>Xb)b#xd)VY6d$sv>h>S zx`jU=Ha|pm1KABLJVLFoqLRu^KT1a17vg8xpLl)K7Me^y>G8+sOX z1TeIE(11Ex)|2&Bo@g2@`&EWeEWW@rCdZ z{Un`3#M7bl)8ZT^o(`uU(;3DOvcrkdEItMiZktSh&m)o50%>SLwV3Xh#W8?eC(}>+ z;O5E^05peJI+z2QBo-L5&15QnT3d>=4%yb5D;QAv!gQz|=nT82Rb}-~To)S@G4KaZ@<~nc*GCv0&3}j^Q6blLbQv6@= zX~AR!>ai;R$9O&+up)FuGk)oh(tjOaH{uub@~ZeUo;M)=n}K+mZ~h7CUk#m8z8u}c zG}O_LLL|qr@hwH?Szpj%zMPeQ<44Dh5zgZcvCau-UP8n=CnB8GgAbwL1J0`%lg1Y6 zk|!ah-ATFwV_iNO7Rf3nBU%uQtErq)^Na%{Rd7rOq3@j2@gqw(13{e`GewbSB0bWv7XY0owMAf@VT zz*jOl908m0mWYjb>a+h76P={lw__7}Uoy619sNj3ld0vwvk?)jY7-Sia-}&iVVK2M ziSsMm_y93N=tbvHJPE6eKNrEy+SWHy%JV2Cbvi4KZC?Bqx@4XUI5KU2A3Ka(R(`P+ zOW7AvnqHZPh-k&q_8*ZZ<7~zgmz6if>j-2jrlY}>75W@>xCm*N{aUEO=w$j?uNR3t zAbWt)4bcw=n1_{YAi38IbH||LQNMxTjna+Jy?Ai@6ZMY^5w{clBjmHn9JYy53UewJ zW>&@33X569C#=fKEX?y{R%l`7V&N6yHz62Rn6Fkm-l-K#IZf=kc@!PSDoCkH;W4y6 zaehab<)v_$_)Y4vj{d3=Se5B6OD^$Pa(Gp$Kt0UE1{ov|Rlkp_6-wKTm(+Pu13ED$ zza=;cGqBG|)mMi(wA1AU*~O0liBH1E<;D6kR_Nv!t#ZqkqK+|I-y#$FNWq7Y|J<`$ z?zP2Ek$S?Rs&g4K6mh)ea{BF4YtQ`^+f-UVNEb^w=vWN#)o5BUUYuow`!ed(6>@9Y z47m_yzo10!~4OzwKeKLK6#TczZH`)_5P)PrwC` zo#%3tfhB}rrGx~%KIDn0tw7D+!s_C^BG8TO-AT}Q1a0t)P4N}5N%*!YcnW`!pFLaD zfpxUrrf3zSoG?Yp4UUsRgNaV;F6^x`HMxF!`?Qaf_k6X7$+~nf>|Qm+lJbUTs^8xc zetkQY&O3#@52LX1>@SsWVee>B{!?#?fHt6`IFo>395zkahAYsh>YbM>5o6|)hVx1U zV%%z2)3)Kka4=Oii$9ydZWUgRUb8*IKF6xkt7Ml8`wHo*Q%(`~#S<|NgS8cJfilZi z;fvXPH3ES>jTeyqqG}#Lg{Xl2v4jj_XQGVIKf*hl5Edp!XFGxi)H~eu4S(VX!n{ZP zxf~51W&W&mcA!Gf7XKEXE9=k>!*d&@t!}yijK2ty7M|9$<710l;?&zOiKuZ z-A9B!=)neijfjU~gWWmA!_uHD=MnjnE3an?-3DocE zk)Q6MlscR-1COEUoiR6qsgWt28Gk%1o0^L@@MS!0scW@QC&QS8TRQnNA{2u!BTS{P zyBd5M!|-K{VLchMVsr-qd>O-qu1J(z8L^AR3uj}Z7cPqiED;kKg+Ri9YfO+QBS+)j zg`g*6ct1TE^~z147MoUYMqtu-6TYPv8bRv3(7H;}lQH6XGDZ%pC!_1%)n(Nc+`yC3 z2zWAvX7*%s3->)44bPMDBVb{`c`k>!{e2K3crwPV5Ih;lSNx63s*6u26YyjV zSqWD(X7ps7uJqR)QC+%~fP}%NnJ_0$Mi}9RC!--e8L>#*TQw7^^JJW^wp~ZkL{WM& zhAOvI%h0X93=yPGhI~)P<|#ZGo9jFo?}z4qVljLVr9ESasnbZ=sOztI+fjsLz+Lc% zaFN687DhkUcl8ULq#KOJnm{;J!!@^b&e4=`uCEKF$6-&cJK;p4$}-balXo5Ysur zP|WnFa}4|hP&cM<3}gpL(O(Mr+F3}cZ8=@9z=xLJh@kHwm1EV*O4|tf{E^aS?QJkx z!spMB-hGDe-4~~(% z8W28xx=6r2ebVc1CZE2FIE+Eqio+N*kch(=G%{43$P(+mgTcYApug(uLISgL8@^%q z5GSm#F{jzLBL;hgv(u*A!}-LqYHQZ$|Ix(fj=17d=;Uf|pg zRZ!T+b32UG{-4{yU0)J=C1L zfpvwxGK&|KsDhf(OBbN%z_Qupjfr+|g$(#UqBN(~6*#ylV~8)m6=j-+KKeHN8YBFD z-P;j%Pa5Bhgl_yj6#p|k_q#D(N*u#BM(C;ZMndE(XmBB^$pc(mtlZD%uy;Z!dtKUj z2Xe*HYq)s>jWPjvE16Fd@C(Zi;Qoz!+&AMy;8klG_vIVqa(xu3Lw+-wzH4g|J0jtH ztEFSB>8`DtaGMOy#L@N%ymbeEX~7Ch4Qz;k=Cdqn??x(LeM`+LD8gqJjr1tYWbn%N zy}`F%2=rmey$|u_cjC*wA72v(^-uIBBO+_fFos=RUU^I6%X8EXD2jr~IIg^+X~FeP z+68#z@N1fSNpBOce-7vk#OrsVPU7_g_zfVpgOH0EBNQEW9>h1F$!2~q-Es3?2(Kfu zLSYQP?*{xnm$sZ{@MnCBHn?Ntaob6HNt7mf??Jl$Xv8vZW6SsBkO;nTR@|~}!F7Z# z;SvQr5#_yGGK3QnEJH9oq~HYEh>Gt;n)3VbWxpR^6R`VIF5hPo?v1L_qkQ%U!nK9` zS70|#UIQBVjRJqthHifVInh}t&GATsbmZf5Xh=8i!?l8%^AO;RTHvUX*$`?L$sui+ zbvz6JyX%IW4MEY}U1q^I-(v^HFqR=OguXLKkAE!CTUP z6e-G&;ER{EA47oKDej+yADU;^nlsb_x%wSS)#>e?IIgc%D6?2ymOqZ*4Fttv+x`R| z3T+J5>`!tcTI}U8;co`Fc+pHY#~#o!SVy)Q2NN}?8wMG8{otB{N0B$zPi}6I-aIYR zKSeR07fSjugnbP+j(t<1N%<)A*rx$4e+FN^;cjZ*^APV3T@+|9e9Zm~^gJ6+g~}_W zG%Vvki;&;7r|}(+55Jp>`1_dtCN^soB0-hq?{gfnU#tAJ4OjWDE$H`n{SF$#wmSG8 zDz7D4xwg8;QERoW?(>KdR-rE-6k|lCv2J>+&=-;1wF>GyJ2JlRt!HcTeqD8C!7a8B()!?Q!*#iKed(WrT2$0x*SuRD9tsc4Y@7Df0sX$Tj$ z;g5ji;V7IGzDo4Dq_!H@Q>OG^qM9g8B#u6YClWPPc9qt1Jo>Sya!%<=ittahi7NBU z;VQ&CXt+Mm{wSKOJCEQS3R#Cvw*MQ}`HAkS{Tb19G|!%bGgg9rJbLyd^j>&%Bg02eyyzJ{-r46xDuFF+CzZU?u4 zZif@cc3`#nI9aW`lcCz>0R}KJth%@I4Zcsl>vol5Z5H-x(%rE8E3dD@F~}FjY$@vB z@gI<5(4IVWV zs>Z_@`5NJ%J732Ssnu`L?=nr7w)Yqa6L>V~(d|%Za}qW-w263Rm7hS?KyQf|snKsD z$_QrCUS`jM)_?<+)v1zEd2@9S|RfSWTjw9McODB0#(C~9qnxB@|D zd=?okLq2#UcCJU8NNY$_X++~SN`9VOY(LZ_X-7?H#}Mw=3pw9M16`-=SCgSN8J>Vw z0VdfvMwQB0VQ#C6{jg7bMTww2yoazGzqg>Rm;?O_3XmhJ^REb-`R#`D0|a6^w?Pto z4JwAOKTvnM;$6AnREQZgJC+F;ON6nCH1YEs=V28%^)`*+>_M{Pjs6urVjVG8S$nlR z{^HEXUDac*oS#h~tIr;~6E-+M`w^h!z4$sn^D`<>%+G#|(92|gMkJ`3pZ$a*{?7BW zPeYDwWjT`i9DPDclMTU!HX8XEeqv#|*2L@Dzd$&iZ-Hmy3kW5`QRkQV#pAE=Q+z=< zI!=01vas`Sh|g@qw!`5{g&GRqV&~WR6??MN4y?EZ2N^9rz38h`?b#ke>$4$c&RJq^ zM;40q>)pNMPG#5o{Jq>q9ue|Kcb&{b+pnOuH@q*U{O`c;hOHP>#C<8h!J~Iy%5U)i z-L5OAp^V_VBr~*}iu(=qUU`bzA#LF*@@i$VN?R#6Y@+`kcV7Y+S5^J}^4{dlmTj`k zBx#$ZOTsWq+9puivX)W`1xj1Cwm@6TzCM|0Svt%RKu`oKps19kP(%e35kv$1abKzQorBt-22|VnIr`Y`u)GJka_3a<=k`6J@?*ocNxUIL9#aoaGGA) zNLE>lZK`h0D%Vzyj?mY>$yfksXQ21w*$Rv~<2aoVuO~BqAu}AEXuxymO%bOZjfY^c^?ca> zRA6tr7`gr@5Ptu}=G^^GOALJrBdNsDUHDC{Rg-b1bqPD;;yZ`|Tl`=A#5cDT-z9~d zxw)l4C=<;so{b|9i!d>;#w;+@sGg*R(;_-1?Mn7(m{%~?LUtx{ock(iEf88goC28~ zluwg^vml!h-FNl_oyUyQzu^{k42z3vSmT-$3kVD5KxZs~`-3#QDp;#igK(S1NwY6b zjtPf>dn#@d#!FjC3(olfelVM=*HDwjfoCawCeJh#unRV3W}~@Dd$>0yyE)6AD!f7$ z*s^1fPsH=t$4qFRs3z(0z6@lW6k-aSiMn*Gn$agi*{Fmuom%E362x8#bqO+rsm6gl z#`3cjpD0`#p;*ZB{ehWS(uAvO6GyJ#r(JzI)u&5+x|`&iSd0)Uy%~vO&%?fo3{lvr z%gw@l&=O~V6jHXyEMZ0{kPpGTNN44lTBcQ~$~X0Q3g6w zwMn@M;=taGq)zc742zBYvu(+sTrNeqBMf!*(69A|@!87Mx$Pi^ssBsvYlaC|MNfszMC&oag^meWYT7t0Aw3c6K+NxbGy z;z2|}5)biHTYMNFC}x4K{L-0;(A{#HNVYTiLr4X0a5c{X(Fml84T>ChLKMbjDC5#& z2%KG5`UyV1s-~R#TQ}Rh)-@jkExt=Jw+(aaKG}xJxwS& zfR@@#R^KK}q*rqD47j2FjpFin;g0v{62sy^nSBQe)Ii&T^}G~hDunRX}dI7tT z{~8)_AuLeN;rGr~{warTpCxtxsd{&SFv+YtKSA}Fz<__c>Mh2y(E zurza9#I)o}_!-|p!j@d{E@yM<^V=W*4B+jb;TXJZZ|%st`}I^rMeHsiu}iw=L;-%bQyQDt)Gu{)+90UWeaJ4u?uMw`v9f41D11=n8d+>4&8Tl1TyhJ z?qLwI%C9ZRez20nw4K4>5>PyiF&3QY@?;qYAg@<4Z>)_KEhDQ16^|U?w*HpdXSq$j zqLs9g+rg7eEksT-rkx_Am}C-0T{p~+VC1$Du0ffZp2>b=3tjFD$)yOju{@0 z%|;0GC)rYG=0Mzi*(i4%vZpM)4bNz- zV{;OW^EsH|G4!!D99%u6;s!U&@S<*TT*U*d!h@%@S1}m|{r<@(U9Ktg- z>5R#nNOlIM3E)|ZG6A0Eb9RBJEB~N_x$eloBcQMw0IZhdps~DrG4rbsUtq=;@hk6l zVmG6$PANvy+c!tm5yiS#L_F1ofCgY}3FU|)cR$AJWJi+55osIrf7u^kJ|gNr*cb5D zK(c#s-6Ii`-4wSA(t)m2J+ac6+jTCz$5`C_bQ9t7$_G^l?I|voKvN#hM1ci3(JBqQ zJ68LKvHM%938QTf)6uvJ;ta$WHSn)CeqcOO+q#fvAL`_~Pc!74fO76WbT_nTh8apE zF==Yohr2VJ#6Ns+jU_y2o|P47SVgCL!*~b^{(h*d9zQi3YPV zYo5KN4s}Ee4R5_O{(;s!#m~S!a+&@)u*D@^%Vqeu@nXZ>g{^n>|DD%kP2M#b+U4H9+AQ=xfj>)xTiWg9ewT`*RWkQ)PAvZ#q8@ z3~xG@uQB%+*TIg%(xD=+ZN^+^HX@S^J=033enItTyZl7tA2XZ_Zd#_b8z!> zMV?LqPwRyzOr+b{34R(4`_e=>1;74SCa2tOmkUg>Xf7}vG>nS__9KNm@$0AXx++H8 zg)SxRK!I&lR?b`$6pn6T>f6Q#bK(3vD<9D_Xh%|%P!{qkrsq`Ik3~DifBC&YY3N-j zM}BWYn+eHi^51~e`+wM5iQDkm->IEz`vC9j-3XJW(gE#ar2`tkN{36U9oAMmTwUz| z1+1h2&8T!3Q|*BMu`&b-uF~PUY6mKlFLOhfE#wJAM@ZOBcjx_8x}58oi*)(VbQY27&ZdJ&YaRmRYnDnZvd1Pn z(JY_VS1vJgqbE9XNhMMPB}&h94g?X*hndD~Mcy#gVa_`B<=ym=l&MZ%!fh$iacxG_*lY84_V1p#qm&$!zQd`C*@&SNSwN*B9FO13v zcwl?OH3|NMHeo{FE`1jwm6HtL0kGLVld~{~BIVv8`jqai^j<^n!^E3D$#L9HCG%Zx zgXRs)qpZJIueXm;&U&m-uP_WZs9h$mTv!H@rSDayRbX1nB`x|SyO5THfhX253;DC) z8O0XqiNK5Z!8;Hv@WY8fJ9DUoyCsTl{A4#`)+zraX7}yT@=Tkh@YYtYHQ3G(NGClh zG_rf04lJS68Nr!rxXUS0J|@V%P1S*;j8DDp)&a}FNKF3evfn9?8K;ZCH(S?d%HD99 zHx1-pz+qSD?Li=9Re9#0SANvxjG{rXI#?iYBGX#;t3C5I%5Uc~4T9Cd0{J&pS|fSp z-=Lp5E>3+irT>Ci?&`K%2UkL#ZXKMaG`rV15{?n)DEwk~htltMY{U>nZ?v7G;gJaj zJuz+9HnY2h4^*G0bng2xB^cC4g2Hs!fGzRiWZ4 zP(lTgJRIPbQGrw~`BjViyO;&0V9D>`6tlpDEcumI358i;nwIqdUfQ~4`F#I%)m2>qSX8KILwq@D+_8GDW?jA56& ze4S$;u5@kB_$h|b^O+i>X6X@%Sq~wvYP6L_9Aa*qPuKe5kpFD3=f$s}melq<^HNQj z95Vy2@4#S#*UJm*U9Z$YB9HlRd#Dy6XcK5lpnyptWpoPQE-+Y0O!=yJvd=@#ZiK${ zpe;8pxdtU0F*7q@ucw=9a&7ygHMady^7t21BPzHX}%Ei~JjZTa`@K|~# zW?TE4t=v8h{)pJx8^%CN;$Vfi99QOJCFOxfV2!dpWSjpb@PmH1R1fCUwWT_IB3Mmn zUn*m9bjj(SQ2Ww)+YDWHMN1$E+D}{)1g%)0yXmMWu2JI`Odb3>m_HVUB5!1F0E1ta z_K+j{-u6Qy?T2F(atv~)nrizJ+9)7CJ%^yAU&5x=0A3@7v?G^s4z~vufibwJxBKX5 zM8<$r2Whb}LH8EIa*y7P;?;raSX$29|M%-AcSx$z+cdZDqakEyJ~0WQIK`}h;8UVCPyt9$0r)80{!h?c1xcZ$kTV{r zsb=X2=v!t=GYpE$iuXf-34xX3_caXuiZ}ow?qIrz8;t{~vl5=L8{Q4W@NQg&Cr!KX zL;T7bDCUUyHj$+NJum$gir#}hdJk!s^d8nQ>HSE_=SeM0OLwr3Ev$Cf?IJF5&?pf z@d}9o!ELw-sRM!|@(QU3@*5Xv0P>8BGy-`R$aJiw>YNaDh3ST4PFw=aiA$L|ag$_D zTwa(Hmr3Tt<(@flb0s-(v)j#_xN_)bPFw+XGbgU(x|tJKq}|MkE9-9NgoR)iHsM#w zER8a|MVHzAC^J=3&-wEAyoQ;-7c|WLy{KX457+66JeWUp!U8jYztb@D_p*kWzu#+E z^7jf5RTUR7b;;(dZUAQUH5Xwv|KK9b<{w>z*+f6CijvuU9Y}hE9tUX zMqe$II{>xov;>gEv?qe8^brc_gCcE&(Ph4 z^i$24C}k(2^doIrc7Z*MNXIU)!;zA-3+#sgb}Y6F?4HP*hA2qSza5~C#h^k<>5FBs zjq~?WOq&h7O8XEJWUH^!W@n(&W*?!`X4e6*6SUc*02~959Sy*-0NMWl90!oylHyY! z#i#ZspE?%#)U-%er$DkgU6R$@kgV|N=IMf}eu;Tv11Nc#@h#+-*2^877vLx91Ag3$|c0K@^C-yx6 znJ0EV0GTKDJOG&|c02%?C-yr4nJ0ET0GTKDIshe4>~yYHO1(FnSRicT>CFOR+fSGU z!cKuO3xvG|VHOCx5yC7G_Ae|DAtVT35^@8PkQ8)w}T%z>~*e$Trjfh$|nB{BqGm05~+c4gz>Ps*+fux3MP<3)h?pFT~tn z0>Gi!br7H&4@=gJhgDsh=_J>|e3rY(liOjnFtyT@N%CR~qU+s>NlwqpJ|)`om%+~9 zKFwAH$ZlsA7|^$^!Skv&lP4e^wsA6~e}{t`#9fDMF~)D_&J~-+Hf|cjC|e`Ya%qH( zma%0Tem>hq=Tp4u%{-=@$tTfjKI!JB@j>{krsdM80>P(hyZazknMKxuXSv4(} zMp+iJ*|~${QTq@>KymCWI|}%BGD4_*urv1<<{U74X!qrgT7c=7Q=!Ruto+++7>G0y zgV?2v^-Y{<3F0^P7dLjMGxu3U*<$4OelIfi?dr8dOV%Z5wpr+|lUl2nqXWvA zmZVJvGvjkR!rPL&Qq;!OV}Z+Dxs}J3gfg4Hl(1tLDRJM>3{N+zWlE)>Ol6xnvnc@6 z^p}`lAA0+hKFrgVn-o>$R_E^8kQUabhOH@M)x@`^ESR+WBdsZm??2U=a_M+9X?axt zNO7!})Ubu+ar6olyCekWUS(mq8<@ASOvEhkSDHit(6lik+dRhPx5o`20361<4g$bo zg6kjv7M91r!CP1+qMRfdqFh)e>sVMmkuz%dRG`^$2v2Y4BzPX^`pt7r2AaS;D$WLA z%?39|2HFn9M6w_tWx_3ECQ{-GnY;U&ze?FBvFc%G>jR}9L66VrL~UkFI`XbS#K!i0 ziS4cTzE%-d)0>L#*MuGxcgO+uZ-5RFO~>}==oQ=7B+P)$(kaX@R%j^(uF&$US7;^6 z^v9Yk)}6RCi?tYjFolj!QI}9sN|W=grZ;vmbB|H|zl+Re$C|m=A{S{lbNhHmYkG{8 zg!b4A(`}Y?APduVRuW|Z7Yln)a3*E5Mcw8a=CSy)Kib?sG}>FXGKSA3Tk~ z2K}-t^5-JOx=?wsQFck@K7stpUb5b7XJ57F4X$VLEzl6bB|@9+^IYCtu9-p=*K{hk z1Fc5>6J@@Avg;#nBgsxYrb_W7N`FBppX|wcsy34ZB*fB*6`WiTokFcp>*VgwoE-cj9{@u-YxL;{m#Pm8VNu zQ;pb5;rZqrsO=h3L|TX8J3OssrnNoNI!dLLhaMoQ^Fekil43g86=2+kJXzVky^m8Zxvny`$AWI7vyNz8Pm) zy?o|8DX6nXjd;$;^Hf4$y;Qt?L-V#u@wQr}*ra%aIKbQFO5RRWyq!L3NRKxW+g9+l z$V}eK#>8@N#|IrZ3t@h;2W11dGmx-$gKXIbK!nEa$Op!QR&5fcY)5M|VKbP7r0q?a zmauxg5sQJvcxia0UGCe z#juM$Tv0~c9<9#~j9yMm@6Hj@!(x4Ul=PI>R;6bdNu-Av2=w7nRz3lusGxv$RnaIr zJ!rIfV-`i@uF+^r0^{#VBOvc#Vc#>(+i}zE>Q6&b8PiO;J5DgZBdRq@YDQFKkG%=l zUK^2%D5Ur0_E$Sp7@{M$#+4oYdKeE%txEP*Dvf*St9-019+IL>_90;Xrmk|u!^u2s z-9%IWOj&dB-cAh!Y8q3GQ`WonFm04>a^YTM?Hvlnx-X_iaT{D72l4HpZB$=UYoJ{- z?uHz=Q|}e1Q#3eca2E@&oV^1iJ5YTzKKCY?cstj9AYZ)nU2CGAXU8TnJCv%9>YeYLRjV6@8SHf;Jt1>(6` z=I5S@{B)@N{PjPUpN@|%KNy)ve$K7P&vz>FlTi8j(|;^KiH|NnnDLPOoG1C=y*szS zRDod|Q%ZvC4`n+k_LAF9J$|ygl|IgzbUuEv+iBlf@Q_oB%1<^^T?j2v`y{aw(QXc? z8|7kwR3b|4r7G8#E&!Do|APiMJa%wLKd~Ppwh)sY;<@^RTw>H#5qZuC8pZ7)g zcAf8lcu;6OhSe@r0+(;n!tkkfXYOzbGiF>%Egz-vd5z7TOt11zbfww8WDQ{v1DfWb z^IK$S29CqwIeT2hvk+Bz#s} zI|gO*E>nmn{{>0RpoJd8)-A7)_~af0G#_mU9}iLopV|TJixzVuHgEa13Z`q~E#cB9 zSdu|JiN3i84q2-;jh8%_z`IC*d;K$Qe6`K_B*NWz13JN$z_XtSA=!|Noe8XTA<5u& zq37Lf7C7sZ!OPoTp1opOC^<}cIc(2esPpVfp)+@fxQs#34SPe~pWRO(Sxc^Z23v0g z-Na@8^9M@rj6MUv`3QvRJKQnaIHt*tU^ zTcG~q#iBkVQLo6z1GXnD*6w75B)?Sll*)bZ61=SLJ76Vs+Ao&Xh!Bsi!BZ~f^2Q5i z*llZ9q`Du%1v5cQzg`_qESUov-S}j!VO)p56Y)16fBpEw|Hl5PLiYmrK59<__>K4@ z?*AKv-}G<8(QOwzzEW0mz4IEf*=OU4H{76sXVzj3uG;_{=HNOJ zyQMkS>~ixZ1lXc%nm76-SU*e$KGR+pRh(YX1EE~(a!kegf39qER> z&1#OThW!}mq2+7>gDr_zTsP@aw(o7RxN7a+g&M|NI)LIj54)wabP<}SSm*N0SUBB= zdY~>NQh91mv~)~A7BLv#!AxGHw`EMWF&2-t#gpg|?HLz<3nSKwRRmqJM0_A(#}ctF-lJo?8Hshw zq(Dci?QUnZB|f)Q%eAP|+lriUi?Zv`K3W#YV(f|7#`0Danem*+$Q{n!1eEod7?r+0A z27fo*&4_;s7``c78QyjOD%^V!-pv=?ah}n50`6|Ucn`r>5eEAVV`k|RRO!L7rM38E z8wE>lgZM*q5Z9Dh`m_pjsR~0(g`q=|sKA=NPg`tDErb?dy=s$_`S>Sx$ z`3iiqEvAHzl*H9`J_pCjQ#fjVVU>}&t~~E^B}(Ia$VaVQ*n~04;b<{=-W8)`HAd&%^Ustjiejx;3Fpu-0-S@O}n& zQwO9XXG3tp;x`_@Rt~rt^awD8Q=JyhtYXo->|;CF)vtVPUaVa9spZywFkHLbyIsaomwmGV69))7kTE}FqRr!XQ(&k zO~B&|t~z$qbWg7duzs3GN6o~YYU&soHLRv{$aO!art9O%9djdJfb3vfB{H+GTX(&JdVzpOC8}hS(o-xhRsq63`GU zkvbR1N+(NBL#*kt<}@U=^LQx35bHAM9yuTLeSGgjT`JEnb@m5>9fQ+3O8+0U)!B@1 zP^Zq7e)7=j*(J1Q5gEX|_v}*V@Y#zWf*wY^!{%u^b3YZI_n2!ctz&*ph>&|-QHn!R-?bJI4KERl!HMJ;EoFATg3_wWlF z2z$G;NdIxB?|cW2k#vLYd>25}3Oe`Vt6#H!&A%_vWLxg;f9o9Y&QI4GG|4uCRvb1b zsYTN*L7`S>h3sBjspotTu0baO2D87DEyjB5n5o|&2^-x>MQ>^M=KOsK-D?)_=La`{ z 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 false - + + diff --git a/benchmark/SerializerBenchmark/Serializers/OdinSerializer.cs b/benchmark/SerializerBenchmark/Serializers/OdinSerializer.cs new file mode 100644 index 000000000..53844a380 --- /dev/null +++ b/benchmark/SerializerBenchmark/Serializers/OdinSerializer.cs @@ -0,0 +1,29 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using Benchmark.Serializers; +using OdinSerializer; +using OdinSerializer.Utilities; + +#pragma warning disable SA1649 // File name should match first type name + +public class Odin_ : SerializerBase +{ + public override object Serialize(T input) + { + using (var ctx = Cache.Claim()) + { + ctx.Value.Config.SerializationPolicy = SerializationPolicies.Everything; + return SerializationUtility.SerializeValue(input, DataFormat.Binary, ctx.Value); + } + } + + public override T Deserialize(object input) + { + using (var ctx = Cache.Claim()) + { + ctx.Value.Config.SerializationPolicy = SerializationPolicies.Everything; + return SerializationUtility.DeserializeValue((byte[])input, DataFormat.Binary, ctx.Value); + } + } +} From bbda765e7b3bdfd104548f07ff26a2291ce2b6af Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sat, 29 May 2021 19:09:48 -0600 Subject: [PATCH 070/161] Update from Library.Template Fixes #1244 --- Directory.Build.rsp | 16 ++++ azure-pipelines/Get-TempToolsPath.ps1 | 6 +- azure-pipelines/Get-nbgv.ps1 | 6 +- azure-pipelines/install-dependencies.yml | 6 ++ azure-pipelines/release.yml | 1 + azure-pipelines/variables/_pipelines.ps1 | 9 +- init.cmd | 16 ++++ init.ps1 | 37 ++++---- tools/Check-DotNetRuntime.ps1 | 41 +++++++++ tools/Check-DotNetSdk.ps1 | 37 ++++++++ tools/Install-DotNetSdk.ps1 | 102 +++++++++++++++------ tools/Install-NuGetCredProvider.ps1 | 8 +- {azure-pipelines => tools}/Set-EnvVars.ps1 | 24 ++++- 13 files changed, 248 insertions(+), 61 deletions(-) create mode 100644 Directory.Build.rsp create mode 100644 tools/Check-DotNetRuntime.ps1 create mode 100644 tools/Check-DotNetSdk.ps1 rename {azure-pipelines => tools}/Set-EnvVars.ps1 (67%) diff --git a/Directory.Build.rsp b/Directory.Build.rsp new file mode 100644 index 000000000..9a833a034 --- /dev/null +++ b/Directory.Build.rsp @@ -0,0 +1,16 @@ +#------------------------------------------------------------------------------ +# This file contains command-line options that MSBuild will process as part of +# every build, unless the "/noautoresponse" switch is specified. +# +# MSBuild processes the options in this file first, before processing the +# options on the command line. As a result, options on the command line can +# override the options in this file. However, depending on the options being +# set, the overriding can also result in conflicts. +# +# NOTE: The "/noautoresponse" switch cannot be specified in this file, nor in +# any response file that is referenced by this file. +#------------------------------------------------------------------------------ +/nr:false +/m +/verbosity:minimal +/clp:Summary;ForceNoAlign diff --git a/azure-pipelines/Get-TempToolsPath.ps1 b/azure-pipelines/Get-TempToolsPath.ps1 index 97c552c06..bb3da8e33 100644 --- a/azure-pipelines/Get-TempToolsPath.ps1 +++ b/azure-pipelines/Get-TempToolsPath.ps1 @@ -1,7 +1,7 @@ -if ($env:AGENT_TOOLSDIRECTORY) { - $path = "$env:AGENT_TOOLSDIRECTORY\vs-platform\tools" +if ($env:AGENT_TEMPDIRECTORY) { + $path = "$env:AGENT_TEMPDIRECTORY\$env:BUILD_BUILDID" } elseif ($env:localappdata) { - $path = "$env:localappdata\vs-platform\tools" + $path = "$env:localappdata\gitrepos\tools" } else { $path = "$PSScriptRoot\..\obj\tools" } diff --git a/azure-pipelines/Get-nbgv.ps1 b/azure-pipelines/Get-nbgv.ps1 index 925eecddb..a5be2cf7c 100644 --- a/azure-pipelines/Get-nbgv.ps1 +++ b/azure-pipelines/Get-nbgv.ps1 @@ -10,11 +10,7 @@ if ($existingTool) { return $existingTool.Path } -if ($env:AGENT_TEMPDIRECTORY) { - $toolInstallDir = "$env:AGENT_TEMPDIRECTORY/$env:BUILD_BUILDID" -} else { - $toolInstallDir = "$PSScriptRoot/../obj/tools" -} +$toolInstallDir = & "$PSScriptRoot/Get-TempToolsPath.ps1" $toolPath = "$toolInstallDir/nbgv" if (!(Test-Path $toolInstallDir)) { New-Item -Path $toolInstallDir -ItemType Directory | Out-Null } diff --git a/azure-pipelines/install-dependencies.yml b/azure-pipelines/install-dependencies.yml index 5b1ac4afd..7563bc1f8 100644 --- a/azure-pipelines/install-dependencies.yml +++ b/azure-pipelines/install-dependencies.yml @@ -7,8 +7,14 @@ steps: $AccessToken = '$(System.AccessToken)' # Avoid specifying the access token directly on the init.ps1 command line to avoid it showing up in errors .\init.ps1 -AccessToken $AccessToken ${{ parameters['initArgs'] }} -UpgradePrerequisites dotnet --info + + # Print mono version if it is present. + if (Get-Command mono -ErrorAction SilentlyContinue) { + mono --version + } displayName: Install prerequisites - powershell: azure-pipelines/variables/_pipelines.ps1 failOnStderr: true displayName: Set pipeline variables based on source + name: SetPipelineVariables diff --git a/azure-pipelines/release.yml b/azure-pipelines/release.yml index 4f6ebd829..316655a8e 100644 --- a/azure-pipelines/release.yml +++ b/azure-pipelines/release.yml @@ -21,6 +21,7 @@ stages: runOnce: deploy: steps: + - download: none - powershell: | Write-Host "##vso[build.updatebuildnumber]$(resources.pipeline.CI.runName)" displayName: Set pipeline name diff --git a/azure-pipelines/variables/_pipelines.ps1 b/azure-pipelines/variables/_pipelines.ps1 index 14d6ffc28..867b7fc8b 100644 --- a/azure-pipelines/variables/_pipelines.ps1 +++ b/azure-pipelines/variables/_pipelines.ps1 @@ -8,13 +8,16 @@ # Always use ALL CAPS for env var names since Azure Pipelines converts variable names to all caps and on non-Windows OS, env vars are case sensitive. $keyCaps = $_.Key.ToUpper() if (Test-Path -Path "env:$keyCaps") { - Write-Host "Skipping setting $keyCaps because variable is already set." -ForegroundColor Cyan + Write-Host "Skipping setting $keyCaps because variable is already set to '$(Get-Content env:$keyCaps)'." -ForegroundColor Cyan } else { Write-Host "$keyCaps=$($_.Value)" -ForegroundColor Yellow if ($env:TF_BUILD) { - Write-Host "##vso[task.setvariable variable=$keyCaps;]$($_.Value)" + # Create two variables: the first that can be used by its simple name and accessible only within this job. + Write-Host "##vso[task.setvariable variable=$keyCaps]$($_.Value)" + # and the second that works across jobs and stages but must be fully qualified when referenced. + Write-Host "##vso[task.setvariable variable=$keyCaps;isOutput=true]$($_.Value)" } elseif ($env:GITHUB_ACTIONS) { - Write-Host "::set-env name=$keyCaps::$($_.Value)" + Add-Content -Path $env:GITHUB_ENV -Value "$keyCaps=$($_.Value)" } Set-Item -Path "env:$keyCaps" -Value $_.Value } diff --git a/init.cmd b/init.cmd index 970285c2f..667efabb7 100644 --- a/init.cmd +++ b/init.cmd @@ -1,4 +1,20 @@ @echo off SETLOCAL set PS1UnderCmd=1 + +:: Get the datetime in a format that can go in a filename. +set _my_datetime=%date%_%time% +set _my_datetime=%_my_datetime: =_% +set _my_datetime=%_my_datetime::=% +set _my_datetime=%_my_datetime:/=_% +set _my_datetime=%_my_datetime:.=_% +set CmdEnvScriptPath=%temp%\envvarscript_%_my_datetime%.cmd + powershell.exe -NoProfile -NoLogo -ExecutionPolicy bypass -Command "try { & '%~dpn0.ps1' %*; exit $LASTEXITCODE } catch { write-host $_; exit 1 }" + +:: Set environment variables in the parent cmd.exe process. +IF EXIST "%CmdEnvScriptPath%" ( + ENDLOCAL + CALL "%CmdEnvScriptPath%" + DEL "%CmdEnvScriptPath%" +) diff --git a/init.ps1 b/init.ps1 index 72d68b5fa..e5aad5bfa 100755 --- a/init.ps1 +++ b/init.ps1 @@ -2,28 +2,31 @@ <# .SYNOPSIS -Installs dependencies required to build and test the projects in this repository. + Installs dependencies required to build and test the projects in this repository. .DESCRIPTION -This MAY not require elevation, as the SDK and runtimes are installed to a per-user location, -unless the `-InstallLocality` switch is specified directing to a per-repo or per-machine location. -See detailed help on that switch for more information. + This MAY not require elevation, as the SDK and runtimes are installed to a per-user location, + unless the `-InstallLocality` switch is specified directing to a per-repo or per-machine location. + See detailed help on that switch for more information. + + The CmdEnvScriptPath environment variable may be optionally set to a path to a cmd shell script to be created (or appended to if it already exists) that will set the environment variables in cmd.exe that are set within the PowerShell environment. + This is used by init.cmd in order to reapply any new environment variables to the parent cmd.exe process that were set in the powershell child process. .PARAMETER InstallLocality -A value indicating whether dependencies should be installed locally to the repo or at a per-user location. -Per-user allows sharing the installed dependencies across repositories and allows use of a shared expanded package cache. -Visual Studio will only notice and use these SDKs/runtimes if VS is launched from the environment that runs this script. -Per-repo allows for high isolation, allowing for a more precise recreation of the environment within an Azure Pipelines build. -When using 'repo', environment variables are set to cause the locally installed dotnet SDK to be used. -Per-repo can lead to file locking issues when dotnet.exe is left running as a build server and can be mitigated by running `dotnet build-server shutdown`. -Per-machine requires elevation and will download and install all SDKs and runtimes to machine-wide locations so all applications can find it. + A value indicating whether dependencies should be installed locally to the repo or at a per-user location. + Per-user allows sharing the installed dependencies across repositories and allows use of a shared expanded package cache. + Visual Studio will only notice and use these SDKs/runtimes if VS is launched from the environment that runs this script. + Per-repo allows for high isolation, allowing for a more precise recreation of the environment within an Azure Pipelines build. + When using 'repo', environment variables are set to cause the locally installed dotnet SDK to be used. + Per-repo can lead to file locking issues when dotnet.exe is left running as a build server and can be mitigated by running `dotnet build-server shutdown`. + Per-machine requires elevation and will download and install all SDKs and runtimes to machine-wide locations so all applications can find it. .PARAMETER NoPrerequisites -Skips the installation of prerequisite software (e.g. SDKs, tools). + Skips the installation of prerequisite software (e.g. SDKs, tools). .PARAMETER UpgradePrerequisites -Takes time to install prerequisites even if they are already present in case they need to be upgraded. -No effect if -NoPrerequisites is specified. + Takes time to install prerequisites even if they are already present in case they need to be upgraded. + No effect if -NoPrerequisites is specified. .PARAMETER NoRestore -Skips the package restore step. + Skips the package restore step. .PARAMETER AccessToken -An optional access token for authenticating to Azure Artifacts authenticated feeds. + An optional access token for authenticating to Azure Artifacts authenticated feeds. #> [CmdletBinding(SupportsShouldProcess=$true)] Param ( @@ -71,7 +74,7 @@ try { } } - & "$PSScriptRoot\azure-pipelines\Set-EnvVars.ps1" -Variables $EnvVars | Out-Null + & "$PSScriptRoot/tools/Set-EnvVars.ps1" -Variables $EnvVars | Out-Null } catch { Write-Error $error[0] diff --git a/tools/Check-DotNetRuntime.ps1 b/tools/Check-DotNetRuntime.ps1 new file mode 100644 index 000000000..9d0121095 --- /dev/null +++ b/tools/Check-DotNetRuntime.ps1 @@ -0,0 +1,41 @@ +<# +.SYNOPSIS + Checks whether a given .NET Core runtime is installed. +#> +[CmdletBinding()] +Param ( + [Parameter()] + [ValidateSet('Microsoft.AspNetCore.App','Microsoft.NETCore.App')] + [string]$Runtime='Microsoft.NETCore.App', + [Parameter(Mandatory=$true)] + [Version]$Version +) + +$dotnet = Get-Command dotnet -ErrorAction SilentlyContinue +if (!$dotnet) { + # Nothing is installed. + Write-Output $false + exit 1 +} + +Function IsVersionMatch { + Param( + [Parameter()] + $actualVersion + ) + return $actualVersion -and + $Version.Major -eq $actualVersion.Major -and + $Version.Minor -eq $actualVersion.Minor -and + (($Version.Build -eq -1) -or ($Version.Build -eq $actualVersion.Build)) -and + (($Version.Revision -eq -1) -or ($Version.Revision -eq $actualVersion.Revision)) +} + +$installedRuntimes = dotnet --list-runtimes |? { $_.Split()[0] -ieq $Runtime } |% { $v = $null; [Version]::tryparse($_.Split()[1], [ref] $v); $v } +$matchingRuntimes = $installedRuntimes |? { IsVersionMatch -actualVersion $_ } +if (!$matchingRuntimes) { + Write-Output $false + exit 1 +} + +Write-Output $true +exit 0 diff --git a/tools/Check-DotNetSdk.ps1 b/tools/Check-DotNetSdk.ps1 new file mode 100644 index 000000000..6c9fa772c --- /dev/null +++ b/tools/Check-DotNetSdk.ps1 @@ -0,0 +1,37 @@ +<# +.SYNOPSIS + Checks whether the .NET Core SDK required by this repo is installed. +#> +[CmdletBinding()] +Param ( +) + +$dotnet = Get-Command dotnet -ErrorAction SilentlyContinue +if (!$dotnet) { + # Nothing is installed. + Write-Output $false + exit 1 +} + +# We need to set the current directory so dotnet considers the SDK required by our global.json file. +Push-Location "$PSScriptRoot\.." +try { + dotnet -h 2>&1 | Out-Null + if (($LASTEXITCODE -eq 129) -or # On Linux + ($LASTEXITCODE -eq -2147450751) # On Windows + ) { + # These exit codes indicate no matching SDK exists. + Write-Output $false + exit 2 + } + + # The required SDK is already installed! + Write-Output $true + exit 0 +} catch { + # I don't know why, but on some build agents (e.g. MicroBuild), an exception is thrown from the `dotnet` invocation when a match is not found. + Write-Output $false + exit 3 +} finally { + Pop-Location +} diff --git a/tools/Install-DotNetSdk.ps1 b/tools/Install-DotNetSdk.ps1 index 05cfef02a..a8407a32e 100755 --- a/tools/Install-DotNetSdk.ps1 +++ b/tools/Install-DotNetSdk.ps1 @@ -2,19 +2,19 @@ <# .SYNOPSIS -Installs the .NET SDK specified in the global.json file at the root of this repository, -along with supporting .NET Core runtimes used for testing. + Installs the .NET SDK specified in the global.json file at the root of this repository, + along with supporting .NET Core runtimes used for testing. .DESCRIPTION -This MAY not require elevation, as the SDK and runtimes are installed locally to this repo location, -unless `-InstallLocality machine` is specified. + This MAY not require elevation, as the SDK and runtimes are installed locally to this repo location, + unless `-InstallLocality machine` is specified. .PARAMETER InstallLocality -A value indicating whether dependencies should be installed locally to the repo or at a per-user location. -Per-user allows sharing the installed dependencies across repositories and allows use of a shared expanded package cache. -Visual Studio will only notice and use these SDKs/runtimes if VS is launched from the environment that runs this script. -Per-repo allows for high isolation, allowing for a more precise recreation of the environment within an Azure Pipelines build. -When using 'repo', environment variables are set to cause the locally installed dotnet SDK to be used. -Per-repo can lead to file locking issues when dotnet.exe is left running as a build server and can be mitigated by running `dotnet build-server shutdown`. -Per-machine requires elevation and will download and install all SDKs and runtimes to machine-wide locations so all applications can find it. + A value indicating whether dependencies should be installed locally to the repo or at a per-user location. + Per-user allows sharing the installed dependencies across repositories and allows use of a shared expanded package cache. + Visual Studio will only notice and use these SDKs/runtimes if VS is launched from the environment that runs this script. + Per-repo allows for high isolation, allowing for a more precise recreation of the environment within an Azure Pipelines build. + When using 'repo', environment variables are set to cause the locally installed dotnet SDK to be used. + Per-repo can lead to file locking issues when dotnet.exe is left running as a build server and can be mitigated by running `dotnet build-server shutdown`. + Per-machine requires elevation and will download and install all SDKs and runtimes to machine-wide locations so all applications can find it. #> [CmdletBinding(SupportsShouldProcess=$true,ConfirmImpact='Medium')] Param ( @@ -31,17 +31,25 @@ $sdkVersion = & "$PSScriptRoot/../azure-pipelines/variables/DotNetSdkVersion.ps1 # Search for all .NET Core runtime versions referenced from MSBuild projects and arrange to install them. $runtimeVersions = @() +$windowsDesktopRuntimeVersions = @() Get-ChildItem "$PSScriptRoot\..\src\*.*proj","$PSScriptRoot\..\tests\*.*proj","$PSScriptRoot\..\Directory.Build.props" -Recurse |% { $projXml = [xml](Get-Content -Path $_) - $targetFrameworks = $projXml.Project.PropertyGroup.TargetFramework - if (!$targetFrameworks) { - $targetFrameworks = $projXml.Project.PropertyGroup.TargetFrameworks - if ($targetFrameworks) { - $targetFrameworks = $targetFrameworks -Split ';' + $pg = $projXml.Project.PropertyGroup + if ($pg) { + $targetFrameworks = $pg.TargetFramework + if (!$targetFrameworks) { + $targetFrameworks = $pg.TargetFrameworks + if ($targetFrameworks) { + $targetFrameworks = $targetFrameworks -Split ';' + } } } $targetFrameworks |? { $_ -match 'netcoreapp(\d+\.\d+)' } |% { - $runtimeVersions += $Matches[1] + $v = $Matches[1] + $runtimeVersions += $v + if ($v -ge '3.0' -and -not ($IsMacOS -or $IsLinux)) { + $windowsDesktopRuntimeVersions += $v + } } } @@ -128,16 +136,16 @@ if ($InstallLocality -eq 'machine') { Write-Host "Installing .NET Core SDK and runtimes to $DotNetInstallDir" -ForegroundColor Blue if ($DotNetInstallDir) { - $switches += '-InstallDir',$DotNetInstallDir + $switches += '-InstallDir',"`"$DotNetInstallDir`"" $envVars['DOTNET_MULTILEVEL_LOOKUP'] = '0' $envVars['DOTNET_ROOT'] = $DotNetInstallDir } if ($IsMacOS -or $IsLinux) { - $DownloadUri = "https://dot.net/v1/dotnet-install.sh" + $DownloadUri = "https://raw.githubusercontent.com/dotnet/install-scripts/49d5da7f7d313aa65d24fe95cc29767faef553fd/src/dotnet-install.sh" $DotNetInstallScriptPath = "$DotNetInstallScriptRoot/dotnet-install.sh" } else { - $DownloadUri = "https://dot.net/v1/dotnet-install.ps1" + $DownloadUri = "https://raw.githubusercontent.com/dotnet/install-scripts/49d5da7f7d313aa65d24fe95cc29767faef553fd/src/dotnet-install.ps1" $DotNetInstallScriptPath = "$DotNetInstallScriptRoot/dotnet-install.ps1" } @@ -148,22 +156,62 @@ if (-not (Test-Path $DotNetInstallScriptPath)) { } } +# In case the script we invoke is in a directory with spaces, wrap it with single quotes. +# In case the path includes single quotes, escape them. +$DotNetInstallScriptPathExpression = $DotNetInstallScriptPath.Replace("'", "''") +$DotNetInstallScriptPathExpression = "& '$DotNetInstallScriptPathExpression'" + +$anythingInstalled = $false +$global:LASTEXITCODE = 0 + if ($PSCmdlet.ShouldProcess(".NET Core SDK $sdkVersion", "Install")) { - Invoke-Expression -Command "$DotNetInstallScriptPath -Version $sdkVersion $switches" + $anythingInstalled = $true + Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Version $sdkVersion $switches" + + if ($LASTEXITCODE -ne 0) { + Write-Error ".NET SDK installation failure: $LASTEXITCODE" + exit $LASTEXITCODE + } } else { - Invoke-Expression -Command "$DotNetInstallScriptPath -Version $sdkVersion $switches -DryRun" + Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Version $sdkVersion $switches -DryRun" } -$switches += '-Runtime','dotnet' +$dotnetRuntimeSwitches = $switches + '-Runtime','dotnet' -$runtimeVersions | Get-Unique |% { +$runtimeVersions | Sort-Object -Unique |% { if ($PSCmdlet.ShouldProcess(".NET Core runtime $_", "Install")) { - Invoke-Expression -Command "$DotNetInstallScriptPath -Channel $_ $switches" + $anythingInstalled = $true + Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ $dotnetRuntimeSwitches" + + if ($LASTEXITCODE -ne 0) { + Write-Error ".NET SDK installation failure: $LASTEXITCODE" + exit $LASTEXITCODE + } } else { - Invoke-Expression -Command "$DotNetInstallScriptPath -Channel $_ $switches -DryRun" + Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ $dotnetRuntimeSwitches -DryRun" + } +} + +$windowsDesktopRuntimeSwitches = $switches + '-Runtime','windowsdesktop' + +$windowsDesktopRuntimeVersions | Sort-Object -Unique |% { + if ($PSCmdlet.ShouldProcess(".NET Core WindowsDesktop runtime $_", "Install")) { + $anythingInstalled = $true + Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ $windowsDesktopRuntimeSwitches" + + if ($LASTEXITCODE -ne 0) { + Write-Error ".NET SDK installation failure: $LASTEXITCODE" + exit $LASTEXITCODE + } + } else { + Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ $windowsDesktopRuntimeSwitches -DryRun" } } if ($PSCmdlet.ShouldProcess("Set DOTNET environment variables to discover these installed runtimes?")) { - & "$PSScriptRoot/../azure-pipelines/Set-EnvVars.ps1" -Variables $envVars -PrependPath $DotNetInstallDir | Out-Null + & "$PSScriptRoot/Set-EnvVars.ps1" -Variables $envVars -PrependPath $DotNetInstallDir | Out-Null +} + +if ($anythingInstalled -and ($InstallLocality -ne 'machine') -and !$env:TF_BUILD -and !$env:GITHUB_ACTIONS) { + Write-Warning ".NET Core runtimes or SDKs were installed to a non-machine location. Perform your builds or open Visual Studio from this same environment in order for tools to discover the location of these dependencies." } diff --git a/tools/Install-NuGetCredProvider.ps1 b/tools/Install-NuGetCredProvider.ps1 index 2b3fb6fb4..6d3100349 100644 --- a/tools/Install-NuGetCredProvider.ps1 +++ b/tools/Install-NuGetCredProvider.ps1 @@ -19,6 +19,8 @@ Param ( [string]$AccessToken ) +$envVars = @{} + $toolsPath = & "$PSScriptRoot\..\azure-pipelines\Get-TempToolsPath.ps1" if ($IsMacOS -or $IsLinux) { @@ -66,9 +68,9 @@ if ($AccessToken) { Add-Member -InputObject $auth -MemberType NoteProperty -Name endpointCredentials -Value $endpoints $authJson = ConvertTo-Json -InputObject $auth - $envVars = @{ + $envVars += @{ 'VSS_NUGET_EXTERNAL_FEED_ENDPOINTS'=$authJson; } - - & "$PSScriptRoot\..\azure-pipelines\Set-EnvVars.ps1" -Variables $envVars | Out-Null } + +& "$PSScriptRoot/Set-EnvVars.ps1" -Variables $envVars | Out-Null diff --git a/azure-pipelines/Set-EnvVars.ps1 b/tools/Set-EnvVars.ps1 similarity index 67% rename from azure-pipelines/Set-EnvVars.ps1 rename to tools/Set-EnvVars.ps1 index 9d14d9aa0..3f6f86ba5 100644 --- a/azure-pipelines/Set-EnvVars.ps1 +++ b/tools/Set-EnvVars.ps1 @@ -4,8 +4,13 @@ Azure Pipeline and CMD environments are considered. .PARAMETER Variables A hashtable of variables to be set. +.PARAMETER PrependPath + A set of paths to prepend to the PATH environment variable. .OUTPUTS A boolean indicating whether the environment variables can be expected to propagate to the caller's environment. +.DESCRIPTION + The CmdEnvScriptPath environment variable may be optionally set to a path to a cmd shell script to be created (or appended to if it already exists) that will set the environment variables in cmd.exe that are set within the PowerShell environment. + This is used by init.cmd in order to reapply any new environment variables to the parent cmd.exe process that were set in the powershell child process. #> [CmdletBinding(SupportsShouldProcess=$true)] Param( @@ -18,7 +23,7 @@ if ($Variables.Count -eq 0) { return $true } -$cmdInstructions = !$env:TF_BUILD -and !$env:GITHUB_ACTIONS -and $env:PS1UnderCmd -eq '1' +$cmdInstructions = !$env:TF_BUILD -and !$env:GITHUB_ACTIONS -and !$env:CmdEnvScriptPath -and ($env:PS1UnderCmd -eq '1') if ($cmdInstructions) { Write-Warning "Environment variables have been set that will be lost because you're running under cmd.exe" Write-Host "Environment variables that must be set manually:" -ForegroundColor Blue @@ -38,6 +43,7 @@ if ($env:GITHUB_ACTIONS) { Write-Host "GitHub Actions detected. Logging commands will be used to propagate environment variables and prepend path." } +$CmdEnvScript = '' $Variables.GetEnumerator() |% { Set-Item -Path env:$($_.Key) -Value $_.Value @@ -46,12 +52,14 @@ $Variables.GetEnumerator() |% { Write-Host "##vso[task.setvariable variable=$($_.Key);]$($_.Value)" } if ($env:GITHUB_ACTIONS) { - Write-Host "::set-env name=$($_.Key)::$($_.Value)" + Add-Content -Path $env:GITHUB_ENV -Value "$($_.Key)=$($_.Value)" } if ($cmdInstructions) { Write-Host "SET $($_.Key)=$($_.Value)" } + + $CmdEnvScript += "SET $($_.Key)=$($_.Value)`r`n" } $pathDelimiter = ';' @@ -71,9 +79,19 @@ if ($PrependPath) { Write-Host "##vso[task.prependpath]$_" } if ($env:GITHUB_ACTIONS) { - Write-Host "::add-path::$_" + Add-Content -Path $env:GITHUB_PATH -Value $_ } + + $CmdEnvScript += "SET PATH=$_$pathDelimiter%PATH%" + } +} + +if ($env:CmdEnvScriptPath) { + if (Test-Path $env:CmdEnvScriptPath) { + $CmdEnvScript = (Get-Content -Path $env:CmdEnvScriptPath) + $CmdEnvScript } + + Set-Content -Path $env:CmdEnvScriptPath -Value $CmdEnvScript } return !$cmdInstructions From b0bb0acfebe58758ab4fe111cedeb76e703b056e Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sat, 29 May 2021 19:15:10 -0600 Subject: [PATCH 071/161] Add Assert.Empty to unity xunit shim --- .../Assets/Scripts/Tests/Shims/XUnit.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/Tests/Shims/XUnit.cs b/src/MessagePack.UnityClient/Assets/Scripts/Tests/Shims/XUnit.cs index 86efef462..569cd3b42 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/Tests/Shims/XUnit.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/Tests/Shims/XUnit.cs @@ -87,6 +87,11 @@ public static void Null(object expected) NUnit.Framework.Assert.IsNull(expected); } + public static void Empty(System.Collections.IEnumerable enumerable) + { + Assert.False(enumerable.GetEnumerator().MoveNext()); + } + public static T IsType(object o) { NUnit.Framework.Assert.AreEqual(typeof(T), o.GetType()); From b7839d5f86917b3fd7880f61c046bf56ef1a933f Mon Sep 17 00:00:00 2001 From: Jonas Frost Date: Thu, 3 Jun 2021 00:00:26 -0700 Subject: [PATCH 072/161] If a object type has a custom formatter, dont require [MessagePackObject] --- src/MessagePackAnalyzer/ReferenceSymbols.cs | 11 +++++ src/MessagePackAnalyzer/TypeCollector.cs | 7 ++++ .../MessagePackAnalyzerTests.cs | 42 ++++++++++++++++--- 3 files changed, 55 insertions(+), 5 deletions(-) diff --git a/src/MessagePackAnalyzer/ReferenceSymbols.cs b/src/MessagePackAnalyzer/ReferenceSymbols.cs index 354599ad8..944324756 100644 --- a/src/MessagePackAnalyzer/ReferenceSymbols.cs +++ b/src/MessagePackAnalyzer/ReferenceSymbols.cs @@ -13,12 +13,14 @@ private ReferenceSymbols( INamedTypeSymbol unionAttribute, INamedTypeSymbol keyAttribute, INamedTypeSymbol ignoreAttribute, + INamedTypeSymbol formatterAttribute, INamedTypeSymbol ignoreDataMemberAttribute) { this.MessagePackObjectAttribute = messagePackObjectAttribute; this.UnionAttribute = unionAttribute; this.KeyAttribute = keyAttribute; this.IgnoreAttribute = ignoreAttribute; + this.FormatterAttribute = formatterAttribute; this.IgnoreDataMemberAttribute = ignoreDataMemberAttribute; } @@ -30,6 +32,8 @@ private ReferenceSymbols( internal INamedTypeSymbol IgnoreAttribute { get; } + internal INamedTypeSymbol FormatterAttribute { get; } + internal INamedTypeSymbol IgnoreDataMemberAttribute { get; } public static bool TryCreate(Compilation compilation, [NotNullWhen(true)] out ReferenceSymbols? instance) @@ -60,6 +64,12 @@ public static bool TryCreate(Compilation compilation, [NotNullWhen(true)] out Re return false; } + var formatterAttribute = compilation.GetTypeByMetadataName("MessagePack.MessagePackFormatterAttribute"); + if (formatterAttribute is null) + { + return false; + } + var ignoreDataMemberAttribute = compilation.GetTypeByMetadataName("System.Runtime.Serialization.IgnoreDataMemberAttribute"); if (ignoreDataMemberAttribute is null) { @@ -71,6 +81,7 @@ public static bool TryCreate(Compilation compilation, [NotNullWhen(true)] out Re unionAttribute, keyAttribute, ignoreAttribute, + formatterAttribute, ignoreDataMemberAttribute); return true; } diff --git a/src/MessagePackAnalyzer/TypeCollector.cs b/src/MessagePackAnalyzer/TypeCollector.cs index 55c481a94..09dfabe8f 100644 --- a/src/MessagePackAnalyzer/TypeCollector.cs +++ b/src/MessagePackAnalyzer/TypeCollector.cs @@ -183,6 +183,13 @@ private void CollectObject(INamedTypeSymbol type, ISymbol? callerSymbol) { var isClass = !type.IsValueType; + AttributeData formatterAttr = type.GetAttributes().FirstOrDefault(x => Equals(x.AttributeClass, this.typeReferences.FormatterAttribute)); + if( formatterAttr != null ) + { + // TODO: Validate that ConstructorArguments[0] is in fact of type IMessagePackFormatter + return; + } + AttributeData contractAttr = type.GetAttributes().FirstOrDefault(x => Equals(x.AttributeClass, this.typeReferences.MessagePackObjectAttribute)); if (contractAttr == null) { diff --git a/tests/MessagePackAnalyzer.Tests/MessagePackAnalyzerTests.cs b/tests/MessagePackAnalyzer.Tests/MessagePackAnalyzerTests.cs index 9e27d3cca..04dbf71d4 100644 --- a/tests/MessagePackAnalyzer.Tests/MessagePackAnalyzerTests.cs +++ b/tests/MessagePackAnalyzer.Tests/MessagePackAnalyzerTests.cs @@ -2,8 +2,11 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System.Threading.Tasks; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.Testing; using Xunit; -using VerifyCS = CSharpCodeFixVerifier; +using VerifyCS = + CSharpCodeFixVerifier; public class MessagePackAnalyzerTests { @@ -23,6 +26,33 @@ public class Foo await VerifyCS.VerifyAnalyzerWithoutMessagePackReferenceAsync(input); } + [Fact] + public async Task MessageFormatterAttribute() + { + string input = Preamble + @"using MessagePack.Formatters; + +public class FooFormatter : IMessagePackFormatter { + public void Serialize(ref MessagePackWriter writer, Foo value, MessagePackSerializerOptions options) {} + public Foo Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) => default; +} + + +[MessagePackFormatter(typeof(Foo))] +public struct Foo +{ +} + +[MessagePackObject] +public class SomeClass { + [Key(0)] + public Foo SomeFoo { get; set; } +} +"; + + await VerifyCS.VerifyAnalyzerAsync(input); + } + + [Fact] public async Task NullStringKey() { @@ -106,12 +136,13 @@ public async Task CodeFixAppliesAcrossFiles() { var inputs = new string[] { - @" + @" public class Foo { public int {|MsgPack004:Member1|} { get; set; } } -", @"using MessagePack; +", + @"using MessagePack; [MessagePackObject] public class Bar : Foo @@ -122,13 +153,14 @@ public class Bar : Foo }; var outputs = new string[] { - @" + @" public class Foo { [MessagePack.Key(1)] public int Member1 { get; set; } } -", @"using MessagePack; +", + @"using MessagePack; [MessagePackObject] public class Bar : Foo From fb3277d980f5a0aa38721ca4e049c370e48c03bc Mon Sep 17 00:00:00 2001 From: Jonas Frost Date: Thu, 3 Jun 2021 00:25:55 -0700 Subject: [PATCH 073/161] check that `[MessagePackFormatter(typeof(SomeFormatter))]` is an actual IMessagePackFormatter --- .../MessagePackAnalyzer.cs | 15 +++++++++++- src/MessagePackAnalyzer/ReferenceSymbols.cs | 11 +++++++++ src/MessagePackAnalyzer/TypeCollector.cs | 11 +++++++-- .../MessagePackAnalyzerTests.cs | 24 ++++++++++++++++++- 4 files changed, 57 insertions(+), 4 deletions(-) diff --git a/src/MessagePackAnalyzer/MessagePackAnalyzer.cs b/src/MessagePackAnalyzer/MessagePackAnalyzer.cs index bfb0b21e5..2e65888ee 100644 --- a/src/MessagePackAnalyzer/MessagePackAnalyzer.cs +++ b/src/MessagePackAnalyzer/MessagePackAnalyzer.cs @@ -16,6 +16,7 @@ public class MessagePackAnalyzer : DiagnosticAnalyzer public const string UseMessagePackObjectAttributeId = "MsgPack003"; public const string AttributeMessagePackObjectMembersId = "MsgPack004"; public const string InvalidMessagePackObjectId = "MsgPack005"; + public const string MessagePackFormatterMustBeMessagePackFormatterId = "MsgPack006"; internal const string Category = "Usage"; @@ -35,6 +36,16 @@ public class MessagePackAnalyzer : DiagnosticAnalyzer isEnabledByDefault: true, helpLinkUri: AnalyzerUtilities.GetHelpLink(UseMessagePackObjectAttributeId)); + internal static readonly DiagnosticDescriptor MessageFormatterMustBeMessagePackFormatter = new DiagnosticDescriptor( + id: MessagePackFormatterMustBeMessagePackFormatterId, + title: "Must be IMessageFormatter", + category: Category, + messageFormat: "Type must be of IMessagePackFormatter. {0}.", // type.Name + description: "Type must be of IMessagePackFormatter.", + defaultSeverity: DiagnosticSeverity.Error, + isEnabledByDefault: true, + helpLinkUri: AnalyzerUtilities.GetHelpLink(UseMessagePackObjectAttributeId)); + internal static readonly DiagnosticDescriptor PublicMemberNeedsKey = new DiagnosticDescriptor( id: AttributeMessagePackObjectMembersId, title: "Attribute public members of MessagePack objects", @@ -58,7 +69,9 @@ public class MessagePackAnalyzer : DiagnosticAnalyzer public override ImmutableArray SupportedDiagnostics { get; } = ImmutableArray.Create( TypeMustBeMessagePackObject, PublicMemberNeedsKey, - InvalidMessagePackObject); + InvalidMessagePackObject, + MessageFormatterMustBeMessagePackFormatter + ); public override void Initialize(AnalysisContext context) { diff --git a/src/MessagePackAnalyzer/ReferenceSymbols.cs b/src/MessagePackAnalyzer/ReferenceSymbols.cs index 944324756..36787e73c 100644 --- a/src/MessagePackAnalyzer/ReferenceSymbols.cs +++ b/src/MessagePackAnalyzer/ReferenceSymbols.cs @@ -14,6 +14,7 @@ private ReferenceSymbols( INamedTypeSymbol keyAttribute, INamedTypeSymbol ignoreAttribute, INamedTypeSymbol formatterAttribute, + INamedTypeSymbol messagePackFormatter, INamedTypeSymbol ignoreDataMemberAttribute) { this.MessagePackObjectAttribute = messagePackObjectAttribute; @@ -21,6 +22,7 @@ private ReferenceSymbols( this.KeyAttribute = keyAttribute; this.IgnoreAttribute = ignoreAttribute; this.FormatterAttribute = formatterAttribute; + this.MessagePackFormatter = messagePackFormatter; this.IgnoreDataMemberAttribute = ignoreDataMemberAttribute; } @@ -34,6 +36,8 @@ private ReferenceSymbols( internal INamedTypeSymbol FormatterAttribute { get; } + internal INamedTypeSymbol MessagePackFormatter { get; } + internal INamedTypeSymbol IgnoreDataMemberAttribute { get; } public static bool TryCreate(Compilation compilation, [NotNullWhen(true)] out ReferenceSymbols? instance) @@ -70,6 +74,12 @@ public static bool TryCreate(Compilation compilation, [NotNullWhen(true)] out Re return false; } + var messageFormatter = compilation.GetTypeByMetadataName("MessagePack.Formatters.IMessagePackFormatter"); + if (messageFormatter is null) + { + return false; + } + var ignoreDataMemberAttribute = compilation.GetTypeByMetadataName("System.Runtime.Serialization.IgnoreDataMemberAttribute"); if (ignoreDataMemberAttribute is null) { @@ -82,6 +92,7 @@ public static bool TryCreate(Compilation compilation, [NotNullWhen(true)] out Re keyAttribute, ignoreAttribute, formatterAttribute, + messageFormatter, ignoreDataMemberAttribute); return true; } diff --git a/src/MessagePackAnalyzer/TypeCollector.cs b/src/MessagePackAnalyzer/TypeCollector.cs index 09dfabe8f..5d68a43a5 100644 --- a/src/MessagePackAnalyzer/TypeCollector.cs +++ b/src/MessagePackAnalyzer/TypeCollector.cs @@ -179,14 +179,21 @@ public void CollectCore(ITypeSymbol typeSymbol, ISymbol? callerSymbol = null) return; } - private void CollectObject(INamedTypeSymbol type, ISymbol? callerSymbol) + private void ICollectObject(INamedTypeSymbol type, ISymbol? callerSymbol) { var isClass = !type.IsValueType; AttributeData formatterAttr = type.GetAttributes().FirstOrDefault(x => Equals(x.AttributeClass, this.typeReferences.FormatterAttribute)); if( formatterAttr != null ) { - // TODO: Validate that ConstructorArguments[0] is in fact of type IMessagePackFormatter + // Validate that the typed formatter is actually of `IMessagePackFormatter` + var formatterType = (ITypeSymbol)formatterAttr.ConstructorArguments[0].Value; + var isMessagePackFormatter = formatterType.AllInterfaces.Any(x => x.Equals(this.typeReferences.MessagePackFormatter)); + if( !isMessagePackFormatter ) + { + var typeInfo = ImmutableDictionary.Create().Add("type", formatterType.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)); + this.ReportContext.Add(Diagnostic.Create(MessagePackAnalyzer.MessageFormatterMustBeMessagePackFormatter, formatterType.Locations[0], typeInfo)); + } return; } diff --git a/tests/MessagePackAnalyzer.Tests/MessagePackAnalyzerTests.cs b/tests/MessagePackAnalyzer.Tests/MessagePackAnalyzerTests.cs index 04dbf71d4..231197c05 100644 --- a/tests/MessagePackAnalyzer.Tests/MessagePackAnalyzerTests.cs +++ b/tests/MessagePackAnalyzer.Tests/MessagePackAnalyzerTests.cs @@ -37,7 +37,29 @@ public void Serialize(ref MessagePackWriter writer, Foo value, MessagePackSerial } -[MessagePackFormatter(typeof(Foo))] +[MessagePackFormatter(typeof(FooFormatter))] +public struct Foo +{ +} + +[MessagePackObject] +public class SomeClass { + [Key(0)] + public Foo SomeFoo { get; set; } +} +"; + + await VerifyCS.VerifyAnalyzerAsync(input); + } + + [Fact] + public async Task InvalidMessageFormatterType() + { + string input = Preamble + @"using MessagePack.Formatters; + +public class {|MsgPack006:InvalidMessageFormatter|} { } + +[MessagePackFormatter(typeof(InvalidMessageFormatter))] public struct Foo { } From a6021801b418265004e2c7e0a3de31ac47e110ef Mon Sep 17 00:00:00 2001 From: Jonas Frost Date: Thu, 3 Jun 2021 00:29:46 -0700 Subject: [PATCH 074/161] oups --- src/MessagePackAnalyzer/TypeCollector.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MessagePackAnalyzer/TypeCollector.cs b/src/MessagePackAnalyzer/TypeCollector.cs index 5d68a43a5..5f8a36ca0 100644 --- a/src/MessagePackAnalyzer/TypeCollector.cs +++ b/src/MessagePackAnalyzer/TypeCollector.cs @@ -179,7 +179,7 @@ public void CollectCore(ITypeSymbol typeSymbol, ISymbol? callerSymbol = null) return; } - private void ICollectObject(INamedTypeSymbol type, ISymbol? callerSymbol) + private void CollectObject(INamedTypeSymbol type, ISymbol? callerSymbol) { var isClass = !type.IsValueType; From 74ce9db531d785fdc7f0cf8266491bf644eb1a1d Mon Sep 17 00:00:00 2001 From: Jonas Frost Date: Thu, 3 Jun 2021 11:03:25 -0700 Subject: [PATCH 075/161] fixed style violations --- src/MessagePackAnalyzer/MessagePackAnalyzer.cs | 3 +-- src/MessagePackAnalyzer/TypeCollector.cs | 5 +++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/MessagePackAnalyzer/MessagePackAnalyzer.cs b/src/MessagePackAnalyzer/MessagePackAnalyzer.cs index 2e65888ee..7fd3f7926 100644 --- a/src/MessagePackAnalyzer/MessagePackAnalyzer.cs +++ b/src/MessagePackAnalyzer/MessagePackAnalyzer.cs @@ -70,8 +70,7 @@ public class MessagePackAnalyzer : DiagnosticAnalyzer TypeMustBeMessagePackObject, PublicMemberNeedsKey, InvalidMessagePackObject, - MessageFormatterMustBeMessagePackFormatter - ); + MessageFormatterMustBeMessagePackFormatter); public override void Initialize(AnalysisContext context) { diff --git a/src/MessagePackAnalyzer/TypeCollector.cs b/src/MessagePackAnalyzer/TypeCollector.cs index 5f8a36ca0..bee2f314b 100644 --- a/src/MessagePackAnalyzer/TypeCollector.cs +++ b/src/MessagePackAnalyzer/TypeCollector.cs @@ -184,16 +184,17 @@ private void CollectObject(INamedTypeSymbol type, ISymbol? callerSymbol) var isClass = !type.IsValueType; AttributeData formatterAttr = type.GetAttributes().FirstOrDefault(x => Equals(x.AttributeClass, this.typeReferences.FormatterAttribute)); - if( formatterAttr != null ) + if (formatterAttr != null) { // Validate that the typed formatter is actually of `IMessagePackFormatter` var formatterType = (ITypeSymbol)formatterAttr.ConstructorArguments[0].Value; var isMessagePackFormatter = formatterType.AllInterfaces.Any(x => x.Equals(this.typeReferences.MessagePackFormatter)); - if( !isMessagePackFormatter ) + if (!isMessagePackFormatter) { var typeInfo = ImmutableDictionary.Create().Add("type", formatterType.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)); this.ReportContext.Add(Diagnostic.Create(MessagePackAnalyzer.MessageFormatterMustBeMessagePackFormatter, formatterType.Locations[0], typeInfo)); } + return; } From 070f3a9e1133cf62c50e080312f63ce0cac0d671 Mon Sep 17 00:00:00 2001 From: Jonas Frost Date: Thu, 3 Jun 2021 11:21:29 -0700 Subject: [PATCH 076/161] MsgPack006 diagnostic error is not properly located on the attribute instead of the intended formatter class --- src/MessagePackAnalyzer/TypeCollector.cs | 3 ++- tests/MessagePackAnalyzer.Tests/MessagePackAnalyzerTests.cs | 5 ++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/MessagePackAnalyzer/TypeCollector.cs b/src/MessagePackAnalyzer/TypeCollector.cs index bee2f314b..a2ece5781 100644 --- a/src/MessagePackAnalyzer/TypeCollector.cs +++ b/src/MessagePackAnalyzer/TypeCollector.cs @@ -191,8 +191,9 @@ private void CollectObject(INamedTypeSymbol type, ISymbol? callerSymbol) var isMessagePackFormatter = formatterType.AllInterfaces.Any(x => x.Equals(this.typeReferences.MessagePackFormatter)); if (!isMessagePackFormatter) { + var location = formatterAttr.ApplicationSyntaxReference.SyntaxTree.GetLocation(formatterAttr.ApplicationSyntaxReference.Span); var typeInfo = ImmutableDictionary.Create().Add("type", formatterType.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)); - this.ReportContext.Add(Diagnostic.Create(MessagePackAnalyzer.MessageFormatterMustBeMessagePackFormatter, formatterType.Locations[0], typeInfo)); + this.ReportContext.Add(Diagnostic.Create(MessagePackAnalyzer.MessageFormatterMustBeMessagePackFormatter, location, typeInfo)); } return; diff --git a/tests/MessagePackAnalyzer.Tests/MessagePackAnalyzerTests.cs b/tests/MessagePackAnalyzer.Tests/MessagePackAnalyzerTests.cs index 231197c05..8fc4c65f9 100644 --- a/tests/MessagePackAnalyzer.Tests/MessagePackAnalyzerTests.cs +++ b/tests/MessagePackAnalyzer.Tests/MessagePackAnalyzerTests.cs @@ -57,9 +57,9 @@ public async Task InvalidMessageFormatterType() { string input = Preamble + @"using MessagePack.Formatters; -public class {|MsgPack006:InvalidMessageFormatter|} { } +public class InvalidMessageFormatter { } -[MessagePackFormatter(typeof(InvalidMessageFormatter))] +[{|MsgPack006:MessagePackFormatter(typeof(InvalidMessageFormatter))|}] public struct Foo { } @@ -74,7 +74,6 @@ public class SomeClass { await VerifyCS.VerifyAnalyzerAsync(input); } - [Fact] public async Task NullStringKey() { From b6b1cf944cbad38d82d58d033b67c1991e952f63 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sat, 12 Jun 2021 06:58:01 -0600 Subject: [PATCH 077/161] Suppress the only build warning we have As far as I know, there's no way to "fix" this and it's actually by design because we are comparing two versions of MessagePack. --- benchmark/ExperimentalBenchmark/ExperimentalBenchmark.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/benchmark/ExperimentalBenchmark/ExperimentalBenchmark.csproj b/benchmark/ExperimentalBenchmark/ExperimentalBenchmark.csproj index fb222f26c..dbefafaf4 100644 --- a/benchmark/ExperimentalBenchmark/ExperimentalBenchmark.csproj +++ b/benchmark/ExperimentalBenchmark/ExperimentalBenchmark.csproj @@ -6,6 +6,7 @@ Benchmark true True + $(NoWarn);MSB3243 From b0db693c23d6266ae36dfb9cb5d0b95dcbc3fb1e Mon Sep 17 00:00:00 2001 From: Minhyuk Kim Date: Sun, 13 Jun 2021 21:46:40 +0900 Subject: [PATCH 078/161] Use AssemblyBuilderAccess.RunAndCollect --- .../Assets/Scripts/MessagePack/Internal/DynamicAssembly.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Internal/DynamicAssembly.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Internal/DynamicAssembly.cs index f5988af0f..72b86f849 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Internal/DynamicAssembly.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Internal/DynamicAssembly.cs @@ -26,7 +26,7 @@ public DynamicAssembly(string moduleName) AssemblyBuilderAccess builderAccess = AssemblyBuilderAccess.RunAndSave; this.moduleName = moduleName; #else - AssemblyBuilderAccess builderAccess = AssemblyBuilderAccess.Run; + AssemblyBuilderAccess builderAccess = AssemblyBuilderAccess.RunAndCollect; #endif this.assemblyBuilder = AssemblyBuilder.DefineDynamicAssembly(new AssemblyName(moduleName), builderAccess); this.moduleBuilder = this.assemblyBuilder.DefineDynamicModule(moduleName + ".dll"); From 412a1af91548671d4540f20f8e86605e57de3ad9 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sun, 13 Jun 2021 15:54:49 -0600 Subject: [PATCH 079/161] Clearly document unity scenarios that require AOT --- README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 628d85eec..c228a1246 100644 --- a/README.md +++ b/README.md @@ -1458,7 +1458,9 @@ MessagePack for C# already used some MessagePack extension type codes, be carefu Unity lowest supported version is `2018.3`, API Compatibility Level supports both `.NET 4.x` and `.NET Standard 2.0`. -You can install the `unitypackage` from the [releases][Releases] page. If your build targets PC, you can use it as is, but if your build targets IL2CPP, you can not use `Dynamic***Resolver`, so it is required to use pre-code generation. Please see [pre-code generation section](#aot). +You can install the `unitypackage` from the [releases][Releases] page. +If your build targets .NET Framework 4.x and runs on mono, you can use it as is. +But if your build targets IL2CPP, you can not use `Dynamic***Resolver`, so it is required to use pre-code generation. Please see [pre-code generation section](#aot). MessagePack for C# includes some additional `System.*.dll` libraries that originally provides in NuGet. They are located under `Plugins`. If other packages use these libraries (e.g. Unity Collections package using `System.Runtime.CompilerServices.Unsafe.dll`), to avoid conflicts, please delete the DLL under `Plugins`. @@ -1504,7 +1506,8 @@ If you want to share a class between Unity and a server, you can use `SharedProj By default, MessagePack for C# serializes custom objects by [generating IL](https://msdn.microsoft.com/en-us/library/system.reflection.emit.ilgenerator.aspx) on the fly at runtime to create custom, highly tuned formatters for each type. This code generation has a minor upfront performance cost. Because strict-AOT environments such as Xamarin and Unity IL2CPP forbid runtime code generation, MessagePack provides a way for you to run a code generator ahead of time as well. -> Note: When Unity targets the PC it allows dynamic code generation, so AOT is not required. +> Note: When using Unity, dynamic code generation only works when targeting .NET Framework 4.x + mono runtime. +For all other Unity targets, AOT is required. If you want to avoid the upfront dynamic generation cost or you need to run on Xamarin or Unity, you need AOT code generation. `mpc` (MessagePackCompiler) is the code generator of MessagePack for C#. mpc uses [Roslyn](https://github.com/dotnet/roslyn) to analyze source code. From db29bea591a47c102c2c5b8e049186582678a789 Mon Sep 17 00:00:00 2001 From: Aleksander Heintz Date: Mon, 14 Jun 2021 18:02:08 +0200 Subject: [PATCH 080/161] Fix handling of readonly private fields Disallow writing to readonly private fields even when using a resolver that allows using private fields. Fixes: #1218 --- .../Resolvers/DynamicObjectResolver.cs | 4 +-- .../Tests/ShareTests/AllowPrivateTest.cs | 31 +++++++++++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs index f285082dc..c4cf22b6a 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs @@ -1492,7 +1492,7 @@ public static ObjectSerializationInfo CreateOrNull(Type type, bool forceStringKe { FieldInfo = field, IsReadable = allowPrivate || field.IsPublic, - IsWritable = allowPrivate || (field.IsPublic && !field.IsInitOnly), + IsWritable = (allowPrivate || field.IsPublic) && !field.IsInitOnly, StringKey = firstMemberByName ? item.Name : $"{item.DeclaringType.FullName}.{item.Name}", }; } @@ -1675,7 +1675,7 @@ public static ObjectSerializationInfo CreateOrNull(Type type, bool forceStringKe { FieldInfo = item, IsReadable = allowPrivate || item.IsPublic, - IsWritable = allowPrivate || (item.IsPublic && !item.IsInitOnly), + IsWritable = (allowPrivate || item.IsPublic) && !item.IsInitOnly, }; if (!member.IsReadable && !member.IsWritable) { diff --git a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/AllowPrivateTest.cs b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/AllowPrivateTest.cs index 7c418e7ea..b4abbb503 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/AllowPrivateTest.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/AllowPrivateTest.cs @@ -157,6 +157,28 @@ internal class InternalClass internal InternalEnum EnumProperty { get; set; } } + [MessagePackObject] + public class PrivateReadonlyField + { + public static PrivateReadonlyField WithNullValue { get; } = new PrivateReadonlyField(); + + [Key(0)] + private readonly string field; + + [SerializationConstructor] + public PrivateReadonlyField(string field) + { + this.field = field ?? "not null"; + } + + private PrivateReadonlyField() + { + } + + [IgnoreMember] + public string Field => field; + } + #if !ENABLE_IL2CPP [MessagePackObject] @@ -310,6 +332,15 @@ public void InternalClassWithInternalEnum() Assert.Equal(expected.EnumProperty, actual.EnumProperty); } + [Fact] + public void PrivateReadonlyFieldSetInConstructor() + { + PrivateReadonlyField initial = PrivateReadonlyField.WithNullValue; + var bin = MessagePackSerializer.Serialize(initial, StandardResolverAllowPrivate.Options); + var deserialized = MessagePackSerializer.Deserialize(bin, StandardResolverAllowPrivate.Options); + Assert.Equal("not null", deserialized.Field); + } + #if !ENABLE_IL2CPP [Fact] From 0dc070a3e0dc2187304eaed8958f796d75cd14de Mon Sep 17 00:00:00 2001 From: Nokman Date: Sun, 27 Jun 2021 13:56:54 +0300 Subject: [PATCH 081/161] Mapping intMembers to constructor parameters in ascending order. --- .../Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs index f285082dc..3e321f548 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs @@ -1787,6 +1787,7 @@ public static ObjectSerializationInfo CreateOrNull(Type type, bool forceStringKe var constructorParameters = new List(); if (ctor != null) { + IReadOnlyDictionary ctorParamIndexIntMembersDictionary = intMembers.OrderBy(x => x.Key).Select((x, i) => (Key: x.Value, Index: i)).ToDictionary(x => x.Index, x => x.Key); ILookup> constructorLookupByKeyDictionary = stringMembers.ToLookup(x => x.Key, x => x, StringComparer.OrdinalIgnoreCase); ILookup> constructorLookupByMemberNameDictionary = stringMembers.ToLookup(x => x.Value.Name, x => x, StringComparer.OrdinalIgnoreCase); do @@ -1798,7 +1799,7 @@ public static ObjectSerializationInfo CreateOrNull(Type type, bool forceStringKe EmittableMember paramMember; if (isIntKey) { - if (intMembers.TryGetValue(ctorParamIndex, out paramMember)) + if (ctorParamIndexIntMembersDictionary.TryGetValue(ctorParamIndex, out paramMember)) { if ((item.ParameterType == paramMember.Type || item.ParameterType.GetTypeInfo().IsAssignableFrom(paramMember.Type)) From aeb2575f1d3f89780892072dd703d8334b4b5e87 Mon Sep 17 00:00:00 2001 From: Nokman Date: Sun, 27 Jun 2021 14:06:00 +0300 Subject: [PATCH 082/161] Exiting the loop, since the next iterations do not affect the result. --- .../MessagePack/Resolvers/DynamicObjectResolver.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs index 3e321f548..b629e3412 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs @@ -1812,7 +1812,7 @@ public static ObjectSerializationInfo CreateOrNull(Type type, bool forceStringKe if (ctorEnumerator != null) { ctor = null; - continue; + break; } else { @@ -1825,7 +1825,7 @@ public static ObjectSerializationInfo CreateOrNull(Type type, bool forceStringKe if (ctorEnumerator != null) { ctor = null; - continue; + break; } else { @@ -1858,7 +1858,7 @@ public static ObjectSerializationInfo CreateOrNull(Type type, bool forceStringKe if (ctorEnumerator != null) { ctor = null; - continue; + break; } else { @@ -1876,7 +1876,7 @@ public static ObjectSerializationInfo CreateOrNull(Type type, bool forceStringKe if (ctorEnumerator != null) { ctor = null; - continue; + break; } else { @@ -1889,7 +1889,7 @@ public static ObjectSerializationInfo CreateOrNull(Type type, bool forceStringKe if (ctorEnumerator != null) { ctor = null; - continue; + break; } else { From c2a7583ee58695bbf10721b8464169787b305ba9 Mon Sep 17 00:00:00 2001 From: Nokman Date: Thu, 1 Jul 2021 23:35:58 +0300 Subject: [PATCH 083/161] Added a constructor test for an immutable type with missing keys. --- .../DynamicObjectResolverConstructorTest.cs | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/DynamicObjectResolverConstructorTest.cs b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/DynamicObjectResolverConstructorTest.cs index 73bc1c70b..68f0b8aa2 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/DynamicObjectResolverConstructorTest.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/DynamicObjectResolverConstructorTest.cs @@ -255,6 +255,30 @@ public TestConstructor9(int x, int y, int z) } } + ///

+ /// This constructor tests the case where there are missing int keys, to ensure that + /// the correct ctor is still found using index numbers of the keys, not their values. + /// + [MessagePackObject] + public class TestConstructor10 + { + [Key(0)] + public int X { get; } + + [Key(2)] + public int Y { get; } + + [Key(5)] + public int Z { get; } + + public TestConstructor10(int x, int y, int z) + { + X = x; + Y = y; + Z = z; + } + } + [Fact] public void StringKey() { @@ -350,5 +374,17 @@ public void MatchedStructCtorFoundWithMixOfMemberNamesAndStringKeys() r.Y.Is(8); r.Z.Is(9); } + + [Fact] + public void MatchedClassCtorFoundWithMissingIntKeys() + { + var ctor = new TestConstructor10(10, 11, 12); + var bin = MessagePackSerializer.Serialize(ctor); + var r = MessagePackSerializer.Deserialize(bin); + + r.X.Is(10); + r.Y.Is(11); + r.Z.Is(12); + } } } From 2c9a73defea18d5253d7e76def85a654edf952fe Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 12 Jul 2021 10:26:41 -0600 Subject: [PATCH 084/161] Add string interning option This isn't on by default, and while this first trivial implementation allocates every string and passes it through `string.Intern(string)`, many optimizations could be made to it either in this library directly or by apps through overridding the virtual method. Closes #634 --- .../DynamicCodeDumper.csproj | 3 ++ .../Formatters/StringInterningFormatter.cs | 25 +++++++++++++ .../MessagePack/InternedStringCollection.cs | 34 ++++++++++++++++++ .../MessagePackSerializerOptions.cs | 27 ++++++++++++++ .../MessagePack/Resolvers/StandardResolver.cs | 1 + .../Resolvers/StringInterningResolver.cs | 35 +++++++++++++++++++ .../MessagePackSerializerOptionsTests.cs | 14 +++++++- .../net5.0/PublicAPI.Unshipped.txt | 12 +++++++ .../netcoreapp2.1/PublicAPI.Unshipped.txt | 12 +++++++ .../netcoreapp3.1/PublicAPI.Unshipped.txt | 12 +++++++ .../netstandard2.0/PublicAPI.Unshipped.txt | 12 +++++++ 11 files changed, 186 insertions(+), 1 deletion(-) create mode 100644 src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/StringInterningFormatter.cs create mode 100644 src/MessagePack.UnityClient/Assets/Scripts/MessagePack/InternedStringCollection.cs create mode 100644 src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/StringInterningResolver.cs diff --git a/sandbox/DynamicCodeDumper/DynamicCodeDumper.csproj b/sandbox/DynamicCodeDumper/DynamicCodeDumper.csproj index 4ef220a07..a0252ad38 100644 --- a/sandbox/DynamicCodeDumper/DynamicCodeDumper.csproj +++ b/sandbox/DynamicCodeDumper/DynamicCodeDumper.csproj @@ -72,6 +72,9 @@ Code\MessagePackSerializerOptions.cs + + Code\InternedStringCollection.cs + Code\MessagePackSecurity.cs diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/StringInterningFormatter.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/StringInterningFormatter.cs new file mode 100644 index 000000000..eb39af152 --- /dev/null +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/StringInterningFormatter.cs @@ -0,0 +1,25 @@ +// 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.Formatters +{ + /// + /// A formatter that interns strings on deserialization. + /// + public sealed class StringInterningFormatter : IMessagePackFormatter + { + /// + public string Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (options.StringInterning is null) + { + return reader.ReadString(); + } + + return options.StringInterning.GetString(ref reader); + } + + /// + public void Serialize(ref MessagePackWriter writer, string value, MessagePackSerializerOptions options) => writer.Write(value); + } +} diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/InternedStringCollection.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/InternedStringCollection.cs new file mode 100644 index 000000000..8218b17cc --- /dev/null +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/InternedStringCollection.cs @@ -0,0 +1,34 @@ +// 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 +{ + /// + /// Reuses previously created objects wherever possible + /// to reduce memory allocations while deserializing msgpack sequences. + /// + /// + /// This class is thread-safe. + /// Derived types are also expected to be thread-safe. + /// + public class InternedStringCollection + { + /// + /// Reads a string from a given . + /// + /// The reader to read the string from. + /// A string that matches the value at the caller's position on the reader. + /// + /// The default implementation simply interns all strings using . + /// This method may be overridden to: + /// 1) be more selective about which strings should be interned, + /// 2) change where interned strings are stored, + /// 3) avoid the initial string allocation and go straight to the interned string. + /// + public virtual string GetString(ref MessagePackReader reader) + { + string value = reader.ReadString(); + return value is null ? null : string.Intern(value); + } + } +} diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs index ebf1ca43b..ed510ff61 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs @@ -62,6 +62,7 @@ protected MessagePackSerializerOptions(MessagePackSerializerOptions copyFrom) this.AllowAssemblyVersionMismatch = copyFrom.AllowAssemblyVersionMismatch; this.Security = copyFrom.Security; this.SequencePool = copyFrom.SequencePool; + this.StringInterning = copyFrom.StringInterning; } /// @@ -121,6 +122,15 @@ protected MessagePackSerializerOptions(MessagePackSerializerOptions copyFrom) /// The default value is the instance. public SequencePool SequencePool { get; private set; } = SequencePool.Shared; + /// + /// Gets an optional collection used for string interning on deserialization. + /// + /// The default value is . + /// + /// When , string interning is disabled. + /// + public InternedStringCollection StringInterning { get; private set; } + /// /// Gets a type given a string representation of the type. /// @@ -289,6 +299,23 @@ public MessagePackSerializerOptions WithPool(SequencePool pool) return result; } + /// + /// Gets a copy of these options with the property set to a new value. + /// + /// The new value for the property. + /// The new instance. + public MessagePackSerializerOptions WithStringInterning(InternedStringCollection value) + { + if (this.StringInterning == value) + { + return this; + } + + var result = this.Clone(); + result.StringInterning = value; + return result; + } + /// /// Creates a clone of this instance with the same properties set. /// diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/StandardResolver.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/StandardResolver.cs index 009e050e6..38d8924cd 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/StandardResolver.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/StandardResolver.cs @@ -283,6 +283,7 @@ internal static class StandardResolverHelper public static readonly IFormatterResolver[] DefaultResolvers = new IFormatterResolver[] { BuiltinResolver.Instance, // Try Builtin + StringInterningResolver.Instance, // intern strings if enabled. AttributeFormatterResolver.Instance, // Try use [MessagePackFormatter] #if UNITY_2018_3_OR_NEWER diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/StringInterningResolver.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/StringInterningResolver.cs new file mode 100644 index 000000000..bbe836f2b --- /dev/null +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/StringInterningResolver.cs @@ -0,0 +1,35 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using MessagePack.Formatters; + +namespace MessagePack.Resolvers +{ + /// + /// Directs strings to be deserialized with the . + /// + public sealed class StringInterningResolver : IFormatterResolver + { + /// + /// The singleton instance that can be used. + /// + public static readonly StringInterningResolver Instance = new StringInterningResolver(); + + private readonly StringInterningFormatter formatter = new StringInterningFormatter(); + + private StringInterningResolver() + { + } + + /// + public IMessagePackFormatter GetFormatter() + { + if (typeof(T) == typeof(string)) + { + return (IMessagePackFormatter)(object)this.formatter; + } + + return null; + } + } +} diff --git a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/MessagePackSerializerOptionsTests.cs b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/MessagePackSerializerOptionsTests.cs index 96bec149a..cee1cfb1b 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/MessagePackSerializerOptionsTests.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/MessagePackSerializerOptionsTests.cs @@ -13,7 +13,19 @@ public class MessagePackSerializerOptionsTests .WithOmitAssemblyVersion(true) .WithResolver(BuiltinResolver.Instance) .WithOldSpec(false) - .WithSecurity(MySecurityOptions.Instance); + .WithSecurity(MySecurityOptions.Instance) + .WithStringInterning(new InternedStringCollection()); + + [Fact] + public void StringInterning() + { + Assert.Null(MessagePackSerializerOptions.Standard.StringInterning); + var collection = new InternedStringCollection(); + Assert.Same(collection, MessagePackSerializerOptions.Standard.WithStringInterning(collection).StringInterning); + + Assert.Same(NonDefaultOptions, NonDefaultOptions.WithStringInterning(NonDefaultOptions.StringInterning)); + Assert.Null(NonDefaultOptions.WithStringInterning(null).StringInterning); + } [Fact] public void AllowAssemblyVersionMismatch() diff --git a/src/MessagePack/net5.0/PublicAPI.Unshipped.txt b/src/MessagePack/net5.0/PublicAPI.Unshipped.txt index 1447ef0d5..d2851af1d 100644 --- a/src/MessagePack/net5.0/PublicAPI.Unshipped.txt +++ b/src/MessagePack/net5.0/PublicAPI.Unshipped.txt @@ -6,13 +6,23 @@ MessagePack.Formatters.HalfFormatter.Deserialize(ref MessagePack.MessagePackRead MessagePack.Formatters.HalfFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Half value, MessagePack.MessagePackSerializerOptions options) -> void MessagePack.Formatters.InterfaceReadOnlySetFormatter MessagePack.Formatters.InterfaceReadOnlySetFormatter.InterfaceReadOnlySetFormatter() -> void +MessagePack.Formatters.StringInterningFormatter +MessagePack.Formatters.StringInterningFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> string +MessagePack.Formatters.StringInterningFormatter.Serialize(ref MessagePack.MessagePackWriter writer, string value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.StringInterningFormatter.StringInterningFormatter() -> void +MessagePack.InternedStringCollection +MessagePack.InternedStringCollection.InternedStringCollection() -> void MessagePack.MessagePackReader.MessagePackReader() -> void MessagePack.MessagePackSerializerOptions.SequencePool.get -> MessagePack.SequencePool +MessagePack.MessagePackSerializerOptions.StringInterning.get -> MessagePack.InternedStringCollection MessagePack.MessagePackSerializerOptions.WithPool(MessagePack.SequencePool pool) -> MessagePack.MessagePackSerializerOptions +MessagePack.MessagePackSerializerOptions.WithStringInterning(MessagePack.InternedStringCollection value) -> MessagePack.MessagePackSerializerOptions MessagePack.MessagePackStreamReader.MessagePackStreamReader(System.IO.Stream stream, bool leaveOpen, MessagePack.SequencePool sequencePool) -> void MessagePack.MessagePackStreamReader.ReadArrayHeaderAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask MessagePack.MessagePackStreamReader.ReadMapHeaderAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask MessagePack.MessagePackWriter.MessagePackWriter() -> void +MessagePack.Resolvers.StringInterningResolver +MessagePack.Resolvers.StringInterningResolver.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter MessagePack.SequencePool MessagePack.SequencePool.SequencePool() -> void MessagePack.SequencePool.SequencePool(int maxSize) -> void @@ -21,6 +31,8 @@ MessagePack.TinyJsonException.TinyJsonException(System.Runtime.Serialization.Ser static MessagePack.Nil.operator !=(MessagePack.Nil left, MessagePack.Nil right) -> bool static MessagePack.Nil.operator ==(MessagePack.Nil left, MessagePack.Nil right) -> bool static readonly MessagePack.Formatters.HalfFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter +static readonly MessagePack.Resolvers.StringInterningResolver.Instance -> MessagePack.Resolvers.StringInterningResolver +virtual MessagePack.InternedStringCollection.GetString(ref MessagePack.MessagePackReader reader) -> string virtual MessagePack.MessagePackStreamReader.Dispose(bool disposing) -> void MessagePack.Formatters.GenericEnumerableFormatter MessagePack.Formatters.GenericEnumerableFormatter.GenericEnumerableFormatter() -> void diff --git a/src/MessagePack/netcoreapp2.1/PublicAPI.Unshipped.txt b/src/MessagePack/netcoreapp2.1/PublicAPI.Unshipped.txt index f053d3cd8..a6bc9cd99 100644 --- a/src/MessagePack/netcoreapp2.1/PublicAPI.Unshipped.txt +++ b/src/MessagePack/netcoreapp2.1/PublicAPI.Unshipped.txt @@ -1,11 +1,21 @@ MessagePack.ExtensionHeader.ExtensionHeader() -> void MessagePack.ExtensionResult.ExtensionResult() -> void MessagePack.FormatterNotRegisteredException.FormatterNotRegisteredException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) -> void +MessagePack.Formatters.StringInterningFormatter +MessagePack.Formatters.StringInterningFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> string +MessagePack.Formatters.StringInterningFormatter.Serialize(ref MessagePack.MessagePackWriter writer, string value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.StringInterningFormatter.StringInterningFormatter() -> void +MessagePack.InternedStringCollection +MessagePack.InternedStringCollection.InternedStringCollection() -> void MessagePack.MessagePackReader.MessagePackReader() -> void MessagePack.MessagePackSerializerOptions.SequencePool.get -> MessagePack.SequencePool +MessagePack.MessagePackSerializerOptions.StringInterning.get -> MessagePack.InternedStringCollection MessagePack.MessagePackSerializerOptions.WithPool(MessagePack.SequencePool pool) -> MessagePack.MessagePackSerializerOptions +MessagePack.MessagePackSerializerOptions.WithStringInterning(MessagePack.InternedStringCollection value) -> MessagePack.MessagePackSerializerOptions MessagePack.MessagePackStreamReader.MessagePackStreamReader(System.IO.Stream stream, bool leaveOpen, MessagePack.SequencePool sequencePool) -> void MessagePack.MessagePackWriter.MessagePackWriter() -> void +MessagePack.Resolvers.StringInterningResolver +MessagePack.Resolvers.StringInterningResolver.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter MessagePack.SequencePool MessagePack.SequencePool.SequencePool() -> void MessagePack.SequencePool.SequencePool(int maxSize) -> void @@ -13,6 +23,8 @@ MessagePack.SequencePool.SequencePool(int maxSize, System.Buffers.ArrayPool void static MessagePack.Nil.operator !=(MessagePack.Nil left, MessagePack.Nil right) -> bool static MessagePack.Nil.operator ==(MessagePack.Nil left, MessagePack.Nil right) -> bool +static readonly MessagePack.Resolvers.StringInterningResolver.Instance -> MessagePack.Resolvers.StringInterningResolver +virtual MessagePack.InternedStringCollection.GetString(ref MessagePack.MessagePackReader reader) -> string virtual MessagePack.MessagePackStreamReader.Dispose(bool disposing) -> void MessagePack.Formatters.GenericEnumerableFormatter MessagePack.Formatters.GenericEnumerableFormatter.GenericEnumerableFormatter() -> void diff --git a/src/MessagePack/netcoreapp3.1/PublicAPI.Unshipped.txt b/src/MessagePack/netcoreapp3.1/PublicAPI.Unshipped.txt index 73b4e7c06..c311155be 100644 --- a/src/MessagePack/netcoreapp3.1/PublicAPI.Unshipped.txt +++ b/src/MessagePack/netcoreapp3.1/PublicAPI.Unshipped.txt @@ -1,13 +1,23 @@ MessagePack.ExtensionHeader.ExtensionHeader() -> void MessagePack.ExtensionResult.ExtensionResult() -> void MessagePack.FormatterNotRegisteredException.FormatterNotRegisteredException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) -> void +MessagePack.Formatters.StringInterningFormatter +MessagePack.Formatters.StringInterningFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> string +MessagePack.Formatters.StringInterningFormatter.Serialize(ref MessagePack.MessagePackWriter writer, string value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.StringInterningFormatter.StringInterningFormatter() -> void +MessagePack.InternedStringCollection +MessagePack.InternedStringCollection.InternedStringCollection() -> void MessagePack.MessagePackReader.MessagePackReader() -> void MessagePack.MessagePackSerializerOptions.SequencePool.get -> MessagePack.SequencePool +MessagePack.MessagePackSerializerOptions.StringInterning.get -> MessagePack.InternedStringCollection MessagePack.MessagePackSerializerOptions.WithPool(MessagePack.SequencePool pool) -> MessagePack.MessagePackSerializerOptions +MessagePack.MessagePackSerializerOptions.WithStringInterning(MessagePack.InternedStringCollection value) -> MessagePack.MessagePackSerializerOptions MessagePack.MessagePackStreamReader.MessagePackStreamReader(System.IO.Stream stream, bool leaveOpen, MessagePack.SequencePool sequencePool) -> void MessagePack.MessagePackStreamReader.ReadArrayHeaderAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask MessagePack.MessagePackStreamReader.ReadMapHeaderAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask MessagePack.MessagePackWriter.MessagePackWriter() -> void +MessagePack.Resolvers.StringInterningResolver +MessagePack.Resolvers.StringInterningResolver.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter MessagePack.SequencePool MessagePack.SequencePool.SequencePool() -> void MessagePack.SequencePool.SequencePool(int maxSize) -> void @@ -15,6 +25,8 @@ MessagePack.SequencePool.SequencePool(int maxSize, System.Buffers.ArrayPool void static MessagePack.Nil.operator !=(MessagePack.Nil left, MessagePack.Nil right) -> bool static MessagePack.Nil.operator ==(MessagePack.Nil left, MessagePack.Nil right) -> bool +static readonly MessagePack.Resolvers.StringInterningResolver.Instance -> MessagePack.Resolvers.StringInterningResolver +virtual MessagePack.InternedStringCollection.GetString(ref MessagePack.MessagePackReader reader) -> string virtual MessagePack.MessagePackStreamReader.Dispose(bool disposing) -> void MessagePack.Formatters.GenericEnumerableFormatter MessagePack.Formatters.GenericEnumerableFormatter.GenericEnumerableFormatter() -> void diff --git a/src/MessagePack/netstandard2.0/PublicAPI.Unshipped.txt b/src/MessagePack/netstandard2.0/PublicAPI.Unshipped.txt index 73b4e7c06..c311155be 100644 --- a/src/MessagePack/netstandard2.0/PublicAPI.Unshipped.txt +++ b/src/MessagePack/netstandard2.0/PublicAPI.Unshipped.txt @@ -1,13 +1,23 @@ MessagePack.ExtensionHeader.ExtensionHeader() -> void MessagePack.ExtensionResult.ExtensionResult() -> void MessagePack.FormatterNotRegisteredException.FormatterNotRegisteredException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) -> void +MessagePack.Formatters.StringInterningFormatter +MessagePack.Formatters.StringInterningFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> string +MessagePack.Formatters.StringInterningFormatter.Serialize(ref MessagePack.MessagePackWriter writer, string value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.StringInterningFormatter.StringInterningFormatter() -> void +MessagePack.InternedStringCollection +MessagePack.InternedStringCollection.InternedStringCollection() -> void MessagePack.MessagePackReader.MessagePackReader() -> void MessagePack.MessagePackSerializerOptions.SequencePool.get -> MessagePack.SequencePool +MessagePack.MessagePackSerializerOptions.StringInterning.get -> MessagePack.InternedStringCollection MessagePack.MessagePackSerializerOptions.WithPool(MessagePack.SequencePool pool) -> MessagePack.MessagePackSerializerOptions +MessagePack.MessagePackSerializerOptions.WithStringInterning(MessagePack.InternedStringCollection value) -> MessagePack.MessagePackSerializerOptions MessagePack.MessagePackStreamReader.MessagePackStreamReader(System.IO.Stream stream, bool leaveOpen, MessagePack.SequencePool sequencePool) -> void MessagePack.MessagePackStreamReader.ReadArrayHeaderAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask MessagePack.MessagePackStreamReader.ReadMapHeaderAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask MessagePack.MessagePackWriter.MessagePackWriter() -> void +MessagePack.Resolvers.StringInterningResolver +MessagePack.Resolvers.StringInterningResolver.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter MessagePack.SequencePool MessagePack.SequencePool.SequencePool() -> void MessagePack.SequencePool.SequencePool(int maxSize) -> void @@ -15,6 +25,8 @@ MessagePack.SequencePool.SequencePool(int maxSize, System.Buffers.ArrayPool void static MessagePack.Nil.operator !=(MessagePack.Nil left, MessagePack.Nil right) -> bool static MessagePack.Nil.operator ==(MessagePack.Nil left, MessagePack.Nil right) -> bool +static readonly MessagePack.Resolvers.StringInterningResolver.Instance -> MessagePack.Resolvers.StringInterningResolver +virtual MessagePack.InternedStringCollection.GetString(ref MessagePack.MessagePackReader reader) -> string virtual MessagePack.MessagePackStreamReader.Dispose(bool disposing) -> void MessagePack.Formatters.GenericEnumerableFormatter MessagePack.Formatters.GenericEnumerableFormatter.GenericEnumerableFormatter() -> void From 0f1a56bd7a435f0aa15f7215bc85113d2a2cbe39 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 12 Jul 2021 13:40:16 -0600 Subject: [PATCH 085/161] Switch string interning to `Microsoft.NET.StringTools` This gets us a few things: 1. Intern strings without wastefully allocating them first in the common fast paths. 1. Switch to a string collection that retains only weak references. --- .../DynamicCodeDumper.csproj | 3 +- .../Formatters/StringInterningFormatter.cs | 5 ++ .../MessagePack/InternedStringCollection.cs | 36 +++++++++++-- .../Scripts/MessagePack/MessagePack.asmdef | 3 +- .../InternedStringCollectionTests.cs | 37 ++++++++++++++ .../StringInterningResolverTests.cs | 51 +++++++++++++++++++ src/MessagePack.UnityClient/copy_assets.bat | 1 + src/MessagePack.UnityClient/copy_assets.sh | 1 + src/MessagePack/MessagePack.csproj | 3 +- 9 files changed, 132 insertions(+), 8 deletions(-) create mode 100644 src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/InternedStringCollectionTests.cs create mode 100644 src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/StringInterningResolverTests.cs diff --git a/sandbox/DynamicCodeDumper/DynamicCodeDumper.csproj b/sandbox/DynamicCodeDumper/DynamicCodeDumper.csproj index a0252ad38..3bca0b875 100644 --- a/sandbox/DynamicCodeDumper/DynamicCodeDumper.csproj +++ b/sandbox/DynamicCodeDumper/DynamicCodeDumper.csproj @@ -144,7 +144,6 @@ - - + diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/StringInterningFormatter.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/StringInterningFormatter.cs index eb39af152..984b96736 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/StringInterningFormatter.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/StringInterningFormatter.cs @@ -11,6 +11,11 @@ public sealed class StringInterningFormatter : IMessagePackFormatter /// public string Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) { + if (reader.TryReadNil()) + { + return null; + } + if (options.StringInterning is null) { return reader.ReadString(); diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/InternedStringCollection.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/InternedStringCollection.cs index 8218b17cc..55a0a49d8 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/InternedStringCollection.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/InternedStringCollection.cs @@ -1,6 +1,9 @@ // Copyright (c) All contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. +using System; +using Microsoft.NET.StringTools; + namespace MessagePack { /// @@ -16,7 +19,7 @@ public class InternedStringCollection /// /// Reads a string from a given . /// - /// The reader to read the string from. + /// The reader to read the string from. This string is never expected to be since the caller can trivially filter that case out. /// A string that matches the value at the caller's position on the reader. /// /// The default implementation simply interns all strings using . @@ -27,8 +30,35 @@ public class InternedStringCollection /// public virtual string GetString(ref MessagePackReader reader) { - string value = reader.ReadString(); - return value is null ? null : string.Intern(value); + MessagePackReader retryReader = reader; + if (reader.TryReadStringSpan(out ReadOnlySpan bytes)) + { + if (bytes.Length < 4096) + { + Span chars = stackalloc char[bytes.Length]; + int charLength; +#if SPAN_BUILTIN + charLength = StringEncoding.UTF8.GetChars(bytes, chars); +#else + unsafe + { + fixed (byte* pBytes = bytes) + fixed (char* pChars = chars) + { + charLength = StringEncoding.UTF8.GetChars(pBytes, bytes.Length, pChars, chars.Length); + } + } +#endif + return Strings.WeakIntern(chars.Slice(0, charLength)); + } + else + { + // Rewind the reader to the start of the string because we're taking the slow path. + reader = retryReader; + } + } + + return Strings.WeakIntern(reader.ReadString()); } } } diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePack.asmdef b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePack.asmdef index f1e851eb9..ff7f5b38c 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePack.asmdef +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePack.asmdef @@ -13,9 +13,10 @@ "System.Buffers.dll", "System.Threading.Tasks.Extensions.dll", "System.Runtime.CompilerServices.Unsafe.dll", + "Microsoft.NET.StringTools.dll", "System.Runtime.Extensions.dll" ], "autoReferenced": true, "defineConstraints": [], "versionDefines": [] -} \ No newline at end of file +} diff --git a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/InternedStringCollectionTests.cs b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/InternedStringCollectionTests.cs new file mode 100644 index 000000000..8c840d6e0 --- /dev/null +++ b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/InternedStringCollectionTests.cs @@ -0,0 +1,37 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using Nerdbank.Streams; +using Xunit; + +namespace MessagePack.Tests +{ + public class InternedStringCollectionTests + { + [Theory] + [InlineData(3)] + [InlineData(1024 * 1024)] + public void EquivalentStringsGetSharedInstance(int length) + { + string originalValue1 = new string('a', length); + string originalValue3 = new string('b', length); + var seq = new Sequence(); + var writer = new MessagePackWriter(seq); + writer.Write(originalValue1); + writer.Write(originalValue1); + writer.Write(originalValue3); + writer.Flush(); + + var reader = new MessagePackReader(seq); + var collection = new InternedStringCollection(); + string value1 = collection.GetString(ref reader); + string value2 = collection.GetString(ref reader); + string value3 = collection.GetString(ref reader); + + Assert.Equal(originalValue1, value1); + Assert.Equal(originalValue3, value3); + + Assert.Same(value1, value2); + } + } +} diff --git a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/StringInterningResolverTests.cs b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/StringInterningResolverTests.cs new file mode 100644 index 000000000..b429d5640 --- /dev/null +++ b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/StringInterningResolverTests.cs @@ -0,0 +1,51 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using MessagePack.Resolvers; +using Nerdbank.Streams; +using Xunit; + +namespace MessagePack.Tests +{ + public class StringInterningResolverTests + { + [Fact] + public void NullString() + { + var seq = new Sequence(); + var writer = new MessagePackWriter(seq); + writer.WriteNil(); + writer.Flush(); + + var reader = new MessagePackReader(seq); + var options = MessagePackSerializerOptions.Standard.WithStringInterning(new InternedStringCollection()); + string result = StringInterningResolver.Instance.GetFormatter().Deserialize(ref reader, options); + Assert.Null(result); + } + + [Fact] + public void EquivalentStringsGetSharedInstance() + { + string originalValue1 = new string('a', 5); + string originalValue3 = new string('b', 5); + var seq = new Sequence(); + var writer = new MessagePackWriter(seq); + writer.Write(originalValue1); + writer.Write(originalValue1); + writer.Write(originalValue3); + writer.Flush(); + + var reader = new MessagePackReader(seq); + var options = MessagePackSerializerOptions.Standard.WithStringInterning(new InternedStringCollection()); + var formatter = StringInterningResolver.Instance.GetFormatter(); + string value1 = formatter.Deserialize(ref reader, options); + string value2 = formatter.Deserialize(ref reader, options); + string value3 = formatter.Deserialize(ref reader, options); + + Assert.Equal(originalValue1, value1); + Assert.Equal(originalValue3, value3); + + Assert.Same(value1, value2); + } + } +} diff --git a/src/MessagePack.UnityClient/copy_assets.bat b/src/MessagePack.UnityClient/copy_assets.bat index bb7232df3..c2b03f0e0 100644 --- a/src/MessagePack.UnityClient/copy_assets.bat +++ b/src/MessagePack.UnityClient/copy_assets.bat @@ -11,6 +11,7 @@ echo F | xcopy "..\..\bin\MessagePack\release\netstandard2.0\publish\System.Buffers.dll" ".\Assets\Plugins\System.Buffers.dll" /Y /I echo F | xcopy "..\..\bin\MessagePack\release\netstandard2.0\publish\System.Memory.dll" ".\Assets\Plugins\System.Memory.dll" /Y /I echo F | xcopy "..\..\bin\MessagePack\release\netstandard2.0\publish\System.Runtime.CompilerServices.Unsafe.dll" ".\Assets\Plugins\System.Runtime.CompilerServices.Unsafe.dll" /Y /I +echo F | xcopy "..\..\bin\MessagePack\release\netstandard2.0\publish\Microsoft.NET.StringTools.dll" ".\Assets\Plugins\Microsoft.NET.StringTools.dll" /Y /I echo F | xcopy "..\..\bin\MessagePack\release\netstandard2.0\publish\System.Threading.Tasks.Extensions.dll" ".\Assets\Plugins\System.Threading.Tasks.Extensions.dll" /Y /I @popd diff --git a/src/MessagePack.UnityClient/copy_assets.sh b/src/MessagePack.UnityClient/copy_assets.sh index 9912ab972..7743fd666 100755 --- a/src/MessagePack.UnityClient/copy_assets.sh +++ b/src/MessagePack.UnityClient/copy_assets.sh @@ -21,4 +21,5 @@ fi cp ${SCRIPT_DIR}/../../bin/MessagePack/${BUILDCONFIGURATION}/netstandard2.0/publish/System.Buffers.dll ${SCRIPT_DIR}/Assets/Plugins/System.Buffers.dll cp ${SCRIPT_DIR}/../../bin/MessagePack/${BUILDCONFIGURATION}/netstandard2.0/publish/System.Memory.dll ${SCRIPT_DIR}/Assets/Plugins/System.Memory.dll cp ${SCRIPT_DIR}/../../bin/MessagePack/${BUILDCONFIGURATION}/netstandard2.0/publish/System.Runtime.CompilerServices.Unsafe.dll ${SCRIPT_DIR}/Assets/Plugins/System.Runtime.CompilerServices.Unsafe.dll +cp ${SCRIPT_DIR}/../../bin/MessagePack/${BUILDCONFIGURATION}/netstandard2.0/publish/Microsoft.NET.StringTools.dll ${SCRIPT_DIR}/Assets/Plugins/Microsoft.NET.StringTools.dll cp ${SCRIPT_DIR}/../../bin/MessagePack/${BUILDCONFIGURATION}/netstandard2.0/publish/System.Threading.Tasks.Extensions.dll ${SCRIPT_DIR}/Assets/Plugins/System.Threading.Tasks.Extensions.dll diff --git a/src/MessagePack/MessagePack.csproj b/src/MessagePack/MessagePack.csproj index 7a2df01dd..d8ab9f42c 100644 --- a/src/MessagePack/MessagePack.csproj +++ b/src/MessagePack/MessagePack.csproj @@ -34,6 +34,7 @@ + @@ -41,8 +42,6 @@ - - From f5edd630a3139a4b45aeac25386800c37019cb42 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 13 Jul 2021 17:05:02 -0600 Subject: [PATCH 086/161] String interning on by default Also revert the Options changes. If the app needs to customize string interning, they can do so by changing the resolver to their own formatter. --- .../DynamicCodeDumper.csproj | 3 - .../Formatters/StringInterningFormatter.cs | 38 ++++++++++- .../MessagePack/InternedStringCollection.cs | 64 ------------------- .../MessagePackSerializerOptions.cs | 27 -------- .../MessagePack/Resolvers/BuiltinResolver.cs | 2 +- .../MessagePack/Resolvers/StandardResolver.cs | 1 - .../Resolvers/StringInterningResolver.cs | 35 ---------- .../InternedStringCollectionTests.cs | 37 ----------- .../MessagePackSerializerOptionsTests.cs | 14 +--- .../StringInterningResolverTests.cs | 22 +++---- .../net5.0/PublicAPI.Unshipped.txt | 12 +--- .../netcoreapp2.1/PublicAPI.Unshipped.txt | 12 +--- .../netcoreapp3.1/PublicAPI.Unshipped.txt | 12 +--- .../netstandard2.0/PublicAPI.Unshipped.txt | 12 +--- 14 files changed, 56 insertions(+), 235 deletions(-) delete mode 100644 src/MessagePack.UnityClient/Assets/Scripts/MessagePack/InternedStringCollection.cs delete mode 100644 src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/StringInterningResolver.cs delete mode 100644 src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/InternedStringCollectionTests.cs diff --git a/sandbox/DynamicCodeDumper/DynamicCodeDumper.csproj b/sandbox/DynamicCodeDumper/DynamicCodeDumper.csproj index 3bca0b875..7c86c1eb6 100644 --- a/sandbox/DynamicCodeDumper/DynamicCodeDumper.csproj +++ b/sandbox/DynamicCodeDumper/DynamicCodeDumper.csproj @@ -72,9 +72,6 @@ Code\MessagePackSerializerOptions.cs - - Code\InternedStringCollection.cs - Code\MessagePackSecurity.cs diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/StringInterningFormatter.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/StringInterningFormatter.cs index 984b96736..8af3de36e 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/StringInterningFormatter.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/StringInterningFormatter.cs @@ -1,6 +1,9 @@ // Copyright (c) All contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. +using System; +using Microsoft.NET.StringTools; + namespace MessagePack.Formatters { /// @@ -8,6 +11,12 @@ namespace MessagePack.Formatters /// public sealed class StringInterningFormatter : IMessagePackFormatter { + public static readonly StringInterningFormatter Instance = new StringInterningFormatter(); + + private StringInterningFormatter() + { + } + /// public string Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) { @@ -16,12 +25,35 @@ public string Deserialize(ref MessagePackReader reader, MessagePackSerializerOpt return null; } - if (options.StringInterning is null) + MessagePackReader retryReader = reader; + if (reader.TryReadStringSpan(out ReadOnlySpan bytes)) { - return reader.ReadString(); + if (bytes.Length < 4096) + { + Span chars = stackalloc char[bytes.Length]; + int charLength; +#if SPAN_BUILTIN + charLength = StringEncoding.UTF8.GetChars(bytes, chars); +#else + unsafe + { + fixed (byte* pBytes = bytes) + fixed (char* pChars = chars) + { + charLength = StringEncoding.UTF8.GetChars(pBytes, bytes.Length, pChars, chars.Length); + } + } +#endif + return Strings.WeakIntern(chars.Slice(0, charLength)); + } + else + { + // Rewind the reader to the start of the string because we're taking the slow path. + reader = retryReader; + } } - return options.StringInterning.GetString(ref reader); + return Strings.WeakIntern(reader.ReadString()); } /// diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/InternedStringCollection.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/InternedStringCollection.cs deleted file mode 100644 index 55a0a49d8..000000000 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/InternedStringCollection.cs +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) All contributors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -using System; -using Microsoft.NET.StringTools; - -namespace MessagePack -{ - /// - /// Reuses previously created objects wherever possible - /// to reduce memory allocations while deserializing msgpack sequences. - /// - /// - /// This class is thread-safe. - /// Derived types are also expected to be thread-safe. - /// - public class InternedStringCollection - { - /// - /// Reads a string from a given . - /// - /// The reader to read the string from. This string is never expected to be since the caller can trivially filter that case out. - /// A string that matches the value at the caller's position on the reader. - /// - /// The default implementation simply interns all strings using . - /// This method may be overridden to: - /// 1) be more selective about which strings should be interned, - /// 2) change where interned strings are stored, - /// 3) avoid the initial string allocation and go straight to the interned string. - /// - public virtual string GetString(ref MessagePackReader reader) - { - MessagePackReader retryReader = reader; - if (reader.TryReadStringSpan(out ReadOnlySpan bytes)) - { - if (bytes.Length < 4096) - { - Span chars = stackalloc char[bytes.Length]; - int charLength; -#if SPAN_BUILTIN - charLength = StringEncoding.UTF8.GetChars(bytes, chars); -#else - unsafe - { - fixed (byte* pBytes = bytes) - fixed (char* pChars = chars) - { - charLength = StringEncoding.UTF8.GetChars(pBytes, bytes.Length, pChars, chars.Length); - } - } -#endif - return Strings.WeakIntern(chars.Slice(0, charLength)); - } - else - { - // Rewind the reader to the start of the string because we're taking the slow path. - reader = retryReader; - } - } - - return Strings.WeakIntern(reader.ReadString()); - } - } -} diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs index ed510ff61..ebf1ca43b 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs @@ -62,7 +62,6 @@ protected MessagePackSerializerOptions(MessagePackSerializerOptions copyFrom) this.AllowAssemblyVersionMismatch = copyFrom.AllowAssemblyVersionMismatch; this.Security = copyFrom.Security; this.SequencePool = copyFrom.SequencePool; - this.StringInterning = copyFrom.StringInterning; } /// @@ -122,15 +121,6 @@ protected MessagePackSerializerOptions(MessagePackSerializerOptions copyFrom) /// The default value is the instance. public SequencePool SequencePool { get; private set; } = SequencePool.Shared; - /// - /// Gets an optional collection used for string interning on deserialization. - /// - /// The default value is . - /// - /// When , string interning is disabled. - /// - public InternedStringCollection StringInterning { get; private set; } - /// /// Gets a type given a string representation of the type. /// @@ -299,23 +289,6 @@ public MessagePackSerializerOptions WithPool(SequencePool pool) return result; } - /// - /// Gets a copy of these options with the property set to a new value. - /// - /// The new value for the property. - /// The new instance. - public MessagePackSerializerOptions WithStringInterning(InternedStringCollection value) - { - if (this.StringInterning == value) - { - return this; - } - - var result = this.Clone(); - result.StringInterning = value; - return result; - } - /// /// Creates a clone of this instance with the same properties set. /// diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/BuiltinResolver.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/BuiltinResolver.cs index 000b9fbdb..a613126b3 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/BuiltinResolver.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/BuiltinResolver.cs @@ -82,7 +82,7 @@ internal static class BuiltinResolverGetFormatterHelper { typeof(char?), NullableCharFormatter.Instance }, // StandardClassLibraryFormatter - { typeof(string), NullableStringFormatter.Instance }, + { typeof(string), StringInterningFormatter.Instance }, { typeof(decimal), DecimalFormatter.Instance }, { typeof(decimal?), new StaticNullableFormatter(DecimalFormatter.Instance) }, { typeof(TimeSpan), TimeSpanFormatter.Instance }, diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/StandardResolver.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/StandardResolver.cs index 38d8924cd..009e050e6 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/StandardResolver.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/StandardResolver.cs @@ -283,7 +283,6 @@ internal static class StandardResolverHelper public static readonly IFormatterResolver[] DefaultResolvers = new IFormatterResolver[] { BuiltinResolver.Instance, // Try Builtin - StringInterningResolver.Instance, // intern strings if enabled. AttributeFormatterResolver.Instance, // Try use [MessagePackFormatter] #if UNITY_2018_3_OR_NEWER diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/StringInterningResolver.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/StringInterningResolver.cs deleted file mode 100644 index bbe836f2b..000000000 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/StringInterningResolver.cs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) All contributors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -using MessagePack.Formatters; - -namespace MessagePack.Resolvers -{ - /// - /// Directs strings to be deserialized with the . - /// - public sealed class StringInterningResolver : IFormatterResolver - { - /// - /// The singleton instance that can be used. - /// - public static readonly StringInterningResolver Instance = new StringInterningResolver(); - - private readonly StringInterningFormatter formatter = new StringInterningFormatter(); - - private StringInterningResolver() - { - } - - /// - public IMessagePackFormatter GetFormatter() - { - if (typeof(T) == typeof(string)) - { - return (IMessagePackFormatter)(object)this.formatter; - } - - return null; - } - } -} diff --git a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/InternedStringCollectionTests.cs b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/InternedStringCollectionTests.cs deleted file mode 100644 index 8c840d6e0..000000000 --- a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/InternedStringCollectionTests.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) All contributors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -using Nerdbank.Streams; -using Xunit; - -namespace MessagePack.Tests -{ - public class InternedStringCollectionTests - { - [Theory] - [InlineData(3)] - [InlineData(1024 * 1024)] - public void EquivalentStringsGetSharedInstance(int length) - { - string originalValue1 = new string('a', length); - string originalValue3 = new string('b', length); - var seq = new Sequence(); - var writer = new MessagePackWriter(seq); - writer.Write(originalValue1); - writer.Write(originalValue1); - writer.Write(originalValue3); - writer.Flush(); - - var reader = new MessagePackReader(seq); - var collection = new InternedStringCollection(); - string value1 = collection.GetString(ref reader); - string value2 = collection.GetString(ref reader); - string value3 = collection.GetString(ref reader); - - Assert.Equal(originalValue1, value1); - Assert.Equal(originalValue3, value3); - - Assert.Same(value1, value2); - } - } -} diff --git a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/MessagePackSerializerOptionsTests.cs b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/MessagePackSerializerOptionsTests.cs index cee1cfb1b..96bec149a 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/MessagePackSerializerOptionsTests.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/MessagePackSerializerOptionsTests.cs @@ -13,19 +13,7 @@ public class MessagePackSerializerOptionsTests .WithOmitAssemblyVersion(true) .WithResolver(BuiltinResolver.Instance) .WithOldSpec(false) - .WithSecurity(MySecurityOptions.Instance) - .WithStringInterning(new InternedStringCollection()); - - [Fact] - public void StringInterning() - { - Assert.Null(MessagePackSerializerOptions.Standard.StringInterning); - var collection = new InternedStringCollection(); - Assert.Same(collection, MessagePackSerializerOptions.Standard.WithStringInterning(collection).StringInterning); - - Assert.Same(NonDefaultOptions, NonDefaultOptions.WithStringInterning(NonDefaultOptions.StringInterning)); - Assert.Null(NonDefaultOptions.WithStringInterning(null).StringInterning); - } + .WithSecurity(MySecurityOptions.Instance); [Fact] public void AllowAssemblyVersionMismatch() diff --git a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/StringInterningResolverTests.cs b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/StringInterningResolverTests.cs index b429d5640..e2b51250f 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/StringInterningResolverTests.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/StringInterningResolverTests.cs @@ -18,16 +18,17 @@ public void NullString() writer.Flush(); var reader = new MessagePackReader(seq); - var options = MessagePackSerializerOptions.Standard.WithStringInterning(new InternedStringCollection()); - string result = StringInterningResolver.Instance.GetFormatter().Deserialize(ref reader, options); + string result = StandardResolver.Instance.GetFormatter().Deserialize(ref reader, MessagePackSerializerOptions.Standard); Assert.Null(result); } - [Fact] - public void EquivalentStringsGetSharedInstance() + [Theory] + [InlineData(3)] + [InlineData(1024 * 1024)] + public void EquivalentStringsGetSharedInstance(int length) { - string originalValue1 = new string('a', 5); - string originalValue3 = new string('b', 5); + string originalValue1 = new string('a', length); + string originalValue3 = new string('b', length); var seq = new Sequence(); var writer = new MessagePackWriter(seq); writer.Write(originalValue1); @@ -36,11 +37,10 @@ public void EquivalentStringsGetSharedInstance() writer.Flush(); var reader = new MessagePackReader(seq); - var options = MessagePackSerializerOptions.Standard.WithStringInterning(new InternedStringCollection()); - var formatter = StringInterningResolver.Instance.GetFormatter(); - string value1 = formatter.Deserialize(ref reader, options); - string value2 = formatter.Deserialize(ref reader, options); - string value3 = formatter.Deserialize(ref reader, options); + var formatter = StandardResolver.Instance.GetFormatter(); + string value1 = formatter.Deserialize(ref reader, MessagePackSerializerOptions.Standard); + string value2 = formatter.Deserialize(ref reader, MessagePackSerializerOptions.Standard); + string value3 = formatter.Deserialize(ref reader, MessagePackSerializerOptions.Standard); Assert.Equal(originalValue1, value1); Assert.Equal(originalValue3, value3); diff --git a/src/MessagePack/net5.0/PublicAPI.Unshipped.txt b/src/MessagePack/net5.0/PublicAPI.Unshipped.txt index d2851af1d..e314ad873 100644 --- a/src/MessagePack/net5.0/PublicAPI.Unshipped.txt +++ b/src/MessagePack/net5.0/PublicAPI.Unshipped.txt @@ -9,20 +9,13 @@ MessagePack.Formatters.InterfaceReadOnlySetFormatter.InterfaceReadOnlySetForm MessagePack.Formatters.StringInterningFormatter MessagePack.Formatters.StringInterningFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> string MessagePack.Formatters.StringInterningFormatter.Serialize(ref MessagePack.MessagePackWriter writer, string value, MessagePack.MessagePackSerializerOptions options) -> void -MessagePack.Formatters.StringInterningFormatter.StringInterningFormatter() -> void -MessagePack.InternedStringCollection -MessagePack.InternedStringCollection.InternedStringCollection() -> void MessagePack.MessagePackReader.MessagePackReader() -> void MessagePack.MessagePackSerializerOptions.SequencePool.get -> MessagePack.SequencePool -MessagePack.MessagePackSerializerOptions.StringInterning.get -> MessagePack.InternedStringCollection MessagePack.MessagePackSerializerOptions.WithPool(MessagePack.SequencePool pool) -> MessagePack.MessagePackSerializerOptions -MessagePack.MessagePackSerializerOptions.WithStringInterning(MessagePack.InternedStringCollection value) -> MessagePack.MessagePackSerializerOptions MessagePack.MessagePackStreamReader.MessagePackStreamReader(System.IO.Stream stream, bool leaveOpen, MessagePack.SequencePool sequencePool) -> void MessagePack.MessagePackStreamReader.ReadArrayHeaderAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask MessagePack.MessagePackStreamReader.ReadMapHeaderAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask MessagePack.MessagePackWriter.MessagePackWriter() -> void -MessagePack.Resolvers.StringInterningResolver -MessagePack.Resolvers.StringInterningResolver.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter MessagePack.SequencePool MessagePack.SequencePool.SequencePool() -> void MessagePack.SequencePool.SequencePool(int maxSize) -> void @@ -31,10 +24,9 @@ MessagePack.TinyJsonException.TinyJsonException(System.Runtime.Serialization.Ser static MessagePack.Nil.operator !=(MessagePack.Nil left, MessagePack.Nil right) -> bool static MessagePack.Nil.operator ==(MessagePack.Nil left, MessagePack.Nil right) -> bool static readonly MessagePack.Formatters.HalfFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter -static readonly MessagePack.Resolvers.StringInterningResolver.Instance -> MessagePack.Resolvers.StringInterningResolver -virtual MessagePack.InternedStringCollection.GetString(ref MessagePack.MessagePackReader reader) -> string +static readonly MessagePack.Formatters.StringInterningFormatter.Instance -> MessagePack.Formatters.StringInterningFormatter virtual MessagePack.MessagePackStreamReader.Dispose(bool disposing) -> void MessagePack.Formatters.GenericEnumerableFormatter MessagePack.Formatters.GenericEnumerableFormatter.GenericEnumerableFormatter() -> void MessagePack.Formatters.GenericReadOnlyDictionaryFormatter -MessagePack.Formatters.GenericReadOnlyDictionaryFormatter.GenericReadOnlyDictionaryFormatter() -> void \ No newline at end of file +MessagePack.Formatters.GenericReadOnlyDictionaryFormatter.GenericReadOnlyDictionaryFormatter() -> void diff --git a/src/MessagePack/netcoreapp2.1/PublicAPI.Unshipped.txt b/src/MessagePack/netcoreapp2.1/PublicAPI.Unshipped.txt index a6bc9cd99..8f0dff9e8 100644 --- a/src/MessagePack/netcoreapp2.1/PublicAPI.Unshipped.txt +++ b/src/MessagePack/netcoreapp2.1/PublicAPI.Unshipped.txt @@ -4,18 +4,11 @@ MessagePack.FormatterNotRegisteredException.FormatterNotRegisteredException(Syst MessagePack.Formatters.StringInterningFormatter MessagePack.Formatters.StringInterningFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> string MessagePack.Formatters.StringInterningFormatter.Serialize(ref MessagePack.MessagePackWriter writer, string value, MessagePack.MessagePackSerializerOptions options) -> void -MessagePack.Formatters.StringInterningFormatter.StringInterningFormatter() -> void -MessagePack.InternedStringCollection -MessagePack.InternedStringCollection.InternedStringCollection() -> void MessagePack.MessagePackReader.MessagePackReader() -> void MessagePack.MessagePackSerializerOptions.SequencePool.get -> MessagePack.SequencePool -MessagePack.MessagePackSerializerOptions.StringInterning.get -> MessagePack.InternedStringCollection MessagePack.MessagePackSerializerOptions.WithPool(MessagePack.SequencePool pool) -> MessagePack.MessagePackSerializerOptions -MessagePack.MessagePackSerializerOptions.WithStringInterning(MessagePack.InternedStringCollection value) -> MessagePack.MessagePackSerializerOptions MessagePack.MessagePackStreamReader.MessagePackStreamReader(System.IO.Stream stream, bool leaveOpen, MessagePack.SequencePool sequencePool) -> void MessagePack.MessagePackWriter.MessagePackWriter() -> void -MessagePack.Resolvers.StringInterningResolver -MessagePack.Resolvers.StringInterningResolver.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter MessagePack.SequencePool MessagePack.SequencePool.SequencePool() -> void MessagePack.SequencePool.SequencePool(int maxSize) -> void @@ -23,10 +16,9 @@ MessagePack.SequencePool.SequencePool(int maxSize, System.Buffers.ArrayPool void static MessagePack.Nil.operator !=(MessagePack.Nil left, MessagePack.Nil right) -> bool static MessagePack.Nil.operator ==(MessagePack.Nil left, MessagePack.Nil right) -> bool -static readonly MessagePack.Resolvers.StringInterningResolver.Instance -> MessagePack.Resolvers.StringInterningResolver -virtual MessagePack.InternedStringCollection.GetString(ref MessagePack.MessagePackReader reader) -> string +static readonly MessagePack.Formatters.StringInterningFormatter.Instance -> MessagePack.Formatters.StringInterningFormatter virtual MessagePack.MessagePackStreamReader.Dispose(bool disposing) -> void MessagePack.Formatters.GenericEnumerableFormatter MessagePack.Formatters.GenericEnumerableFormatter.GenericEnumerableFormatter() -> void MessagePack.Formatters.GenericReadOnlyDictionaryFormatter -MessagePack.Formatters.GenericReadOnlyDictionaryFormatter.GenericReadOnlyDictionaryFormatter() -> void \ No newline at end of file +MessagePack.Formatters.GenericReadOnlyDictionaryFormatter.GenericReadOnlyDictionaryFormatter() -> void diff --git a/src/MessagePack/netcoreapp3.1/PublicAPI.Unshipped.txt b/src/MessagePack/netcoreapp3.1/PublicAPI.Unshipped.txt index c311155be..85cc22a91 100644 --- a/src/MessagePack/netcoreapp3.1/PublicAPI.Unshipped.txt +++ b/src/MessagePack/netcoreapp3.1/PublicAPI.Unshipped.txt @@ -4,20 +4,13 @@ MessagePack.FormatterNotRegisteredException.FormatterNotRegisteredException(Syst MessagePack.Formatters.StringInterningFormatter MessagePack.Formatters.StringInterningFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> string MessagePack.Formatters.StringInterningFormatter.Serialize(ref MessagePack.MessagePackWriter writer, string value, MessagePack.MessagePackSerializerOptions options) -> void -MessagePack.Formatters.StringInterningFormatter.StringInterningFormatter() -> void -MessagePack.InternedStringCollection -MessagePack.InternedStringCollection.InternedStringCollection() -> void MessagePack.MessagePackReader.MessagePackReader() -> void MessagePack.MessagePackSerializerOptions.SequencePool.get -> MessagePack.SequencePool -MessagePack.MessagePackSerializerOptions.StringInterning.get -> MessagePack.InternedStringCollection MessagePack.MessagePackSerializerOptions.WithPool(MessagePack.SequencePool pool) -> MessagePack.MessagePackSerializerOptions -MessagePack.MessagePackSerializerOptions.WithStringInterning(MessagePack.InternedStringCollection value) -> MessagePack.MessagePackSerializerOptions MessagePack.MessagePackStreamReader.MessagePackStreamReader(System.IO.Stream stream, bool leaveOpen, MessagePack.SequencePool sequencePool) -> void MessagePack.MessagePackStreamReader.ReadArrayHeaderAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask MessagePack.MessagePackStreamReader.ReadMapHeaderAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask MessagePack.MessagePackWriter.MessagePackWriter() -> void -MessagePack.Resolvers.StringInterningResolver -MessagePack.Resolvers.StringInterningResolver.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter MessagePack.SequencePool MessagePack.SequencePool.SequencePool() -> void MessagePack.SequencePool.SequencePool(int maxSize) -> void @@ -25,10 +18,9 @@ MessagePack.SequencePool.SequencePool(int maxSize, System.Buffers.ArrayPool void static MessagePack.Nil.operator !=(MessagePack.Nil left, MessagePack.Nil right) -> bool static MessagePack.Nil.operator ==(MessagePack.Nil left, MessagePack.Nil right) -> bool -static readonly MessagePack.Resolvers.StringInterningResolver.Instance -> MessagePack.Resolvers.StringInterningResolver -virtual MessagePack.InternedStringCollection.GetString(ref MessagePack.MessagePackReader reader) -> string +static readonly MessagePack.Formatters.StringInterningFormatter.Instance -> MessagePack.Formatters.StringInterningFormatter virtual MessagePack.MessagePackStreamReader.Dispose(bool disposing) -> void MessagePack.Formatters.GenericEnumerableFormatter MessagePack.Formatters.GenericEnumerableFormatter.GenericEnumerableFormatter() -> void MessagePack.Formatters.GenericReadOnlyDictionaryFormatter -MessagePack.Formatters.GenericReadOnlyDictionaryFormatter.GenericReadOnlyDictionaryFormatter() -> void \ No newline at end of file +MessagePack.Formatters.GenericReadOnlyDictionaryFormatter.GenericReadOnlyDictionaryFormatter() -> void diff --git a/src/MessagePack/netstandard2.0/PublicAPI.Unshipped.txt b/src/MessagePack/netstandard2.0/PublicAPI.Unshipped.txt index c311155be..85cc22a91 100644 --- a/src/MessagePack/netstandard2.0/PublicAPI.Unshipped.txt +++ b/src/MessagePack/netstandard2.0/PublicAPI.Unshipped.txt @@ -4,20 +4,13 @@ MessagePack.FormatterNotRegisteredException.FormatterNotRegisteredException(Syst MessagePack.Formatters.StringInterningFormatter MessagePack.Formatters.StringInterningFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> string MessagePack.Formatters.StringInterningFormatter.Serialize(ref MessagePack.MessagePackWriter writer, string value, MessagePack.MessagePackSerializerOptions options) -> void -MessagePack.Formatters.StringInterningFormatter.StringInterningFormatter() -> void -MessagePack.InternedStringCollection -MessagePack.InternedStringCollection.InternedStringCollection() -> void MessagePack.MessagePackReader.MessagePackReader() -> void MessagePack.MessagePackSerializerOptions.SequencePool.get -> MessagePack.SequencePool -MessagePack.MessagePackSerializerOptions.StringInterning.get -> MessagePack.InternedStringCollection MessagePack.MessagePackSerializerOptions.WithPool(MessagePack.SequencePool pool) -> MessagePack.MessagePackSerializerOptions -MessagePack.MessagePackSerializerOptions.WithStringInterning(MessagePack.InternedStringCollection value) -> MessagePack.MessagePackSerializerOptions MessagePack.MessagePackStreamReader.MessagePackStreamReader(System.IO.Stream stream, bool leaveOpen, MessagePack.SequencePool sequencePool) -> void MessagePack.MessagePackStreamReader.ReadArrayHeaderAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask MessagePack.MessagePackStreamReader.ReadMapHeaderAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask MessagePack.MessagePackWriter.MessagePackWriter() -> void -MessagePack.Resolvers.StringInterningResolver -MessagePack.Resolvers.StringInterningResolver.GetFormatter() -> MessagePack.Formatters.IMessagePackFormatter MessagePack.SequencePool MessagePack.SequencePool.SequencePool() -> void MessagePack.SequencePool.SequencePool(int maxSize) -> void @@ -25,10 +18,9 @@ MessagePack.SequencePool.SequencePool(int maxSize, System.Buffers.ArrayPool void static MessagePack.Nil.operator !=(MessagePack.Nil left, MessagePack.Nil right) -> bool static MessagePack.Nil.operator ==(MessagePack.Nil left, MessagePack.Nil right) -> bool -static readonly MessagePack.Resolvers.StringInterningResolver.Instance -> MessagePack.Resolvers.StringInterningResolver -virtual MessagePack.InternedStringCollection.GetString(ref MessagePack.MessagePackReader reader) -> string +static readonly MessagePack.Formatters.StringInterningFormatter.Instance -> MessagePack.Formatters.StringInterningFormatter virtual MessagePack.MessagePackStreamReader.Dispose(bool disposing) -> void MessagePack.Formatters.GenericEnumerableFormatter MessagePack.Formatters.GenericEnumerableFormatter.GenericEnumerableFormatter() -> void MessagePack.Formatters.GenericReadOnlyDictionaryFormatter -MessagePack.Formatters.GenericReadOnlyDictionaryFormatter.GenericReadOnlyDictionaryFormatter() -> void \ No newline at end of file +MessagePack.Formatters.GenericReadOnlyDictionaryFormatter.GenericReadOnlyDictionaryFormatter() -> void From 8a6a48f1eb10b9c36db24f1289fd319ba6f03045 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 14 Jul 2021 07:29:34 -0600 Subject: [PATCH 087/161] Add C# 9 records test with `StandardResolverAllowPrivate` This repros the failure reported in #1232. --- .../DynamicObjectResolverRecordsTests.cs | 28 +++++++++++++++++-- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/tests/MessagePack.Tests/DynamicObjectResolverRecordsTests.cs b/tests/MessagePack.Tests/DynamicObjectResolverRecordsTests.cs index 340ef63e8..483fe4ce7 100644 --- a/tests/MessagePack.Tests/DynamicObjectResolverRecordsTests.cs +++ b/tests/MessagePack.Tests/DynamicObjectResolverRecordsTests.cs @@ -1,6 +1,7 @@ // Copyright (c) All contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. +using MessagePack.Resolvers; using Xunit; #if NET5_0_OR_GREATER @@ -39,10 +40,20 @@ public void RoundtripPositionalDerivedRecord() this.AssertRoundTrip(new StudentPositional("bob", "smith", 5)); } - protected T AssertRoundTrip(T value) + [Fact] + public void RoundtripRecordWithPrivateProperties() + { + var original = new RecordWithPrivateProperties("PublicValue"); + original.SetPrivateProperty("PrivateValue"); + var deserializedValue = this.AssertRoundTrip(original, allowPrivate: true); + Assert.Equal(original.GetPrivateProperty(), deserializedValue.GetPrivateProperty()); + } + + protected T AssertRoundTrip(T value, bool allowPrivate = false) { - byte[] msgpack = MessagePackSerializer.Serialize(value, MessagePackSerializerOptions.Standard, this.TimeoutToken); - T deserializedValue = MessagePackSerializer.Deserialize(msgpack, MessagePackSerializerOptions.Standard, this.TimeoutToken); + var options = allowPrivate ? StandardResolverAllowPrivate.Options : MessagePackSerializerOptions.Standard; + byte[] msgpack = MessagePackSerializer.Serialize(value, options, this.TimeoutToken); + T deserializedValue = MessagePackSerializer.Deserialize(msgpack, options, this.TimeoutToken); Assert.Equal(value, deserializedValue); return deserializedValue; } @@ -73,6 +84,17 @@ public record Student : Person [Key(2)] public int Grade { get; init; } } + + [MessagePackObject] + public record RecordWithPrivateProperties([property: Key(0)] string SomePublicProperty) + { + [Key(1)] + private string SomePrivateProperty { get; set; } + + public string GetPrivateProperty() => this.SomePrivateProperty; + + public void SetPrivateProperty(string value) => this.SomePrivateProperty = value; + } } } From a266ea2cf673886d014dc3fd0d1e6eb13deb9b89 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 14 Jul 2021 07:35:54 -0600 Subject: [PATCH 088/161] Fix interning of empty strings This caused a test failure on `net472`. --- .../Formatters/StringInterningFormatter.cs | 5 +++++ .../ShareTests/StringInterningResolverTests.cs | 13 +++++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/StringInterningFormatter.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/StringInterningFormatter.cs index 8af3de36e..17a0ab299 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/StringInterningFormatter.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/StringInterningFormatter.cs @@ -30,6 +30,11 @@ public string Deserialize(ref MessagePackReader reader, MessagePackSerializerOpt { if (bytes.Length < 4096) { + if (bytes.Length == 0) + { + return string.Empty; + } + Span chars = stackalloc char[bytes.Length]; int charLength; #if SPAN_BUILTIN diff --git a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/StringInterningResolverTests.cs b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/StringInterningResolverTests.cs index e2b51250f..b7d93bf8b 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/StringInterningResolverTests.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/StringInterningResolverTests.cs @@ -22,6 +22,19 @@ public void NullString() Assert.Null(result); } + [Fact] + public void EmptyString() + { + var seq = new Sequence(); + var writer = new MessagePackWriter(seq); + writer.Write(string.Empty); + writer.Flush(); + + var reader = new MessagePackReader(seq); + string result = StandardResolver.Instance.GetFormatter().Deserialize(ref reader, MessagePackSerializerOptions.Standard); + Assert.Same(string.Empty, result); + } + [Theory] [InlineData(3)] [InlineData(1024 * 1024)] From 634f141e464acfc19b47f16a4ccc41b859eb7b04 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 14 Jul 2021 07:44:52 -0600 Subject: [PATCH 089/161] Skip serializing `EqualityContract` properties of C# records Fixes #1232 --- .../Resolvers/DynamicObjectResolver.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs index c847a3038..c0eee0323 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs @@ -1697,6 +1697,7 @@ public static ObjectSerializationInfo CreateOrNull(Type type, bool forceStringKe { TypeInfo ti = type.GetTypeInfo(); var isClass = ti.IsClass || ti.IsInterface || ti.IsAbstract; + var isClassRecord = isClass && IsClassRecord(ti); var isStruct = ti.IsValueType; MessagePackObjectAttribute contractAttr = ti.GetCustomAttributes().FirstOrDefault(); @@ -1819,6 +1820,13 @@ public static ObjectSerializationInfo CreateOrNull(Type type, bool forceStringKe continue; } + if (isClassRecord && item.Name == "EqualityContract") + { + // This is a special compiler-generated property that the user cannot add + // [IgnoreMember] to, nor do we want to serialize it. + continue; + } + if (item.IsIndexer()) { continue; @@ -2309,6 +2317,14 @@ private static IEnumerable GetAllProperties(Type type) } } + private static bool IsClassRecord(TypeInfo type) + { + // The only truly unique thing about a C# 9 record class is the presence of a $ method, + // which cannot be declared in C# because of the reserved characters in its name. + return type.IsClass + && type.GetMethod("$", BindingFlags.Public | BindingFlags.Instance) is object; + } + private static bool TryGetNextConstructor(IEnumerator ctorEnumerator, ref ConstructorInfo ctor) { if (ctorEnumerator == null || ctor != null) From 4ff278b8b0d16f5a26719e3d8eba371deac96827 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 15 Jul 2021 15:56:57 -0600 Subject: [PATCH 090/161] Update mpc roslyn dependency to 3.10.0 This fixes #1274 by updating to a compiler version that supports C# 9 `record` type declarations. --- sandbox/TestData2/Generated.cs | 59 ++++++++++++++++++- sandbox/TestData2/Record.cs | 10 ++++ sandbox/TestData2/TestData2.csproj | 2 + .../MessagePack.Generator.csproj | 8 +-- .../CodeAnalysis/TypeCollector.cs | 4 +- .../MessagePack.GeneratorCore.csproj | 2 +- .../MessagePack.Generator.Tests.csproj | 1 - 7 files changed, 78 insertions(+), 8 deletions(-) create mode 100644 sandbox/TestData2/Record.cs diff --git a/sandbox/TestData2/Generated.cs b/sandbox/TestData2/Generated.cs index 752733200..606e2dca8 100644 --- a/sandbox/TestData2/Generated.cs +++ b/sandbox/TestData2/Generated.cs @@ -49,7 +49,7 @@ internal static class GeneratedResolverGetFormatterHelper static GeneratedResolverGetFormatterHelper() { - lookup = new global::System.Collections.Generic.Dictionary(13) + lookup = new global::System.Collections.Generic.Dictionary(14) { { typeof(global::System.Collections.Generic.List), 0 }, { typeof(global::System.Collections.Generic.List), 1 }, @@ -64,6 +64,7 @@ static GeneratedResolverGetFormatterHelper() { typeof(global::TestData2.Nest2.IdType), 10 }, { typeof(global::TestData2.PropNameCheck1), 11 }, { typeof(global::TestData2.PropNameCheck2), 12 }, + { typeof(global::TestData2.Record), 13 }, }; } @@ -90,6 +91,7 @@ internal static object GetFormatter(Type t) case 10: return new MessagePack.Formatters.TestData2.Nest2_IdTypeFormatter(); case 11: return new MessagePack.Formatters.TestData2.PropNameCheck1Formatter(); case 12: return new MessagePack.Formatters.TestData2.PropNameCheck2Formatter(); + case 13: return new MessagePack.Formatters.TestData2.RecordFormatter(); default: return null; } } @@ -711,5 +713,60 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: return ____result; } } + + public sealed class RecordFormatter : global::MessagePack.Formatters.IMessagePackFormatter + { + // SomeProperty + private static global::System.ReadOnlySpan GetSpan_SomeProperty() => new byte[1 + 12] { 172, 83, 111, 109, 101, 80, 114, 111, 112, 101, 114, 116, 121 }; + + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::TestData2.Record value, global::MessagePack.MessagePackSerializerOptions options) + { + if (value is null) + { + writer.WriteNil(); + return; + } + + var formatterResolver = options.Resolver; + writer.WriteMapHeader(1); + writer.WriteRaw(GetSpan_SomeProperty()); + formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.SomeProperty, options); + } + + public global::TestData2.Record Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return null; + } + + options.Security.DepthStep(ref reader); + var formatterResolver = options.Resolver; + var length = reader.ReadMapHeader(); + var __SomeProperty__ = default(string); + + for (int i = 0; i < length; i++) + { + var stringKey = global::MessagePack.Internal.CodeGenHelpers.ReadStringSpan(ref reader); + switch (stringKey.Length) + { + default: + FAIL: + reader.Skip(); + continue; + case 12: + if (!global::System.MemoryExtensions.SequenceEqual(stringKey, GetSpan_SomeProperty().Slice(1))) { goto FAIL; } + + __SomeProperty__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + continue; + + } + } + + var ____result = new global::TestData2.Record(__SomeProperty__); + reader.Depth--; + return ____result; + } + } } diff --git a/sandbox/TestData2/Record.cs b/sandbox/TestData2/Record.cs new file mode 100644 index 000000000..b48bf693c --- /dev/null +++ b/sandbox/TestData2/Record.cs @@ -0,0 +1,10 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using MessagePack; + +namespace TestData2 +{ + [MessagePackObject] + public record Record([property: Key("SomeProperty")] string SomeProperty); +} diff --git a/sandbox/TestData2/TestData2.csproj b/sandbox/TestData2/TestData2.csproj index 966e801de..241bef293 100644 --- a/sandbox/TestData2/TestData2.csproj +++ b/sandbox/TestData2/TestData2.csproj @@ -1,9 +1,11 @@  net461 + 9 + diff --git a/src/MessagePack.Generator/MessagePack.Generator.csproj b/src/MessagePack.Generator/MessagePack.Generator.csproj index 253bfd20c..b684a5b89 100644 --- a/src/MessagePack.Generator/MessagePack.Generator.csproj +++ b/src/MessagePack.Generator/MessagePack.Generator.csproj @@ -19,10 +19,10 @@ - - - - + + + + diff --git a/src/MessagePack.GeneratorCore/CodeAnalysis/TypeCollector.cs b/src/MessagePack.GeneratorCore/CodeAnalysis/TypeCollector.cs index 82235e013..d2537dcd9 100644 --- a/src/MessagePack.GeneratorCore/CodeAnalysis/TypeCollector.cs +++ b/src/MessagePack.GeneratorCore/CodeAnalysis/TypeCollector.cs @@ -244,7 +244,9 @@ public class TypeCollector private readonly HashSet externalIgnoreTypeNames; // visitor workspace: - private readonly HashSet alreadyCollected = new(); +#pragma warning disable RS1024 // Compare symbols correctly (https://github.com/dotnet/roslyn-analyzers/issues/5246) + private readonly HashSet alreadyCollected = new(SymbolEqualityComparer.Default); +#pragma warning restore RS1024 // Compare symbols correctly private readonly List collectedObjectInfo = new(); private readonly List collectedEnumInfo = new(); private readonly List collectedGenericInfo = new(); diff --git a/src/MessagePack.GeneratorCore/MessagePack.GeneratorCore.csproj b/src/MessagePack.GeneratorCore/MessagePack.GeneratorCore.csproj index d2d86f281..526615e57 100644 --- a/src/MessagePack.GeneratorCore/MessagePack.GeneratorCore.csproj +++ b/src/MessagePack.GeneratorCore/MessagePack.GeneratorCore.csproj @@ -11,7 +11,7 @@ - + diff --git a/tests/MessagePack.Generator.Tests/MessagePack.Generator.Tests.csproj b/tests/MessagePack.Generator.Tests/MessagePack.Generator.Tests.csproj index 08a0c8028..ac91ade4a 100644 --- a/tests/MessagePack.Generator.Tests/MessagePack.Generator.Tests.csproj +++ b/tests/MessagePack.Generator.Tests/MessagePack.Generator.Tests.csproj @@ -10,7 +10,6 @@ - From 4d61d5d2d82a6fc842a54187a9383d58ac318eea Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 28 Jul 2021 22:05:07 -0600 Subject: [PATCH 091/161] Build stable v2.3 packages --- .../Assets/Scripts/MessagePack/package.json | 2 +- version.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/package.json b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/package.json index aeb8a8b39..677cba61c 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/package.json +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/package.json @@ -1,7 +1,7 @@ { "name": "com.neuecc.messagepack", "displayName": "MessagePack", - "version": "2.3.58-alpha", + "version": "2.3.74", "unity": "2018.4", "description": "Extremely Fast MessagePack Serializer for C#.", "keywords": [ diff --git a/version.json b/version.json index 6b4d79f3c..5d063bf1b 100644 --- a/version.json +++ b/version.json @@ -1,6 +1,6 @@ { "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", - "version": "2.3-alpha", + "version": "2.3", "publicReleaseRefSpec": [ "^refs/heads/master$", "^refs/heads/v1\\.x$", From 013e3c32a6c5c89e384e36e4a2100e61e72d31d4 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 28 Jul 2021 22:07:30 -0600 Subject: [PATCH 092/161] Start building 2.4-alpha --- .../Assets/Scripts/MessagePack/package.json | 2 +- version.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/package.json b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/package.json index 677cba61c..5e7b60bde 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/package.json +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/package.json @@ -1,7 +1,7 @@ { "name": "com.neuecc.messagepack", "displayName": "MessagePack", - "version": "2.3.74", + "version": "2.4.1-alpha", "unity": "2018.4", "description": "Extremely Fast MessagePack Serializer for C#.", "keywords": [ diff --git a/version.json b/version.json index 5d063bf1b..6fc917f32 100644 --- a/version.json +++ b/version.json @@ -1,6 +1,6 @@ { "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", - "version": "2.3", + "version": "2.4-alpha", "publicReleaseRefSpec": [ "^refs/heads/master$", "^refs/heads/v1\\.x$", From cfdaeac7cb61e6f26da2a24c6a2163fc41c19bf4 Mon Sep 17 00:00:00 2001 From: Mayuki Sawatari Date: Tue, 3 Aug 2021 19:05:36 +0900 Subject: [PATCH 093/161] Add unit tests to run the generated code --- .../AssemblyExtensions.cs | 16 + .../GenerateKeyedFormatterTest.cs | 164 ++++ .../GenerateStringKeyedFormatterTest.cs | 867 ++++++++++++++++++ .../MessagePack.Generator.Tests.csproj | 2 + .../TemporaryProjectWorkarea.cs | 40 +- 5 files changed, 1086 insertions(+), 3 deletions(-) create mode 100644 tests/MessagePack.Generator.Tests/AssemblyExtensions.cs create mode 100644 tests/MessagePack.Generator.Tests/GenerateKeyedFormatterTest.cs create mode 100644 tests/MessagePack.Generator.Tests/GenerateStringKeyedFormatterTest.cs diff --git a/tests/MessagePack.Generator.Tests/AssemblyExtensions.cs b/tests/MessagePack.Generator.Tests/AssemblyExtensions.cs new file mode 100644 index 000000000..dde50fc0c --- /dev/null +++ b/tests/MessagePack.Generator.Tests/AssemblyExtensions.cs @@ -0,0 +1,16 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System.Reflection; + +namespace MessagePack.Generator.Tests +{ + internal static class AssemblyExtensions + { + public static IFormatterResolver GetResolverInstance(this Assembly assembly, string name) + { + var resolverType = assembly.GetType(name); + return (IFormatterResolver) resolverType.GetField("Instance", BindingFlags.Static | BindingFlags.Public).GetValue(null); + } + } +} diff --git a/tests/MessagePack.Generator.Tests/GenerateKeyedFormatterTest.cs b/tests/MessagePack.Generator.Tests/GenerateKeyedFormatterTest.cs new file mode 100644 index 000000000..f81ef6802 --- /dev/null +++ b/tests/MessagePack.Generator.Tests/GenerateKeyedFormatterTest.cs @@ -0,0 +1,164 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Buffers; +using System.Threading; +using System.Threading.Tasks; +using FluentAssertions; +using MessagePack.Resolvers; +using Microsoft.CodeAnalysis; +using Nerdbank.Streams; +using Xunit; +using Xunit.Abstractions; + +namespace MessagePack.Generator.Tests +{ + public class GenerateKeyedFormatterTest + { + private readonly ITestOutputHelper testOutputHelper; + + public GenerateKeyedFormatterTest(ITestOutputHelper testOutputHelper) + { + this.testOutputHelper = testOutputHelper; + } + + [Fact] + public async Task PropertiesGetterSetter() + { + using var tempWorkarea = TemporaryProjectWorkarea.Create(); + var contents = @" +using System; +using System.Collections.Generic; +using MessagePack; + +namespace TempProject +{ + [MessagePackObject(false)] + public class MyMessagePackObject + { + [Key(0)] + public int A { get; set; } + [Key(1)] + public string B { get; set; } + } +} + "; + tempWorkarea.AddFileToTargetProject("MyMessagePackObject.cs", contents); + + var compiler = new MessagePackCompiler.CodeGenerator(testOutputHelper.WriteLine, CancellationToken.None); + await compiler.GenerateFileAsync( + tempWorkarea.GetOutputCompilation().Compilation, + tempWorkarea.OutputDirectory, + "TempProjectResolver", + "TempProject.Generated", + false, + string.Empty, + Array.Empty()); + + var compilation = tempWorkarea.GetOutputCompilation(); + compilation.Compilation.GetDiagnostics().Should().NotContain(x => x.Severity == DiagnosticSeverity.Error); + + // Run tests with the generated resolver/formatter assembly. + compilation.ExecuteWithGeneratedAssembly((ctx, assembly) => + { + var mpoType = assembly.GetType("TempProject.MyMessagePackObject"); + var options = MessagePackSerializerOptions.Standard + .WithResolver(CompositeResolver.Create( + StandardResolver.Instance, + assembly.GetResolverInstance("TempProject.Generated.Resolvers.TempProjectResolver"))); + + // Build `[]` + var seq = new Sequence(); + var writer = new MessagePackWriter(seq); + writer.WriteArrayHeader(0); + writer.Flush(); + + dynamic result = MessagePackSerializer.Deserialize(mpoType, seq, options); + + // The deserialized object has default values. + ((int)result.A).Should().Be(0); + ((string)result.B).Should().BeNull(); + + // Verify round trip serialization/deserialization. + result.A = 123; + result.B = "foobar"; + + var serialized = MessagePackSerializer.Serialize(mpoType, (object)result, options); + dynamic result2 = MessagePackSerializer.Deserialize(mpoType, serialized, options); + ((int)result2.A).Should().Be(123); + ((string)result2.B).Should().Be("foobar"); + }); + } + + [Fact] + public async Task PropertiesGetterOnlyWithParameterizedConstructor() + { + using var tempWorkarea = TemporaryProjectWorkarea.Create(); + var contents = @" +using System; +using System.Collections.Generic; +using MessagePack; + +namespace TempProject +{ + [MessagePackObject(false)] + public class MyMessagePackObject + { + [Key(0)] + public int A { get; } + [Key(1)] + public string B { get; } + + public MyMessagePackObject(int a, string b) + { + A = a; + B = b; + } + } +} + "; + tempWorkarea.AddFileToTargetProject("MyMessagePackObject.cs", contents); + + var compiler = new MessagePackCompiler.CodeGenerator(testOutputHelper.WriteLine, CancellationToken.None); + await compiler.GenerateFileAsync( + tempWorkarea.GetOutputCompilation().Compilation, + tempWorkarea.OutputDirectory, + "TempProjectResolver", + "TempProject.Generated", + false, + string.Empty, + Array.Empty()); + + var compilation = tempWorkarea.GetOutputCompilation(); + compilation.Compilation.GetDiagnostics().Should().NotContain(x => x.Severity == DiagnosticSeverity.Error); + + // Run tests with the generated resolver/formatter assembly. + compilation.ExecuteWithGeneratedAssembly((ctx, assembly) => + { + var mpoType = assembly.GetType("TempProject.MyMessagePackObject"); + var options = MessagePackSerializerOptions.Standard + .WithResolver(CompositeResolver.Create( + StandardResolver.Instance, + assembly.GetResolverInstance("TempProject.Generated.Resolvers.TempProjectResolver"))); + + // Build `[-1, "foobar"]` + var seq = new Sequence(); + var writer = new MessagePackWriter(seq); + writer.WriteArrayHeader(2); + writer.Write(-1); + writer.Write("foobar"); + writer.Flush(); + + // Verify deserialization + dynamic result = MessagePackSerializer.Deserialize(mpoType, seq, options); + ((int)result.A).Should().Be(-1); + ((string)result.B).Should().Be("foobar"); + + // Verify serialization + var serialized = MessagePackSerializer.Serialize(mpoType, (object)result, options); + serialized.Should().BeEquivalentTo(seq.AsReadOnlySequence.ToArray()); + }); + } + } +} diff --git a/tests/MessagePack.Generator.Tests/GenerateStringKeyedFormatterTest.cs b/tests/MessagePack.Generator.Tests/GenerateStringKeyedFormatterTest.cs new file mode 100644 index 000000000..cd914fbd6 --- /dev/null +++ b/tests/MessagePack.Generator.Tests/GenerateStringKeyedFormatterTest.cs @@ -0,0 +1,867 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Buffers; +using System.IO; +using System.Linq; +using System.Runtime.Loader; +using System.Threading; +using System.Threading.Tasks; +using FluentAssertions; +using MessagePack.Resolvers; +using Microsoft.CodeAnalysis; +using Nerdbank.Streams; +using Xunit; +using Xunit.Abstractions; + +namespace MessagePack.Generator.Tests +{ + public class GenerateStringKeyedFormatterTest + { + private readonly ITestOutputHelper testOutputHelper; + + public GenerateStringKeyedFormatterTest(ITestOutputHelper testOutputHelper) + { + this.testOutputHelper = testOutputHelper; + } + + [Fact] + public async Task PropertiesGetterSetter() + { + using var tempWorkarea = TemporaryProjectWorkarea.Create(); + var contents = @" +using System; +using System.Collections.Generic; +using MessagePack; + +namespace TempProject +{ + [MessagePackObject(true)] + public class MyMessagePackObject + { + public int A { get; set; } + public string B { get; set; } + } +} + "; + tempWorkarea.AddFileToTargetProject("MyMessagePackObject.cs", contents); + + var compiler = new MessagePackCompiler.CodeGenerator(testOutputHelper.WriteLine, CancellationToken.None); + await compiler.GenerateFileAsync( + tempWorkarea.GetOutputCompilation().Compilation, + tempWorkarea.OutputDirectory, + "TempProjectResolver", + "TempProject.Generated", + false, + string.Empty, + Array.Empty()); + + var compilation = tempWorkarea.GetOutputCompilation(); + compilation.Compilation.GetDiagnostics().Should().NotContain(x => x.Severity == DiagnosticSeverity.Error); + + // Run tests with the generated resolver/formatter assembly. + compilation.ExecuteWithGeneratedAssembly((ctx, assembly) => + { + var mpoType = assembly.GetType("TempProject.MyMessagePackObject"); + var options = MessagePackSerializerOptions.Standard + .WithResolver(CompositeResolver.Create( + StandardResolver.Instance, + assembly.GetResolverInstance("TempProject.Generated.Resolvers.TempProjectResolver"))); + + // Build `{ }`. + var seq = new Sequence(); + var writer = new MessagePackWriter(seq); + writer.WriteMapHeader(0); + writer.Flush(); + + // Verify deserialization + dynamic result = MessagePackSerializer.Deserialize(mpoType, seq, options); + ((int)result.A).Should().Be(0); + ((string)result.B).Should().BeNull(); + + // Verify round trip serialization/deserialization. + result.A = 123; + result.B = "foobar"; + + var serialized = MessagePackSerializer.Serialize(mpoType, (object)result, options); + dynamic result2 = MessagePackSerializer.Deserialize(mpoType, serialized, options); + ((int)result2.A).Should().Be(123); + ((string)result2.B).Should().Be("foobar"); + }); + } + + [Fact] + public async Task PropertiesGetterOnlyMixed() + { + using var tempWorkarea = TemporaryProjectWorkarea.Create(); + var contents = @" +using System; +using System.Collections.Generic; +using MessagePack; + +namespace TempProject +{ + [MessagePackObject(true)] + public class MyMessagePackObject + { + public int A { get; } + public string B { get; set; } + } +} + "; + tempWorkarea.AddFileToTargetProject("MyMessagePackObject.cs", contents); + + var compiler = new MessagePackCompiler.CodeGenerator(testOutputHelper.WriteLine, CancellationToken.None); + await compiler.GenerateFileAsync( + tempWorkarea.GetOutputCompilation().Compilation, + tempWorkarea.OutputDirectory, + "TempProjectResolver", + "TempProject.Generated", + false, + string.Empty, + Array.Empty()); + + var compilation = tempWorkarea.GetOutputCompilation(); + compilation.Compilation.GetDiagnostics().Should().NotContain(x => x.Severity == DiagnosticSeverity.Error); + + // Run tests with the generated resolver/formatter assembly. + compilation.ExecuteWithGeneratedAssembly((ctx, assembly) => + { + var mpoType = assembly.GetType("TempProject.MyMessagePackObject"); + var options = MessagePackSerializerOptions.Standard + .WithResolver(CompositeResolver.Create( + StandardResolver.Instance, + assembly.GetResolverInstance("TempProject.Generated.Resolvers.TempProjectResolver"))); + + // Build `{ "A": -1, "B": "foobar" }`. + var seq = new Sequence(); + var writer = new MessagePackWriter(seq); + writer.WriteMapHeader(2); + writer.Write("A"); + writer.Write(-1); + writer.Write("B"); + writer.Write("foobar"); + writer.Flush(); + + // Verify deserialization + dynamic result = MessagePackSerializer.Deserialize(mpoType, seq, options); + ((int)result.A).Should().Be(0); // default + ((string)result.B).Should().Be("foobar"); // from input + }); + } + + [Fact] + public async Task PropertiesGetterOnlyIgnore() + { + using var tempWorkarea = TemporaryProjectWorkarea.Create(); + var contents = @" +using System; +using System.Collections.Generic; +using MessagePack; + +namespace TempProject +{ + [MessagePackObject(true)] + public class MyMessagePackObject + { + public int A { get; } + public string B { get; } + } +} + "; + tempWorkarea.AddFileToTargetProject("MyMessagePackObject.cs", contents); + + var compiler = new MessagePackCompiler.CodeGenerator(testOutputHelper.WriteLine, CancellationToken.None); + await compiler.GenerateFileAsync( + tempWorkarea.GetOutputCompilation().Compilation, + tempWorkarea.OutputDirectory, + "TempProjectResolver", + "TempProject.Generated", + false, + string.Empty, + Array.Empty()); + + var compilation = tempWorkarea.GetOutputCompilation(); + compilation.Compilation.GetDiagnostics().Should().NotContain(x => x.Severity == DiagnosticSeverity.Error); + + // Run tests with the generated resolver/formatter assembly. + compilation.ExecuteWithGeneratedAssembly((ctx, assembly) => + { + var mpoType = assembly.GetType("TempProject.MyMessagePackObject"); + var options = MessagePackSerializerOptions.Standard + .WithResolver(CompositeResolver.Create( + StandardResolver.Instance, + assembly.GetResolverInstance("TempProject.Generated.Resolvers.TempProjectResolver"))); + + // Build `{ "A": -1, "B": "foobar" }`. + var seq = new Sequence(); + var writer = new MessagePackWriter(seq); + writer.WriteMapHeader(2); + writer.Write("A"); + writer.Write(-1); + writer.Write("B"); + writer.Write("foobar"); + writer.Flush(); + + // Verify deserialization + dynamic result = MessagePackSerializer.Deserialize(mpoType, seq, options); + ((int)result.A).Should().Be(0); + ((string)result.B).Should().BeNull(); + }); + } + + [Fact] + public async Task PropertiesGetterOnlyDefaultValue() + { + using var tempWorkarea = TemporaryProjectWorkarea.Create(); + var contents = @" +using System; +using System.Collections.Generic; +using MessagePack; + +namespace TempProject +{ + [MessagePackObject(true)] + public class MyMessagePackObject + { + public int A { get; } = 123; + public string B { get; } = ""foobar""; + } +} + "; + tempWorkarea.AddFileToTargetProject("MyMessagePackObject.cs", contents); + + var compiler = new MessagePackCompiler.CodeGenerator(testOutputHelper.WriteLine, CancellationToken.None); + await compiler.GenerateFileAsync( + tempWorkarea.GetOutputCompilation().Compilation, + tempWorkarea.OutputDirectory, + "TempProjectResolver", + "TempProject.Generated", + false, + string.Empty, + Array.Empty()); + + var compilation = tempWorkarea.GetOutputCompilation(); + compilation.Compilation.GetDiagnostics().Should().NotContain(x => x.Severity == DiagnosticSeverity.Error); + + // Run tests with the generated resolver/formatter assembly. + compilation.ExecuteWithGeneratedAssembly((ctx, assembly) => + { + var mpoType = assembly.GetType("TempProject.MyMessagePackObject"); + var options = MessagePackSerializerOptions.Standard + .WithResolver(CompositeResolver.Create( + StandardResolver.Instance, + assembly.GetResolverInstance("TempProject.Generated.Resolvers.TempProjectResolver"))); + + // Build `{ }`. + var seq = new Sequence(); + var writer = new MessagePackWriter(seq); + writer.WriteMapHeader(0); + writer.Flush(); + + // Verify deserialization + // The deserialized object has default values. + dynamic result = MessagePackSerializer.Deserialize(mpoType, seq, options); + ((int)result.A).Should().Be(123); + ((string)result.B).Should().Be("foobar"); + }); + } + + [Fact] + public async Task PropertiesGetterSetterWithDefaultValue() + { + using var tempWorkarea = TemporaryProjectWorkarea.Create(); + var contents = @" +using System; +using System.Collections.Generic; +using MessagePack; + +namespace TempProject +{ + [MessagePackObject(true)] + public class MyMessagePackObject + { + public int A { get; set; } = 123; + public string B { get; set; } = ""foobar""; + } +} + "; + tempWorkarea.AddFileToTargetProject("MyMessagePackObject.cs", contents); + + var compiler = new MessagePackCompiler.CodeGenerator(testOutputHelper.WriteLine, CancellationToken.None); + await compiler.GenerateFileAsync( + tempWorkarea.GetOutputCompilation().Compilation, + tempWorkarea.OutputDirectory, + "TempProjectResolver", + "TempProject.Generated", + false, + string.Empty, + Array.Empty()); + + var compilation = tempWorkarea.GetOutputCompilation(); + compilation.Compilation.GetDiagnostics().Should().NotContain(x => x.Severity == DiagnosticSeverity.Error); + + // Run tests with the generated resolver/formatter assembly. + compilation.ExecuteWithGeneratedAssembly((ctx, assembly) => + { + var mpoType = assembly.GetType("TempProject.MyMessagePackObject"); + var options = MessagePackSerializerOptions.Standard + .WithResolver(CompositeResolver.Create( + StandardResolver.Instance, + assembly.GetResolverInstance("TempProject.Generated.Resolvers.TempProjectResolver"))); + + // Build an empty data. + var seq = new Sequence(); + var writer = new MessagePackWriter(seq); + writer.WriteMapHeader(0); + writer.Flush(); + + // Verify deserialization + // The deserialized object has default values. + dynamic result = MessagePackSerializer.Deserialize(mpoType, seq, options); + ((int)result.A).Should().Be(123); + ((string)result.B).Should().Be("foobar"); + + // Verify round trip serialization/deserialization. + result.A = 456; + result.B = "baz"; + + var serialized = MessagePackSerializer.Serialize(mpoType, (object)result, options); + dynamic result2 = MessagePackSerializer.Deserialize(mpoType, serialized, options); + ((int)result2.A).Should().Be(456); + ((string)result2.B).Should().Be("baz"); + }); + } + + [Fact] + public async Task PropertiesGetterSetterWithDefaultValueInputPartially() + { + using var tempWorkarea = TemporaryProjectWorkarea.Create(); + var contents = @" +using System; +using System.Collections.Generic; +using MessagePack; + +namespace TempProject +{ + [MessagePackObject(true)] + public class MyMessagePackObject + { + public int A { get; set; } = 123; + public string B { get; set; } = ""foobar""; + } +} + "; + tempWorkarea.AddFileToTargetProject("MyMessagePackObject.cs", contents); + + var compiler = new MessagePackCompiler.CodeGenerator(testOutputHelper.WriteLine, CancellationToken.None); + await compiler.GenerateFileAsync( + tempWorkarea.GetOutputCompilation().Compilation, + tempWorkarea.OutputDirectory, + "TempProjectResolver", + "TempProject.Generated", + false, + string.Empty, + Array.Empty()); + + var compilation = tempWorkarea.GetOutputCompilation(); + compilation.Compilation.GetDiagnostics().Should().NotContain(x => x.Severity == DiagnosticSeverity.Error); + + // Run tests with the generated resolver/formatter assembly. + compilation.ExecuteWithGeneratedAssembly((ctx, assembly) => + { + var mpoType = assembly.GetType("TempProject.MyMessagePackObject"); + var options = MessagePackSerializerOptions.Standard + .WithResolver(CompositeResolver.Create( + StandardResolver.Instance, + assembly.GetResolverInstance("TempProject.Generated.Resolvers.TempProjectResolver"))); + + // Build `{ "A": -1 }` + var seq = new Sequence(); + var writer = new MessagePackWriter(seq); + writer.WriteMapHeader(1); + writer.Write("A"); + writer.Write(-1); + writer.Flush(); + + // Verify deserialization + // The deserialized object has default value and should preserve it. + dynamic result = MessagePackSerializer.Deserialize(mpoType, seq, options); + ((int)result.A).Should().Be(-1); // from input + ((string)result.B).Should().Be("foobar"); // default value + + // Verify round trip serialization/deserialization. + result.A = 456; + result.B = "baz"; + + var serialized = MessagePackSerializer.Serialize(mpoType, (object)result, options); + dynamic result2 = MessagePackSerializer.Deserialize(mpoType, serialized, options); + ((int)result2.A).Should().Be(456); + ((string)result2.B).Should().Be("baz"); + }); + } + + [Fact] + public async Task PropertiesGetterOnlyWithParameterizedConstructor() + { + using var tempWorkarea = TemporaryProjectWorkarea.Create(); + var contents = @" +using System; +using System.Collections.Generic; +using MessagePack; + +namespace TempProject +{ + [MessagePackObject(true)] + public class MyMessagePackObject + { + public int A { get; } + public string B { get; } + + public MyMessagePackObject(int a, string b) + { + A = a; + B = b; + } + } +} + "; + tempWorkarea.AddFileToTargetProject("MyMessagePackObject.cs", contents); + + var compiler = new MessagePackCompiler.CodeGenerator(testOutputHelper.WriteLine, CancellationToken.None); + await compiler.GenerateFileAsync( + tempWorkarea.GetOutputCompilation().Compilation, + tempWorkarea.OutputDirectory, + "TempProjectResolver", + "TempProject.Generated", + false, + string.Empty, + Array.Empty()); + + var compilation = tempWorkarea.GetOutputCompilation(); + compilation.Compilation.GetDiagnostics().Should().NotContain(x => x.Severity == DiagnosticSeverity.Error); + + // Run tests with the generated resolver/formatter assembly. + compilation.ExecuteWithGeneratedAssembly((ctx, assembly) => + { + var mpoType = assembly.GetType("TempProject.MyMessagePackObject"); + var options = MessagePackSerializerOptions.Standard + .WithResolver(CompositeResolver.Create( + StandardResolver.Instance, + assembly.GetResolverInstance("TempProject.Generated.Resolvers.TempProjectResolver"))); + + // Build `{ "A": -1, "B": "foobar" }` + var seq = new Sequence(); + var writer = new MessagePackWriter(seq); + writer.WriteMapHeader(2); + writer.Write("A"); + writer.Write(-1); + writer.Write("B"); + writer.Write("foobar"); + writer.Flush(); + + // Verify deserialization + dynamic result = MessagePackSerializer.Deserialize(mpoType, seq, options); + ((int)result.A).Should().Be(-1); // from input + ((string)result.B).Should().Be("foobar"); // from input + + // Verify serialization + var serialized = MessagePackSerializer.Serialize(mpoType, (object)result, options); + serialized.Should().BeEquivalentTo(seq.AsReadOnlySequence.ToArray()); + }); + } + + [Fact] + public async Task PropertiesGetterOnlyWithParameterizedConstructorPartially() + { + using var tempWorkarea = TemporaryProjectWorkarea.Create(); + var contents = @" +using System; +using System.Collections.Generic; +using MessagePack; + +namespace TempProject +{ + [MessagePackObject(true)] + public class MyMessagePackObject + { + public int A { get; } + public string B { get; } + + public MyMessagePackObject(string b) + { + B = b; + } + } +} + "; + tempWorkarea.AddFileToTargetProject("MyMessagePackObject.cs", contents); + + var compiler = new MessagePackCompiler.CodeGenerator(testOutputHelper.WriteLine, CancellationToken.None); + await compiler.GenerateFileAsync( + tempWorkarea.GetOutputCompilation().Compilation, + tempWorkarea.OutputDirectory, + "TempProjectResolver", + "TempProject.Generated", + false, + string.Empty, + Array.Empty()); + + var compilation = tempWorkarea.GetOutputCompilation(); + compilation.Compilation.GetDiagnostics().Should().NotContain(x => x.Severity == DiagnosticSeverity.Error); + + // Run tests with the generated resolver/formatter assembly. + compilation.ExecuteWithGeneratedAssembly((ctx, assembly) => + { + var mpoType = assembly.GetType("TempProject.MyMessagePackObject"); + var options = MessagePackSerializerOptions.Standard + .WithResolver(CompositeResolver.Create( + StandardResolver.Instance, + assembly.GetResolverInstance("TempProject.Generated.Resolvers.TempProjectResolver"))); + + // Build `{ "A": -1, "B": "foobar" }` + var seq = new Sequence(); + var writer = new MessagePackWriter(seq); + writer.WriteMapHeader(2); + writer.Write("A"); + writer.Write(-1); + writer.Write("B"); + writer.Write("foobar"); + writer.Flush(); + + // Verify deserialization + dynamic result = MessagePackSerializer.Deserialize(mpoType, seq, options); + ((int)result.A).Should().Be(0); // default value + ((string)result.B).Should().Be("foobar"); // from input + }); + } + + [Fact] + public async Task PropertiesGetterOnlyWithParameterizedConstructorDefaultValue() + { + using var tempWorkarea = TemporaryProjectWorkarea.Create(); + var contents = @" +using System; +using System.Collections.Generic; +using MessagePack; + +namespace TempProject +{ + [MessagePackObject(true)] + public class MyMessagePackObject + { + public int A { get; } = 12345; + public string B { get; } = ""some""; + + public MyMessagePackObject(string b) + { + B = b; + } + } +} + "; + tempWorkarea.AddFileToTargetProject("MyMessagePackObject.cs", contents); + + var compiler = new MessagePackCompiler.CodeGenerator(testOutputHelper.WriteLine, CancellationToken.None); + await compiler.GenerateFileAsync( + tempWorkarea.GetOutputCompilation().Compilation, + tempWorkarea.OutputDirectory, + "TempProjectResolver", + "TempProject.Generated", + false, + string.Empty, + Array.Empty()); + + var compilation = tempWorkarea.GetOutputCompilation(); + compilation.Compilation.GetDiagnostics().Should().NotContain(x => x.Severity == DiagnosticSeverity.Error); + + // Run tests with the generated resolver/formatter assembly. + compilation.ExecuteWithGeneratedAssembly((ctx, assembly) => + { + var mpoType = assembly.GetType("TempProject.MyMessagePackObject"); + var options = MessagePackSerializerOptions.Standard + .WithResolver(CompositeResolver.Create( + StandardResolver.Instance, + assembly.GetResolverInstance("TempProject.Generated.Resolvers.TempProjectResolver"))); + + // Build `{ "A": -1, "B": "foobar" }` + var seq = new Sequence(); + var writer = new MessagePackWriter(seq); + writer.WriteMapHeader(2); + writer.Write("A"); + writer.Write(-1); + writer.Write("B"); + writer.Write("foobar"); + writer.Flush(); + + // Verify deserialization + dynamic result = MessagePackSerializer.Deserialize(mpoType, seq, options); + ((int)result.A).Should().Be(12345); // default value + ((string)result.B).Should().Be("foobar"); // from input + }); + } + + [Fact] + public async Task PropertiesGetterSetterWithParameterizedConstructor() + { + using var tempWorkarea = TemporaryProjectWorkarea.Create(); + var contents = @" +using System; +using System.Collections.Generic; +using MessagePack; + +namespace TempProject +{ + [MessagePackObject(true)] + public class MyMessagePackObject + { + public int A { get; set; } + public string B { get; set; } + + public MyMessagePackObject(int a, string b) + { + A = a; + B = b; + } + } +} + "; + tempWorkarea.AddFileToTargetProject("MyMessagePackObject.cs", contents); + + var compiler = new MessagePackCompiler.CodeGenerator(testOutputHelper.WriteLine, CancellationToken.None); + await compiler.GenerateFileAsync( + tempWorkarea.GetOutputCompilation().Compilation, + tempWorkarea.OutputDirectory, + "TempProjectResolver", + "TempProject.Generated", + false, + string.Empty, + Array.Empty()); + + var compilation = tempWorkarea.GetOutputCompilation(); + compilation.Compilation.GetDiagnostics().Should().NotContain(x => x.Severity == DiagnosticSeverity.Error); + + // Run tests with the generated resolver/formatter assembly. + compilation.ExecuteWithGeneratedAssembly((ctx, assembly) => + { + var mpoType = assembly.GetType("TempProject.MyMessagePackObject"); + var options = MessagePackSerializerOptions.Standard + .WithResolver(CompositeResolver.Create( + StandardResolver.Instance, + assembly.GetResolverInstance("TempProject.Generated.Resolvers.TempProjectResolver"))); + + // Build `{ "A": -1, "B": "foobar" }` + var seq = new Sequence(); + var writer = new MessagePackWriter(seq); + writer.WriteMapHeader(2); + writer.Write("A"); + writer.Write(-1); + writer.Write("B"); + writer.Write("foobar"); + writer.Flush(); + + // Verify deserialization + dynamic result = MessagePackSerializer.Deserialize(mpoType, seq, options); + ((int)result.A).Should().Be(-1); // from input + ((string)result.B).Should().Be("foobar"); // from input + + // Verify serialization + var serialized = MessagePackSerializer.Serialize(mpoType, (object)result, options); + serialized.Should().BeEquivalentTo(seq.AsReadOnlySequence.ToArray()); + }); + } + + [Fact] + public async Task PropertiesGetterSetterWithParameterizedConstructorPartially() + { + using var tempWorkarea = TemporaryProjectWorkarea.Create(); + var contents = @" +using System; +using System.Collections.Generic; +using MessagePack; + +namespace TempProject +{ + [MessagePackObject(true)] + public class MyMessagePackObject + { + public int A { get; set; } + public string B { get; set; } + + public MyMessagePackObject(int a) + { + A = a; + } + } +} + "; + tempWorkarea.AddFileToTargetProject("MyMessagePackObject.cs", contents); + + var compiler = new MessagePackCompiler.CodeGenerator(testOutputHelper.WriteLine, CancellationToken.None); + await compiler.GenerateFileAsync( + tempWorkarea.GetOutputCompilation().Compilation, + tempWorkarea.OutputDirectory, + "TempProjectResolver", + "TempProject.Generated", + false, + string.Empty, + Array.Empty()); + + var compilation = tempWorkarea.GetOutputCompilation(); + compilation.Compilation.GetDiagnostics().Should().NotContain(x => x.Severity == DiagnosticSeverity.Error); + + // Run tests with the generated resolver/formatter assembly. + compilation.ExecuteWithGeneratedAssembly((ctx, assembly) => + { + var mpoType = assembly.GetType("TempProject.MyMessagePackObject"); + var options = MessagePackSerializerOptions.Standard + .WithResolver(CompositeResolver.Create( + StandardResolver.Instance, + assembly.GetResolverInstance("TempProject.Generated.Resolvers.TempProjectResolver"))); + + // Build `{ "A": -1, "B": "foobar" }` + var seq = new Sequence(); + var writer = new MessagePackWriter(seq); + writer.WriteMapHeader(2); + writer.Write("A"); + writer.Write(-1); + writer.Write("B"); + writer.Write("foobar"); + writer.Flush(); + + // Verify deserialization + dynamic result = MessagePackSerializer.Deserialize(mpoType, seq, options); + ((int)result.A).Should().Be(-1); // from ctor + ((string)result.B).Should().Be("foobar"); // from setter + + // Verify serialization + var serialized = MessagePackSerializer.Serialize(mpoType, (object)result, options); + serialized.Should().BeEquivalentTo(seq.AsReadOnlySequence.ToArray()); + }); + } + + [Fact] + public async Task PropertiesGetterSetterWithParameterizedConstructorDoNotUseSetter() + { + using var tempWorkarea = TemporaryProjectWorkarea.Create(); + var contents = @" +using System; +using System.Collections.Generic; +using MessagePack; + +namespace TempProject +{ + [MessagePackObject(true)] + public class MyMessagePackObject + { + public int A { get; set; } + + public MyMessagePackObject(int a) + { + } + } +} + "; + tempWorkarea.AddFileToTargetProject("MyMessagePackObject.cs", contents); + + var compiler = new MessagePackCompiler.CodeGenerator(testOutputHelper.WriteLine, CancellationToken.None); + await compiler.GenerateFileAsync( + tempWorkarea.GetOutputCompilation().Compilation, + tempWorkarea.OutputDirectory, + "TempProjectResolver", + "TempProject.Generated", + false, + string.Empty, + Array.Empty()); + + var compilation = tempWorkarea.GetOutputCompilation(); + compilation.Compilation.GetDiagnostics().Should().NotContain(x => x.Severity == DiagnosticSeverity.Error); + + // Run tests with the generated resolver/formatter assembly. + compilation.ExecuteWithGeneratedAssembly((ctx, assembly) => + { + var mpoType = assembly.GetType("TempProject.MyMessagePackObject"); + var options = MessagePackSerializerOptions.Standard + .WithResolver(CompositeResolver.Create( + StandardResolver.Instance, + assembly.GetResolverInstance("TempProject.Generated.Resolvers.TempProjectResolver"))); + + // Build `{ "A": -1 }` + var seq = new Sequence(); + var writer = new MessagePackWriter(seq); + writer.WriteMapHeader(1); + writer.Write("A"); + writer.Write(-1); + writer.Flush(); + + // Verify deserialization + dynamic result = MessagePackSerializer.Deserialize(mpoType, seq, options); + ((int)result.A).Should().Be(0); + }); + } + + [Fact] + public async Task PropertiesGetterSetterWithParameterizedConstructorAndDefaultValue() + { + using var tempWorkarea = TemporaryProjectWorkarea.Create(); + var contents = @" +using System; +using System.Collections.Generic; +using MessagePack; + +namespace TempProject +{ + [MessagePackObject(true)] + public class MyMessagePackObject + { + public int A { get; set; } + public string B { get; set; } = ""foobar""; + + public MyMessagePackObject(int a) + { + A = a; + } + } +} + "; + tempWorkarea.AddFileToTargetProject("MyMessagePackObject.cs", contents); + + var compiler = new MessagePackCompiler.CodeGenerator(testOutputHelper.WriteLine, CancellationToken.None); + await compiler.GenerateFileAsync( + tempWorkarea.GetOutputCompilation().Compilation, + tempWorkarea.OutputDirectory, + "TempProjectResolver", + "TempProject.Generated", + false, + string.Empty, + Array.Empty()); + + var compilation = tempWorkarea.GetOutputCompilation(); + compilation.Compilation.GetDiagnostics().Should().NotContain(x => x.Severity == DiagnosticSeverity.Error); + + // Run tests with the generated resolver/formatter assembly. + compilation.ExecuteWithGeneratedAssembly((ctx, assembly) => + { + var mpoType = assembly.GetType("TempProject.MyMessagePackObject"); + var options = MessagePackSerializerOptions.Standard + .WithResolver(CompositeResolver.Create( + StandardResolver.Instance, + assembly.GetResolverInstance("TempProject.Generated.Resolvers.TempProjectResolver"))); + + // Build `{ "A": -1 }` + var seq = new Sequence(); + var writer = new MessagePackWriter(seq); + writer.WriteMapHeader(1); + writer.Write("A"); + writer.Write(-1); + writer.Flush(); + + // Verify deserialization + dynamic result = MessagePackSerializer.Deserialize(mpoType, seq, options); + ((int)result.A).Should().Be(-1); // from ctor + ((string)result.B).Should().Be("foobar"); // default value + }); + } + } +} diff --git a/tests/MessagePack.Generator.Tests/MessagePack.Generator.Tests.csproj b/tests/MessagePack.Generator.Tests/MessagePack.Generator.Tests.csproj index ac91ade4a..9f3993898 100644 --- a/tests/MessagePack.Generator.Tests/MessagePack.Generator.Tests.csproj +++ b/tests/MessagePack.Generator.Tests/MessagePack.Generator.Tests.csproj @@ -13,6 +13,8 @@ + + diff --git a/tests/MessagePack.Generator.Tests/TemporaryProjectWorkarea.cs b/tests/MessagePack.Generator.Tests/TemporaryProjectWorkarea.cs index 42791bfd9..ce8d92807 100644 --- a/tests/MessagePack.Generator.Tests/TemporaryProjectWorkarea.cs +++ b/tests/MessagePack.Generator.Tests/TemporaryProjectWorkarea.cs @@ -6,11 +6,13 @@ using System.IO; using System.Linq; using System.Reflection; +using System.Runtime.Loader; using System.Threading.Tasks; using MessagePack.Formatters; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; +using Nerdbank.Streams; namespace MessagePack.Generator.Tests { @@ -24,6 +26,11 @@ public class TemporaryProjectWorkarea : IDisposable private readonly string referencedCsprojFileName = "TempReferencedProject.csproj"; private readonly bool cleanOnDisposing; + /// + /// Gets the identifier of the workarea. + /// + public Guid WorkareaId { get; } + /// /// Gets Generator target csproj file path. /// @@ -47,8 +54,9 @@ public static TemporaryProjectWorkarea Create(bool cleanOnDisposing = true) private TemporaryProjectWorkarea(bool cleanOnDisposing) { + WorkareaId = Guid.NewGuid(); this.cleanOnDisposing = cleanOnDisposing; - this.tempDirPath = Path.Combine(Path.GetTempPath(), $"MessagePack.Generator.Tests-{Guid.NewGuid()}"); + this.tempDirPath = Path.Combine(Path.GetTempPath(), $"MessagePack.Generator.Tests-{WorkareaId}"); TargetProjectDirectory = Path.Combine(tempDirPath, "TargetProject"); ReferencedProjectDirectory = Path.Combine(tempDirPath, "ReferencedProject"); @@ -57,6 +65,7 @@ private TemporaryProjectWorkarea(bool cleanOnDisposing) Directory.CreateDirectory(TargetProjectDirectory); Directory.CreateDirectory(ReferencedProjectDirectory); Directory.CreateDirectory(OutputDirectory); + Directory.CreateDirectory(Path.Combine(OutputDirectory, "bin")); var solutionRootDir = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "../../../..")); var messagePackProjectDir = Path.Combine(solutionRootDir, "src/MessagePack/MessagePack.csproj"); @@ -149,7 +158,7 @@ public OutputCompilation GetOutputCompilation() .AddReferences(MetadataReference.CreateFromFile(typeof(IMessagePackFormatter<>).Assembly.Location)) .WithOptions(new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary)); - return new OutputCompilation(compilation); + return new OutputCompilation(this, compilation); } public void Dispose() @@ -163,10 +172,13 @@ public void Dispose() public class OutputCompilation { + private readonly TemporaryProjectWorkarea _workarea; + public Compilation Compilation { get; } - public OutputCompilation(Compilation compilation) + public OutputCompilation(TemporaryProjectWorkarea workarea, Compilation compilation) { + this._workarea = workarea; this.Compilation = compilation ?? throw new ArgumentNullException(nameof(compilation)); } @@ -203,5 +215,27 @@ public IReadOnlyList GetResolverKnownFormatterTypes() .Select(x => x.ToString())) .ToArray(); } + + /// + /// Load the generated assembly and execute the code in that context. + /// + public void ExecuteWithGeneratedAssembly(Action action) + { + var memoryStream = new MemoryStream(); + Compilation.Emit(memoryStream); + memoryStream.Position = 0; + + var assemblyLoadContext = new AssemblyLoadContext($"TempProject-{_workarea.WorkareaId}", isCollectible: true); + try + { + assemblyLoadContext.LoadFromStream(memoryStream); + var assembly = assemblyLoadContext.Assemblies.First(); + action(assemblyLoadContext, assembly); + } + finally + { + assemblyLoadContext.Unload(); + } + } } } From 8097901a49139cc556299c4c2bc21bba2131258b Mon Sep 17 00:00:00 2001 From: Mayuki Sawatari Date: Tue, 3 Aug 2021 19:08:53 +0900 Subject: [PATCH 094/161] Fix code generation for objects with getter-only props and parameterized ctor. --- .../Generator/StringKey/StringKeyFormatterDeserializeHelper.cs | 2 +- .../Generator/StringKey/StringKeyFormatterTemplate.cs | 2 +- .../Generator/StringKey/StringKeyFormatterTemplate.tt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterDeserializeHelper.cs b/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterDeserializeHelper.cs index d9b21677b..f65bed0b3 100644 --- a/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterDeserializeHelper.cs +++ b/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterDeserializeHelper.cs @@ -44,7 +44,7 @@ private static bool IsConstructorParameter(ObjectSerializationInfo objectSeriali private static void Assign(StringBuilder buffer, in MemberInfoTuple member, bool canOverwrite, string indent, string tab, int tabCount) { - if (member.Info.IsWritable) + if (member.Info.IsWritable || member.IsConstructorParameter) { if (canOverwrite) { diff --git a/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterTemplate.cs b/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterTemplate.cs index 521df4441..a3df9f44e 100644 --- a/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterTemplate.cs +++ b/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterTemplate.cs @@ -139,7 +139,7 @@ namespace "); this.Write(this.ToStringHelper.ToStringWithCulture(objInfo.GetConstructorString())); this.Write(";\r\n"); } else { - foreach (var member in objInfo.Members.Where(x => x.IsWritable)) { + foreach (var member in objInfo.Members.Where(x => x.IsWritable || objInfo.ConstructorParameters.Any(p => p.Equals(x)))) { if (objInfo.ConstructorParameters.All(p => !p.Equals(member))) { this.Write(" var __"); this.Write(this.ToStringHelper.ToStringWithCulture(member.Name)); diff --git a/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterTemplate.tt b/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterTemplate.tt index 251fa55c4..9bc3e4d8b 100644 --- a/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterTemplate.tt +++ b/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterTemplate.tt @@ -102,7 +102,7 @@ foreach (var objInfo in ObjectSerializationInfos) { if (canOverwrite) { #> var ____result = new <#= objInfo.GetConstructorString() #>; <# } else { - foreach (var member in objInfo.Members.Where(x => x.IsWritable)) { #> + foreach (var member in objInfo.Members.Where(x => x.IsWritable || objInfo.ConstructorParameters.Any(p => p.Equals(x)))) { #> <# if (objInfo.ConstructorParameters.All(p => !p.Equals(member))) { #> var __<#= member.Name #>__IsInitialized = false; <# } #> From b33f4534e0f804001da888ee45ea8088a8840db9 Mon Sep 17 00:00:00 2001 From: Mayuki Sawatari Date: Tue, 3 Aug 2021 19:23:54 +0900 Subject: [PATCH 095/161] Fix code formatting --- tests/MessagePack.Generator.Tests/AssemblyExtensions.cs | 2 +- .../MessagePack.Generator.Tests/TemporaryProjectWorkarea.cs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/MessagePack.Generator.Tests/AssemblyExtensions.cs b/tests/MessagePack.Generator.Tests/AssemblyExtensions.cs index dde50fc0c..f6afd71af 100644 --- a/tests/MessagePack.Generator.Tests/AssemblyExtensions.cs +++ b/tests/MessagePack.Generator.Tests/AssemblyExtensions.cs @@ -10,7 +10,7 @@ internal static class AssemblyExtensions public static IFormatterResolver GetResolverInstance(this Assembly assembly, string name) { var resolverType = assembly.GetType(name); - return (IFormatterResolver) resolverType.GetField("Instance", BindingFlags.Static | BindingFlags.Public).GetValue(null); + return (IFormatterResolver)resolverType.GetField("Instance", BindingFlags.Static | BindingFlags.Public).GetValue(null); } } } diff --git a/tests/MessagePack.Generator.Tests/TemporaryProjectWorkarea.cs b/tests/MessagePack.Generator.Tests/TemporaryProjectWorkarea.cs index ce8d92807..370da3440 100644 --- a/tests/MessagePack.Generator.Tests/TemporaryProjectWorkarea.cs +++ b/tests/MessagePack.Generator.Tests/TemporaryProjectWorkarea.cs @@ -172,13 +172,13 @@ public void Dispose() public class OutputCompilation { - private readonly TemporaryProjectWorkarea _workarea; + private readonly TemporaryProjectWorkarea workarea; public Compilation Compilation { get; } public OutputCompilation(TemporaryProjectWorkarea workarea, Compilation compilation) { - this._workarea = workarea; + this.workarea = workarea; this.Compilation = compilation ?? throw new ArgumentNullException(nameof(compilation)); } @@ -225,7 +225,7 @@ public void ExecuteWithGeneratedAssembly(Action a Compilation.Emit(memoryStream); memoryStream.Position = 0; - var assemblyLoadContext = new AssemblyLoadContext($"TempProject-{_workarea.WorkareaId}", isCollectible: true); + var assemblyLoadContext = new AssemblyLoadContext($"TempProject-{workarea.WorkareaId}", isCollectible: true); try { assemblyLoadContext.LoadFromStream(memoryStream); From 71f44c9d79b08f0697c838cee8706569356d8e25 Mon Sep 17 00:00:00 2001 From: fred Date: Wed, 4 Aug 2021 09:26:18 +0800 Subject: [PATCH 096/161] Refactory ObjectSerializationInfo.CreateOrNull --- .../Resolvers/DynamicObjectResolver.cs | 383 ++++++------------ 1 file changed, 113 insertions(+), 270 deletions(-) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs index d9d0cc85a..be730a33c 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs @@ -1711,343 +1711,186 @@ public static ObjectSerializationInfo CreateOrNull(Type type, bool forceStringKe var intMembers = new Dictionary(); var stringMembers = new Dictionary(); - if (forceStringKey || contractless || (contractAttr != null && contractAttr.KeyAsPropertyName)) + // When returning false, it means should ignoring this member. + bool AddEmittableMemberOrIgnore(bool isIntKeyMode, EmittableMember member, bool checkConflicting) { - // All public members are serialize target except [Ignore] member. - isIntKey = !(forceStringKey || (contractAttr != null && contractAttr.KeyAsPropertyName)); - - var hiddenIntKey = 0; - - // Group the properties and fields by name to qualify members of the same name - // (declared with the 'new' keyword) with the declaring type. - IEnumerable> membersByName = type.GetRuntimeProperties() - .Concat(type.GetRuntimeFields().Cast()) - .OrderBy(m => m.DeclaringType, OrderBaseTypesBeforeDerivedTypes.Instance) - .GroupBy(m => m.Name); - foreach (var memberGroup in membersByName) + if (checkConflicting) { - bool firstMemberByName = true; - foreach (MemberInfo item in memberGroup) + if (isIntKeyMode ? intMembers.TryGetValue(member.IntKey, out var conflictingMember) : stringMembers.TryGetValue(member.StringKey, out conflictingMember)) { - if (item.GetCustomAttribute(true) != null) - { - continue; - } - - if (item.GetCustomAttribute(true) != null) + // Quietly skip duplicate if this is an override property. + if (member.PropertyInfo != null && ((conflictingMember.PropertyInfo.SetMethod?.IsVirtual ?? false) || (conflictingMember.PropertyInfo.GetMethod?.IsVirtual ?? false))) { - continue; + return false; } - EmittableMember member; - if (item is PropertyInfo property) - { - if (property.IsIndexer()) - { - continue; - } + var memberInfo = (MemberInfo)member.PropertyInfo ?? member.FieldInfo; + throw new MessagePackDynamicObjectResolverException($"key is duplicated, all members key must be unique. type:{type.FullName} member:{memberInfo.Name}"); + } + } - MethodInfo getMethod = property.GetGetMethod(true); - MethodInfo setMethod = property.GetSetMethod(true); + if (isIntKeyMode) + { + intMembers.Add(member.IntKey, member); + } + else + { + stringMembers.Add(member.StringKey, member); + } - member = new EmittableMember(dynamicMethod) - { - PropertyInfo = property, - IsReadable = (getMethod != null) && (allowPrivate || getMethod.IsPublic) && !getMethod.IsStatic, - IsWritable = (setMethod != null) && (allowPrivate || setMethod.IsPublic) && !setMethod.IsStatic, - StringKey = firstMemberByName ? item.Name : $"{item.DeclaringType.FullName}.{item.Name}", - }; - } - else if (item is FieldInfo field) - { - if (item.GetCustomAttribute(true) != null) - { - continue; - } + return true; + } - if (field.IsStatic) - { - continue; - } + EmittableMember CreateEmittableMember(MemberInfo m) + { + if (m.IsDefined(typeof(IgnoreMemberAttribute), true) || m.IsDefined(typeof(IgnoreDataMemberAttribute), true)) + { + return null; + } - member = new EmittableMember(dynamicMethod) - { - FieldInfo = field, - IsReadable = allowPrivate || field.IsPublic, - IsWritable = (allowPrivate || field.IsPublic) && !field.IsInitOnly, - StringKey = firstMemberByName ? item.Name : $"{item.DeclaringType.FullName}.{item.Name}", - }; - } - else + EmittableMember result; + switch (m) + { + case PropertyInfo property: + if (property.IsIndexer()) { - throw new MessagePackSerializationException("unexpected member type"); + return null; } - if (!member.IsReadable && !member.IsWritable) + if (isClassRecord && property.Name == "EqualityContract") { - continue; + return null; } - member.IntKey = hiddenIntKey++; - if (isIntKey) + var getMethod = property.GetGetMethod(true); + var setMethod = property.GetSetMethod(true); + result = new EmittableMember(dynamicMethod) { - intMembers.Add(member.IntKey, member); + PropertyInfo = property, + IsReadable = (getMethod != null) && (allowPrivate || getMethod.IsPublic) && !getMethod.IsStatic, + IsWritable = (setMethod != null) && (allowPrivate || setMethod.IsPublic) && !setMethod.IsStatic, + }; + break; + case FieldInfo field: + if (field.GetCustomAttribute(true) != null) + { + return null; } - else + + if (field.IsStatic) { - stringMembers.Add(member.StringKey, member); + return null; } - firstMemberByName = false; - } + result = new EmittableMember(dynamicMethod) + { + FieldInfo = field, + IsReadable = allowPrivate || field.IsPublic, + IsWritable = (allowPrivate || field.IsPublic) && !field.IsInitOnly, + }; + break; + default: + throw new MessagePackSerializationException("unexpected member type"); } + + return result.IsReadable || result.IsWritable ? result : null; } - else + + // Determine whether to ignore MessagePackObjectAttribute or DataContract. + if (forceStringKey || contractless || (contractAttr?.KeyAsPropertyName == true)) { - // Public members with KeyAttribute except [Ignore] member. - var searchFirst = true; + // All public members are serialize target except [Ignore] member. + isIntKey = !(forceStringKey || (contractAttr != null && contractAttr.KeyAsPropertyName)); var hiddenIntKey = 0; - foreach (PropertyInfo item in GetAllProperties(type)) + // Group the properties and fields by name to qualify members of the same name + // (declared with the 'new' keyword) with the declaring type. + var membersByName = type.GetRuntimeProperties().Concat(type.GetRuntimeFields().Cast()) + .OrderBy(m => m.DeclaringType, OrderBaseTypesBeforeDerivedTypes.Instance) + .GroupBy(m => m.Name); + foreach (var memberGroup in membersByName) { - if (item.GetCustomAttribute(true) != null) - { - continue; - } - - if (item.GetCustomAttribute(true) != null) - { - continue; - } - - if (isClassRecord && item.Name == "EqualityContract") - { - // This is a special compiler-generated property that the user cannot add - // [IgnoreMember] to, nor do we want to serialize it. - continue; - } - - if (item.IsIndexer()) - { - continue; - } - - MethodInfo getMethod = item.GetGetMethod(true); - MethodInfo setMethod = item.GetSetMethod(true); - - var member = new EmittableMember(dynamicMethod) - { - PropertyInfo = item, - IsReadable = (getMethod != null) && (allowPrivate || getMethod.IsPublic) && !getMethod.IsStatic, - IsWritable = (setMethod != null) && (allowPrivate || setMethod.IsPublic) && !setMethod.IsStatic, - }; - if (!member.IsReadable && !member.IsWritable) - { - continue; - } - - KeyAttribute key; - if (contractAttr != null) - { - // MessagePackObjectAttribute - key = item.GetCustomAttribute(true); - if (key == null) - { - throw new MessagePackDynamicObjectResolverException("all public members must mark KeyAttribute or IgnoreMemberAttribute." + " type: " + type.FullName + " member:" + item.Name); - } - - member.IsExplicitContract = true; - if (key.IntKey == null && key.StringKey == null) - { - throw new MessagePackDynamicObjectResolverException("both IntKey and StringKey are null." + " type: " + type.FullName + " member:" + item.Name); - } - } - else + var first = true; + foreach (var member in memberGroup.Select(CreateEmittableMember).Where(n => n != null)) { - // DataContractAttribute - DataMemberAttribute pseudokey = item.GetCustomAttribute(true); - if (pseudokey == null) - { - // This member has no DataMemberAttribute nor IgnoreMemberAttribute. - // But the type *did* have a DataContractAttribute on it, so no attribute implies the member should not be serialized. - continue; - } - - member.IsExplicitContract = true; - - // use Order first - if (pseudokey.Order != -1) - { - key = new KeyAttribute(pseudokey.Order); - } - else if (pseudokey.Name != null) + var memberInfo = (MemberInfo)member.PropertyInfo ?? member.FieldInfo; + if (first) { - key = new KeyAttribute(pseudokey.Name); + first = false; + member.StringKey = memberInfo.Name; } else { - key = new KeyAttribute(item.Name); // use property name - } - } - - if (searchFirst) - { - searchFirst = false; - isIntKey = key.IntKey != null; - } - else - { - if ((isIntKey && key.IntKey == null) || (!isIntKey && key.StringKey == null)) - { - throw new MessagePackDynamicObjectResolverException("all members key type must be same." + " type: " + type.FullName + " member:" + item.Name); - } - } - - if (isIntKey) - { - member.IntKey = key.IntKey.Value; - if (intMembers.TryGetValue(member.IntKey, out EmittableMember conflictingMember)) - { - // Quietly skip duplicate if this is an override property. - if ((conflictingMember.PropertyInfo.SetMethod?.IsVirtual ?? false) || (conflictingMember.PropertyInfo.GetMethod?.IsVirtual ?? false)) - { - continue; - } - - throw new MessagePackDynamicObjectResolverException("key is duplicated, all members key must be unique." + " type: " + type.FullName + " member:" + item.Name); - } - - intMembers.Add(member.IntKey, member); - } - else - { - member.StringKey = key.StringKey; - if (stringMembers.TryGetValue(member.StringKey, out EmittableMember conflictingMember)) - { - // Quietly skip duplicate if this is an override property. - if ((conflictingMember.PropertyInfo.SetMethod?.IsVirtual ?? false) || (conflictingMember.PropertyInfo.GetMethod?.IsVirtual ?? false)) - { - continue; - } - - throw new MessagePackDynamicObjectResolverException("key is duplicated, all members key must be unique." + " type: " + type.FullName + " member:" + item.Name); + member.StringKey = $"{memberInfo.DeclaringType.FullName}.{memberInfo.Name}"; } member.IntKey = hiddenIntKey++; - stringMembers.Add(member.StringKey, member); + AddEmittableMemberOrIgnore(isIntKey, member, false); } } + } + else + { + // Public members with KeyAttribute except [Ignore] member. + var searchFirst = true; + var hiddenIntKey = 0; - foreach (FieldInfo item in GetAllFields(type)) + var memberInfos = GetAllProperties(type).Cast().Concat(GetAllFields(type)); + foreach (var member in memberInfos.Select(CreateEmittableMember).Where(n => n != null)) { - if (item.GetCustomAttribute(true) != null) - { - continue; - } - - if (item.GetCustomAttribute(true) != null) - { - continue; - } - - if (item.GetCustomAttribute(true) != null) - { - continue; - } - - if (item.IsStatic) - { - continue; - } - - var member = new EmittableMember(dynamicMethod) - { - FieldInfo = item, - IsReadable = allowPrivate || item.IsPublic, - IsWritable = (allowPrivate || item.IsPublic) && !item.IsInitOnly, - }; - if (!member.IsReadable && !member.IsWritable) - { - continue; - } + var memberInfo = (MemberInfo)member.PropertyInfo ?? member.FieldInfo; KeyAttribute key; if (contractAttr != null) { - // MessagePackObjectAttribute - key = item.GetCustomAttribute(true); - if (key == null) - { - throw new MessagePackDynamicObjectResolverException("all public members must mark KeyAttribute or IgnoreMemberAttribute." + " type: " + type.FullName + " member:" + item.Name); - } - - member.IsExplicitContract = true; + // MessagePackObjectAttribute. KeyAttribute must be marked, and IntKey or StringKey must be set. + key = memberInfo.GetCustomAttribute(true) ?? + throw new MessagePackDynamicObjectResolverException($"all public members must mark KeyAttribute or IgnoreMemberAttribute. type:{type.FullName} member:{memberInfo.Name}"); if (key.IntKey == null && key.StringKey == null) { - throw new MessagePackDynamicObjectResolverException("both IntKey and StringKey are null." + " type: " + type.FullName + " member:" + item.Name); + throw new MessagePackDynamicObjectResolverException($"both IntKey and StringKey are null. type: {type.FullName} member:{memberInfo.Name}"); } } else { - // DataContractAttribute - DataMemberAttribute pseudokey = item.GetCustomAttribute(true); - if (pseudokey == null) - { - // This member has no DataMemberAttribute nor IgnoreMemberAttribute. - // But the type *did* have a DataContractAttribute on it, so no attribute implies the member should not be serialized. - continue; - } - - member.IsExplicitContract = true; - - // use Order first - if (pseudokey.Order != -1) - { - key = new KeyAttribute(pseudokey.Order); - } - else if (pseudokey.Name != null) - { - key = new KeyAttribute(pseudokey.Name); - } - else - { - key = new KeyAttribute(item.Name); // use property name - } + // DataContractAttribute. Try to use the DataMemberAttribute to fake KeyAttribute. + // This member has no DataMemberAttribute nor IgnoreMemberAttribute. + // But the type *did* have a DataContractAttribute on it, so no attribute implies the member should not be serialized. + var pseudokey = memberInfo.GetCustomAttribute(true); + if (pseudokey == null) continue; + + key = + pseudokey.Order != -1 ? new KeyAttribute(pseudokey.Order) : + pseudokey.Name != null ? new KeyAttribute(pseudokey.Name) : + new KeyAttribute(memberInfo.Name); } + member.IsExplicitContract = true; + + // Cannot assign StringKey and IntKey at the same time. if (searchFirst) { searchFirst = false; isIntKey = key.IntKey != null; } - else + else if ((isIntKey && key.IntKey == null) || (!isIntKey && key.StringKey == null)) { - if ((isIntKey && key.IntKey == null) || (!isIntKey && key.StringKey == null)) - { - throw new MessagePackDynamicObjectResolverException("all members key type must be same." + " type: " + type.FullName + " member:" + item.Name); - } + throw new MessagePackDynamicObjectResolverException($"all members key type must be same. type: {type.FullName} member:{memberInfo.Name}"); } if (isIntKey) { member.IntKey = key.IntKey.Value; - if (intMembers.ContainsKey(member.IntKey)) - { - throw new MessagePackDynamicObjectResolverException("key is duplicated, all members key must be unique." + " type: " + type.FullName + " member:" + item.Name); - } - - intMembers.Add(member.IntKey, member); } else { member.StringKey = key.StringKey; - if (stringMembers.ContainsKey(member.StringKey)) - { - throw new MessagePackDynamicObjectResolverException("key is duplicated, all members key must be unique." + " type: " + type.FullName + " member:" + item.Name); - } - member.IntKey = hiddenIntKey++; - stringMembers.Add(member.StringKey, member); + } + + if (!AddEmittableMemberOrIgnore(isIntKey, member, true)) + { + continue; } } } From 192ba3ebc8c9c93f18207daef517e70b4fb61a3d Mon Sep 17 00:00:00 2001 From: fred Date: Wed, 4 Aug 2021 19:38:50 +0800 Subject: [PATCH 097/161] add unittest for DataContractSerializer compatibility --- .../Tests/ShareTests/DataContractTest.cs | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/DataContractTest.cs b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/DataContractTest.cs index 87175888d..4daac8302 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/DataContractTest.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/DataContractTest.cs @@ -3,10 +3,12 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Runtime.Serialization; using System.Text; using System.Threading.Tasks; +using MessagePack.Resolvers; using Xunit; namespace MessagePack.Tests @@ -134,6 +136,73 @@ public void Serialize_WithVariousAttributes() MessagePackSerializer.ConvertToJson(bin).Is(@"{""AttributedProperty"":1,""AttributedField"":4}"); } + + [DataContract] + public class Master : IEquatable + { + [DataMember] + public int A { get; set; } + + [DataMember] + internal Detail InternalComplexProperty { get; set; } + + [DataMember] + internal Detail InternalComplexField; + + public bool Equals(Master other) + { + return other != null + && this.A == other.A + && EqualityComparer.Default.Equals(this.InternalComplexProperty, other.InternalComplexProperty) + && EqualityComparer.Default.Equals(this.InternalComplexField, other.InternalComplexField); + } + } + + public class Detail : IEquatable + { + public int B1 { get; set; } + + internal int B2 { get; set; } + + public bool Equals(Detail other) => other != null && this.B1 == other.B1 && this.B2 == other.B2; + } + + [Fact] + public void DataContractSerializerCompatibility() + { + var master = new Master + { + A = 1, + InternalComplexProperty = new Detail + { + B1 = 2, + B2 = 3, + }, + InternalComplexField = new Detail + { + B1 = 4, + B2 = 5, + }, + }; + + var dcsValue = DataContractSerializerRoundTrip(master); + + var option = MessagePackSerializerOptions.Standard.WithResolver(CompositeResolver.Create( + DynamicObjectResolverAllowPrivate.Instance, + ContractlessStandardResolver.Instance)); + var mpValue = MessagePackSerializer.Deserialize(MessagePackSerializer.Serialize(master, option), option); + + Assert.Equal(dcsValue, mpValue); + } + + private static T DataContractSerializerRoundTrip(T value) + { + var ms = new MemoryStream(); + var dcs = new DataContractSerializer(typeof(T)); + dcs.WriteObject(ms, value); + ms.Position = 0; + return (T)dcs.ReadObject(ms); + } } #endif From 7cb857fc5d7bdc46b6a3c9ce0ae5f9d5cf3c734b Mon Sep 17 00:00:00 2001 From: fred Date: Wed, 4 Aug 2021 19:46:24 +0800 Subject: [PATCH 098/161] add braces --- .../Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs index be730a33c..0500eba26 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs @@ -1857,7 +1857,10 @@ EmittableMember CreateEmittableMember(MemberInfo m) // This member has no DataMemberAttribute nor IgnoreMemberAttribute. // But the type *did* have a DataContractAttribute on it, so no attribute implies the member should not be serialized. var pseudokey = memberInfo.GetCustomAttribute(true); - if (pseudokey == null) continue; + if (pseudokey == null) + { + continue; + } key = pseudokey.Order != -1 ? new KeyAttribute(pseudokey.Order) : From ab35db5b0a18385ba0a41ce5a2bd1e9d187dd6df Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sat, 21 Aug 2021 12:17:05 -0600 Subject: [PATCH 099/161] More reliable assembly load --- tests/MessagePack.Generator.Tests/TemporaryProjectWorkarea.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/MessagePack.Generator.Tests/TemporaryProjectWorkarea.cs b/tests/MessagePack.Generator.Tests/TemporaryProjectWorkarea.cs index 370da3440..243e9fcb1 100644 --- a/tests/MessagePack.Generator.Tests/TemporaryProjectWorkarea.cs +++ b/tests/MessagePack.Generator.Tests/TemporaryProjectWorkarea.cs @@ -228,8 +228,7 @@ public void ExecuteWithGeneratedAssembly(Action a var assemblyLoadContext = new AssemblyLoadContext($"TempProject-{workarea.WorkareaId}", isCollectible: true); try { - assemblyLoadContext.LoadFromStream(memoryStream); - var assembly = assemblyLoadContext.Assemblies.First(); + Assembly assembly = assemblyLoadContext.LoadFromStream(memoryStream); action(assemblyLoadContext, assembly); } finally From d0b140960c9a48ed8ca4815c9441d17a94608310 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sat, 21 Aug 2021 12:17:30 -0600 Subject: [PATCH 100/161] Do not use extension method syntax --- .../AssemblyExtensions.cs | 16 ------------ .../GenerateKeyedFormatterTest.cs | 4 +-- .../GenerateStringKeyedFormatterTest.cs | 26 +++++++++---------- .../TestUtilities.cs | 22 ++++++++++++++++ 4 files changed, 37 insertions(+), 31 deletions(-) delete mode 100644 tests/MessagePack.Generator.Tests/AssemblyExtensions.cs create mode 100644 tests/MessagePack.Generator.Tests/TestUtilities.cs diff --git a/tests/MessagePack.Generator.Tests/AssemblyExtensions.cs b/tests/MessagePack.Generator.Tests/AssemblyExtensions.cs deleted file mode 100644 index f6afd71af..000000000 --- a/tests/MessagePack.Generator.Tests/AssemblyExtensions.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) All contributors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -using System.Reflection; - -namespace MessagePack.Generator.Tests -{ - internal static class AssemblyExtensions - { - public static IFormatterResolver GetResolverInstance(this Assembly assembly, string name) - { - var resolverType = assembly.GetType(name); - return (IFormatterResolver)resolverType.GetField("Instance", BindingFlags.Static | BindingFlags.Public).GetValue(null); - } - } -} diff --git a/tests/MessagePack.Generator.Tests/GenerateKeyedFormatterTest.cs b/tests/MessagePack.Generator.Tests/GenerateKeyedFormatterTest.cs index f81ef6802..502093263 100644 --- a/tests/MessagePack.Generator.Tests/GenerateKeyedFormatterTest.cs +++ b/tests/MessagePack.Generator.Tests/GenerateKeyedFormatterTest.cs @@ -66,7 +66,7 @@ await compiler.GenerateFileAsync( var options = MessagePackSerializerOptions.Standard .WithResolver(CompositeResolver.Create( StandardResolver.Instance, - assembly.GetResolverInstance("TempProject.Generated.Resolvers.TempProjectResolver"))); + TestUtilities.GetResolverInstance(assembly, "TempProject.Generated.Resolvers.TempProjectResolver"))); // Build `[]` var seq = new Sequence(); @@ -140,7 +140,7 @@ await compiler.GenerateFileAsync( var options = MessagePackSerializerOptions.Standard .WithResolver(CompositeResolver.Create( StandardResolver.Instance, - assembly.GetResolverInstance("TempProject.Generated.Resolvers.TempProjectResolver"))); + TestUtilities.GetResolverInstance(assembly, "TempProject.Generated.Resolvers.TempProjectResolver"))); // Build `[-1, "foobar"]` var seq = new Sequence(); diff --git a/tests/MessagePack.Generator.Tests/GenerateStringKeyedFormatterTest.cs b/tests/MessagePack.Generator.Tests/GenerateStringKeyedFormatterTest.cs index cd914fbd6..1719fb5fa 100644 --- a/tests/MessagePack.Generator.Tests/GenerateStringKeyedFormatterTest.cs +++ b/tests/MessagePack.Generator.Tests/GenerateStringKeyedFormatterTest.cs @@ -67,7 +67,7 @@ await compiler.GenerateFileAsync( var options = MessagePackSerializerOptions.Standard .WithResolver(CompositeResolver.Create( StandardResolver.Instance, - assembly.GetResolverInstance("TempProject.Generated.Resolvers.TempProjectResolver"))); + TestUtilities.GetResolverInstance(assembly, "TempProject.Generated.Resolvers.TempProjectResolver"))); // Build `{ }`. var seq = new Sequence(); @@ -132,7 +132,7 @@ await compiler.GenerateFileAsync( var options = MessagePackSerializerOptions.Standard .WithResolver(CompositeResolver.Create( StandardResolver.Instance, - assembly.GetResolverInstance("TempProject.Generated.Resolvers.TempProjectResolver"))); + TestUtilities.GetResolverInstance(assembly, "TempProject.Generated.Resolvers.TempProjectResolver"))); // Build `{ "A": -1, "B": "foobar" }`. var seq = new Sequence(); @@ -192,7 +192,7 @@ await compiler.GenerateFileAsync( var options = MessagePackSerializerOptions.Standard .WithResolver(CompositeResolver.Create( StandardResolver.Instance, - assembly.GetResolverInstance("TempProject.Generated.Resolvers.TempProjectResolver"))); + TestUtilities.GetResolverInstance(assembly, "TempProject.Generated.Resolvers.TempProjectResolver"))); // Build `{ "A": -1, "B": "foobar" }`. var seq = new Sequence(); @@ -252,7 +252,7 @@ await compiler.GenerateFileAsync( var options = MessagePackSerializerOptions.Standard .WithResolver(CompositeResolver.Create( StandardResolver.Instance, - assembly.GetResolverInstance("TempProject.Generated.Resolvers.TempProjectResolver"))); + TestUtilities.GetResolverInstance(assembly, "TempProject.Generated.Resolvers.TempProjectResolver"))); // Build `{ }`. var seq = new Sequence(); @@ -309,7 +309,7 @@ await compiler.GenerateFileAsync( var options = MessagePackSerializerOptions.Standard .WithResolver(CompositeResolver.Create( StandardResolver.Instance, - assembly.GetResolverInstance("TempProject.Generated.Resolvers.TempProjectResolver"))); + TestUtilities.GetResolverInstance(assembly, "TempProject.Generated.Resolvers.TempProjectResolver"))); // Build an empty data. var seq = new Sequence(); @@ -375,7 +375,7 @@ await compiler.GenerateFileAsync( var options = MessagePackSerializerOptions.Standard .WithResolver(CompositeResolver.Create( StandardResolver.Instance, - assembly.GetResolverInstance("TempProject.Generated.Resolvers.TempProjectResolver"))); + TestUtilities.GetResolverInstance(assembly, "TempProject.Generated.Resolvers.TempProjectResolver"))); // Build `{ "A": -1 }` var seq = new Sequence(); @@ -449,7 +449,7 @@ await compiler.GenerateFileAsync( var options = MessagePackSerializerOptions.Standard .WithResolver(CompositeResolver.Create( StandardResolver.Instance, - assembly.GetResolverInstance("TempProject.Generated.Resolvers.TempProjectResolver"))); + TestUtilities.GetResolverInstance(assembly, "TempProject.Generated.Resolvers.TempProjectResolver"))); // Build `{ "A": -1, "B": "foobar" }` var seq = new Sequence(); @@ -518,7 +518,7 @@ await compiler.GenerateFileAsync( var options = MessagePackSerializerOptions.Standard .WithResolver(CompositeResolver.Create( StandardResolver.Instance, - assembly.GetResolverInstance("TempProject.Generated.Resolvers.TempProjectResolver"))); + TestUtilities.GetResolverInstance(assembly, "TempProject.Generated.Resolvers.TempProjectResolver"))); // Build `{ "A": -1, "B": "foobar" }` var seq = new Sequence(); @@ -583,7 +583,7 @@ await compiler.GenerateFileAsync( var options = MessagePackSerializerOptions.Standard .WithResolver(CompositeResolver.Create( StandardResolver.Instance, - assembly.GetResolverInstance("TempProject.Generated.Resolvers.TempProjectResolver"))); + TestUtilities.GetResolverInstance(assembly, "TempProject.Generated.Resolvers.TempProjectResolver"))); // Build `{ "A": -1, "B": "foobar" }` var seq = new Sequence(); @@ -649,7 +649,7 @@ await compiler.GenerateFileAsync( var options = MessagePackSerializerOptions.Standard .WithResolver(CompositeResolver.Create( StandardResolver.Instance, - assembly.GetResolverInstance("TempProject.Generated.Resolvers.TempProjectResolver"))); + TestUtilities.GetResolverInstance(assembly, "TempProject.Generated.Resolvers.TempProjectResolver"))); // Build `{ "A": -1, "B": "foobar" }` var seq = new Sequence(); @@ -718,7 +718,7 @@ await compiler.GenerateFileAsync( var options = MessagePackSerializerOptions.Standard .WithResolver(CompositeResolver.Create( StandardResolver.Instance, - assembly.GetResolverInstance("TempProject.Generated.Resolvers.TempProjectResolver"))); + TestUtilities.GetResolverInstance(assembly, "TempProject.Generated.Resolvers.TempProjectResolver"))); // Build `{ "A": -1, "B": "foobar" }` var seq = new Sequence(); @@ -785,7 +785,7 @@ await compiler.GenerateFileAsync( var options = MessagePackSerializerOptions.Standard .WithResolver(CompositeResolver.Create( StandardResolver.Instance, - assembly.GetResolverInstance("TempProject.Generated.Resolvers.TempProjectResolver"))); + TestUtilities.GetResolverInstance(assembly, "TempProject.Generated.Resolvers.TempProjectResolver"))); // Build `{ "A": -1 }` var seq = new Sequence(); @@ -847,7 +847,7 @@ await compiler.GenerateFileAsync( var options = MessagePackSerializerOptions.Standard .WithResolver(CompositeResolver.Create( StandardResolver.Instance, - assembly.GetResolverInstance("TempProject.Generated.Resolvers.TempProjectResolver"))); + TestUtilities.GetResolverInstance(assembly, "TempProject.Generated.Resolvers.TempProjectResolver"))); // Build `{ "A": -1 }` var seq = new Sequence(); diff --git a/tests/MessagePack.Generator.Tests/TestUtilities.cs b/tests/MessagePack.Generator.Tests/TestUtilities.cs new file mode 100644 index 000000000..ad6bb13f5 --- /dev/null +++ b/tests/MessagePack.Generator.Tests/TestUtilities.cs @@ -0,0 +1,22 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System.Reflection; + +namespace MessagePack.Generator.Tests +{ + internal static class TestUtilities + { + /// + /// Fetches the static instance of the named resolver, by its Instance property. + /// + /// The assembly to retrieve the resolver from. + /// The full name of the resolver. + /// The resolver. + internal static IFormatterResolver GetResolverInstance(Assembly assembly, string name) + { + var resolverType = assembly.GetType(name); + return (IFormatterResolver)resolverType.GetField("Instance", BindingFlags.Static | BindingFlags.Public).GetValue(null); + } + } +} From 9f64926de7e176a134c1464b8b44f121472b6856 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sat, 21 Aug 2021 12:43:51 -0600 Subject: [PATCH 101/161] Add test for a DCS type with a private, readonly dictionary Repro for #1308 --- .../Tests/ShareTests/DataContractTest.cs | 54 ++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/DataContractTest.cs b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/DataContractTest.cs index 87175888d..9af050db1 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/DataContractTest.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/DataContractTest.cs @@ -3,18 +3,27 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Runtime.Serialization; using System.Text; using System.Threading.Tasks; +using MessagePack.Resolvers; using Xunit; +using Xunit.Abstractions; namespace MessagePack.Tests { #if !ENABLE_IL2CPP - public class DataContractTest { + private readonly ITestOutputHelper logger; + + public DataContractTest(ITestOutputHelper logger) + { + this.logger = logger; + } + [DataContract] public class MyClass { @@ -65,6 +74,23 @@ public class ClassWithPublicMembersWithoutAttributes public int IgnoredField; } + [DataContract] + public class ClassWithPrivateReadonlyDictionary + { + [DataMember(Name = "Key", Order = 0, EmitDefaultValue = false)] + private readonly Guid? key; + + [DataMember(Name = "Body", Order = 1, EmitDefaultValue = false)] + private readonly Dictionary body = new Dictionary(); + + public ClassWithPrivateReadonlyDictionary(Guid? key) + { + this.key = key; + } + + internal Dictionary GetBody() => this.body; + } + [Fact] public void SerializeOrder() { @@ -134,6 +160,32 @@ public void Serialize_WithVariousAttributes() MessagePackSerializer.ConvertToJson(bin).Is(@"{""AttributedProperty"":1,""AttributedField"":4}"); } + + [Fact] + public void DeserializeTypeWithPrivateReadonlyDictionary() + { + var before = new ClassWithPrivateReadonlyDictionary(Guid.NewGuid()); + before.GetBody()["name"] = "my name"; + byte[] bytes = MessagePackSerializer.Serialize(before, StandardResolverAllowPrivate.Options); + string json = MessagePackSerializer.ConvertToJson(bytes); // just for check that json has _body' values. + this.logger.WriteLine(json); + + var after = MessagePackSerializer.Deserialize(bytes, StandardResolverAllowPrivate.Options); + Assert.Equal("my name", after.GetBody()["name"]); + } + + [Fact] + public void DeserializeTypeWithPrivateReadonlyDictionary_DCS() + { + var before = new ClassWithPrivateReadonlyDictionary(Guid.NewGuid()); + before.GetBody()["name"] = "my name"; + DataContractSerializer dcs = new DataContractSerializer(typeof(ClassWithPrivateReadonlyDictionary)); + using var ms = new MemoryStream(); + dcs.WriteObject(ms, before); + ms.Position = 0; + var after = (ClassWithPrivateReadonlyDictionary)dcs.ReadObject(ms); + Assert.Equal("my name", after.GetBody()["name"]); + } } #endif From 6e4fd8d2c25d915c5a6fab913e49734254175dff Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sat, 21 Aug 2021 20:48:46 -0600 Subject: [PATCH 102/161] Remove string interning by default It is still available via the `StringInterningFormatter`, which can be turned on by default by aggregating a custom resolver, or by specifying this on a `[Key]` or `[DataMember]` member: ```cs [MessagePackFormatter(typeof(StringInterningFormatter))] ``` --- .../Formatters/StringInterningFormatter.cs | 6 - .../MessagePack/Resolvers/BuiltinResolver.cs | 2 +- .../StringInterningResolverTests.cs | 64 ----------- .../Tests/ShareTests/StringInterningTests.cs | 107 ++++++++++++++++++ .../net5.0/PublicAPI.Unshipped.txt | 2 +- .../netcoreapp2.1/PublicAPI.Unshipped.txt | 2 +- .../netcoreapp3.1/PublicAPI.Unshipped.txt | 2 +- .../netstandard2.0/PublicAPI.Unshipped.txt | 2 +- 8 files changed, 112 insertions(+), 75 deletions(-) delete mode 100644 src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/StringInterningResolverTests.cs create mode 100644 src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/StringInterningTests.cs diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/StringInterningFormatter.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/StringInterningFormatter.cs index 17a0ab299..9e07521b7 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/StringInterningFormatter.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/StringInterningFormatter.cs @@ -11,12 +11,6 @@ namespace MessagePack.Formatters /// public sealed class StringInterningFormatter : IMessagePackFormatter { - public static readonly StringInterningFormatter Instance = new StringInterningFormatter(); - - private StringInterningFormatter() - { - } - /// public string Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) { diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/BuiltinResolver.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/BuiltinResolver.cs index a613126b3..000b9fbdb 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/BuiltinResolver.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/BuiltinResolver.cs @@ -82,7 +82,7 @@ internal static class BuiltinResolverGetFormatterHelper { typeof(char?), NullableCharFormatter.Instance }, // StandardClassLibraryFormatter - { typeof(string), StringInterningFormatter.Instance }, + { typeof(string), NullableStringFormatter.Instance }, { typeof(decimal), DecimalFormatter.Instance }, { typeof(decimal?), new StaticNullableFormatter(DecimalFormatter.Instance) }, { typeof(TimeSpan), TimeSpanFormatter.Instance }, diff --git a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/StringInterningResolverTests.cs b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/StringInterningResolverTests.cs deleted file mode 100644 index b7d93bf8b..000000000 --- a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/StringInterningResolverTests.cs +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) All contributors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -using MessagePack.Resolvers; -using Nerdbank.Streams; -using Xunit; - -namespace MessagePack.Tests -{ - public class StringInterningResolverTests - { - [Fact] - public void NullString() - { - var seq = new Sequence(); - var writer = new MessagePackWriter(seq); - writer.WriteNil(); - writer.Flush(); - - var reader = new MessagePackReader(seq); - string result = StandardResolver.Instance.GetFormatter().Deserialize(ref reader, MessagePackSerializerOptions.Standard); - Assert.Null(result); - } - - [Fact] - public void EmptyString() - { - var seq = new Sequence(); - var writer = new MessagePackWriter(seq); - writer.Write(string.Empty); - writer.Flush(); - - var reader = new MessagePackReader(seq); - string result = StandardResolver.Instance.GetFormatter().Deserialize(ref reader, MessagePackSerializerOptions.Standard); - Assert.Same(string.Empty, result); - } - - [Theory] - [InlineData(3)] - [InlineData(1024 * 1024)] - public void EquivalentStringsGetSharedInstance(int length) - { - string originalValue1 = new string('a', length); - string originalValue3 = new string('b', length); - var seq = new Sequence(); - var writer = new MessagePackWriter(seq); - writer.Write(originalValue1); - writer.Write(originalValue1); - writer.Write(originalValue3); - writer.Flush(); - - var reader = new MessagePackReader(seq); - var formatter = StandardResolver.Instance.GetFormatter(); - string value1 = formatter.Deserialize(ref reader, MessagePackSerializerOptions.Standard); - string value2 = formatter.Deserialize(ref reader, MessagePackSerializerOptions.Standard); - string value3 = formatter.Deserialize(ref reader, MessagePackSerializerOptions.Standard); - - Assert.Equal(originalValue1, value1); - Assert.Equal(originalValue3, value3); - - Assert.Same(value1, value2); - } - } -} diff --git a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/StringInterningTests.cs b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/StringInterningTests.cs new file mode 100644 index 000000000..d4e98f77a --- /dev/null +++ b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/StringInterningTests.cs @@ -0,0 +1,107 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using MessagePack.Formatters; +using MessagePack.Resolvers; +using Nerdbank.Streams; +using Xunit; + +namespace MessagePack.Tests +{ + public class StringInterningTests + { + [Fact] + public void NullString() + { + var seq = new Sequence(); + var writer = new MessagePackWriter(seq); + writer.WriteNil(); + writer.Flush(); + + var reader = new MessagePackReader(seq); + string result = StandardResolver.Instance.GetFormatter().Deserialize(ref reader, MessagePackSerializerOptions.Standard); + Assert.Null(result); + } + + [Fact] + public void EmptyString() + { + var seq = new Sequence(); + var writer = new MessagePackWriter(seq); + writer.Write(string.Empty); + writer.Flush(); + + var reader = new MessagePackReader(seq); + string result = StandardResolver.Instance.GetFormatter().Deserialize(ref reader, MessagePackSerializerOptions.Standard); + Assert.Same(string.Empty, result); + } + + [Theory] + [InlineData(3)] + [InlineData(1024 * 1024)] + public void EquivalentStringsGetSharedInstance(int length) + { + string originalValue1 = new string('a', length); + string originalValue3 = new string('b', length); + var seq = new Sequence(); + var writer = new MessagePackWriter(seq); + writer.Write(originalValue1); + writer.Write(originalValue1); + writer.Write(originalValue3); + writer.Flush(); + + var reader = new MessagePackReader(seq); + var formatter = new StringInterningFormatter(); + string value1 = formatter.Deserialize(ref reader, MessagePackSerializerOptions.Standard); + string value2 = formatter.Deserialize(ref reader, MessagePackSerializerOptions.Standard); + string value3 = formatter.Deserialize(ref reader, MessagePackSerializerOptions.Standard); + + Assert.Equal(originalValue1, value1); + Assert.Equal(originalValue3, value3); + + Assert.Same(value1, value2); + } + + [Fact] + public void StringMemberInterning() + { + ClassOfStrings before = new ClassOfStrings { InternedString = "abc", OrdinaryString = "def" }; + ClassOfStrings after1 = MessagePackSerializer.Deserialize(MessagePackSerializer.Serialize(before, MessagePackSerializerOptions.Standard), MessagePackSerializerOptions.Standard); + ClassOfStrings after2 = MessagePackSerializer.Deserialize(MessagePackSerializer.Serialize(before, MessagePackSerializerOptions.Standard), MessagePackSerializerOptions.Standard); + Assert.Equal(after1.InternedString, after2.InternedString); + Assert.Equal(after1.OrdinaryString, after2.OrdinaryString); + + Assert.Same(after1.InternedString, after2.InternedString); + Assert.NotSame(after1.OrdinaryString, after2.OrdinaryString); + } + + [Fact] + public void StringMemberInterning_CustomResolver() + { + var options = MessagePackSerializerOptions.Standard.WithResolver( + CompositeResolver.Create( + new IMessagePackFormatter[] { new StringInterningFormatter() }, + new IFormatterResolver[] { StandardResolver.Instance })); + + ClassOfStrings before = new ClassOfStrings { InternedString = "abc", OrdinaryString = "def" }; + ClassOfStrings after1 = MessagePackSerializer.Deserialize(MessagePackSerializer.Serialize(before, options), options); + ClassOfStrings after2 = MessagePackSerializer.Deserialize(MessagePackSerializer.Serialize(before, options), options); + Assert.Equal(after1.InternedString, after2.InternedString); + Assert.Equal(after1.OrdinaryString, after2.OrdinaryString); + + Assert.Same(after1.InternedString, after2.InternedString); + Assert.Same(after1.OrdinaryString, after2.OrdinaryString); + } + + [MessagePackObject] + public class ClassOfStrings + { + [Key(0)] + [MessagePackFormatter(typeof(StringInterningFormatter))] + public string InternedString { get; set; } + + [Key(1)] + public string OrdinaryString { get; set; } + } + } +} diff --git a/src/MessagePack/net5.0/PublicAPI.Unshipped.txt b/src/MessagePack/net5.0/PublicAPI.Unshipped.txt index e314ad873..e04348f79 100644 --- a/src/MessagePack/net5.0/PublicAPI.Unshipped.txt +++ b/src/MessagePack/net5.0/PublicAPI.Unshipped.txt @@ -9,6 +9,7 @@ MessagePack.Formatters.InterfaceReadOnlySetFormatter.InterfaceReadOnlySetForm MessagePack.Formatters.StringInterningFormatter MessagePack.Formatters.StringInterningFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> string MessagePack.Formatters.StringInterningFormatter.Serialize(ref MessagePack.MessagePackWriter writer, string value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.StringInterningFormatter.StringInterningFormatter() -> void MessagePack.MessagePackReader.MessagePackReader() -> void MessagePack.MessagePackSerializerOptions.SequencePool.get -> MessagePack.SequencePool MessagePack.MessagePackSerializerOptions.WithPool(MessagePack.SequencePool pool) -> MessagePack.MessagePackSerializerOptions @@ -24,7 +25,6 @@ MessagePack.TinyJsonException.TinyJsonException(System.Runtime.Serialization.Ser static MessagePack.Nil.operator !=(MessagePack.Nil left, MessagePack.Nil right) -> bool static MessagePack.Nil.operator ==(MessagePack.Nil left, MessagePack.Nil right) -> bool static readonly MessagePack.Formatters.HalfFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter -static readonly MessagePack.Formatters.StringInterningFormatter.Instance -> MessagePack.Formatters.StringInterningFormatter virtual MessagePack.MessagePackStreamReader.Dispose(bool disposing) -> void MessagePack.Formatters.GenericEnumerableFormatter MessagePack.Formatters.GenericEnumerableFormatter.GenericEnumerableFormatter() -> void diff --git a/src/MessagePack/netcoreapp2.1/PublicAPI.Unshipped.txt b/src/MessagePack/netcoreapp2.1/PublicAPI.Unshipped.txt index 8f0dff9e8..b44f24ad2 100644 --- a/src/MessagePack/netcoreapp2.1/PublicAPI.Unshipped.txt +++ b/src/MessagePack/netcoreapp2.1/PublicAPI.Unshipped.txt @@ -4,6 +4,7 @@ MessagePack.FormatterNotRegisteredException.FormatterNotRegisteredException(Syst MessagePack.Formatters.StringInterningFormatter MessagePack.Formatters.StringInterningFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> string MessagePack.Formatters.StringInterningFormatter.Serialize(ref MessagePack.MessagePackWriter writer, string value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.StringInterningFormatter.StringInterningFormatter() -> void MessagePack.MessagePackReader.MessagePackReader() -> void MessagePack.MessagePackSerializerOptions.SequencePool.get -> MessagePack.SequencePool MessagePack.MessagePackSerializerOptions.WithPool(MessagePack.SequencePool pool) -> MessagePack.MessagePackSerializerOptions @@ -16,7 +17,6 @@ MessagePack.SequencePool.SequencePool(int maxSize, System.Buffers.ArrayPool void static MessagePack.Nil.operator !=(MessagePack.Nil left, MessagePack.Nil right) -> bool static MessagePack.Nil.operator ==(MessagePack.Nil left, MessagePack.Nil right) -> bool -static readonly MessagePack.Formatters.StringInterningFormatter.Instance -> MessagePack.Formatters.StringInterningFormatter virtual MessagePack.MessagePackStreamReader.Dispose(bool disposing) -> void MessagePack.Formatters.GenericEnumerableFormatter MessagePack.Formatters.GenericEnumerableFormatter.GenericEnumerableFormatter() -> void diff --git a/src/MessagePack/netcoreapp3.1/PublicAPI.Unshipped.txt b/src/MessagePack/netcoreapp3.1/PublicAPI.Unshipped.txt index 85cc22a91..cfbfc2d15 100644 --- a/src/MessagePack/netcoreapp3.1/PublicAPI.Unshipped.txt +++ b/src/MessagePack/netcoreapp3.1/PublicAPI.Unshipped.txt @@ -4,6 +4,7 @@ MessagePack.FormatterNotRegisteredException.FormatterNotRegisteredException(Syst MessagePack.Formatters.StringInterningFormatter MessagePack.Formatters.StringInterningFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> string MessagePack.Formatters.StringInterningFormatter.Serialize(ref MessagePack.MessagePackWriter writer, string value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.StringInterningFormatter.StringInterningFormatter() -> void MessagePack.MessagePackReader.MessagePackReader() -> void MessagePack.MessagePackSerializerOptions.SequencePool.get -> MessagePack.SequencePool MessagePack.MessagePackSerializerOptions.WithPool(MessagePack.SequencePool pool) -> MessagePack.MessagePackSerializerOptions @@ -18,7 +19,6 @@ MessagePack.SequencePool.SequencePool(int maxSize, System.Buffers.ArrayPool void static MessagePack.Nil.operator !=(MessagePack.Nil left, MessagePack.Nil right) -> bool static MessagePack.Nil.operator ==(MessagePack.Nil left, MessagePack.Nil right) -> bool -static readonly MessagePack.Formatters.StringInterningFormatter.Instance -> MessagePack.Formatters.StringInterningFormatter virtual MessagePack.MessagePackStreamReader.Dispose(bool disposing) -> void MessagePack.Formatters.GenericEnumerableFormatter MessagePack.Formatters.GenericEnumerableFormatter.GenericEnumerableFormatter() -> void diff --git a/src/MessagePack/netstandard2.0/PublicAPI.Unshipped.txt b/src/MessagePack/netstandard2.0/PublicAPI.Unshipped.txt index 85cc22a91..cfbfc2d15 100644 --- a/src/MessagePack/netstandard2.0/PublicAPI.Unshipped.txt +++ b/src/MessagePack/netstandard2.0/PublicAPI.Unshipped.txt @@ -4,6 +4,7 @@ MessagePack.FormatterNotRegisteredException.FormatterNotRegisteredException(Syst MessagePack.Formatters.StringInterningFormatter MessagePack.Formatters.StringInterningFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> string MessagePack.Formatters.StringInterningFormatter.Serialize(ref MessagePack.MessagePackWriter writer, string value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.StringInterningFormatter.StringInterningFormatter() -> void MessagePack.MessagePackReader.MessagePackReader() -> void MessagePack.MessagePackSerializerOptions.SequencePool.get -> MessagePack.SequencePool MessagePack.MessagePackSerializerOptions.WithPool(MessagePack.SequencePool pool) -> MessagePack.MessagePackSerializerOptions @@ -18,7 +19,6 @@ MessagePack.SequencePool.SequencePool(int maxSize, System.Buffers.ArrayPool void static MessagePack.Nil.operator !=(MessagePack.Nil left, MessagePack.Nil right) -> bool static MessagePack.Nil.operator ==(MessagePack.Nil left, MessagePack.Nil right) -> bool -static readonly MessagePack.Formatters.StringInterningFormatter.Instance -> MessagePack.Formatters.StringInterningFormatter virtual MessagePack.MessagePackStreamReader.Dispose(bool disposing) -> void MessagePack.Formatters.GenericEnumerableFormatter MessagePack.Formatters.GenericEnumerableFormatter.GenericEnumerableFormatter() -> void From 6635df63af11237c296b11cd23b429f0ddf7c50d Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sat, 21 Aug 2021 21:05:18 -0600 Subject: [PATCH 103/161] Document string interning --- README.md | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/README.md b/README.md index 8a51d7877..a4bccec76 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,7 @@ MessagePack has a compact binary size and a full set of general purpose expressi - [Security](#security) - [Performance](#performance) - [Deserialization Performance for different options](#deserialization-performance-for-different-options) + - [String interning](#string-interning) - [LZ4 Compression](#lz4-compression) - [Attributions](#attributions) - [Comparison with protobuf, JSON, ZeroFormatter](#comparison-with-protobuf-json-zeroformatter) @@ -758,6 +759,49 @@ Extra note, this is serialization benchmark result. Of course, `IntKey` is fastest but `StringKey` also performs reasonably well. +### String interning + +The msgpack format does not provide for reusing strings in the data stream. +This naturally leads the deserializer to create a new `string` object for every string encountered, +even if it is equal to another string previously encountered. + +When deserializing data that may contain the same strings repeatedly it can be worthwhile +to have the deserializer take a little extra time to check whether it has seen a given string before +and reuse it if it has. + +To enable string interning on *all* string values, use a resolver that specifies `StringInterningFormatter` +before any of the standard ones, like this: + +```cs +var options = MessagePackSerializerOptions.Standard.WithResolver( + CompositeResolver.Create( + new IMessagePackFormatter[] { new StringInterningFormatter() }, + new IFormatterResolver[] { StandardResolver.Instance })); + +MessagePackSerializer.Deserialize(data, options); +``` + +If you know which fields of a particular type are likely to contain duplicate strings, +you can apply the string interning formatter to just those fields so the deserializer only pays +for the interned string check where it matters most. +Note that this technique requires a `[MessagePackObject]` or `[DataContract]` class. + +```cs +[MessagePackObject] +public class ClassOfStrings +{ + [Key(0)] + [MessagePackFormatter(typeof(StringInterningFormatter))] + public string InternedString { get; set; } + + [Key(1)] + public string OrdinaryString { get; set; } +} +``` + +If you are writing your own formatter for some type that contains strings, +you can call on the `StringInterningFormatter` directly from your formatter as well for the strings. + ## LZ4 Compression MessagePack is a fast and *compact* format but it is not compression. [LZ4](https://github.com/lz4/lz4) is an extremely fast compression algorithm, and using it MessagePack for C# can achieve extremely fast performance as well as extremely compact binary sizes! From 49fa946120dce638fa0683e0f99f03e1a62a0f2a Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sat, 21 Aug 2021 18:03:06 -0600 Subject: [PATCH 104/161] Allows client code to avoid tripping over StandardResolver In AOT-only environments it seems it was impossible to avoid loading `StandardResolver` because the `MessagePackSerializer` had a static property with an initializer that loaded the `StandardResolver`. After this change, if the `DefaultOptions` getter is never called, or its setter is called first, then the `StandardResolver` can be avoided. Fixes #832 --- .../Scripts/MessagePack/MessagePackSerializer.cs | 16 +++++++++++++++- .../MessagePack/MessagePackSerializerOptions.cs | 2 +- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.cs index 0e0188cff..93acd6688 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.cs @@ -20,6 +20,7 @@ public static partial class MessagePackSerializer { private const int LZ4NotCompressionSizeInLz4BlockType = 64; private const int MaxHintSize = 1024 * 1024; + private static MessagePackSerializerOptions defaultOptions; /// /// Gets or sets the default set of options to use when not explicitly specified for a method call. @@ -33,7 +34,20 @@ public static partial class MessagePackSerializer /// If you are an app author, realize that setting this property impacts the entire application so it should only be /// set once, and before any use of occurs. /// - public static MessagePackSerializerOptions DefaultOptions { get; set; } = MessagePackSerializerOptions.Standard; + public static MessagePackSerializerOptions DefaultOptions + { + get + { + if (defaultOptions is null) + { + defaultOptions = MessagePackSerializerOptions.Standard; + } + + return defaultOptions; + } + + set => defaultOptions = value; + } /// /// A thread-local, recyclable array that may be used for short bursts of code. diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs index ebf1ca43b..211874c49 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs @@ -38,7 +38,7 @@ public class MessagePackSerializerOptions /// /// Initializes a new instance of the class. /// - protected internal MessagePackSerializerOptions(IFormatterResolver resolver) + public MessagePackSerializerOptions(IFormatterResolver resolver) { this.Resolver = resolver ?? throw new ArgumentNullException(nameof(resolver)); } From 4e6b915fa3a8a65be40f70bcfd4299f5d48a5efb Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sat, 21 Aug 2021 17:38:45 -0600 Subject: [PATCH 105/161] Skip setting fields when the ctor already took the value Fixes #1308 --- .../Resolvers/DynamicObjectResolver.cs | 20 ++++++++++++++++--- .../Tests/ShareTests/DataContractTest.cs | 2 +- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs index 0500eba26..62a34d7ae 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs @@ -953,7 +953,7 @@ private static void BuildDeserializeInternalAssignFieldFromLocalVariableStringKe { foreach (var item in infoList) { - if (item.MemberInfo == null || item.IsInitializedLocalVariable == null) + if (item.MemberInfo == null || item.IsInitializedLocalVariable == null || item.MemberInfo.IsWrittenByConstructor) { continue; } @@ -995,6 +995,11 @@ private static void BuildDeserializeInternalAssignFieldFromLocalVariableIntKey(O continue; } + if (item.MemberInfo.IsWrittenByConstructor) + { + continue; + } + // if (length <= key) { goto MEMBER_ASSIGNMENT_DONE; } il.EmitLdloc(localLength); il.EmitLdc_I4(key); @@ -1786,7 +1791,7 @@ EmittableMember CreateEmittableMember(MemberInfo m) { FieldInfo = field, IsReadable = allowPrivate || field.IsPublic, - IsWritable = (allowPrivate || field.IsPublic) && !field.IsInitOnly, + IsWritable = allowPrivate || (field.IsPublic && !field.IsInitOnly), }; break; default: @@ -2066,7 +2071,14 @@ EmittableMember CreateEmittableMember(MemberInfo m) } var shouldUseFormatterResolver = false; - var membersArray = members.Where(m => m.IsExplicitContract || constructorParameters.Any(p => p.MemberInfo.Equals(m)) || m.IsWritable).ToArray(); + + // Mark each member that will be set by way of the constructor. + foreach (var item in constructorParameters) + { + item.MemberInfo.IsWrittenByConstructor = true; + } + + var membersArray = members.Where(m => m.IsExplicitContract || m.IsWrittenByConstructor || m.IsWritable).ToArray(); foreach (var member in membersArray) { if (IsOptimizeTargetType(member.Type)) @@ -2219,6 +2231,8 @@ public bool IsField public bool IsWritable { get; set; } + public bool IsWrittenByConstructor { get; set; } + /// /// Gets a value indicating whether the property can only be set by an object initializer, a constructor, or another `init` member. /// diff --git a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/DataContractTest.cs b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/DataContractTest.cs index ebc8697e6..c14649e30 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/DataContractTest.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/DataContractTest.cs @@ -247,7 +247,7 @@ public void DeserializeTypeWithPrivateReadonlyDictionary_DCS() var before = new ClassWithPrivateReadonlyDictionary(Guid.NewGuid()); before.GetBody()["name"] = "my name"; DataContractSerializer dcs = new DataContractSerializer(typeof(ClassWithPrivateReadonlyDictionary)); - using var ms = new MemoryStream(); + var ms = new MemoryStream(); dcs.WriteObject(ms, before); ms.Position = 0; var after = (ClassWithPrivateReadonlyDictionary)dcs.ReadObject(ms); From 5dc5feed0abdd423d7b8fe222b9c2a3ac96a86ae Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sat, 21 Aug 2021 21:19:56 -0600 Subject: [PATCH 106/161] Fix unity build --- .../Assets/Scripts/Tests/Shims/XUnit.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/Tests/Shims/XUnit.cs b/src/MessagePack.UnityClient/Assets/Scripts/Tests/Shims/XUnit.cs index 569cd3b42..ef9a80b49 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/Tests/Shims/XUnit.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/Tests/Shims/XUnit.cs @@ -122,6 +122,11 @@ public static void Same(object expected, object actual) { NUnit.Framework.Assert.AreSame(expected, actual); } + + public static void NotSame(object expected, object actual) + { + NUnit.Framework.Assert.AreNotSame(expected, actual); + } } [Serializable] From 8563c84f68b6c0b89448f617bd269a9c401a62d4 Mon Sep 17 00:00:00 2001 From: Marek Ott <46067021+marekott@users.noreply.github.com> Date: Fri, 27 Aug 2021 11:51:46 +0200 Subject: [PATCH 107/161] Fixed typo in README.MD --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8a51d7877..5440487c3 100644 --- a/README.md +++ b/README.md @@ -699,7 +699,7 @@ Benchmarks comparing MessagePack For C# to other serializers were run on `Window * Avoid string key decoding for lookup maps (string key and use automata based name lookup with inlined IL code generation, see: [AutomataDictionary](https://github.com/neuecc/MessagePack-CSharp/blob/bcedbce3fd98cb294210d6b4a22bdc4c75ccd916/src/MessagePack/Internal/AutomataDictionary.cs) * To encode string keys, use pre-generated member name bytes and fixed sized byte array copies in IL, see: [UnsafeMemory.cs](https://github.com/neuecc/MessagePack-CSharp/blob/f17ddc5d107d3a2f66f60398b214ef87919ff892/src/MessagePack/Internal/UnsafeMemory.cs) -Before creating this library, I implemented a fast fast serializer with [ZeroFormatter#Performance](https://github.com/neuecc/ZeroFormatter#performance). This is a further evolved implementation. MessagePack for C# is always fast and optimized for all types (primitive, small struct, large object, any collections). +Before creating this library, I implemented a fast serializer with [ZeroFormatter#Performance](https://github.com/neuecc/ZeroFormatter#performance). This is a further evolved implementation. MessagePack for C# is always fast and optimized for all types (primitive, small struct, large object, any collections). ### Deserialization Performance for different options From e2c83c485ecfaca09ca0864a87dcbc561cd591bf Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 20 Sep 2021 08:02:22 -0600 Subject: [PATCH 108/161] Show build status of last build of master --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 659e0f7fc..e5730bae4 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [![Releases](https://img.shields.io/github/release/neuecc/MessagePack-CSharp.svg)][Releases] [![Join the chat at https://gitter.im/MessagePack-CSharp/Lobby](https://badges.gitter.im/MessagePack-CSharp/Lobby.svg)](https://gitter.im/MessagePack-CSharp/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) -[![Build Status](https://dev.azure.com/ils0086/MessagePack-CSharp/_apis/build/status/MessagePack-CSharp-CI)](https://dev.azure.com/ils0086/MessagePack-CSharp/_build/latest?definitionId=2) +[![Build Status](https://dev.azure.com/ils0086/MessagePack-CSharp/_apis/build/status/MessagePack-CSharp-CI?branchName=master)](https://dev.azure.com/ils0086/MessagePack-CSharp/_build/latest?definitionId=2&branchName=master) The extremely fast [MessagePack](http://msgpack.org/) serializer for C#. It is 10x faster than [MsgPack-Cli](https://github.com/msgpack/msgpack-cli) and outperforms other C# serializers. MessagePack for C# also ships with built-in support for LZ4 compression - an extremely fast compression algorithm. Performance is important, particularly in applications like games, distributed computing, microservices, or data caches. From 14272ce7edf4615b627388d0fcc040d45d42726d Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 3 Nov 2021 12:12:47 -0600 Subject: [PATCH 109/161] Use Ubuntu 18 instead of 16 in AzP --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index a3206040b..995645974 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -42,7 +42,7 @@ stages: - job: Linux pool: - vmImage: Ubuntu 16.04 + vmImage: Ubuntu 18.04 steps: - checkout: self clean: true From 2153355af76d8ead11314d8606266b5b7c7a8207 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 3 Nov 2021 12:13:10 -0600 Subject: [PATCH 110/161] Drop netcoreapp2.1 support netcoreapp2.1 is no longer under LTS support by Microsoft and no one should be using it. --- azure-pipelines/build_nonWindows.yml | 14 +++++++++++--- .../MessagePack.Internal.csproj | 2 +- .../PerfBenchmarkDotNet/PerfBenchmarkDotNet.csproj | 2 +- sandbox/PerfNetFramework/PerfNetFramework.csproj | 2 +- sandbox/Sandbox/Sandbox.csproj | 2 +- src/MessagePack/MessagePack.csproj | 4 ++-- ...MessagePack.AspNetCoreMvcFormatter.Tests.csproj | 2 +- .../MessagePack.Internal.Tests.csproj | 2 +- tests/MessagePack.Tests/MessagePack.Tests.csproj | 2 +- 9 files changed, 20 insertions(+), 12 deletions(-) diff --git a/azure-pipelines/build_nonWindows.yml b/azure-pipelines/build_nonWindows.yml index df0da729f..6b5ac10a8 100644 --- a/azure-pipelines/build_nonWindows.yml +++ b/azure-pipelines/build_nonWindows.yml @@ -6,12 +6,20 @@ steps: arguments: --no-restore -c $(BuildConfiguration) - task: DotNetCoreCLI@2 - displayName: Run MessagePack.Tests (netcoreapp2.1) + displayName: Run MessagePack.Tests (netcoreapp3.1) inputs: command: test projects: tests/MessagePack.Tests/MessagePack.Tests.csproj - arguments: --no-build -c $(BuildConfiguration) -f netcoreapp2.1 -v n --settings "$(Build.Repository.LocalPath)/azure-pipelines/$(Agent.OS).runsettings" - testRunTitle: netcoreapp2.1-$(Agent.JobName) + arguments: --no-build -c $(BuildConfiguration) -f netcoreapp3.1 -v n --settings "$(Build.Repository.LocalPath)/azure-pipelines/$(Agent.OS).runsettings" + testRunTitle: netcoreapp3.1-$(Agent.JobName) + +- task: DotNetCoreCLI@2 + displayName: Run MessagePack.Tests (net5.0) + inputs: + command: test + projects: tests/MessagePack.Tests/MessagePack.Tests.csproj + arguments: --no-build -c $(BuildConfiguration) -f net5.0 -v n --settings "$(Build.Repository.LocalPath)/azure-pipelines/$(Agent.OS).runsettings" + testRunTitle: net5.0-$(Agent.JobName) - bash: mono ~/.nuget/packages/xunit.runner.console/2.4.1/tools/net472/xunit.console.exe bin/MessagePack.Tests/$(BuildConfiguration)/net472/MessagePack.Tests.dll -html $(BUILD.ARTIFACTSTAGINGDIRECTORY)/build_logs/mono_testrun.html displayName: Run MessagePack.Tests (mono) diff --git a/sandbox/MessagePack.Internal/MessagePack.Internal.csproj b/sandbox/MessagePack.Internal/MessagePack.Internal.csproj index 33fa720e9..283524803 100644 --- a/sandbox/MessagePack.Internal/MessagePack.Internal.csproj +++ b/sandbox/MessagePack.Internal/MessagePack.Internal.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1 + netcoreapp3.1 $(DefineConstants);SPAN_BUILTIN;MESSAGEPACK_INTERNAL true True diff --git a/sandbox/PerfBenchmarkDotNet/PerfBenchmarkDotNet.csproj b/sandbox/PerfBenchmarkDotNet/PerfBenchmarkDotNet.csproj index 2d50eff77..36fe6bafd 100644 --- a/sandbox/PerfBenchmarkDotNet/PerfBenchmarkDotNet.csproj +++ b/sandbox/PerfBenchmarkDotNet/PerfBenchmarkDotNet.csproj @@ -1,7 +1,7 @@  Exe - net472;netcoreapp2.1 + net472;net5.0 true true diff --git a/sandbox/PerfNetFramework/PerfNetFramework.csproj b/sandbox/PerfNetFramework/PerfNetFramework.csproj index ea9b63dc0..080b4fb75 100644 --- a/sandbox/PerfNetFramework/PerfNetFramework.csproj +++ b/sandbox/PerfNetFramework/PerfNetFramework.csproj @@ -1,7 +1,7 @@  Exe - net472;netcoreapp2.1 + net472;net5.0 true diff --git a/sandbox/Sandbox/Sandbox.csproj b/sandbox/Sandbox/Sandbox.csproj index 489425ec8..a15617098 100644 --- a/sandbox/Sandbox/Sandbox.csproj +++ b/sandbox/Sandbox/Sandbox.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp2.1 + netcoreapp3.1 True diff --git a/src/MessagePack/MessagePack.csproj b/src/MessagePack/MessagePack.csproj index 7a2df01dd..bffdded87 100644 --- a/src/MessagePack/MessagePack.csproj +++ b/src/MessagePack/MessagePack.csproj @@ -1,7 +1,7 @@  - netstandard2.0;netcoreapp2.1;netcoreapp3.1;net5.0 + netstandard2.0;netcoreapp3.1;net5.0 $(NoWarn);CS0649 True $(DefineConstants);SPAN_BUILTIN @@ -35,7 +35,7 @@ - + diff --git a/tests/MessagePack.AspNetCoreMvcFormatter.Tests/MessagePack.AspNetCoreMvcFormatter.Tests.csproj b/tests/MessagePack.AspNetCoreMvcFormatter.Tests/MessagePack.AspNetCoreMvcFormatter.Tests.csproj index 975fc82a1..46b40bf0d 100644 --- a/tests/MessagePack.AspNetCoreMvcFormatter.Tests/MessagePack.AspNetCoreMvcFormatter.Tests.csproj +++ b/tests/MessagePack.AspNetCoreMvcFormatter.Tests/MessagePack.AspNetCoreMvcFormatter.Tests.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1 + netcoreapp3.1 false ..\MessagePack.Tests\MessagePack.Tests.ruleset diff --git a/tests/MessagePack.Internal.Tests/MessagePack.Internal.Tests.csproj b/tests/MessagePack.Internal.Tests/MessagePack.Internal.Tests.csproj index 494885c2d..61f979640 100644 --- a/tests/MessagePack.Internal.Tests/MessagePack.Internal.Tests.csproj +++ b/tests/MessagePack.Internal.Tests/MessagePack.Internal.Tests.csproj @@ -1,6 +1,6 @@  - netcoreapp2.1 + netcoreapp3.1 ..\MessagePack.Tests\MessagePack.Tests.ruleset diff --git a/tests/MessagePack.Tests/MessagePack.Tests.csproj b/tests/MessagePack.Tests/MessagePack.Tests.csproj index 1611f38e8..2e5229dff 100644 --- a/tests/MessagePack.Tests/MessagePack.Tests.csproj +++ b/tests/MessagePack.Tests/MessagePack.Tests.csproj @@ -1,6 +1,6 @@  - net472;netcoreapp2.1;netcoreapp3.1;net5.0 + net472;netcoreapp3.1;net5.0 true 9.0 true From 5c0220eecc34b34c76f022a46bf7c246786f0a65 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 3 Nov 2021 12:29:59 -0600 Subject: [PATCH 111/161] Fix up build issues --- sandbox/PerfBenchmarkDotNet/MessagePackWriterBenchmark.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sandbox/PerfBenchmarkDotNet/MessagePackWriterBenchmark.cs b/sandbox/PerfBenchmarkDotNet/MessagePackWriterBenchmark.cs index 0cff63343..8afaccc14 100644 --- a/sandbox/PerfBenchmarkDotNet/MessagePackWriterBenchmark.cs +++ b/sandbox/PerfBenchmarkDotNet/MessagePackWriterBenchmark.cs @@ -4,6 +4,7 @@ extern alias newmsgpack; extern alias oldmsgpack; +using System; using BenchmarkDotNet.Attributes; using BenchmarkDotNet.Configs; using Nerdbank.Streams; @@ -12,7 +13,7 @@ namespace PerfBenchmarkDotNet { [GroupBenchmarksBy(BenchmarkLogicalGroupRule.ByCategory)] [CategoriesColumn] - public class MessagePackWriterBenchmark + public sealed class MessagePackWriterBenchmark : IDisposable { private const int RepsOverArray = 300 * 1024; private readonly Sequence sequence = new Sequence(); @@ -148,5 +149,10 @@ public void WriteString() offset = 0; } } + + public void Dispose() + { + this.sequence.Dispose(); + } } } From 96a5722bd3888e9f9590b344ae2f6f4cbf58097b Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 3 Nov 2021 13:11:40 -0600 Subject: [PATCH 112/161] Demand an agent running Unity v2019.1 --- azure-pipelines.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 995645974..2c179114d 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -33,7 +33,9 @@ stages: - job: Unity pool: name: CustomAgents - demands: UNITYHUB_EDITORS_FOLDER_LOCATION + demands: + - UNITYHUB_EDITORS_FOLDER_LOCATION + - UNITYVERSION -equals 2019.1 steps: - checkout: self clean: true From cb0735423cd2b05d4ac2f40c092c2226b19941bb Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 3 Nov 2021 13:34:01 -0600 Subject: [PATCH 113/161] Update to .NET SDK 5.0.401 --- global.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global.json b/global.json index e8e7c67eb..3057bb452 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "5.0.201", + "version": "5.0.401", "rollForward": "patch", "allowPrerelease": false } From e630a16dd01615dbfbd6fc468b81b3546749344e Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 3 Nov 2021 13:37:52 -0600 Subject: [PATCH 114/161] Install ASP.NET runtime --- tools/Install-DotNetSdk.ps1 | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tools/Install-DotNetSdk.ps1 b/tools/Install-DotNetSdk.ps1 index a8407a32e..fac05df7f 100755 --- a/tools/Install-DotNetSdk.ps1 +++ b/tools/Install-DotNetSdk.ps1 @@ -208,6 +208,22 @@ $windowsDesktopRuntimeVersions | Sort-Object -Unique |% { } } +$aspnetRuntimeSwitches = $switches + '-Runtime','aspnetcore' + +$runtimeVersions | Sort-Object -Unique |% { + if ($PSCmdlet.ShouldProcess(".NET Core ASP.NET runtime $_", "Install")) { + $anythingInstalled = $true + Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ $aspnetRuntimeSwitches" + + if ($LASTEXITCODE -ne 0) { + Write-Error ".NET SDK installation failure: $LASTEXITCODE" + exit $LASTEXITCODE + } + } else { + Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ $aspnetRuntimeSwitches -DryRun" + } +} + if ($PSCmdlet.ShouldProcess("Set DOTNET environment variables to discover these installed runtimes?")) { & "$PSScriptRoot/Set-EnvVars.ps1" -Variables $envVars -PrependPath $DotNetInstallDir | Out-Null } From 2119ae61806d3de66f8f70872929abcd0da070a6 Mon Sep 17 00:00:00 2001 From: neuecc Date: Thu, 4 Nov 2021 18:00:26 +0900 Subject: [PATCH 115/161] removing HashCode when Unity uses netstandard2.1 --- .../Assets/Scripts/MessagePack/HashCode.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/HashCode.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/HashCode.cs index 8d48c08fd..b10c8ac64 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/HashCode.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/HashCode.cs @@ -42,7 +42,7 @@ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */ -#if !NETCOREAPP +#if !(NETCOREAPP || NET_STANDARD) using System.Collections.Generic; using System.ComponentModel; From c38823538505a4854abf3f94d894a61dcf07c98f Mon Sep 17 00:00:00 2001 From: neuecc Date: Thu, 4 Nov 2021 18:04:03 +0900 Subject: [PATCH 116/161] some dynamic test disable in Unity --- .../Assets/Scripts/Tests/ShareTests/DataContractTest.cs | 4 ++++ .../Scripts/Tests/ShareTests/DynamicObjectFallbackTest.cs | 2 +- .../Assets/Scripts/Tests/ShareTests/ExpandoObjectTests.cs | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/DataContractTest.cs b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/DataContractTest.cs index c14649e30..d4defb9e3 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/DataContractTest.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/DataContractTest.cs @@ -191,6 +191,8 @@ public class Detail : IEquatable public bool Equals(Detail other) => other != null && this.B1 == other.B1 && this.B2 == other.B2; } +#if !UNITY_2018_3_OR_NEWER + [Fact] public void DataContractSerializerCompatibility() { @@ -219,6 +221,8 @@ public void DataContractSerializerCompatibility() Assert.Equal(dcsValue, mpValue); } +#endif + private static T DataContractSerializerRoundTrip(T value) { var ms = new MemoryStream(); diff --git a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/DynamicObjectFallbackTest.cs b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/DynamicObjectFallbackTest.cs index 4ac2331d3..a16b9f0b0 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/DynamicObjectFallbackTest.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/DynamicObjectFallbackTest.cs @@ -1,7 +1,7 @@ // Copyright (c) All contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -#if !ENABLE_IL2CPP +#if !UNITY_2018_3_OR_NEWER using System; using System.Collections.Generic; diff --git a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/ExpandoObjectTests.cs b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/ExpandoObjectTests.cs index 45b17edeb..99f3b808a 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/ExpandoObjectTests.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/ExpandoObjectTests.cs @@ -1,6 +1,8 @@ // Copyright (c) All contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. +#if !UNITY_2018_3_OR_NEWER + using System.Dynamic; using System.Runtime.Serialization; using MessagePack.Resolvers; @@ -115,3 +117,5 @@ public class CustomObject } } } + +#endif From 770f34110efa1c723438a9e92455e98ef83c1757 Mon Sep 17 00:00:00 2001 From: neuecc Date: Thu, 4 Nov 2021 18:04:25 +0900 Subject: [PATCH 117/161] add msgPack.dll reference to Unity's Tests.asmdef --- .../Assets/Scripts/Tests/Tests.asmdef | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/Tests/Tests.asmdef b/src/MessagePack.UnityClient/Assets/Scripts/Tests/Tests.asmdef index 9fb3f1719..a4466b001 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/Tests/Tests.asmdef +++ b/src/MessagePack.UnityClient/Assets/Scripts/Tests/Tests.asmdef @@ -1,19 +1,25 @@ { "name": "MessagePack.Tests", + "rootNamespace": "", "references": [ "MessagePack", "MessagePack.Annotations", - "RuntimeUnitTestToolkit" - ], - "optionalUnityReferences": [ - "TestAssemblies" + "RuntimeUnitTestToolkit", + "UnityEngine.TestRunner", + "UnityEditor.TestRunner" ], "includePlatforms": [], "excludePlatforms": [], "allowUnsafeCode": true, - "overrideReferences": false, - "precompiledReferences": [], - "autoReferenced": true, - "defineConstraints": [], - "versionDefines": [] + "overrideReferences": true, + "precompiledReferences": [ + "nunit.framework.dll", + "MsgPack.dll" + ], + "autoReferenced": false, + "defineConstraints": [ + "UNITY_INCLUDE_TESTS" + ], + "versionDefines": [], + "noEngineReferences": false } \ No newline at end of file From 27bee7116a06f4ec8ce875d96bf5d043cccf20d1 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 3 Nov 2021 14:21:49 -0600 Subject: [PATCH 118/161] Fix up ASP.NET formatter to run on .NET Core 3.1 --- .../MessagePackOutputFormatter.cs | 16 ++++++++++++++++ ...ssagePack.AspNetCoreMvcFormatter.Tests.csproj | 1 - 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/MessagePack.AspNetCoreMvcFormatter/MessagePackOutputFormatter.cs b/src/MessagePack.AspNetCoreMvcFormatter/MessagePackOutputFormatter.cs index 738f0684c..409981148 100644 --- a/src/MessagePack.AspNetCoreMvcFormatter/MessagePackOutputFormatter.cs +++ b/src/MessagePack.AspNetCoreMvcFormatter/MessagePackOutputFormatter.cs @@ -34,6 +34,12 @@ public override Task WriteResponseBodyAsync(OutputFormatterWriteContext context) return Task.CompletedTask; #else var writer = context.HttpContext.Response.BodyWriter; + if (writer == null) + { + context.HttpContext.Response.Body.WriteByte(MessagePackCode.Nil); + return Task.CompletedTask; + } + var span = writer.GetSpan(1); span[0] = MessagePackCode.Nil; writer.Advance(1); @@ -46,6 +52,11 @@ public override Task WriteResponseBodyAsync(OutputFormatterWriteContext context) return MessagePackSerializer.SerializeAsync(context.Object.GetType(), context.HttpContext.Response.Body, context.Object, this.options, context.HttpContext.RequestAborted); #else var writer = context.HttpContext.Response.BodyWriter; + if (writer == null) + { + return MessagePackSerializer.SerializeAsync(context.Object.GetType(), context.HttpContext.Response.Body, context.Object, this.options, context.HttpContext.RequestAborted); + } + MessagePackSerializer.Serialize(context.Object.GetType(), writer, context.Object, this.options, context.HttpContext.RequestAborted); return writer.FlushAsync().AsTask(); #endif @@ -57,6 +68,11 @@ public override Task WriteResponseBodyAsync(OutputFormatterWriteContext context) return MessagePackSerializer.SerializeAsync(context.ObjectType, context.HttpContext.Response.Body, context.Object, this.options, context.HttpContext.RequestAborted); #else var writer = context.HttpContext.Response.BodyWriter; + if (writer == null) + { + return MessagePackSerializer.SerializeAsync(context.ObjectType, context.HttpContext.Response.Body, context.Object, this.options, context.HttpContext.RequestAborted); + } + MessagePackSerializer.Serialize(context.ObjectType, writer, context.Object, this.options, context.HttpContext.RequestAborted); return writer.FlushAsync().AsTask(); #endif diff --git a/tests/MessagePack.AspNetCoreMvcFormatter.Tests/MessagePack.AspNetCoreMvcFormatter.Tests.csproj b/tests/MessagePack.AspNetCoreMvcFormatter.Tests/MessagePack.AspNetCoreMvcFormatter.Tests.csproj index 46b40bf0d..0a9041bd2 100644 --- a/tests/MessagePack.AspNetCoreMvcFormatter.Tests/MessagePack.AspNetCoreMvcFormatter.Tests.csproj +++ b/tests/MessagePack.AspNetCoreMvcFormatter.Tests/MessagePack.AspNetCoreMvcFormatter.Tests.csproj @@ -8,7 +8,6 @@ - From 791450b6fb5c3f85f4a992f2201fad62d2b8cf63 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 22 Sep 2021 08:39:23 -0600 Subject: [PATCH 119/161] Add support for the formatter singleton pattern to `MessagePackFormatterAttribute` Fixes #1328 --- .../DynamicCodeDumper.csproj | 3 + sandbox/DynamicCodeDumper/Program.cs | 1 + .../Resolvers/AttributeFormatterResolver.cs | 13 +- .../Resolvers/DynamicObjectResolver.cs | 61 ++++---- .../Resolvers/ResolverUtilities.cs | 45 ++++++ .../Assets/Scripts/Tests/Class1.cs | 7 + .../MessagePackFormatterPerFieldTest.cs | 135 ++++++++++++++++++ .../Assets/Scripts/Tests/Shims/XUnit.cs | 8 ++ 8 files changed, 238 insertions(+), 35 deletions(-) create mode 100644 src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/ResolverUtilities.cs diff --git a/sandbox/DynamicCodeDumper/DynamicCodeDumper.csproj b/sandbox/DynamicCodeDumper/DynamicCodeDumper.csproj index 4ef220a07..f7f443f0a 100644 --- a/sandbox/DynamicCodeDumper/DynamicCodeDumper.csproj +++ b/sandbox/DynamicCodeDumper/DynamicCodeDumper.csproj @@ -132,6 +132,9 @@ Code\DynamicUnionResolver.cs + + Code\ResolverUtilities.cs + Code\StringEncoding.cs diff --git a/sandbox/DynamicCodeDumper/Program.cs b/sandbox/DynamicCodeDumper/Program.cs index 14f6199e9..0d74db48d 100644 --- a/sandbox/DynamicCodeDumper/Program.cs +++ b/sandbox/DynamicCodeDumper/Program.cs @@ -44,6 +44,7 @@ private static void Main(string[] args) ////DynamicObjectResolver.Instance.GetFormatter(); ////DynamicObjectResolver.Instance.GetFormatter(); IMessagePackFormatter f = DynamicObjectResolverAllowPrivate.Instance.GetFormatter(); + ////IMessagePackFormatter f = DynamicObjectResolver.Instance.GetFormatter(); ////DynamicObjectResolver.Instance.GetFormatter(); ////DynamicObjectResolver.Instance.GetFormatter(); ////DynamicObjectResolver.Instance.GetFormatter(); diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/AttributeFormatterResolver.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/AttributeFormatterResolver.cs index 00e5b075c..8dde36ff0 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/AttributeFormatterResolver.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/AttributeFormatterResolver.cs @@ -1,10 +1,10 @@ // Copyright (c) All contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -using System; -using System.Linq; // require UNITY_2018_3_OR_NEWER +using System.Linq; using System.Reflection; using MessagePack.Formatters; +using MessagePack.Internal; namespace MessagePack.Resolvers { @@ -49,14 +49,7 @@ static FormatterCache() formatterType = formatterType.MakeGenericType(typeof(T).GetGenericArguments()); } - if (attr.Arguments == null) - { - Formatter = (IMessagePackFormatter)Activator.CreateInstance(formatterType); - } - else - { - Formatter = (IMessagePackFormatter)Activator.CreateInstance(formatterType, attr.Arguments); - } + Formatter = (IMessagePackFormatter)ResolverUtilities.ActivateFormatter(formatterType, attr.Arguments); } } } diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs index 62a34d7ae..e82188a2f 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs @@ -14,6 +14,7 @@ using System.Threading; using MessagePack.Formatters; using MessagePack.Internal; +using MessagePack.Resolvers; #pragma warning disable SA1403 // File may only contain a single namespace @@ -110,7 +111,7 @@ static FormatterCache() return; } - Formatter = (IMessagePackFormatter)Activator.CreateInstance(formatterTypeInfo.AsType()); + Formatter = (IMessagePackFormatter)ResolverUtilities.ActivateFormatter(formatterTypeInfo.AsType()); } } } @@ -495,7 +496,7 @@ public static object BuildFormatterToDynamicMethod(Type type, bool forceStringKe MessagePackFormatterAttribute attr = item.GetMessagePackFormatterAttribute(); if (attr != null) { - var formatter = Activator.CreateInstance(attr.FormatterType, attr.Arguments); + IMessagePackFormatter formatter = ResolverUtilities.ActivateFormatter(attr.FormatterType, attr.Arguments); serializeCustomFormatters.Add(formatter); } else @@ -510,7 +511,7 @@ public static object BuildFormatterToDynamicMethod(Type type, bool forceStringKe MessagePackFormatterAttribute attr = item.GetMessagePackFormatterAttribute(); if (attr != null) { - var formatter = Activator.CreateInstance(attr.FormatterType, attr.Arguments); + IMessagePackFormatter formatter = ResolverUtilities.ActivateFormatter(attr.FormatterType, attr.Arguments); deserializeCustomFormatters.Add(formatter); } else @@ -628,36 +629,46 @@ private static void BuildConstructor(Type type, ObjectSerializationInfo info, Co { FieldBuilder f = builder.DefineField(item.Name + "_formatter", attr.FormatterType, FieldAttributes.Private | FieldAttributes.InitOnly); - var bindingFlags = (int)(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); - - LocalBuilder attrVar = il.DeclareLocal(typeof(MessagePackFormatterAttribute)); - - il.Emit(OpCodes.Ldtoken, info.Type); - il.EmitCall(EmitInfo.GetTypeFromHandle); - il.Emit(OpCodes.Ldstr, item.Name); - il.EmitLdc_I4(bindingFlags); - if (item.IsProperty) + // If no args were provided and the formatter implements the singleton pattern, fetch the formatter from the field. + if ((attr.Arguments == null || attr.Arguments.Length == 0) && ResolverUtilities.FetchSingletonField(attr.FormatterType) is FieldInfo singletonField) { - il.EmitCall(EmitInfo.TypeGetProperty); + il.EmitLoadThis(); + il.EmitLdsfld(singletonField); } else { - il.EmitCall(EmitInfo.TypeGetField); - } + var bindingFlags = (int)(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); - il.EmitTrue(); - il.EmitCall(EmitInfo.GetCustomAttributeMessagePackFormatterAttribute); - il.EmitStloc(attrVar); + LocalBuilder attrVar = il.DeclareLocal(typeof(MessagePackFormatterAttribute)); - il.EmitLoadThis(); + il.Emit(OpCodes.Ldtoken, info.Type); + il.EmitCall(EmitInfo.GetTypeFromHandle); + il.Emit(OpCodes.Ldstr, item.Name); + il.EmitLdc_I4(bindingFlags); + if (item.IsProperty) + { + il.EmitCall(EmitInfo.TypeGetProperty); + } + else + { + il.EmitCall(EmitInfo.TypeGetField); + } + + il.EmitTrue(); + il.EmitCall(EmitInfo.GetCustomAttributeMessagePackFormatterAttribute); + il.EmitStloc(attrVar); - il.EmitLdloc(attrVar); - il.EmitCall(EmitInfo.MessagePackFormatterAttr.FormatterType); - il.EmitLdloc(attrVar); - il.EmitCall(EmitInfo.MessagePackFormatterAttr.Arguments); - il.EmitCall(EmitInfo.ActivatorCreateInstance); + il.EmitLoadThis(); + + il.EmitLdloc(attrVar); + il.EmitCall(EmitInfo.MessagePackFormatterAttr.FormatterType); + il.EmitLdloc(attrVar); + il.EmitCall(EmitInfo.MessagePackFormatterAttr.Arguments); + il.EmitCall(EmitInfo.ActivatorCreateInstance); + + il.Emit(OpCodes.Castclass, attr.FormatterType); + } - il.Emit(OpCodes.Castclass, attr.FormatterType); il.Emit(OpCodes.Stfld, f); dict.Add(item, f); diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/ResolverUtilities.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/ResolverUtilities.cs new file mode 100644 index 000000000..a66221814 --- /dev/null +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/ResolverUtilities.cs @@ -0,0 +1,45 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Reflection; +using MessagePack.Formatters; + +namespace MessagePack.Internal +{ + internal static class ResolverUtilities + { + internal static IMessagePackFormatter ActivateFormatter(Type formatterType, object[] args = null) + { + if (args == null || args.Length == 0) + { + if (formatterType.GetConstructor(Type.EmptyTypes) is ConstructorInfo ctor) + { + return (IMessagePackFormatter)ctor.Invoke(Array.Empty()); + } + else if (FetchSingletonField(formatterType) is FieldInfo instance) + { + return (IMessagePackFormatter)instance.GetValue(null); + } + else + { + throw new MessagePackSerializationException($"The {formatterType.FullName} formatter has no default constructor nor implements the singleton pattern."); + } + } + else + { + return (IMessagePackFormatter)Activator.CreateInstance(formatterType, args); + } + } + + internal static FieldInfo FetchSingletonField(Type formatterType) + { + if (formatterType.GetField("Instance", BindingFlags.Static | BindingFlags.Public) is FieldInfo fieldInfo && fieldInfo.IsInitOnly) + { + return fieldInfo; + } + + return null; + } + } +} diff --git a/src/MessagePack.UnityClient/Assets/Scripts/Tests/Class1.cs b/src/MessagePack.UnityClient/Assets/Scripts/Tests/Class1.cs index 9d95efa39..3325e3c33 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/Tests/Class1.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/Tests/Class1.cs @@ -1149,6 +1149,13 @@ public long Amount } } +[MessagePackObject] +public class MessagePackFormatterFieldUser +{ + [Key(0), MessagePackFormatter(typeof(NativeDateTimeFormatter))] + public DateTime Timestamp { get; set; } +} + namespace PerfBenchmarkDotNet { [MessagePackObject(true)] diff --git a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/MessagePackFormatterPerFieldTest.cs b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/MessagePackFormatterPerFieldTest.cs index 6be33a46f..b0dca2c34 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/MessagePackFormatterPerFieldTest.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/MessagePackFormatterPerFieldTest.cs @@ -5,16 +5,27 @@ using System.Buffers; using System.Collections.Generic; using System.Linq; +using System.Net.Sockets; +using System.Reflection; +using System.Runtime.Serialization; using System.Text; using System.Threading.Tasks; using MessagePack.Formatters; using MessagePack.Resolvers; using Xunit; +using Xunit.Abstractions; namespace MessagePack.Tests { public class MessagePackFormatterPerFieldTest { + private readonly ITestOutputHelper logger; + + public MessagePackFormatterPerFieldTest(ITestOutputHelper logger) + { + this.logger = logger; + } + [MessagePackObject] public class MyClass { @@ -105,5 +116,129 @@ public void FooBar() r2.MyProperty4.Is("bar"); } } + + [MessagePackObject] + public class BlockFormattedIntegers + { + [Key(0)] [MessagePackFormatter(typeof(ForceByteBlockFormatter))] public byte UInt8Property { get; set; } + + [Key(1)] [MessagePackFormatter(typeof(ForceUInt16BlockFormatter))] public ushort UInt16Property { get; set; } + + [Key(2)] [MessagePackFormatter(typeof(ForceUInt32BlockFormatter))] public uint UInt32Property { get; set; } + + [Key(3)] [MessagePackFormatter(typeof(ForceUInt64BlockFormatter))] public ulong UInt64Property { get; set; } + + [Key(4)] [MessagePackFormatter(typeof(ForceSByteBlockFormatter))] public sbyte Int8Property { get; set; } + + [Key(5)] [MessagePackFormatter(typeof(ForceInt16BlockFormatter))] public short Int16Property { get; set; } + + [Key(6)] [MessagePackFormatter(typeof(ForceInt32BlockFormatter))] public int Int32Property { get; set; } + + [Key(7)] [MessagePackFormatter(typeof(ForceInt64BlockFormatter))] public long Int64Property { get; set; } + + [Key(8)] [MessagePackFormatter(typeof(NullableForceByteBlockFormatter))] public byte? NullableUInt8Property { get; set; } + + [Key(9)] [MessagePackFormatter(typeof(NullableForceUInt16BlockFormatter))] public ushort? NullableUInt16Property { get; set; } + + [Key(10)] [MessagePackFormatter(typeof(NullableForceUInt32BlockFormatter))] public uint? NullableUInt32Property { get; set; } + + [Key(11)] [MessagePackFormatter(typeof(NullableForceUInt64BlockFormatter))] public ulong? NullableUInt64Property { get; set; } + + [Key(12)] [MessagePackFormatter(typeof(NullableForceSByteBlockFormatter))] public sbyte? NullableInt8Property { get; set; } + + [Key(13)] [MessagePackFormatter(typeof(NullableForceInt16BlockFormatter))] public short? NullableInt16Property { get; set; } + + [Key(14)] [MessagePackFormatter(typeof(NullableForceInt32BlockFormatter))] public int? NullableInt32Property { get; set; } + + [Key(15)] [MessagePackFormatter(typeof(NullableForceInt64BlockFormatter))] public long? NullableInt64Property { get; set; } + } + + /// + /// Asserts that every formatter offers the public API required for use by + /// . + /// + [Fact] + public void AllFormattersOfferAreAvailableViaAttribute() + { + var formatters = (from type in typeof(ForceByteBlockFormatter).Assembly.GetTypes() + where typeof(IMessagePackFormatter).IsAssignableFrom(type) && !type.IsAbstract + let ctor = GetDefaultConstructor(type) + where ctor is object // skip formatters that require special initialization. + select new { Type = type, DefaultConstructor = ctor }).ToList(); + this.logger.WriteLine("Found {0} applicable formatters to check.", formatters.Count); + + Assert.All(formatters, formatter => Assert.True(formatter.DefaultConstructor.IsPublic || UsesSingletonPattern(formatter.Type))); + } + + [Fact] + public void ForceBlockFormatters() + { + var block = new BlockFormattedIntegers + { + UInt8Property = 1, + UInt16Property = 2, + UInt32Property = 3, + UInt64Property = 4, + + Int8Property = 1, + Int16Property = 2, + Int32Property = 3, + Int64Property = 4, + + NullableUInt8Property = 1, + NullableUInt16Property = 2, + NullableUInt32Property = 3, + NullableUInt64Property = 4, + + NullableInt8Property = 1, + NullableInt16Property = 2, + NullableInt32Property = 3, + NullableInt64Property = 4, + }; + byte[] packed = MessagePackSerializer.Serialize(block, MessagePackSerializerOptions.Standard); + var reader = new MessagePackReader(packed); + + reader.ReadArrayHeader(); + + Assert.Equal(MessagePackCode.UInt8, reader.NextCode); + Assert.Equal(1, reader.ReadByte()); + Assert.Equal(MessagePackCode.UInt16, reader.NextCode); + Assert.Equal(2, reader.ReadUInt16()); + Assert.Equal(MessagePackCode.UInt32, reader.NextCode); + Assert.Equal(3u, reader.ReadUInt32()); + Assert.Equal(MessagePackCode.UInt64, reader.NextCode); + Assert.Equal(4u, reader.ReadUInt64()); + + Assert.Equal(MessagePackCode.Int8, reader.NextCode); + Assert.Equal(1, reader.ReadSByte()); + Assert.Equal(MessagePackCode.Int16, reader.NextCode); + Assert.Equal(2, reader.ReadInt16()); + Assert.Equal(MessagePackCode.Int32, reader.NextCode); + Assert.Equal(3, reader.ReadInt32()); + Assert.Equal(MessagePackCode.Int64, reader.NextCode); + Assert.Equal(4, reader.ReadInt64()); + + Assert.Equal(MessagePackCode.UInt8, reader.NextCode); + Assert.Equal(1, reader.ReadByte()); + Assert.Equal(MessagePackCode.UInt16, reader.NextCode); + Assert.Equal(2, reader.ReadUInt16()); + Assert.Equal(MessagePackCode.UInt32, reader.NextCode); + Assert.Equal(3u, reader.ReadUInt32()); + Assert.Equal(MessagePackCode.UInt64, reader.NextCode); + Assert.Equal(4u, reader.ReadUInt64()); + + Assert.Equal(MessagePackCode.Int8, reader.NextCode); + Assert.Equal(1, reader.ReadSByte()); + Assert.Equal(MessagePackCode.Int16, reader.NextCode); + Assert.Equal(2, reader.ReadInt16()); + Assert.Equal(MessagePackCode.Int32, reader.NextCode); + Assert.Equal(3, reader.ReadInt32()); + Assert.Equal(MessagePackCode.Int64, reader.NextCode); + Assert.Equal(4, reader.ReadInt64()); + } + + private static ConstructorInfo GetDefaultConstructor(Type formatterType) => formatterType.GetConstructors(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).FirstOrDefault(c => c.GetParameters().Length == 0); + + private static bool UsesSingletonPattern(Type formatterType) => formatterType.GetField("Instance", BindingFlags.Static | BindingFlags.Public)?.IsInitOnly is true; } } diff --git a/src/MessagePack.UnityClient/Assets/Scripts/Tests/Shims/XUnit.cs b/src/MessagePack.UnityClient/Assets/Scripts/Tests/Shims/XUnit.cs index 569cd3b42..c83b4d511 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/Tests/Shims/XUnit.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/Tests/Shims/XUnit.cs @@ -92,6 +92,14 @@ public static void Empty(System.Collections.IEnumerable enumerable) Assert.False(enumerable.GetEnumerator().MoveNext()); } + public static void All(IEnumerable collection, Action predicate) + { + foreach (T item in collection) + { + predicate(item); + } + } + public static T IsType(object o) { NUnit.Framework.Assert.AreEqual(typeof(T), o.GetType()); From 8bffba218074d6fbdbdd5d82e7dc5576fa3c75f8 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 22 Sep 2021 08:46:40 -0600 Subject: [PATCH 120/161] Improve error message when the MessagePackFormatterAttribute formatter mismatches the declared member type --- .../Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs index e82188a2f..52b92b0e4 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs @@ -627,6 +627,13 @@ private static void BuildConstructor(Type type, ObjectSerializationInfo info, Co MessagePackFormatterAttribute attr = item.GetMessagePackFormatterAttribute(); if (attr != null) { + // Verify that the specified formatter implements the required interface. + // Doing this now provides a more helpful error message than if we let the CLR throw an EntryPointNotFoundException later. + if (!attr.FormatterType.GetInterfaces().Any(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(IMessagePackFormatter<>) && i.GenericTypeArguments[0].IsEquivalentTo(item.Type))) + { + throw new MessagePackSerializationException($"{info.Type.FullName}.{item.Name} is declared as type {item.Type.FullName}, but the prescribed {attr.FormatterType.FullName} does not implement IMessagePackFormatter<{item.Type.Name}>."); + } + FieldBuilder f = builder.DefineField(item.Name + "_formatter", attr.FormatterType, FieldAttributes.Private | FieldAttributes.InitOnly); // If no args were provided and the formatter implements the singleton pattern, fetch the formatter from the field. From 04cfbd755f0548aa4924431bfa705f1dda205e81 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 5 Nov 2021 11:21:12 -0600 Subject: [PATCH 121/161] Update generated code --- sandbox/Sandbox/Generated.cs | 249 +++++++++++++++++++++-------------- 1 file changed, 148 insertions(+), 101 deletions(-) diff --git a/sandbox/Sandbox/Generated.cs b/sandbox/Sandbox/Generated.cs index 6db29c4c3..64f68f84a 100644 --- a/sandbox/Sandbox/Generated.cs +++ b/sandbox/Sandbox/Generated.cs @@ -49,7 +49,7 @@ internal static class GeneratedResolverGetFormatterHelper static GeneratedResolverGetFormatterHelper() { - lookup = new global::System.Collections.Generic.Dictionary(71) + lookup = new global::System.Collections.Generic.Dictionary(72) { { typeof(global::GlobalMyEnum[,]), 0 }, { typeof(global::GlobalMyEnum[]), 1 }, @@ -72,56 +72,57 @@ static GeneratedResolverGetFormatterHelper() { typeof(global::ComplexModel), 18 }, { typeof(global::GlobalMan), 19 }, { typeof(global::Message), 20 }, - { typeof(global::PerfBenchmarkDotNet.StringKeySerializerTarget), 21 }, - { typeof(global::QuestMessageBody), 22 }, - { typeof(global::SharedData.ArrayOptimizeClass), 23 }, - { typeof(global::SharedData.BarClass), 24 }, - { typeof(global::SharedData.Callback1), 25 }, - { typeof(global::SharedData.Callback1_2), 26 }, - { typeof(global::SharedData.Callback2), 27 }, - { typeof(global::SharedData.Callback2_2), 28 }, - { typeof(global::SharedData.DefaultValueIntKeyClassWithExplicitConstructor), 29 }, - { typeof(global::SharedData.DefaultValueIntKeyClassWithoutExplicitConstructor), 30 }, - { typeof(global::SharedData.DefaultValueIntKeyStructWithExplicitConstructor), 31 }, - { typeof(global::SharedData.DefaultValueStringKeyClassWithExplicitConstructor), 32 }, - { typeof(global::SharedData.DefaultValueStringKeyClassWithoutExplicitConstructor), 33 }, - { typeof(global::SharedData.DefaultValueStringKeyStructWithExplicitConstructor), 34 }, - { typeof(global::SharedData.Empty1), 35 }, - { typeof(global::SharedData.Empty2), 36 }, - { typeof(global::SharedData.EmptyClass), 37 }, - { typeof(global::SharedData.EmptyStruct), 38 }, - { typeof(global::SharedData.FirstSimpleData), 39 }, - { typeof(global::SharedData.FooClass), 40 }, - { typeof(global::SharedData.HolderV0), 41 }, - { typeof(global::SharedData.HolderV1), 42 }, - { typeof(global::SharedData.HolderV2), 43 }, - { typeof(global::SharedData.MyClass), 44 }, - { typeof(global::SharedData.MySubUnion1), 45 }, - { typeof(global::SharedData.MySubUnion2), 46 }, - { typeof(global::SharedData.MySubUnion3), 47 }, - { typeof(global::SharedData.MySubUnion4), 48 }, - { typeof(global::SharedData.NestParent.NestContract), 49 }, - { typeof(global::SharedData.NonEmpty1), 50 }, - { typeof(global::SharedData.NonEmpty2), 51 }, - { typeof(global::SharedData.SimpleIntKeyData), 52 }, - { typeof(global::SharedData.SimpleStringKeyData), 53 }, - { typeof(global::SharedData.SimpleStructIntKeyData), 54 }, - { typeof(global::SharedData.SimpleStructStringKeyData), 55 }, - { typeof(global::SharedData.SubUnionType1), 56 }, - { typeof(global::SharedData.SubUnionType2), 57 }, - { typeof(global::SharedData.UnVersionBlockTest), 58 }, - { typeof(global::SharedData.Vector2), 59 }, - { typeof(global::SharedData.Vector3Like), 60 }, - { typeof(global::SharedData.VectorLike2), 61 }, - { typeof(global::SharedData.Version0), 62 }, - { typeof(global::SharedData.Version1), 63 }, - { typeof(global::SharedData.Version2), 64 }, - { typeof(global::SharedData.VersionBlockTest), 65 }, - { typeof(global::SharedData.VersioningUnion), 66 }, - { typeof(global::SharedData.WithIndexer), 67 }, - { typeof(global::SimpleModel), 68 }, - { typeof(global::StampMessageBody), 69 }, - { typeof(global::TextMessageBody), 70 }, + { typeof(global::MessagePackFormatterFieldUser), 21 }, + { typeof(global::PerfBenchmarkDotNet.StringKeySerializerTarget), 22 }, + { typeof(global::QuestMessageBody), 23 }, + { typeof(global::SharedData.ArrayOptimizeClass), 24 }, + { typeof(global::SharedData.BarClass), 25 }, + { typeof(global::SharedData.Callback1), 26 }, + { typeof(global::SharedData.Callback1_2), 27 }, + { typeof(global::SharedData.Callback2), 28 }, + { typeof(global::SharedData.Callback2_2), 29 }, + { typeof(global::SharedData.DefaultValueIntKeyClassWithExplicitConstructor), 30 }, + { typeof(global::SharedData.DefaultValueIntKeyClassWithoutExplicitConstructor), 31 }, + { typeof(global::SharedData.DefaultValueIntKeyStructWithExplicitConstructor), 32 }, + { typeof(global::SharedData.DefaultValueStringKeyClassWithExplicitConstructor), 33 }, + { typeof(global::SharedData.DefaultValueStringKeyClassWithoutExplicitConstructor), 34 }, + { typeof(global::SharedData.DefaultValueStringKeyStructWithExplicitConstructor), 35 }, + { typeof(global::SharedData.Empty1), 36 }, + { typeof(global::SharedData.Empty2), 37 }, + { typeof(global::SharedData.EmptyClass), 38 }, + { typeof(global::SharedData.EmptyStruct), 39 }, + { typeof(global::SharedData.FirstSimpleData), 40 }, + { typeof(global::SharedData.FooClass), 41 }, + { typeof(global::SharedData.HolderV0), 42 }, + { typeof(global::SharedData.HolderV1), 43 }, + { typeof(global::SharedData.HolderV2), 44 }, + { typeof(global::SharedData.MyClass), 45 }, + { typeof(global::SharedData.MySubUnion1), 46 }, + { typeof(global::SharedData.MySubUnion2), 47 }, + { typeof(global::SharedData.MySubUnion3), 48 }, + { typeof(global::SharedData.MySubUnion4), 49 }, + { typeof(global::SharedData.NestParent.NestContract), 50 }, + { typeof(global::SharedData.NonEmpty1), 51 }, + { typeof(global::SharedData.NonEmpty2), 52 }, + { typeof(global::SharedData.SimpleIntKeyData), 53 }, + { typeof(global::SharedData.SimpleStringKeyData), 54 }, + { typeof(global::SharedData.SimpleStructIntKeyData), 55 }, + { typeof(global::SharedData.SimpleStructStringKeyData), 56 }, + { typeof(global::SharedData.SubUnionType1), 57 }, + { typeof(global::SharedData.SubUnionType2), 58 }, + { typeof(global::SharedData.UnVersionBlockTest), 59 }, + { typeof(global::SharedData.Vector2), 60 }, + { typeof(global::SharedData.Vector3Like), 61 }, + { typeof(global::SharedData.VectorLike2), 62 }, + { typeof(global::SharedData.Version0), 63 }, + { typeof(global::SharedData.Version1), 64 }, + { typeof(global::SharedData.Version2), 65 }, + { typeof(global::SharedData.VersionBlockTest), 66 }, + { typeof(global::SharedData.VersioningUnion), 67 }, + { typeof(global::SharedData.WithIndexer), 68 }, + { typeof(global::SimpleModel), 69 }, + { typeof(global::StampMessageBody), 70 }, + { typeof(global::TextMessageBody), 71 }, }; } @@ -156,56 +157,57 @@ internal static object GetFormatter(Type t) case 18: return new MessagePack.Formatters.ComplexModelFormatter(); case 19: return new MessagePack.Formatters.GlobalManFormatter(); case 20: return new MessagePack.Formatters.MessageFormatter(); - case 21: return new MessagePack.Formatters.PerfBenchmarkDotNet.StringKeySerializerTargetFormatter(); - case 22: return new MessagePack.Formatters.QuestMessageBodyFormatter(); - case 23: return new MessagePack.Formatters.SharedData.ArrayOptimizeClassFormatter(); - case 24: return new MessagePack.Formatters.SharedData.BarClassFormatter(); - case 25: return new MessagePack.Formatters.SharedData.Callback1Formatter(); - case 26: return new MessagePack.Formatters.SharedData.Callback1_2Formatter(); - case 27: return new MessagePack.Formatters.SharedData.Callback2Formatter(); - case 28: return new MessagePack.Formatters.SharedData.Callback2_2Formatter(); - case 29: return new MessagePack.Formatters.SharedData.DefaultValueIntKeyClassWithExplicitConstructorFormatter(); - case 30: return new MessagePack.Formatters.SharedData.DefaultValueIntKeyClassWithoutExplicitConstructorFormatter(); - case 31: return new MessagePack.Formatters.SharedData.DefaultValueIntKeyStructWithExplicitConstructorFormatter(); - case 32: return new MessagePack.Formatters.SharedData.DefaultValueStringKeyClassWithExplicitConstructorFormatter(); - case 33: return new MessagePack.Formatters.SharedData.DefaultValueStringKeyClassWithoutExplicitConstructorFormatter(); - case 34: return new MessagePack.Formatters.SharedData.DefaultValueStringKeyStructWithExplicitConstructorFormatter(); - case 35: return new MessagePack.Formatters.SharedData.Empty1Formatter(); - case 36: return new MessagePack.Formatters.SharedData.Empty2Formatter(); - case 37: return new MessagePack.Formatters.SharedData.EmptyClassFormatter(); - case 38: return new MessagePack.Formatters.SharedData.EmptyStructFormatter(); - case 39: return new MessagePack.Formatters.SharedData.FirstSimpleDataFormatter(); - case 40: return new MessagePack.Formatters.SharedData.FooClassFormatter(); - case 41: return new MessagePack.Formatters.SharedData.HolderV0Formatter(); - case 42: return new MessagePack.Formatters.SharedData.HolderV1Formatter(); - case 43: return new MessagePack.Formatters.SharedData.HolderV2Formatter(); - case 44: return new MessagePack.Formatters.SharedData.MyClassFormatter(); - case 45: return new MessagePack.Formatters.SharedData.MySubUnion1Formatter(); - case 46: return new MessagePack.Formatters.SharedData.MySubUnion2Formatter(); - case 47: return new MessagePack.Formatters.SharedData.MySubUnion3Formatter(); - case 48: return new MessagePack.Formatters.SharedData.MySubUnion4Formatter(); - case 49: return new MessagePack.Formatters.SharedData.NestParent_NestContractFormatter(); - case 50: return new MessagePack.Formatters.SharedData.NonEmpty1Formatter(); - case 51: return new MessagePack.Formatters.SharedData.NonEmpty2Formatter(); - case 52: return new MessagePack.Formatters.SharedData.SimpleIntKeyDataFormatter(); - case 53: return new MessagePack.Formatters.SharedData.SimpleStringKeyDataFormatter(); - case 54: return new MessagePack.Formatters.SharedData.SimpleStructIntKeyDataFormatter(); - case 55: return new MessagePack.Formatters.SharedData.SimpleStructStringKeyDataFormatter(); - case 56: return new MessagePack.Formatters.SharedData.SubUnionType1Formatter(); - case 57: return new MessagePack.Formatters.SharedData.SubUnionType2Formatter(); - case 58: return new MessagePack.Formatters.SharedData.UnVersionBlockTestFormatter(); - case 59: return new MessagePack.Formatters.SharedData.Vector2Formatter(); - case 60: return new MessagePack.Formatters.SharedData.Vector3LikeFormatter(); - case 61: return new MessagePack.Formatters.SharedData.VectorLike2Formatter(); - case 62: return new MessagePack.Formatters.SharedData.Version0Formatter(); - case 63: return new MessagePack.Formatters.SharedData.Version1Formatter(); - case 64: return new MessagePack.Formatters.SharedData.Version2Formatter(); - case 65: return new MessagePack.Formatters.SharedData.VersionBlockTestFormatter(); - case 66: return new MessagePack.Formatters.SharedData.VersioningUnionFormatter(); - case 67: return new MessagePack.Formatters.SharedData.WithIndexerFormatter(); - case 68: return new MessagePack.Formatters.SimpleModelFormatter(); - case 69: return new MessagePack.Formatters.StampMessageBodyFormatter(); - case 70: return new MessagePack.Formatters.TextMessageBodyFormatter(); + case 21: return new MessagePack.Formatters.MessagePackFormatterFieldUserFormatter(); + case 22: return new MessagePack.Formatters.PerfBenchmarkDotNet.StringKeySerializerTargetFormatter(); + case 23: return new MessagePack.Formatters.QuestMessageBodyFormatter(); + case 24: return new MessagePack.Formatters.SharedData.ArrayOptimizeClassFormatter(); + case 25: return new MessagePack.Formatters.SharedData.BarClassFormatter(); + case 26: return new MessagePack.Formatters.SharedData.Callback1Formatter(); + case 27: return new MessagePack.Formatters.SharedData.Callback1_2Formatter(); + case 28: return new MessagePack.Formatters.SharedData.Callback2Formatter(); + case 29: return new MessagePack.Formatters.SharedData.Callback2_2Formatter(); + case 30: return new MessagePack.Formatters.SharedData.DefaultValueIntKeyClassWithExplicitConstructorFormatter(); + case 31: return new MessagePack.Formatters.SharedData.DefaultValueIntKeyClassWithoutExplicitConstructorFormatter(); + case 32: return new MessagePack.Formatters.SharedData.DefaultValueIntKeyStructWithExplicitConstructorFormatter(); + case 33: return new MessagePack.Formatters.SharedData.DefaultValueStringKeyClassWithExplicitConstructorFormatter(); + case 34: return new MessagePack.Formatters.SharedData.DefaultValueStringKeyClassWithoutExplicitConstructorFormatter(); + case 35: return new MessagePack.Formatters.SharedData.DefaultValueStringKeyStructWithExplicitConstructorFormatter(); + case 36: return new MessagePack.Formatters.SharedData.Empty1Formatter(); + case 37: return new MessagePack.Formatters.SharedData.Empty2Formatter(); + case 38: return new MessagePack.Formatters.SharedData.EmptyClassFormatter(); + case 39: return new MessagePack.Formatters.SharedData.EmptyStructFormatter(); + case 40: return new MessagePack.Formatters.SharedData.FirstSimpleDataFormatter(); + case 41: return new MessagePack.Formatters.SharedData.FooClassFormatter(); + case 42: return new MessagePack.Formatters.SharedData.HolderV0Formatter(); + case 43: return new MessagePack.Formatters.SharedData.HolderV1Formatter(); + case 44: return new MessagePack.Formatters.SharedData.HolderV2Formatter(); + case 45: return new MessagePack.Formatters.SharedData.MyClassFormatter(); + case 46: return new MessagePack.Formatters.SharedData.MySubUnion1Formatter(); + case 47: return new MessagePack.Formatters.SharedData.MySubUnion2Formatter(); + case 48: return new MessagePack.Formatters.SharedData.MySubUnion3Formatter(); + case 49: return new MessagePack.Formatters.SharedData.MySubUnion4Formatter(); + case 50: return new MessagePack.Formatters.SharedData.NestParent_NestContractFormatter(); + case 51: return new MessagePack.Formatters.SharedData.NonEmpty1Formatter(); + case 52: return new MessagePack.Formatters.SharedData.NonEmpty2Formatter(); + case 53: return new MessagePack.Formatters.SharedData.SimpleIntKeyDataFormatter(); + case 54: return new MessagePack.Formatters.SharedData.SimpleStringKeyDataFormatter(); + case 55: return new MessagePack.Formatters.SharedData.SimpleStructIntKeyDataFormatter(); + case 56: return new MessagePack.Formatters.SharedData.SimpleStructStringKeyDataFormatter(); + case 57: return new MessagePack.Formatters.SharedData.SubUnionType1Formatter(); + case 58: return new MessagePack.Formatters.SharedData.SubUnionType2Formatter(); + case 59: return new MessagePack.Formatters.SharedData.UnVersionBlockTestFormatter(); + case 60: return new MessagePack.Formatters.SharedData.Vector2Formatter(); + case 61: return new MessagePack.Formatters.SharedData.Vector3LikeFormatter(); + case 62: return new MessagePack.Formatters.SharedData.VectorLike2Formatter(); + case 63: return new MessagePack.Formatters.SharedData.Version0Formatter(); + case 64: return new MessagePack.Formatters.SharedData.Version1Formatter(); + case 65: return new MessagePack.Formatters.SharedData.Version2Formatter(); + case 66: return new MessagePack.Formatters.SharedData.VersionBlockTestFormatter(); + case 67: return new MessagePack.Formatters.SharedData.VersioningUnionFormatter(); + case 68: return new MessagePack.Formatters.SharedData.WithIndexerFormatter(); + case 69: return new MessagePack.Formatters.SimpleModelFormatter(); + case 70: return new MessagePack.Formatters.StampMessageBodyFormatter(); + case 71: return new MessagePack.Formatters.TextMessageBodyFormatter(); default: return null; } } @@ -1173,6 +1175,51 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: } } + public sealed class MessagePackFormatterFieldUserFormatter : global::MessagePack.Formatters.IMessagePackFormatter + { + private readonly global::MessagePack.Formatters.NativeDateTimeFormatter __TimestampCustomFormatter__ = new global::MessagePack.Formatters.NativeDateTimeFormatter(); + + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::MessagePackFormatterFieldUser value, global::MessagePack.MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + return; + } + + writer.WriteArrayHeader(1); + this.__TimestampCustomFormatter__.Serialize(ref writer, value.Timestamp, options); + } + + public global::MessagePackFormatterFieldUser Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return null; + } + + options.Security.DepthStep(ref reader); + var length = reader.ReadArrayHeader(); + var ____result = new global::MessagePackFormatterFieldUser(); + + for (int i = 0; i < length; i++) + { + switch (i) + { + case 0: + ____result.Timestamp = this.__TimestampCustomFormatter__.Deserialize(ref reader, options); + break; + default: + reader.Skip(); + break; + } + } + + reader.Depth--; + return ____result; + } + } + public sealed class QuestMessageBodyFormatter : global::MessagePack.Formatters.IMessagePackFormatter { From 69b8b5ff7bb24488949fbd1835d0eaeb8cf3019a Mon Sep 17 00:00:00 2001 From: neuecc Date: Tue, 9 Nov 2021 19:12:45 +0900 Subject: [PATCH 122/161] add dll references --- .../Assets/Scripts/Tests/Tests.asmdef | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/Tests/Tests.asmdef b/src/MessagePack.UnityClient/Assets/Scripts/Tests/Tests.asmdef index a4466b001..b02d5a89d 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/Tests/Tests.asmdef +++ b/src/MessagePack.UnityClient/Assets/Scripts/Tests/Tests.asmdef @@ -13,6 +13,11 @@ "allowUnsafeCode": true, "overrideReferences": true, "precompiledReferences": [ + "System.Memory.dll", + "System.Buffers.dll", + "System.Threading.Tasks.Extensions.dll", + "System.Runtime.CompilerServices.Unsafe.dll", + "System.Runtime.Extensions.dll", "nunit.framework.dll", "MsgPack.dll" ], From 1b228946f43016d153883cc3d5570e371cb100d9 Mon Sep 17 00:00:00 2001 From: neuecc Date: Mon, 13 Dec 2021 00:26:12 +0900 Subject: [PATCH 123/161] disable HashCode.cs if UNITY_2021_2_OR_NEWER --- .../Assets/Scripts/MessagePack/HashCode.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/HashCode.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/HashCode.cs index b10c8ac64..79a44fcf5 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/HashCode.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/HashCode.cs @@ -42,7 +42,7 @@ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */ -#if !(NETCOREAPP || NET_STANDARD) +#if !(NETCOREAPP || UNITY_2021_2_OR_NEWER) using System.Collections.Generic; using System.ComponentModel; From e4fad534b2bec20e760dc5909292e63dcf26de64 Mon Sep 17 00:00:00 2001 From: Israel Lot Date: Wed, 15 Dec 2021 12:02:21 -0300 Subject: [PATCH 124/161] Add CompressionMinLength parameter to MessagePackSerializerOptions Add CompressionMinLength field to unpublished api spec --- .../MessagePack/MessagePackSerializer.Json.cs | 2 +- .../MessagePack/MessagePackSerializer.cs | 7 +++-- .../MessagePackSerializerOptions.cs | 27 +++++++++++++++++++ .../net5.0/PublicAPI.Unshipped.txt | 4 ++- .../netcoreapp2.1/PublicAPI.Unshipped.txt | 4 ++- .../netcoreapp3.1/PublicAPI.Unshipped.txt | 4 ++- .../netstandard2.0/PublicAPI.Unshipped.txt | 4 ++- 7 files changed, 43 insertions(+), 9 deletions(-) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.Json.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.Json.cs index 1d6049579..38e39985d 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.Json.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.Json.cs @@ -171,7 +171,7 @@ public static void ConvertFromJson(TextReader reader, ref MessagePackWriter writ } scratchWriter.Flush(); - ToLZ4BinaryCore(scratchRental.Value, ref writer, options.Compression); + ToLZ4BinaryCore(scratchRental.Value, ref writer, options.Compression, options.CompressionMinLength); } } else diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.cs index 0e0188cff..56f838f8b 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.cs @@ -18,7 +18,6 @@ namespace MessagePack [System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Each overload has sufficiently unique required parameters.")] public static partial class MessagePackSerializer { - private const int LZ4NotCompressionSizeInLz4BlockType = 64; private const int MaxHintSize = 1024 * 1024; /// @@ -85,7 +84,7 @@ public static void Serialize(ref MessagePackWriter writer, T value, MessagePa MessagePackWriter scratchWriter = writer.Clone(scratch); options.Resolver.GetFormatterWithVerify().Serialize(ref scratchWriter, value, options); scratchWriter.Flush(); - ToLZ4BinaryCore(scratch, ref writer, options.Compression); + ToLZ4BinaryCore(scratch, ref writer, options.Compression, options.CompressionMinLength); } } else @@ -555,11 +554,11 @@ private static bool TryDecompress(ref MessagePackReader reader, IBufferWriter msgpackUncompressedData, ref MessagePackWriter writer, MessagePackCompression compression) + private static void ToLZ4BinaryCore(in ReadOnlySequence msgpackUncompressedData, ref MessagePackWriter writer, MessagePackCompression compression, int minCompressionSize) { if (compression == MessagePackCompression.Lz4Block) { - if (msgpackUncompressedData.Length < LZ4NotCompressionSizeInLz4BlockType) + if (msgpackUncompressedData.Length < minCompressionSize) { writer.WriteRaw(msgpackUncompressedData); return; diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs index ebf1ca43b..9087790b7 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs @@ -41,6 +41,7 @@ public class MessagePackSerializerOptions protected internal MessagePackSerializerOptions(IFormatterResolver resolver) { this.Resolver = resolver ?? throw new ArgumentNullException(nameof(resolver)); + this.CompressionMinLength = 64; } /// @@ -57,6 +58,7 @@ protected MessagePackSerializerOptions(MessagePackSerializerOptions copyFrom) this.Resolver = copyFrom.Resolver; this.Compression = copyFrom.Compression; + this.CompressionMinLength = copyFrom.CompressionMinLength; this.OldSpec = copyFrom.OldSpec; this.OmitAssemblyVersion = copyFrom.OmitAssemblyVersion; this.AllowAssemblyVersionMismatch = copyFrom.AllowAssemblyVersionMismatch; @@ -81,6 +83,14 @@ protected MessagePackSerializerOptions(MessagePackSerializerOptions copyFrom) /// public MessagePackCompression Compression { get; private set; } + /// + /// Gets the min sequence length allowed for compression. + /// + /// + /// Sequences with length less then this value will skip block compression. + /// + public int CompressionMinLength { get; private set; } + /// /// Gets a value indicating whether to serialize with set to some value /// causing messagepack spec compliance to be explicitly set to the old or new format. @@ -194,6 +204,23 @@ public MessagePackSerializerOptions WithCompression(MessagePackCompression compr return result; } + /// + /// Gets a copy of these options with the property set to a new value. + /// + /// The new value for the property. + /// The new instance; or the original if the value is unchanged. + public MessagePackSerializerOptions WithCompressionMinLength(int compressionMinLength) + { + if (this.CompressionMinLength == compressionMinLength) + { + return this; + } + + var result = this.Clone(); + result.CompressionMinLength = compressionMinLength; + return result; + } + /// /// Gets a copy of these options with the property set to a new value. /// diff --git a/src/MessagePack/net5.0/PublicAPI.Unshipped.txt b/src/MessagePack/net5.0/PublicAPI.Unshipped.txt index 1447ef0d5..dca33bb1d 100644 --- a/src/MessagePack/net5.0/PublicAPI.Unshipped.txt +++ b/src/MessagePack/net5.0/PublicAPI.Unshipped.txt @@ -9,6 +9,8 @@ MessagePack.Formatters.InterfaceReadOnlySetFormatter.InterfaceReadOnlySetForm MessagePack.MessagePackReader.MessagePackReader() -> void MessagePack.MessagePackSerializerOptions.SequencePool.get -> MessagePack.SequencePool MessagePack.MessagePackSerializerOptions.WithPool(MessagePack.SequencePool pool) -> MessagePack.MessagePackSerializerOptions +MessagePack.MessagePackSerializerOptions.WithCompressionMinLength(int compressionMinLength) -> MessagePack.MessagePackSerializerOptions +MessagePack.MessagePackSerializerOptions.CompressionMinLength.get -> int MessagePack.MessagePackStreamReader.MessagePackStreamReader(System.IO.Stream stream, bool leaveOpen, MessagePack.SequencePool sequencePool) -> void MessagePack.MessagePackStreamReader.ReadArrayHeaderAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask MessagePack.MessagePackStreamReader.ReadMapHeaderAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask @@ -25,4 +27,4 @@ virtual MessagePack.MessagePackStreamReader.Dispose(bool disposing) -> void MessagePack.Formatters.GenericEnumerableFormatter MessagePack.Formatters.GenericEnumerableFormatter.GenericEnumerableFormatter() -> void MessagePack.Formatters.GenericReadOnlyDictionaryFormatter -MessagePack.Formatters.GenericReadOnlyDictionaryFormatter.GenericReadOnlyDictionaryFormatter() -> void \ No newline at end of file +MessagePack.Formatters.GenericReadOnlyDictionaryFormatter.GenericReadOnlyDictionaryFormatter() -> void diff --git a/src/MessagePack/netcoreapp2.1/PublicAPI.Unshipped.txt b/src/MessagePack/netcoreapp2.1/PublicAPI.Unshipped.txt index f053d3cd8..b2746b1be 100644 --- a/src/MessagePack/netcoreapp2.1/PublicAPI.Unshipped.txt +++ b/src/MessagePack/netcoreapp2.1/PublicAPI.Unshipped.txt @@ -4,6 +4,8 @@ MessagePack.FormatterNotRegisteredException.FormatterNotRegisteredException(Syst MessagePack.MessagePackReader.MessagePackReader() -> void MessagePack.MessagePackSerializerOptions.SequencePool.get -> MessagePack.SequencePool MessagePack.MessagePackSerializerOptions.WithPool(MessagePack.SequencePool pool) -> MessagePack.MessagePackSerializerOptions +MessagePack.MessagePackSerializerOptions.WithCompressionMinLength(int compressionMinLength) -> MessagePack.MessagePackSerializerOptions +MessagePack.MessagePackSerializerOptions.CompressionMinLength.get -> int MessagePack.MessagePackStreamReader.MessagePackStreamReader(System.IO.Stream stream, bool leaveOpen, MessagePack.SequencePool sequencePool) -> void MessagePack.MessagePackWriter.MessagePackWriter() -> void MessagePack.SequencePool @@ -17,4 +19,4 @@ virtual MessagePack.MessagePackStreamReader.Dispose(bool disposing) -> void MessagePack.Formatters.GenericEnumerableFormatter MessagePack.Formatters.GenericEnumerableFormatter.GenericEnumerableFormatter() -> void MessagePack.Formatters.GenericReadOnlyDictionaryFormatter -MessagePack.Formatters.GenericReadOnlyDictionaryFormatter.GenericReadOnlyDictionaryFormatter() -> void \ No newline at end of file +MessagePack.Formatters.GenericReadOnlyDictionaryFormatter.GenericReadOnlyDictionaryFormatter() -> void diff --git a/src/MessagePack/netcoreapp3.1/PublicAPI.Unshipped.txt b/src/MessagePack/netcoreapp3.1/PublicAPI.Unshipped.txt index 73b4e7c06..8b63c2e94 100644 --- a/src/MessagePack/netcoreapp3.1/PublicAPI.Unshipped.txt +++ b/src/MessagePack/netcoreapp3.1/PublicAPI.Unshipped.txt @@ -4,6 +4,8 @@ MessagePack.FormatterNotRegisteredException.FormatterNotRegisteredException(Syst MessagePack.MessagePackReader.MessagePackReader() -> void MessagePack.MessagePackSerializerOptions.SequencePool.get -> MessagePack.SequencePool MessagePack.MessagePackSerializerOptions.WithPool(MessagePack.SequencePool pool) -> MessagePack.MessagePackSerializerOptions +MessagePack.MessagePackSerializerOptions.WithCompressionMinLength(int compressionMinLength) -> MessagePack.MessagePackSerializerOptions +MessagePack.MessagePackSerializerOptions.CompressionMinLength.get -> int MessagePack.MessagePackStreamReader.MessagePackStreamReader(System.IO.Stream stream, bool leaveOpen, MessagePack.SequencePool sequencePool) -> void MessagePack.MessagePackStreamReader.ReadArrayHeaderAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask MessagePack.MessagePackStreamReader.ReadMapHeaderAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask @@ -19,4 +21,4 @@ virtual MessagePack.MessagePackStreamReader.Dispose(bool disposing) -> void MessagePack.Formatters.GenericEnumerableFormatter MessagePack.Formatters.GenericEnumerableFormatter.GenericEnumerableFormatter() -> void MessagePack.Formatters.GenericReadOnlyDictionaryFormatter -MessagePack.Formatters.GenericReadOnlyDictionaryFormatter.GenericReadOnlyDictionaryFormatter() -> void \ No newline at end of file +MessagePack.Formatters.GenericReadOnlyDictionaryFormatter.GenericReadOnlyDictionaryFormatter() -> void diff --git a/src/MessagePack/netstandard2.0/PublicAPI.Unshipped.txt b/src/MessagePack/netstandard2.0/PublicAPI.Unshipped.txt index 73b4e7c06..8b63c2e94 100644 --- a/src/MessagePack/netstandard2.0/PublicAPI.Unshipped.txt +++ b/src/MessagePack/netstandard2.0/PublicAPI.Unshipped.txt @@ -4,6 +4,8 @@ MessagePack.FormatterNotRegisteredException.FormatterNotRegisteredException(Syst MessagePack.MessagePackReader.MessagePackReader() -> void MessagePack.MessagePackSerializerOptions.SequencePool.get -> MessagePack.SequencePool MessagePack.MessagePackSerializerOptions.WithPool(MessagePack.SequencePool pool) -> MessagePack.MessagePackSerializerOptions +MessagePack.MessagePackSerializerOptions.WithCompressionMinLength(int compressionMinLength) -> MessagePack.MessagePackSerializerOptions +MessagePack.MessagePackSerializerOptions.CompressionMinLength.get -> int MessagePack.MessagePackStreamReader.MessagePackStreamReader(System.IO.Stream stream, bool leaveOpen, MessagePack.SequencePool sequencePool) -> void MessagePack.MessagePackStreamReader.ReadArrayHeaderAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask MessagePack.MessagePackStreamReader.ReadMapHeaderAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask @@ -19,4 +21,4 @@ virtual MessagePack.MessagePackStreamReader.Dispose(bool disposing) -> void MessagePack.Formatters.GenericEnumerableFormatter MessagePack.Formatters.GenericEnumerableFormatter.GenericEnumerableFormatter() -> void MessagePack.Formatters.GenericReadOnlyDictionaryFormatter -MessagePack.Formatters.GenericReadOnlyDictionaryFormatter.GenericReadOnlyDictionaryFormatter() -> void \ No newline at end of file +MessagePack.Formatters.GenericReadOnlyDictionaryFormatter.GenericReadOnlyDictionaryFormatter() -> void From c1e5f74d63ed0b2d85d2aecdab1a8f9ad88b8264 Mon Sep 17 00:00:00 2001 From: Konstantin S <3002068+HavenDV@users.noreply.github.com> Date: Sun, 19 Dec 2021 17:28:37 -0800 Subject: [PATCH 125/161] feat: Added DevelopmentDependency to MessagePackAnalyzer This automatically exposes private assets after installing packages because it is a analyzer. --- src/MessagePackAnalyzer/MessagePackAnalyzer.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/src/MessagePackAnalyzer/MessagePackAnalyzer.csproj b/src/MessagePackAnalyzer/MessagePackAnalyzer.csproj index 51952963a..5a5a18f88 100644 --- a/src/MessagePackAnalyzer/MessagePackAnalyzer.csproj +++ b/src/MessagePackAnalyzer/MessagePackAnalyzer.csproj @@ -11,6 +11,7 @@ $(TargetsForTfmSpecificContentInPackage);PackBuildOutputs true false + true From b2ab6250d1d3752e5c76cc9b74e92f867e80184c Mon Sep 17 00:00:00 2001 From: pCYSl5EDgo <31692496+pCYSl5EDgo@users.noreply.github.com> Date: Sat, 25 Dec 2021 09:02:15 +0900 Subject: [PATCH 126/161] Fix cast bug (#1364) --- .../Assets/Scripts/MessagePack/MessagePackSecurity.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSecurity.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSecurity.cs index 2136d1250..2b743afa4 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSecurity.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSecurity.cs @@ -334,8 +334,8 @@ public override unsafe int GetHashCode(float value) value = float.NaN; } - long l = *(long*)&value; - return HashCode.Combine((int)(l >> 32), unchecked((int)l)); + int l = *(int*)&value; + return l; } } From 11bdfed53cb331e8ff948d28dab5181d1f9b24b3 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 24 Dec 2021 17:45:28 -0700 Subject: [PATCH 127/161] Apply LZ4 minimum length to all compression types Before, it only applied to the `Lz4Block` scheme, but I don't see why we would want to apply `Lz4BlockArray` without regard to minimum length, so I've changed the library to always honor the new setting. --- .../Scripts/MessagePack/MessagePackSerializer.cs | 12 ++++++------ .../MessagePack/MessagePackSerializerOptions.cs | 16 +++++++++++----- .../MessagePackSerializerOptionsTests.cs | 11 +++++++++++ 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.cs index 56f838f8b..e5992be76 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.cs @@ -556,14 +556,14 @@ private static bool TryDecompress(ref MessagePackReader reader, IBufferWriter msgpackUncompressedData, ref MessagePackWriter writer, MessagePackCompression compression, int minCompressionSize) { - if (compression == MessagePackCompression.Lz4Block) + if (msgpackUncompressedData.Length < minCompressionSize) { - if (msgpackUncompressedData.Length < minCompressionSize) - { - writer.WriteRaw(msgpackUncompressedData); - return; - } + writer.WriteRaw(msgpackUncompressedData); + return; + } + if (compression == MessagePackCompression.Lz4Block) + { var maxCompressedLength = LZ4Codec.MaximumOutputLength((int)msgpackUncompressedData.Length); var lz4Span = ArrayPool.Shared.Rent(maxCompressedLength); try diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs index 9087790b7..7d41720ea 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs @@ -41,7 +41,6 @@ public class MessagePackSerializerOptions protected internal MessagePackSerializerOptions(IFormatterResolver resolver) { this.Resolver = resolver ?? throw new ArgumentNullException(nameof(resolver)); - this.CompressionMinLength = 64; } /// @@ -84,12 +83,14 @@ protected MessagePackSerializerOptions(MessagePackSerializerOptions copyFrom) public MessagePackCompression Compression { get; private set; } /// - /// Gets the min sequence length allowed for compression. + /// Gets the length a serialized msgpack result must equal or exceed before is applied. /// + /// The default value is 64. /// - /// Sequences with length less then this value will skip block compression. + /// When compression is not applied due to a short serialized result, deserialization will still succeed + /// even if is set to something other than . /// - public int CompressionMinLength { get; private set; } + public int CompressionMinLength { get; private set; } = 64; /// /// Gets a value indicating whether to serialize with set to some value @@ -207,7 +208,7 @@ public MessagePackSerializerOptions WithCompression(MessagePackCompression compr /// /// Gets a copy of these options with the property set to a new value. /// - /// The new value for the property. + /// The new value for the property. Must be a positive integer. /// The new instance; or the original if the value is unchanged. public MessagePackSerializerOptions WithCompressionMinLength(int compressionMinLength) { @@ -216,6 +217,11 @@ public MessagePackSerializerOptions WithCompressionMinLength(int compressionMinL return this; } + if (compressionMinLength <= 0) + { + throw new ArgumentOutOfRangeException(nameof(compressionMinLength)); + } + var result = this.Clone(); result.CompressionMinLength = compressionMinLength; return result; diff --git a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/MessagePackSerializerOptionsTests.cs b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/MessagePackSerializerOptionsTests.cs index 96bec149a..dfe988f8a 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/MessagePackSerializerOptionsTests.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/MessagePackSerializerOptionsTests.cs @@ -1,6 +1,7 @@ // Copyright (c) All contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. +using System; using MessagePack; using MessagePack.Resolvers; using Xunit; @@ -36,6 +37,16 @@ public void Compression() Assert.Equal(MessagePackCompression.Lz4Block, MessagePackSerializerOptions.Standard.WithCompression(MessagePackCompression.Lz4Block).Compression); } + [Fact] + public void CompressionMinLength() + { + Assert.Equal(64, MessagePackSerializerOptions.Standard.CompressionMinLength); + Assert.Throws(() => MessagePackSerializerOptions.Standard.WithCompressionMinLength(0)); + Assert.Throws(() => MessagePackSerializerOptions.Standard.WithCompressionMinLength(-1)); + MessagePackSerializerOptions options = MessagePackSerializerOptions.Standard.WithCompressionMinLength(128); + Assert.Equal(128, options.CompressionMinLength); + } + [Fact] public void OldSpec() { From fed033dd7b75c036ff598ac608255c22ae8b708f Mon Sep 17 00:00:00 2001 From: pCYSl5EDgo <31692496+pCYSl5EDgo@users.noreply.github.com> Date: Sat, 25 Dec 2021 13:58:25 +0900 Subject: [PATCH 128/161] .NET 6 Update (#1355) * Update versions of MPC dependencies * Add net6.0 target Co-authored-by: Andrew Arnott --- Directory.Build.props | 8 +++--- azure-pipelines.yml | 10 ++++---- azure-pipelines/build_nonWindows.yml | 8 ++++++ global.json | 2 +- sandbox/Sandbox/codegen.ps1 | 2 +- sandbox/TestData2/B.cs | 2 +- sandbox/TestData2/C.cs | 2 +- sandbox/TestData2/codegen.ps1 | 2 +- .../MessagePack.Generator.csproj | 8 +++--- .../Generator/EnumTemplate.cs | 8 +++--- .../MessagePack.GeneratorCore.csproj | 5 ++-- src/MessagePack/MessagePack.csproj | 14 +++++------ .../PublicAPI.Shipped.txt | 2 +- .../PublicAPI.Unshipped.txt | 6 +++++ .../MessagePack.Tests.csproj | 4 +-- tools/Install-DotNetSdk.ps1 | 25 +++++++++++++++---- 16 files changed, 68 insertions(+), 40 deletions(-) rename src/MessagePack/{netcoreapp2.1 => net6.0}/PublicAPI.Shipped.txt (99%) rename src/MessagePack/{netcoreapp2.1 => net6.0}/PublicAPI.Unshipped.txt (78%) diff --git a/Directory.Build.props b/Directory.Build.props index 99d92e03e..fc7c5f0f7 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -28,10 +28,10 @@ - - - - + + + + diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 2c179114d..d18997c3b 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -19,7 +19,7 @@ stages: jobs: - job: Windows pool: - vmImage: windows-2019 + vmImage: windows-2022 steps: - checkout: self clean: true @@ -44,7 +44,7 @@ stages: - job: Linux pool: - vmImage: Ubuntu 18.04 + vmImage: ubuntu-20.04 steps: - checkout: self clean: true @@ -53,7 +53,7 @@ stages: - job: macOS pool: - vmImage: macOS-10.15 + vmImage: macOS-11 steps: - checkout: self clean: true @@ -64,7 +64,7 @@ stages: # It also helps exercise mpc so bugs don't go unnoticed. - job: codegen_diff pool: - vmImage: ubuntu-latest + vmImage: ubuntu-20.04 steps: - checkout: self clean: true @@ -84,7 +84,7 @@ stages: jobs: - job: push pool: - vmImage: ubuntu-latest + vmImage: ubuntu-20.04 steps: - download: current artifact: nuget diff --git a/azure-pipelines/build_nonWindows.yml b/azure-pipelines/build_nonWindows.yml index 6b5ac10a8..9a57e2f9d 100644 --- a/azure-pipelines/build_nonWindows.yml +++ b/azure-pipelines/build_nonWindows.yml @@ -21,6 +21,14 @@ steps: arguments: --no-build -c $(BuildConfiguration) -f net5.0 -v n --settings "$(Build.Repository.LocalPath)/azure-pipelines/$(Agent.OS).runsettings" testRunTitle: net5.0-$(Agent.JobName) +- task: DotNetCoreCLI@2 + displayName: Run MessagePack.Tests (net6.0) + inputs: + command: test + projects: tests/MessagePack.Tests/MessagePack.Tests.csproj + arguments: --no-build -c $(BuildConfiguration) -f net6.0 -v n --settings "$(Build.Repository.LocalPath)/azure-pipelines/$(Agent.OS).runsettings" + testRunTitle: net6.0-$(Agent.JobName) + - bash: mono ~/.nuget/packages/xunit.runner.console/2.4.1/tools/net472/xunit.console.exe bin/MessagePack.Tests/$(BuildConfiguration)/net472/MessagePack.Tests.dll -html $(BUILD.ARTIFACTSTAGINGDIRECTORY)/build_logs/mono_testrun.html displayName: Run MessagePack.Tests (mono) diff --git a/global.json b/global.json index 3057bb452..d46619b03 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "5.0.401", + "version": "6.0.101", "rollForward": "patch", "allowPrerelease": false } diff --git a/sandbox/Sandbox/codegen.ps1 b/sandbox/Sandbox/codegen.ps1 index 2a595dee5..279718f6f 100644 --- a/sandbox/Sandbox/codegen.ps1 +++ b/sandbox/Sandbox/codegen.ps1 @@ -1 +1 @@ -dotnet run -f "net5.0" -p "$PSScriptRoot/../../src/MessagePack.Generator/MessagePack.Generator.csproj" -- -i "$PSScriptRoot/../SharedData/SharedData.csproj" -o "$PSScriptRoot/Generated.cs" +dotnet run -f "net6.0" --project "$PSScriptRoot/../../src/MessagePack.Generator/MessagePack.Generator.csproj" -- -i "$PSScriptRoot/../SharedData/SharedData.csproj" -o "$PSScriptRoot/Generated.cs" diff --git a/sandbox/TestData2/B.cs b/sandbox/TestData2/B.cs index 769c0e1c5..b44ff0164 100644 --- a/sandbox/TestData2/B.cs +++ b/sandbox/TestData2/B.cs @@ -1,4 +1,4 @@ -// Copyright (c) All contributors. All rights reserved. +// Copyright (c) All contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System.Collections.Generic; diff --git a/sandbox/TestData2/C.cs b/sandbox/TestData2/C.cs index 079c171e6..4a42584d2 100644 --- a/sandbox/TestData2/C.cs +++ b/sandbox/TestData2/C.cs @@ -1,4 +1,4 @@ -// Copyright (c) All contributors. All rights reserved. +// Copyright (c) All contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using MessagePack; diff --git a/sandbox/TestData2/codegen.ps1 b/sandbox/TestData2/codegen.ps1 index d3af92697..6781688ed 100644 --- a/sandbox/TestData2/codegen.ps1 +++ b/sandbox/TestData2/codegen.ps1 @@ -1 +1 @@ -dotnet run -f "net5.0" -p "$PSScriptRoot/../../src/MessagePack.Generator/MessagePack.Generator.csproj" -- -i "$PSScriptRoot/TestData2.csproj" -o "$PSScriptRoot/Generated.cs" +dotnet run -f "net6.0" --project "$PSScriptRoot/../../src/MessagePack.Generator/MessagePack.Generator.csproj" -- -i "$PSScriptRoot/TestData2.csproj" -o "$PSScriptRoot/Generated.cs" diff --git a/src/MessagePack.Generator/MessagePack.Generator.csproj b/src/MessagePack.Generator/MessagePack.Generator.csproj index b684a5b89..be7a10271 100644 --- a/src/MessagePack.Generator/MessagePack.Generator.csproj +++ b/src/MessagePack.Generator/MessagePack.Generator.csproj @@ -3,8 +3,8 @@ mpc Exe - netcoreapp3.1;net5.0 - 9 + netcoreapp3.1;net5.0;net6.0 + 10 enable true true @@ -18,11 +18,11 @@ - + - + diff --git a/src/MessagePack.GeneratorCore/Generator/EnumTemplate.cs b/src/MessagePack.GeneratorCore/Generator/EnumTemplate.cs index b64b4912f..814a31230 100644 --- a/src/MessagePack.GeneratorCore/Generator/EnumTemplate.cs +++ b/src/MessagePack.GeneratorCore/Generator/EnumTemplate.cs @@ -1,10 +1,10 @@ // ------------------------------------------------------------------------------ // -// このコードはツールによって生成されました。 -// ランタイム バージョン: 16.0.0.0 +// This code was generated by a tool. +// Runtime Version: 16.0.0.0 // -// このファイルへの変更は、正しくない動作の原因になる可能性があり、 -// コードが再生成されると失われます。 +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. // // ------------------------------------------------------------------------------ namespace MessagePackCompiler.Generator diff --git a/src/MessagePack.GeneratorCore/MessagePack.GeneratorCore.csproj b/src/MessagePack.GeneratorCore/MessagePack.GeneratorCore.csproj index 526615e57..df4755e25 100644 --- a/src/MessagePack.GeneratorCore/MessagePack.GeneratorCore.csproj +++ b/src/MessagePack.GeneratorCore/MessagePack.GeneratorCore.csproj @@ -11,9 +11,8 @@ - - - + + diff --git a/src/MessagePack/MessagePack.csproj b/src/MessagePack/MessagePack.csproj index c7c5090fa..cb24047ad 100644 --- a/src/MessagePack/MessagePack.csproj +++ b/src/MessagePack/MessagePack.csproj @@ -1,7 +1,7 @@  - netstandard2.0;netcoreapp3.1;net5.0 + netstandard2.0;netcoreapp3.1;net5.0;net6.0 $(NoWarn);CS0649 True $(DefineConstants);SPAN_BUILTIN @@ -33,15 +33,15 @@ - + - - - - - + + + + + diff --git a/src/MessagePack/netcoreapp2.1/PublicAPI.Shipped.txt b/src/MessagePack/net6.0/PublicAPI.Shipped.txt similarity index 99% rename from src/MessagePack/netcoreapp2.1/PublicAPI.Shipped.txt rename to src/MessagePack/net6.0/PublicAPI.Shipped.txt index 8aabf5dce..71c4d87b4 100644 --- a/src/MessagePack/netcoreapp2.1/PublicAPI.Shipped.txt +++ b/src/MessagePack/net6.0/PublicAPI.Shipped.txt @@ -1,4 +1,4 @@ -MessagePack.ExtensionHeader +MessagePack.ExtensionHeader MessagePack.ExtensionHeader.ExtensionHeader(sbyte typeCode, int length) -> void MessagePack.ExtensionHeader.ExtensionHeader(sbyte typeCode, uint length) -> void MessagePack.ExtensionHeader.Length.get -> uint diff --git a/src/MessagePack/netcoreapp2.1/PublicAPI.Unshipped.txt b/src/MessagePack/net6.0/PublicAPI.Unshipped.txt similarity index 78% rename from src/MessagePack/netcoreapp2.1/PublicAPI.Unshipped.txt rename to src/MessagePack/net6.0/PublicAPI.Unshipped.txt index b44f24ad2..4d82b979d 100644 --- a/src/MessagePack/netcoreapp2.1/PublicAPI.Unshipped.txt +++ b/src/MessagePack/net6.0/PublicAPI.Unshipped.txt @@ -1,6 +1,11 @@ MessagePack.ExtensionHeader.ExtensionHeader() -> void MessagePack.ExtensionResult.ExtensionResult() -> void MessagePack.FormatterNotRegisteredException.FormatterNotRegisteredException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) -> void +MessagePack.Formatters.HalfFormatter +MessagePack.Formatters.HalfFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Half +MessagePack.Formatters.HalfFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Half value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.InterfaceReadOnlySetFormatter +MessagePack.Formatters.InterfaceReadOnlySetFormatter.InterfaceReadOnlySetFormatter() -> void MessagePack.Formatters.StringInterningFormatter MessagePack.Formatters.StringInterningFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> string MessagePack.Formatters.StringInterningFormatter.Serialize(ref MessagePack.MessagePackWriter writer, string value, MessagePack.MessagePackSerializerOptions options) -> void @@ -17,6 +22,7 @@ MessagePack.SequencePool.SequencePool(int maxSize, System.Buffers.ArrayPool void static MessagePack.Nil.operator !=(MessagePack.Nil left, MessagePack.Nil right) -> bool static MessagePack.Nil.operator ==(MessagePack.Nil left, MessagePack.Nil right) -> bool +static readonly MessagePack.Formatters.HalfFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter virtual MessagePack.MessagePackStreamReader.Dispose(bool disposing) -> void MessagePack.Formatters.GenericEnumerableFormatter MessagePack.Formatters.GenericEnumerableFormatter.GenericEnumerableFormatter() -> void diff --git a/tests/MessagePack.Tests/MessagePack.Tests.csproj b/tests/MessagePack.Tests/MessagePack.Tests.csproj index 2e5229dff..9f7d98328 100644 --- a/tests/MessagePack.Tests/MessagePack.Tests.csproj +++ b/tests/MessagePack.Tests/MessagePack.Tests.csproj @@ -1,8 +1,8 @@  - net472;netcoreapp3.1;net5.0 + net472;netcoreapp3.1;net5.0;net6.0 true - 9.0 + 10 true true $(NoWarn);CS1701 diff --git a/tools/Install-DotNetSdk.ps1 b/tools/Install-DotNetSdk.ps1 index fac05df7f..0606d802c 100755 --- a/tools/Install-DotNetSdk.ps1 +++ b/tools/Install-DotNetSdk.ps1 @@ -29,6 +29,12 @@ $DotNetInstallScriptRoot = Resolve-Path $DotNetInstallScriptRoot # Look up actual required .NET Core SDK version from global.json $sdkVersion = & "$PSScriptRoot/../azure-pipelines/variables/DotNetSdkVersion.ps1" +$arch = [System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture +if (!$arch) { # Windows Powershell leaves this blank + $arch = 'x64' + if ($env:PROCESSOR_ARCHITECTURE -eq 'ARM64') { $arch = 'ARM64' } +} + # Search for all .NET Core runtime versions referenced from MSBuild projects and arrange to install them. $runtimeVersions = @() $windowsDesktopRuntimeVersions = @() @@ -44,13 +50,22 @@ Get-ChildItem "$PSScriptRoot\..\src\*.*proj","$PSScriptRoot\..\tests\*.*proj","$ } } } - $targetFrameworks |? { $_ -match 'netcoreapp(\d+\.\d+)' } |% { + $targetFrameworks |? { $_ -match 'net(?:coreapp)?(\d+\.\d+)' } |% { $v = $Matches[1] $runtimeVersions += $v if ($v -ge '3.0' -and -not ($IsMacOS -or $IsLinux)) { $windowsDesktopRuntimeVersions += $v } } + + # Add target frameworks of the form: netXX + $targetFrameworks |? { $_ -match 'net(\d+\.\d+)' } |% { + $v = $Matches[1] + $runtimeVersions += $v + if (-not ($IsMacOS -or $IsLinux)) { + $windowsDesktopRuntimeVersions += $v + } + } } Function Get-FileFromWeb([Uri]$Uri, $OutDir) { @@ -77,7 +92,7 @@ Function Get-InstallerExe($Version, [switch]$Runtime) { $Version = $versionInfo[-1] } - Get-FileFromWeb -Uri "https://dotnetcli.blob.core.windows.net/dotnet/$sdkOrRuntime/$Version/dotnet-$($sdkOrRuntime.ToLowerInvariant())-$Version-win-x64.exe" -OutDir "$DotNetInstallScriptRoot" + Get-FileFromWeb -Uri "https://dotnetcli.blob.core.windows.net/dotnet/$sdkOrRuntime/$Version/dotnet-$($sdkOrRuntime.ToLowerInvariant())-$Version-win-$arch.exe" -OutDir "$DotNetInstallScriptRoot" } Function Install-DotNet($Version, [switch]$Runtime) { @@ -94,7 +109,7 @@ Function Install-DotNet($Version, [switch]$Runtime) { } $switches = @( - '-Architecture','x64' + '-Architecture',$arch ) $envVars = @{ # For locally installed dotnet, skip first time experience which takes a long time @@ -142,10 +157,10 @@ if ($DotNetInstallDir) { } if ($IsMacOS -or $IsLinux) { - $DownloadUri = "https://raw.githubusercontent.com/dotnet/install-scripts/49d5da7f7d313aa65d24fe95cc29767faef553fd/src/dotnet-install.sh" + $DownloadUri = "https://raw.githubusercontent.com/dotnet/install-scripts/781752509a890ca7520f1182e8bae71f9a53d754/src/dotnet-install.sh" $DotNetInstallScriptPath = "$DotNetInstallScriptRoot/dotnet-install.sh" } else { - $DownloadUri = "https://raw.githubusercontent.com/dotnet/install-scripts/49d5da7f7d313aa65d24fe95cc29767faef553fd/src/dotnet-install.ps1" + $DownloadUri = "https://raw.githubusercontent.com/dotnet/install-scripts/781752509a890ca7520f1182e8bae71f9a53d754/src/dotnet-install.ps1" $DotNetInstallScriptPath = "$DotNetInstallScriptRoot/dotnet-install.ps1" } From 5c8ab3346aec8c42506a1230cb2d5735bc9a7c0d Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 24 Dec 2021 23:24:03 -0700 Subject: [PATCH 129/161] Promote Unshipped APIs to Shipped --- src/MessagePack/net5.0/PublicAPI.Shipped.txt | 28 +++++++++++++++++++ .../net5.0/PublicAPI.Unshipped.txt | 28 ------------------- .../netcoreapp2.1/PublicAPI.Shipped.txt | 22 ++++++++++++++- .../netcoreapp2.1/PublicAPI.Unshipped.txt | 20 ------------- .../netcoreapp3.1/PublicAPI.Shipped.txt | 24 +++++++++++++++- .../netcoreapp3.1/PublicAPI.Unshipped.txt | 22 --------------- .../netstandard2.0/PublicAPI.Shipped.txt | 24 +++++++++++++++- .../netstandard2.0/PublicAPI.Unshipped.txt | 22 --------------- 8 files changed, 95 insertions(+), 95 deletions(-) diff --git a/src/MessagePack/net5.0/PublicAPI.Shipped.txt b/src/MessagePack/net5.0/PublicAPI.Shipped.txt index 25b01a77c..b0a1a3dc2 100644 --- a/src/MessagePack/net5.0/PublicAPI.Shipped.txt +++ b/src/MessagePack/net5.0/PublicAPI.Shipped.txt @@ -1150,3 +1150,31 @@ static readonly MessagePack.ImmutableCollection.ImmutableCollectionResolver.Inst static readonly MessagePack.Resolvers.ExpandoObjectResolver.Instance -> MessagePack.IFormatterResolver static readonly MessagePack.Resolvers.ExpandoObjectResolver.Options -> MessagePack.MessagePackSerializerOptions virtual MessagePack.Formatters.PrimitiveObjectFormatter.DeserializeMap(ref MessagePack.MessagePackReader reader, int length, MessagePack.MessagePackSerializerOptions options) -> object +MessagePack.ExtensionHeader.ExtensionHeader() -> void +MessagePack.ExtensionResult.ExtensionResult() -> void +MessagePack.FormatterNotRegisteredException.FormatterNotRegisteredException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) -> void +MessagePack.Formatters.HalfFormatter +MessagePack.Formatters.HalfFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Half +MessagePack.Formatters.HalfFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Half value, MessagePack.MessagePackSerializerOptions options) -> void +MessagePack.Formatters.InterfaceReadOnlySetFormatter +MessagePack.Formatters.InterfaceReadOnlySetFormatter.InterfaceReadOnlySetFormatter() -> void +MessagePack.MessagePackReader.MessagePackReader() -> void +MessagePack.MessagePackSerializerOptions.SequencePool.get -> MessagePack.SequencePool +MessagePack.MessagePackSerializerOptions.WithPool(MessagePack.SequencePool pool) -> MessagePack.MessagePackSerializerOptions +MessagePack.MessagePackStreamReader.MessagePackStreamReader(System.IO.Stream stream, bool leaveOpen, MessagePack.SequencePool sequencePool) -> void +MessagePack.MessagePackStreamReader.ReadArrayHeaderAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask +MessagePack.MessagePackStreamReader.ReadMapHeaderAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask +MessagePack.MessagePackWriter.MessagePackWriter() -> void +MessagePack.SequencePool +MessagePack.SequencePool.SequencePool() -> void +MessagePack.SequencePool.SequencePool(int maxSize) -> void +MessagePack.SequencePool.SequencePool(int maxSize, System.Buffers.ArrayPool arrayPool) -> void +MessagePack.TinyJsonException.TinyJsonException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) -> void +static MessagePack.Nil.operator !=(MessagePack.Nil left, MessagePack.Nil right) -> bool +static MessagePack.Nil.operator ==(MessagePack.Nil left, MessagePack.Nil right) -> bool +static readonly MessagePack.Formatters.HalfFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter +virtual MessagePack.MessagePackStreamReader.Dispose(bool disposing) -> void +MessagePack.Formatters.GenericEnumerableFormatter +MessagePack.Formatters.GenericEnumerableFormatter.GenericEnumerableFormatter() -> void +MessagePack.Formatters.GenericReadOnlyDictionaryFormatter +MessagePack.Formatters.GenericReadOnlyDictionaryFormatter.GenericReadOnlyDictionaryFormatter() -> void diff --git a/src/MessagePack/net5.0/PublicAPI.Unshipped.txt b/src/MessagePack/net5.0/PublicAPI.Unshipped.txt index 1447ef0d5..e69de29bb 100644 --- a/src/MessagePack/net5.0/PublicAPI.Unshipped.txt +++ b/src/MessagePack/net5.0/PublicAPI.Unshipped.txt @@ -1,28 +0,0 @@ -MessagePack.ExtensionHeader.ExtensionHeader() -> void -MessagePack.ExtensionResult.ExtensionResult() -> void -MessagePack.FormatterNotRegisteredException.FormatterNotRegisteredException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) -> void -MessagePack.Formatters.HalfFormatter -MessagePack.Formatters.HalfFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.Half -MessagePack.Formatters.HalfFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.Half value, MessagePack.MessagePackSerializerOptions options) -> void -MessagePack.Formatters.InterfaceReadOnlySetFormatter -MessagePack.Formatters.InterfaceReadOnlySetFormatter.InterfaceReadOnlySetFormatter() -> void -MessagePack.MessagePackReader.MessagePackReader() -> void -MessagePack.MessagePackSerializerOptions.SequencePool.get -> MessagePack.SequencePool -MessagePack.MessagePackSerializerOptions.WithPool(MessagePack.SequencePool pool) -> MessagePack.MessagePackSerializerOptions -MessagePack.MessagePackStreamReader.MessagePackStreamReader(System.IO.Stream stream, bool leaveOpen, MessagePack.SequencePool sequencePool) -> void -MessagePack.MessagePackStreamReader.ReadArrayHeaderAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask -MessagePack.MessagePackStreamReader.ReadMapHeaderAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask -MessagePack.MessagePackWriter.MessagePackWriter() -> void -MessagePack.SequencePool -MessagePack.SequencePool.SequencePool() -> void -MessagePack.SequencePool.SequencePool(int maxSize) -> void -MessagePack.SequencePool.SequencePool(int maxSize, System.Buffers.ArrayPool arrayPool) -> void -MessagePack.TinyJsonException.TinyJsonException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) -> void -static MessagePack.Nil.operator !=(MessagePack.Nil left, MessagePack.Nil right) -> bool -static MessagePack.Nil.operator ==(MessagePack.Nil left, MessagePack.Nil right) -> bool -static readonly MessagePack.Formatters.HalfFormatter.Instance -> MessagePack.Formatters.IMessagePackFormatter -virtual MessagePack.MessagePackStreamReader.Dispose(bool disposing) -> void -MessagePack.Formatters.GenericEnumerableFormatter -MessagePack.Formatters.GenericEnumerableFormatter.GenericEnumerableFormatter() -> void -MessagePack.Formatters.GenericReadOnlyDictionaryFormatter -MessagePack.Formatters.GenericReadOnlyDictionaryFormatter.GenericReadOnlyDictionaryFormatter() -> void \ No newline at end of file diff --git a/src/MessagePack/netcoreapp2.1/PublicAPI.Shipped.txt b/src/MessagePack/netcoreapp2.1/PublicAPI.Shipped.txt index 8aabf5dce..c7fc0219c 100644 --- a/src/MessagePack/netcoreapp2.1/PublicAPI.Shipped.txt +++ b/src/MessagePack/netcoreapp2.1/PublicAPI.Shipped.txt @@ -1,4 +1,4 @@ -MessagePack.ExtensionHeader +MessagePack.ExtensionHeader MessagePack.ExtensionHeader.ExtensionHeader(sbyte typeCode, int length) -> void MessagePack.ExtensionHeader.ExtensionHeader(sbyte typeCode, uint length) -> void MessagePack.ExtensionHeader.Length.get -> uint @@ -1152,3 +1152,23 @@ static readonly MessagePack.ImmutableCollection.ImmutableCollectionResolver.Inst static readonly MessagePack.Resolvers.ExpandoObjectResolver.Instance -> MessagePack.IFormatterResolver static readonly MessagePack.Resolvers.ExpandoObjectResolver.Options -> MessagePack.MessagePackSerializerOptions virtual MessagePack.Formatters.PrimitiveObjectFormatter.DeserializeMap(ref MessagePack.MessagePackReader reader, int length, MessagePack.MessagePackSerializerOptions options) -> object +MessagePack.ExtensionHeader.ExtensionHeader() -> void +MessagePack.ExtensionResult.ExtensionResult() -> void +MessagePack.FormatterNotRegisteredException.FormatterNotRegisteredException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) -> void +MessagePack.MessagePackReader.MessagePackReader() -> void +MessagePack.MessagePackSerializerOptions.SequencePool.get -> MessagePack.SequencePool +MessagePack.MessagePackSerializerOptions.WithPool(MessagePack.SequencePool pool) -> MessagePack.MessagePackSerializerOptions +MessagePack.MessagePackStreamReader.MessagePackStreamReader(System.IO.Stream stream, bool leaveOpen, MessagePack.SequencePool sequencePool) -> void +MessagePack.MessagePackWriter.MessagePackWriter() -> void +MessagePack.SequencePool +MessagePack.SequencePool.SequencePool() -> void +MessagePack.SequencePool.SequencePool(int maxSize) -> void +MessagePack.SequencePool.SequencePool(int maxSize, System.Buffers.ArrayPool arrayPool) -> void +MessagePack.TinyJsonException.TinyJsonException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) -> void +static MessagePack.Nil.operator !=(MessagePack.Nil left, MessagePack.Nil right) -> bool +static MessagePack.Nil.operator ==(MessagePack.Nil left, MessagePack.Nil right) -> bool +virtual MessagePack.MessagePackStreamReader.Dispose(bool disposing) -> void +MessagePack.Formatters.GenericEnumerableFormatter +MessagePack.Formatters.GenericEnumerableFormatter.GenericEnumerableFormatter() -> void +MessagePack.Formatters.GenericReadOnlyDictionaryFormatter +MessagePack.Formatters.GenericReadOnlyDictionaryFormatter.GenericReadOnlyDictionaryFormatter() -> void diff --git a/src/MessagePack/netcoreapp2.1/PublicAPI.Unshipped.txt b/src/MessagePack/netcoreapp2.1/PublicAPI.Unshipped.txt index f053d3cd8..e69de29bb 100644 --- a/src/MessagePack/netcoreapp2.1/PublicAPI.Unshipped.txt +++ b/src/MessagePack/netcoreapp2.1/PublicAPI.Unshipped.txt @@ -1,20 +0,0 @@ -MessagePack.ExtensionHeader.ExtensionHeader() -> void -MessagePack.ExtensionResult.ExtensionResult() -> void -MessagePack.FormatterNotRegisteredException.FormatterNotRegisteredException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) -> void -MessagePack.MessagePackReader.MessagePackReader() -> void -MessagePack.MessagePackSerializerOptions.SequencePool.get -> MessagePack.SequencePool -MessagePack.MessagePackSerializerOptions.WithPool(MessagePack.SequencePool pool) -> MessagePack.MessagePackSerializerOptions -MessagePack.MessagePackStreamReader.MessagePackStreamReader(System.IO.Stream stream, bool leaveOpen, MessagePack.SequencePool sequencePool) -> void -MessagePack.MessagePackWriter.MessagePackWriter() -> void -MessagePack.SequencePool -MessagePack.SequencePool.SequencePool() -> void -MessagePack.SequencePool.SequencePool(int maxSize) -> void -MessagePack.SequencePool.SequencePool(int maxSize, System.Buffers.ArrayPool arrayPool) -> void -MessagePack.TinyJsonException.TinyJsonException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) -> void -static MessagePack.Nil.operator !=(MessagePack.Nil left, MessagePack.Nil right) -> bool -static MessagePack.Nil.operator ==(MessagePack.Nil left, MessagePack.Nil right) -> bool -virtual MessagePack.MessagePackStreamReader.Dispose(bool disposing) -> void -MessagePack.Formatters.GenericEnumerableFormatter -MessagePack.Formatters.GenericEnumerableFormatter.GenericEnumerableFormatter() -> void -MessagePack.Formatters.GenericReadOnlyDictionaryFormatter -MessagePack.Formatters.GenericReadOnlyDictionaryFormatter.GenericReadOnlyDictionaryFormatter() -> void \ No newline at end of file diff --git a/src/MessagePack/netcoreapp3.1/PublicAPI.Shipped.txt b/src/MessagePack/netcoreapp3.1/PublicAPI.Shipped.txt index 892718f06..51002a49f 100644 --- a/src/MessagePack/netcoreapp3.1/PublicAPI.Shipped.txt +++ b/src/MessagePack/netcoreapp3.1/PublicAPI.Shipped.txt @@ -1,4 +1,4 @@ -MessagePack.ExtensionHeader +MessagePack.ExtensionHeader MessagePack.ExtensionHeader.ExtensionHeader(sbyte typeCode, int length) -> void MessagePack.ExtensionHeader.ExtensionHeader(sbyte typeCode, uint length) -> void MessagePack.ExtensionHeader.Length.get -> uint @@ -1150,3 +1150,25 @@ static readonly MessagePack.ImmutableCollection.ImmutableCollectionResolver.Inst static readonly MessagePack.Resolvers.ExpandoObjectResolver.Instance -> MessagePack.IFormatterResolver static readonly MessagePack.Resolvers.ExpandoObjectResolver.Options -> MessagePack.MessagePackSerializerOptions virtual MessagePack.Formatters.PrimitiveObjectFormatter.DeserializeMap(ref MessagePack.MessagePackReader reader, int length, MessagePack.MessagePackSerializerOptions options) -> object +MessagePack.ExtensionHeader.ExtensionHeader() -> void +MessagePack.ExtensionResult.ExtensionResult() -> void +MessagePack.FormatterNotRegisteredException.FormatterNotRegisteredException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) -> void +MessagePack.MessagePackReader.MessagePackReader() -> void +MessagePack.MessagePackSerializerOptions.SequencePool.get -> MessagePack.SequencePool +MessagePack.MessagePackSerializerOptions.WithPool(MessagePack.SequencePool pool) -> MessagePack.MessagePackSerializerOptions +MessagePack.MessagePackStreamReader.MessagePackStreamReader(System.IO.Stream stream, bool leaveOpen, MessagePack.SequencePool sequencePool) -> void +MessagePack.MessagePackStreamReader.ReadArrayHeaderAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask +MessagePack.MessagePackStreamReader.ReadMapHeaderAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask +MessagePack.MessagePackWriter.MessagePackWriter() -> void +MessagePack.SequencePool +MessagePack.SequencePool.SequencePool() -> void +MessagePack.SequencePool.SequencePool(int maxSize) -> void +MessagePack.SequencePool.SequencePool(int maxSize, System.Buffers.ArrayPool arrayPool) -> void +MessagePack.TinyJsonException.TinyJsonException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) -> void +static MessagePack.Nil.operator !=(MessagePack.Nil left, MessagePack.Nil right) -> bool +static MessagePack.Nil.operator ==(MessagePack.Nil left, MessagePack.Nil right) -> bool +virtual MessagePack.MessagePackStreamReader.Dispose(bool disposing) -> void +MessagePack.Formatters.GenericEnumerableFormatter +MessagePack.Formatters.GenericEnumerableFormatter.GenericEnumerableFormatter() -> void +MessagePack.Formatters.GenericReadOnlyDictionaryFormatter +MessagePack.Formatters.GenericReadOnlyDictionaryFormatter.GenericReadOnlyDictionaryFormatter() -> void diff --git a/src/MessagePack/netcoreapp3.1/PublicAPI.Unshipped.txt b/src/MessagePack/netcoreapp3.1/PublicAPI.Unshipped.txt index 73b4e7c06..e69de29bb 100644 --- a/src/MessagePack/netcoreapp3.1/PublicAPI.Unshipped.txt +++ b/src/MessagePack/netcoreapp3.1/PublicAPI.Unshipped.txt @@ -1,22 +0,0 @@ -MessagePack.ExtensionHeader.ExtensionHeader() -> void -MessagePack.ExtensionResult.ExtensionResult() -> void -MessagePack.FormatterNotRegisteredException.FormatterNotRegisteredException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) -> void -MessagePack.MessagePackReader.MessagePackReader() -> void -MessagePack.MessagePackSerializerOptions.SequencePool.get -> MessagePack.SequencePool -MessagePack.MessagePackSerializerOptions.WithPool(MessagePack.SequencePool pool) -> MessagePack.MessagePackSerializerOptions -MessagePack.MessagePackStreamReader.MessagePackStreamReader(System.IO.Stream stream, bool leaveOpen, MessagePack.SequencePool sequencePool) -> void -MessagePack.MessagePackStreamReader.ReadArrayHeaderAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask -MessagePack.MessagePackStreamReader.ReadMapHeaderAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask -MessagePack.MessagePackWriter.MessagePackWriter() -> void -MessagePack.SequencePool -MessagePack.SequencePool.SequencePool() -> void -MessagePack.SequencePool.SequencePool(int maxSize) -> void -MessagePack.SequencePool.SequencePool(int maxSize, System.Buffers.ArrayPool arrayPool) -> void -MessagePack.TinyJsonException.TinyJsonException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) -> void -static MessagePack.Nil.operator !=(MessagePack.Nil left, MessagePack.Nil right) -> bool -static MessagePack.Nil.operator ==(MessagePack.Nil left, MessagePack.Nil right) -> bool -virtual MessagePack.MessagePackStreamReader.Dispose(bool disposing) -> void -MessagePack.Formatters.GenericEnumerableFormatter -MessagePack.Formatters.GenericEnumerableFormatter.GenericEnumerableFormatter() -> void -MessagePack.Formatters.GenericReadOnlyDictionaryFormatter -MessagePack.Formatters.GenericReadOnlyDictionaryFormatter.GenericReadOnlyDictionaryFormatter() -> void \ No newline at end of file diff --git a/src/MessagePack/netstandard2.0/PublicAPI.Shipped.txt b/src/MessagePack/netstandard2.0/PublicAPI.Shipped.txt index 892718f06..51002a49f 100644 --- a/src/MessagePack/netstandard2.0/PublicAPI.Shipped.txt +++ b/src/MessagePack/netstandard2.0/PublicAPI.Shipped.txt @@ -1,4 +1,4 @@ -MessagePack.ExtensionHeader +MessagePack.ExtensionHeader MessagePack.ExtensionHeader.ExtensionHeader(sbyte typeCode, int length) -> void MessagePack.ExtensionHeader.ExtensionHeader(sbyte typeCode, uint length) -> void MessagePack.ExtensionHeader.Length.get -> uint @@ -1150,3 +1150,25 @@ static readonly MessagePack.ImmutableCollection.ImmutableCollectionResolver.Inst static readonly MessagePack.Resolvers.ExpandoObjectResolver.Instance -> MessagePack.IFormatterResolver static readonly MessagePack.Resolvers.ExpandoObjectResolver.Options -> MessagePack.MessagePackSerializerOptions virtual MessagePack.Formatters.PrimitiveObjectFormatter.DeserializeMap(ref MessagePack.MessagePackReader reader, int length, MessagePack.MessagePackSerializerOptions options) -> object +MessagePack.ExtensionHeader.ExtensionHeader() -> void +MessagePack.ExtensionResult.ExtensionResult() -> void +MessagePack.FormatterNotRegisteredException.FormatterNotRegisteredException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) -> void +MessagePack.MessagePackReader.MessagePackReader() -> void +MessagePack.MessagePackSerializerOptions.SequencePool.get -> MessagePack.SequencePool +MessagePack.MessagePackSerializerOptions.WithPool(MessagePack.SequencePool pool) -> MessagePack.MessagePackSerializerOptions +MessagePack.MessagePackStreamReader.MessagePackStreamReader(System.IO.Stream stream, bool leaveOpen, MessagePack.SequencePool sequencePool) -> void +MessagePack.MessagePackStreamReader.ReadArrayHeaderAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask +MessagePack.MessagePackStreamReader.ReadMapHeaderAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask +MessagePack.MessagePackWriter.MessagePackWriter() -> void +MessagePack.SequencePool +MessagePack.SequencePool.SequencePool() -> void +MessagePack.SequencePool.SequencePool(int maxSize) -> void +MessagePack.SequencePool.SequencePool(int maxSize, System.Buffers.ArrayPool arrayPool) -> void +MessagePack.TinyJsonException.TinyJsonException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) -> void +static MessagePack.Nil.operator !=(MessagePack.Nil left, MessagePack.Nil right) -> bool +static MessagePack.Nil.operator ==(MessagePack.Nil left, MessagePack.Nil right) -> bool +virtual MessagePack.MessagePackStreamReader.Dispose(bool disposing) -> void +MessagePack.Formatters.GenericEnumerableFormatter +MessagePack.Formatters.GenericEnumerableFormatter.GenericEnumerableFormatter() -> void +MessagePack.Formatters.GenericReadOnlyDictionaryFormatter +MessagePack.Formatters.GenericReadOnlyDictionaryFormatter.GenericReadOnlyDictionaryFormatter() -> void diff --git a/src/MessagePack/netstandard2.0/PublicAPI.Unshipped.txt b/src/MessagePack/netstandard2.0/PublicAPI.Unshipped.txt index 73b4e7c06..e69de29bb 100644 --- a/src/MessagePack/netstandard2.0/PublicAPI.Unshipped.txt +++ b/src/MessagePack/netstandard2.0/PublicAPI.Unshipped.txt @@ -1,22 +0,0 @@ -MessagePack.ExtensionHeader.ExtensionHeader() -> void -MessagePack.ExtensionResult.ExtensionResult() -> void -MessagePack.FormatterNotRegisteredException.FormatterNotRegisteredException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) -> void -MessagePack.MessagePackReader.MessagePackReader() -> void -MessagePack.MessagePackSerializerOptions.SequencePool.get -> MessagePack.SequencePool -MessagePack.MessagePackSerializerOptions.WithPool(MessagePack.SequencePool pool) -> MessagePack.MessagePackSerializerOptions -MessagePack.MessagePackStreamReader.MessagePackStreamReader(System.IO.Stream stream, bool leaveOpen, MessagePack.SequencePool sequencePool) -> void -MessagePack.MessagePackStreamReader.ReadArrayHeaderAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask -MessagePack.MessagePackStreamReader.ReadMapHeaderAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask -MessagePack.MessagePackWriter.MessagePackWriter() -> void -MessagePack.SequencePool -MessagePack.SequencePool.SequencePool() -> void -MessagePack.SequencePool.SequencePool(int maxSize) -> void -MessagePack.SequencePool.SequencePool(int maxSize, System.Buffers.ArrayPool arrayPool) -> void -MessagePack.TinyJsonException.TinyJsonException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) -> void -static MessagePack.Nil.operator !=(MessagePack.Nil left, MessagePack.Nil right) -> bool -static MessagePack.Nil.operator ==(MessagePack.Nil left, MessagePack.Nil right) -> bool -virtual MessagePack.MessagePackStreamReader.Dispose(bool disposing) -> void -MessagePack.Formatters.GenericEnumerableFormatter -MessagePack.Formatters.GenericEnumerableFormatter.GenericEnumerableFormatter() -> void -MessagePack.Formatters.GenericReadOnlyDictionaryFormatter -MessagePack.Formatters.GenericReadOnlyDictionaryFormatter.GenericReadOnlyDictionaryFormatter() -> void \ No newline at end of file From 54b155f6e505c01ccdc95e0ced90dad8dd8225c2 Mon Sep 17 00:00:00 2001 From: pCYSl5EDgo <31692496+pCYSl5EDgo@users.noreply.github.com> Date: Tue, 28 Dec 2021 00:06:20 +0900 Subject: [PATCH 130/161] Avoid C#10 global using name collisions (#1368) --- sandbox/Sandbox/Generated.cs | 468 +++++++++--------- sandbox/TestData2/Generated.cs | 99 ++-- .../CodeAnalysis/Definitions.cs | 14 +- .../Generator/EnumTemplate.cs | 13 +- .../Generator/EnumTemplate.tt | 11 +- .../Generator/FormatterTemplate.cs | 8 +- .../Generator/FormatterTemplate.tt | 9 +- .../Generator/ResolverTemplate.cs | 10 +- .../Generator/ResolverTemplate.tt | 14 +- .../StringKey/StringKeyFormatterTemplate.cs | 21 +- .../StringKey/StringKeyFormatterTemplate.tt | 19 +- .../Generator/UnionTemplate.cs | 34 +- .../Generator/UnionTemplate.tt | 25 +- 13 files changed, 363 insertions(+), 382 deletions(-) diff --git a/sandbox/Sandbox/Generated.cs b/sandbox/Sandbox/Generated.cs index 64f68f84a..9b5c623ca 100644 --- a/sandbox/Sandbox/Generated.cs +++ b/sandbox/Sandbox/Generated.cs @@ -7,14 +7,11 @@ #pragma warning disable 414 #pragma warning disable 168 -#pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1312 // Variable names should begin with lower-case letter #pragma warning disable SA1649 // File name should match first type name namespace MessagePack.Resolvers { - using System; - public class GeneratedResolver : global::MessagePack.IFormatterResolver { public static readonly global::MessagePack.IFormatterResolver Instance = new GeneratedResolver(); @@ -45,11 +42,11 @@ static FormatterCache() internal static class GeneratedResolverGetFormatterHelper { - private static readonly global::System.Collections.Generic.Dictionary lookup; + private static readonly global::System.Collections.Generic.Dictionary lookup; static GeneratedResolverGetFormatterHelper() { - lookup = new global::System.Collections.Generic.Dictionary(72) + lookup = new global::System.Collections.Generic.Dictionary(72) { { typeof(global::GlobalMyEnum[,]), 0 }, { typeof(global::GlobalMyEnum[]), 1 }, @@ -126,7 +123,7 @@ static GeneratedResolverGetFormatterHelper() }; } - internal static object GetFormatter(Type t) + internal static object GetFormatter(global::System.Type t) { int key; if (!lookup.TryGetValue(t, out key)) @@ -220,7 +217,6 @@ internal static object GetFormatter(Type t) #pragma warning restore 612 #pragma warning restore SA1312 // Variable names should begin with lower-case letter -#pragma warning restore SA1200 // Using directives should be placed correctly #pragma warning restore SA1649 // File name should match first type name @@ -233,24 +229,20 @@ internal static object GetFormatter(Type t) #pragma warning disable 414 #pragma warning disable 168 -#pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1403 // File may only contain a single namespace #pragma warning disable SA1649 // File name should match first type name namespace MessagePack.Formatters { - using System; - using System.Buffers; - using MessagePack; public sealed class GlobalMyEnumFormatter : global::MessagePack.Formatters.IMessagePackFormatter { - public void Serialize(ref MessagePackWriter writer, global::GlobalMyEnum value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::GlobalMyEnum value, global::MessagePack.MessagePackSerializerOptions options) { - writer.Write((Int32)value); + writer.Write((global::System.Int32)value); } - public global::GlobalMyEnum Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::GlobalMyEnum Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { return (global::GlobalMyEnum)reader.ReadInt32(); } @@ -262,7 +254,6 @@ public void Serialize(ref MessagePackWriter writer, global::GlobalMyEnum value, #pragma warning restore 618 #pragma warning restore 612 -#pragma warning restore SA1200 // Using directives should be placed correctly #pragma warning restore SA1403 // File may only contain a single namespace #pragma warning restore SA1649 // File name should match first type name @@ -275,24 +266,20 @@ public void Serialize(ref MessagePackWriter writer, global::GlobalMyEnum value, #pragma warning disable 414 #pragma warning disable 168 -#pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1403 // File may only contain a single namespace #pragma warning disable SA1649 // File name should match first type name namespace MessagePack.Formatters.SharedData { - using System; - using System.Buffers; - using MessagePack; public sealed class ByteEnumFormatter : global::MessagePack.Formatters.IMessagePackFormatter { - public void Serialize(ref MessagePackWriter writer, global::SharedData.ByteEnum value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.ByteEnum value, global::MessagePack.MessagePackSerializerOptions options) { - writer.Write((Byte)value); + writer.Write((global::System.Byte)value); } - public global::SharedData.ByteEnum Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::SharedData.ByteEnum Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { return (global::SharedData.ByteEnum)reader.ReadByte(); } @@ -304,7 +291,6 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.ByteEnum #pragma warning restore 618 #pragma warning restore 612 -#pragma warning restore SA1200 // Using directives should be placed correctly #pragma warning restore SA1403 // File may only contain a single namespace #pragma warning restore SA1649 // File name should match first type name @@ -318,31 +304,25 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.ByteEnum #pragma warning disable 414 #pragma warning disable 168 -#pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1403 // File may only contain a single namespace #pragma warning disable SA1649 // File name should match first type name namespace MessagePack.Formatters { - using System; - using System.Buffers; - using System.Collections.Generic; - using MessagePack; - public sealed class IMessageBodyFormatter : global::MessagePack.Formatters.IMessagePackFormatter { - private readonly Dictionary> typeToKeyAndJumpMap; - private readonly Dictionary keyToJumpMap; + private readonly global::System.Collections.Generic.Dictionary> typeToKeyAndJumpMap; + private readonly global::System.Collections.Generic.Dictionary keyToJumpMap; public IMessageBodyFormatter() { - this.typeToKeyAndJumpMap = new Dictionary>(3, global::MessagePack.Internal.RuntimeTypeHandleEqualityComparer.Default) + this.typeToKeyAndJumpMap = new global::System.Collections.Generic.Dictionary>(3, global::MessagePack.Internal.RuntimeTypeHandleEqualityComparer.Default) { - { typeof(global::TextMessageBody).TypeHandle, new KeyValuePair(10, 0) }, - { typeof(global::StampMessageBody).TypeHandle, new KeyValuePair(14, 1) }, - { typeof(global::QuestMessageBody).TypeHandle, new KeyValuePair(25, 2) }, + { typeof(global::TextMessageBody).TypeHandle, new global::System.Collections.Generic.KeyValuePair(10, 0) }, + { typeof(global::StampMessageBody).TypeHandle, new global::System.Collections.Generic.KeyValuePair(14, 1) }, + { typeof(global::QuestMessageBody).TypeHandle, new global::System.Collections.Generic.KeyValuePair(25, 2) }, }; - this.keyToJumpMap = new Dictionary(3) + this.keyToJumpMap = new global::System.Collections.Generic.Dictionary(3) { { 10, 0 }, { 14, 1 }, @@ -350,9 +330,9 @@ public IMessageBodyFormatter() }; } - public void Serialize(ref MessagePackWriter writer, global::IMessageBody value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::IMessageBody value, global::MessagePack.MessagePackSerializerOptions options) { - KeyValuePair keyValuePair; + global::System.Collections.Generic.KeyValuePair keyValuePair; if (value != null && this.typeToKeyAndJumpMap.TryGetValue(value.GetType().TypeHandle, out keyValuePair)) { writer.WriteArrayHeader(2); @@ -378,7 +358,7 @@ public void Serialize(ref MessagePackWriter writer, global::IMessageBody value, writer.WriteNil(); } - public global::IMessageBody Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::IMessageBody Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { @@ -387,7 +367,7 @@ public void Serialize(ref MessagePackWriter writer, global::IMessageBody value, if (reader.ReadArrayHeader() != 2) { - throw new InvalidOperationException("Invalid Union data was detected. Type:global::IMessageBody"); + throw new global::System.InvalidOperationException("Invalid Union data was detected. Type:global::IMessageBody"); } options.Security.DepthStep(ref reader); @@ -428,7 +408,6 @@ public void Serialize(ref MessagePackWriter writer, global::IMessageBody value, #pragma warning restore 618 #pragma warning restore 612 -#pragma warning restore SA1200 // Using directives should be placed correctly #pragma warning restore SA1403 // File may only contain a single namespace #pragma warning restore SA1649 // File name should match first type name @@ -441,37 +420,31 @@ public void Serialize(ref MessagePackWriter writer, global::IMessageBody value, #pragma warning disable 414 #pragma warning disable 168 -#pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1403 // File may only contain a single namespace #pragma warning disable SA1649 // File name should match first type name namespace MessagePack.Formatters.SharedData { - using System; - using System.Buffers; - using System.Collections.Generic; - using MessagePack; - public sealed class IIVersioningUnionFormatter : global::MessagePack.Formatters.IMessagePackFormatter { - private readonly Dictionary> typeToKeyAndJumpMap; - private readonly Dictionary keyToJumpMap; + private readonly global::System.Collections.Generic.Dictionary> typeToKeyAndJumpMap; + private readonly global::System.Collections.Generic.Dictionary keyToJumpMap; public IIVersioningUnionFormatter() { - this.typeToKeyAndJumpMap = new Dictionary>(1, global::MessagePack.Internal.RuntimeTypeHandleEqualityComparer.Default) + this.typeToKeyAndJumpMap = new global::System.Collections.Generic.Dictionary>(1, global::MessagePack.Internal.RuntimeTypeHandleEqualityComparer.Default) { - { typeof(global::SharedData.MySubUnion1).TypeHandle, new KeyValuePair(0, 0) }, + { typeof(global::SharedData.MySubUnion1).TypeHandle, new global::System.Collections.Generic.KeyValuePair(0, 0) }, }; - this.keyToJumpMap = new Dictionary(1) + this.keyToJumpMap = new global::System.Collections.Generic.Dictionary(1) { { 0, 0 }, }; } - public void Serialize(ref MessagePackWriter writer, global::SharedData.IIVersioningUnion value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.IIVersioningUnion value, global::MessagePack.MessagePackSerializerOptions options) { - KeyValuePair keyValuePair; + global::System.Collections.Generic.KeyValuePair keyValuePair; if (value != null && this.typeToKeyAndJumpMap.TryGetValue(value.GetType().TypeHandle, out keyValuePair)) { writer.WriteArrayHeader(2); @@ -491,7 +464,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.IIVersion writer.WriteNil(); } - public global::SharedData.IIVersioningUnion Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::SharedData.IIVersioningUnion Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { @@ -500,7 +473,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.IIVersion if (reader.ReadArrayHeader() != 2) { - throw new InvalidOperationException("Invalid Union data was detected. Type:global::SharedData.IIVersioningUnion"); + throw new global::System.InvalidOperationException("Invalid Union data was detected. Type:global::SharedData.IIVersioningUnion"); } options.Security.DepthStep(ref reader); @@ -529,19 +502,19 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.IIVersion public sealed class IUnionCheckerFormatter : global::MessagePack.Formatters.IMessagePackFormatter { - private readonly Dictionary> typeToKeyAndJumpMap; - private readonly Dictionary keyToJumpMap; + private readonly global::System.Collections.Generic.Dictionary> typeToKeyAndJumpMap; + private readonly global::System.Collections.Generic.Dictionary keyToJumpMap; public IUnionCheckerFormatter() { - this.typeToKeyAndJumpMap = new Dictionary>(4, global::MessagePack.Internal.RuntimeTypeHandleEqualityComparer.Default) + this.typeToKeyAndJumpMap = new global::System.Collections.Generic.Dictionary>(4, global::MessagePack.Internal.RuntimeTypeHandleEqualityComparer.Default) { - { typeof(global::SharedData.MySubUnion1).TypeHandle, new KeyValuePair(0, 0) }, - { typeof(global::SharedData.MySubUnion2).TypeHandle, new KeyValuePair(1, 1) }, - { typeof(global::SharedData.MySubUnion3).TypeHandle, new KeyValuePair(2, 2) }, - { typeof(global::SharedData.MySubUnion4).TypeHandle, new KeyValuePair(3, 3) }, + { typeof(global::SharedData.MySubUnion1).TypeHandle, new global::System.Collections.Generic.KeyValuePair(0, 0) }, + { typeof(global::SharedData.MySubUnion2).TypeHandle, new global::System.Collections.Generic.KeyValuePair(1, 1) }, + { typeof(global::SharedData.MySubUnion3).TypeHandle, new global::System.Collections.Generic.KeyValuePair(2, 2) }, + { typeof(global::SharedData.MySubUnion4).TypeHandle, new global::System.Collections.Generic.KeyValuePair(3, 3) }, }; - this.keyToJumpMap = new Dictionary(4) + this.keyToJumpMap = new global::System.Collections.Generic.Dictionary(4) { { 0, 0 }, { 1, 1 }, @@ -550,9 +523,9 @@ public IUnionCheckerFormatter() }; } - public void Serialize(ref MessagePackWriter writer, global::SharedData.IUnionChecker value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.IUnionChecker value, global::MessagePack.MessagePackSerializerOptions options) { - KeyValuePair keyValuePair; + global::System.Collections.Generic.KeyValuePair keyValuePair; if (value != null && this.typeToKeyAndJumpMap.TryGetValue(value.GetType().TypeHandle, out keyValuePair)) { writer.WriteArrayHeader(2); @@ -581,7 +554,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.IUnionChe writer.WriteNil(); } - public global::SharedData.IUnionChecker Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::SharedData.IUnionChecker Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { @@ -590,7 +563,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.IUnionChe if (reader.ReadArrayHeader() != 2) { - throw new InvalidOperationException("Invalid Union data was detected. Type:global::SharedData.IUnionChecker"); + throw new global::System.InvalidOperationException("Invalid Union data was detected. Type:global::SharedData.IUnionChecker"); } options.Security.DepthStep(ref reader); @@ -628,19 +601,19 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.IUnionChe public sealed class IUnionChecker2Formatter : global::MessagePack.Formatters.IMessagePackFormatter { - private readonly Dictionary> typeToKeyAndJumpMap; - private readonly Dictionary keyToJumpMap; + private readonly global::System.Collections.Generic.Dictionary> typeToKeyAndJumpMap; + private readonly global::System.Collections.Generic.Dictionary keyToJumpMap; public IUnionChecker2Formatter() { - this.typeToKeyAndJumpMap = new Dictionary>(4, global::MessagePack.Internal.RuntimeTypeHandleEqualityComparer.Default) + this.typeToKeyAndJumpMap = new global::System.Collections.Generic.Dictionary>(4, global::MessagePack.Internal.RuntimeTypeHandleEqualityComparer.Default) { - { typeof(global::SharedData.MySubUnion2).TypeHandle, new KeyValuePair(31, 0) }, - { typeof(global::SharedData.MySubUnion3).TypeHandle, new KeyValuePair(42, 1) }, - { typeof(global::SharedData.MySubUnion4).TypeHandle, new KeyValuePair(63, 2) }, - { typeof(global::SharedData.MySubUnion1).TypeHandle, new KeyValuePair(120, 3) }, + { typeof(global::SharedData.MySubUnion2).TypeHandle, new global::System.Collections.Generic.KeyValuePair(31, 0) }, + { typeof(global::SharedData.MySubUnion3).TypeHandle, new global::System.Collections.Generic.KeyValuePair(42, 1) }, + { typeof(global::SharedData.MySubUnion4).TypeHandle, new global::System.Collections.Generic.KeyValuePair(63, 2) }, + { typeof(global::SharedData.MySubUnion1).TypeHandle, new global::System.Collections.Generic.KeyValuePair(120, 3) }, }; - this.keyToJumpMap = new Dictionary(4) + this.keyToJumpMap = new global::System.Collections.Generic.Dictionary(4) { { 31, 0 }, { 42, 1 }, @@ -649,9 +622,9 @@ public IUnionChecker2Formatter() }; } - public void Serialize(ref MessagePackWriter writer, global::SharedData.IUnionChecker2 value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.IUnionChecker2 value, global::MessagePack.MessagePackSerializerOptions options) { - KeyValuePair keyValuePair; + global::System.Collections.Generic.KeyValuePair keyValuePair; if (value != null && this.typeToKeyAndJumpMap.TryGetValue(value.GetType().TypeHandle, out keyValuePair)) { writer.WriteArrayHeader(2); @@ -680,7 +653,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.IUnionChe writer.WriteNil(); } - public global::SharedData.IUnionChecker2 Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::SharedData.IUnionChecker2 Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { @@ -689,7 +662,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.IUnionChe if (reader.ReadArrayHeader() != 2) { - throw new InvalidOperationException("Invalid Union data was detected. Type:global::SharedData.IUnionChecker2"); + throw new global::System.InvalidOperationException("Invalid Union data was detected. Type:global::SharedData.IUnionChecker2"); } options.Security.DepthStep(ref reader); @@ -727,26 +700,26 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.IUnionChe public sealed class IUnionSampleFormatter : global::MessagePack.Formatters.IMessagePackFormatter { - private readonly Dictionary> typeToKeyAndJumpMap; - private readonly Dictionary keyToJumpMap; + private readonly global::System.Collections.Generic.Dictionary> typeToKeyAndJumpMap; + private readonly global::System.Collections.Generic.Dictionary keyToJumpMap; public IUnionSampleFormatter() { - this.typeToKeyAndJumpMap = new Dictionary>(2, global::MessagePack.Internal.RuntimeTypeHandleEqualityComparer.Default) + this.typeToKeyAndJumpMap = new global::System.Collections.Generic.Dictionary>(2, global::MessagePack.Internal.RuntimeTypeHandleEqualityComparer.Default) { - { typeof(global::SharedData.FooClass).TypeHandle, new KeyValuePair(0, 0) }, - { typeof(global::SharedData.BarClass).TypeHandle, new KeyValuePair(100, 1) }, + { typeof(global::SharedData.FooClass).TypeHandle, new global::System.Collections.Generic.KeyValuePair(0, 0) }, + { typeof(global::SharedData.BarClass).TypeHandle, new global::System.Collections.Generic.KeyValuePair(100, 1) }, }; - this.keyToJumpMap = new Dictionary(2) + this.keyToJumpMap = new global::System.Collections.Generic.Dictionary(2) { { 0, 0 }, { 100, 1 }, }; } - public void Serialize(ref MessagePackWriter writer, global::SharedData.IUnionSample value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.IUnionSample value, global::MessagePack.MessagePackSerializerOptions options) { - KeyValuePair keyValuePair; + global::System.Collections.Generic.KeyValuePair keyValuePair; if (value != null && this.typeToKeyAndJumpMap.TryGetValue(value.GetType().TypeHandle, out keyValuePair)) { writer.WriteArrayHeader(2); @@ -769,7 +742,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.IUnionSam writer.WriteNil(); } - public global::SharedData.IUnionSample Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::SharedData.IUnionSample Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { @@ -778,7 +751,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.IUnionSam if (reader.ReadArrayHeader() != 2) { - throw new InvalidOperationException("Invalid Union data was detected. Type:global::SharedData.IUnionSample"); + throw new global::System.InvalidOperationException("Invalid Union data was detected. Type:global::SharedData.IUnionSample"); } options.Security.DepthStep(ref reader); @@ -810,26 +783,26 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.IUnionSam public sealed class RootUnionTypeFormatter : global::MessagePack.Formatters.IMessagePackFormatter { - private readonly Dictionary> typeToKeyAndJumpMap; - private readonly Dictionary keyToJumpMap; + private readonly global::System.Collections.Generic.Dictionary> typeToKeyAndJumpMap; + private readonly global::System.Collections.Generic.Dictionary keyToJumpMap; public RootUnionTypeFormatter() { - this.typeToKeyAndJumpMap = new Dictionary>(2, global::MessagePack.Internal.RuntimeTypeHandleEqualityComparer.Default) + this.typeToKeyAndJumpMap = new global::System.Collections.Generic.Dictionary>(2, global::MessagePack.Internal.RuntimeTypeHandleEqualityComparer.Default) { - { typeof(global::SharedData.SubUnionType1).TypeHandle, new KeyValuePair(0, 0) }, - { typeof(global::SharedData.SubUnionType2).TypeHandle, new KeyValuePair(1, 1) }, + { typeof(global::SharedData.SubUnionType1).TypeHandle, new global::System.Collections.Generic.KeyValuePair(0, 0) }, + { typeof(global::SharedData.SubUnionType2).TypeHandle, new global::System.Collections.Generic.KeyValuePair(1, 1) }, }; - this.keyToJumpMap = new Dictionary(2) + this.keyToJumpMap = new global::System.Collections.Generic.Dictionary(2) { { 0, 0 }, { 1, 1 }, }; } - public void Serialize(ref MessagePackWriter writer, global::SharedData.RootUnionType value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.RootUnionType value, global::MessagePack.MessagePackSerializerOptions options) { - KeyValuePair keyValuePair; + global::System.Collections.Generic.KeyValuePair keyValuePair; if (value != null && this.typeToKeyAndJumpMap.TryGetValue(value.GetType().TypeHandle, out keyValuePair)) { writer.WriteArrayHeader(2); @@ -852,7 +825,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.RootUnion writer.WriteNil(); } - public global::SharedData.RootUnionType Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::SharedData.RootUnionType Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { @@ -861,7 +834,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.RootUnion if (reader.ReadArrayHeader() != 2) { - throw new InvalidOperationException("Invalid Union data was detected. Type:global::SharedData.RootUnionType"); + throw new global::System.InvalidOperationException("Invalid Union data was detected. Type:global::SharedData.RootUnionType"); } options.Security.DepthStep(ref reader); @@ -899,7 +872,6 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.RootUnion #pragma warning restore 618 #pragma warning restore 612 -#pragma warning restore SA1200 // Using directives should be placed correctly #pragma warning restore SA1403 // File may only contain a single namespace #pragma warning restore SA1649 // File name should match first type name @@ -914,7 +886,6 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.RootUnion #pragma warning disable 168 #pragma warning disable SA1129 // Do not use default value type constructor -#pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1309 // Field names should not begin with underscore #pragma warning disable SA1312 // Variable names should begin with lower-case letter #pragma warning disable SA1403 // File may only contain a single namespace @@ -922,9 +893,6 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.RootUnion namespace MessagePack.Formatters.Abcdefg.Efcdigjl.Ateatatea.Hgfagfafgad { - using global::System.Buffers; - using global::MessagePack; - public sealed class TnonodsfarnoiuAtatqagaFormatter : global::MessagePack.Formatters.IMessagePackFormatter { @@ -968,6 +936,7 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: return ____result; } } + } #pragma warning restore 168 @@ -976,7 +945,6 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: #pragma warning restore 612 #pragma warning restore SA1129 // Do not use default value type constructor -#pragma warning restore SA1200 // Using directives should be placed correctly #pragma warning restore SA1309 // Field names should not begin with underscore #pragma warning restore SA1312 // Variable names should begin with lower-case letter #pragma warning restore SA1403 // File may only contain a single namespace @@ -992,7 +960,6 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: #pragma warning disable 168 #pragma warning disable SA1129 // Do not use default value type constructor -#pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1309 // Field names should not begin with underscore #pragma warning disable SA1312 // Variable names should begin with lower-case letter #pragma warning disable SA1403 // File may only contain a single namespace @@ -1000,9 +967,6 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: namespace MessagePack.Formatters { - using global::System.Buffers; - using global::MessagePack; - public sealed class ArrayTestTestFormatter : global::MessagePack.Formatters.IMessagePackFormatter { @@ -1016,13 +980,13 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; writer.WriteArrayHeader(7); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.MyProperty0, options); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.MyProperty1, options); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.MyProperty2, options); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.MyProperty3, options); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.MyProperty4, options); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.MyProperty5, options); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.MyProperty6, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.MyProperty0, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.MyProperty1, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.MyProperty2, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.MyProperty3, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.MyProperty4, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.MyProperty5, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.MyProperty6, options); } public global::ArrayTestTest Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) @@ -1042,25 +1006,25 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: switch (i) { case 0: - ____result.MyProperty0 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.MyProperty0 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); break; case 1: - ____result.MyProperty1 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.MyProperty1 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); break; case 2: - ____result.MyProperty2 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.MyProperty2 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); break; case 3: - ____result.MyProperty3 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.MyProperty3 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); break; case 4: - ____result.MyProperty4 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.MyProperty4 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); break; case 5: - ____result.MyProperty5 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.MyProperty5 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); break; case 6: - ____result.MyProperty6 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.MyProperty6 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); break; default: reader.Skip(); @@ -1132,8 +1096,8 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: writer.WriteArrayHeader(4); writer.Write(value.UserId); writer.Write(value.RoomId); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.PostTime, options); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.Body, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.PostTime, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.Body, options); } public global::Message Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) @@ -1159,10 +1123,10 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: ____result.RoomId = reader.ReadInt32(); break; case 2: - ____result.PostTime = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.PostTime = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); break; case 3: - ____result.Body = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.Body = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); break; default: reader.Skip(); @@ -1234,7 +1198,7 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; writer.WriteArrayHeader(2); writer.Write(value.QuestId); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.Text, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.Text, options); } public global::QuestMessageBody Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) @@ -1257,7 +1221,7 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: ____result.QuestId = reader.ReadInt32(); break; case 1: - ____result.Text = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.Text = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); break; default: reader.Skip(); @@ -1327,7 +1291,7 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; writer.WriteArrayHeader(1); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.Text, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.Text, options); } public global::TextMessageBody Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) @@ -1347,7 +1311,7 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: switch (i) { case 0: - ____result.Text = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.Text = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); break; default: reader.Skip(); @@ -1359,6 +1323,7 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: return ____result; } } + } #pragma warning restore 168 @@ -1367,7 +1332,6 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: #pragma warning restore 612 #pragma warning restore SA1129 // Do not use default value type constructor -#pragma warning restore SA1200 // Using directives should be placed correctly #pragma warning restore SA1309 // Field names should not begin with underscore #pragma warning restore SA1312 // Variable names should begin with lower-case letter #pragma warning restore SA1403 // File may only contain a single namespace @@ -1383,7 +1347,6 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: #pragma warning disable 168 #pragma warning disable SA1129 // Do not use default value type constructor -#pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1309 // Field names should not begin with underscore #pragma warning disable SA1312 // Variable names should begin with lower-case letter #pragma warning disable SA1403 // File may only contain a single namespace @@ -1391,9 +1354,6 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: namespace MessagePack.Formatters { - using global::System.Buffers; - using global::MessagePack; - public sealed class ComplexModelFormatter : global::MessagePack.Formatters.IMessagePackFormatter { // AdditionalProperty @@ -1420,17 +1380,17 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: var formatterResolver = options.Resolver; writer.WriteMapHeader(6); writer.WriteRaw(GetSpan_AdditionalProperty()); - formatterResolver.GetFormatterWithVerify>().Serialize(ref writer, value.AdditionalProperty, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify>(formatterResolver).Serialize(ref writer, value.AdditionalProperty, options); writer.WriteRaw(GetSpan_CreatedOn()); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.CreatedOn, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.CreatedOn, options); writer.WriteRaw(GetSpan_Id()); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.Id, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.Id, options); writer.WriteRaw(GetSpan_Name()); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.Name, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.Name, options); writer.WriteRaw(GetSpan_UpdatedOn()); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.UpdatedOn, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.UpdatedOn, options); writer.WriteRaw(GetSpan_SimpleModels()); - formatterResolver.GetFormatterWithVerify>().Serialize(ref writer, value.SimpleModels, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify>(formatterResolver).Serialize(ref writer, value.SimpleModels, options); } public global::ComplexModel Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) @@ -1466,25 +1426,25 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: case 5720808977192022595UL: if (stringKey[0] != 110) { goto FAIL; } - ____result.CreatedOn = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.CreatedOn = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); continue; case 5720808977191956565UL: if (stringKey[0] != 110) { goto FAIL; } - ____result.UpdatedOn = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.UpdatedOn = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); continue; } case 2: if (global::MessagePack.Internal.AutomataKeyGen.GetKey(ref stringKey) != 25673UL) { goto FAIL; } - ____result.Id = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.Id = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); continue; case 4: if (global::MessagePack.Internal.AutomataKeyGen.GetKey(ref stringKey) != 1701667150UL) { goto FAIL; } - ____result.Name = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.Name = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); continue; case 12: if (!global::System.MemoryExtensions.SequenceEqual(stringKey, GetSpan_SimpleModels().Slice(1))) { goto FAIL; } @@ -1528,13 +1488,13 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: writer.WriteRaw(GetSpan_Id()); writer.Write(value.Id); writer.WriteRaw(GetSpan_Name()); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.Name, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.Name, options); writer.WriteRaw(GetSpan_CreatedOn()); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.CreatedOn, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.CreatedOn, options); writer.WriteRaw(GetSpan_Precision()); writer.Write(value.Precision); writer.WriteRaw(GetSpan_Money()); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.Money, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.Money, options); writer.WriteRaw(GetSpan_Amount()); writer.Write(value.Amount); } @@ -1568,7 +1528,7 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: case 4: if (global::MessagePack.Internal.AutomataKeyGen.GetKey(ref stringKey) != 1701667150UL) { goto FAIL; } - ____result.Name = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.Name = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); continue; case 9: switch (global::MessagePack.Internal.AutomataKeyGen.GetKey(ref stringKey)) @@ -1577,7 +1537,7 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: case 5720808977192022595UL: if (stringKey[0] != 110) { goto FAIL; } - ____result.CreatedOn = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.CreatedOn = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); continue; case 8028074707240972880UL: @@ -1590,7 +1550,7 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: case 5: if (global::MessagePack.Internal.AutomataKeyGen.GetKey(ref stringKey) != 521392779085UL) { goto FAIL; } - ____result.Money = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.Money = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); continue; case 6: if (global::MessagePack.Internal.AutomataKeyGen.GetKey(ref stringKey) != 128017765461313UL) { goto FAIL; } @@ -1605,8 +1565,20 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: return ____result; } } + } +#pragma warning restore 168 +#pragma warning restore 414 +#pragma warning restore 618 +#pragma warning restore 612 + +#pragma warning restore SA1129 // Do not use default value type constructor +#pragma warning restore SA1309 // Field names should not begin with underscore +#pragma warning restore SA1312 // Variable names should begin with lower-case letter +#pragma warning restore SA1403 // File may only contain a single namespace +#pragma warning restore SA1649 // File name should match first type name + // // THIS (.cs) FILE IS GENERATED BY MPC(MessagePack-CSharp). DO NOT CHANGE IT. // @@ -1617,7 +1589,6 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: #pragma warning disable 168 #pragma warning disable SA1129 // Do not use default value type constructor -#pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1309 // Field names should not begin with underscore #pragma warning disable SA1312 // Variable names should begin with lower-case letter #pragma warning disable SA1403 // File may only contain a single namespace @@ -1625,9 +1596,6 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: namespace MessagePack.Formatters.PerfBenchmarkDotNet { - using global::System.Buffers; - using global::MessagePack; - public sealed class StringKeySerializerTargetFormatter : global::MessagePack.Formatters.IMessagePackFormatter { // MyProperty1 @@ -1744,8 +1712,20 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: return ____result; } } + } +#pragma warning restore 168 +#pragma warning restore 414 +#pragma warning restore 618 +#pragma warning restore 612 + +#pragma warning restore SA1129 // Do not use default value type constructor +#pragma warning restore SA1309 // Field names should not begin with underscore +#pragma warning restore SA1312 // Variable names should begin with lower-case letter +#pragma warning restore SA1403 // File may only contain a single namespace +#pragma warning restore SA1649 // File name should match first type name + // // THIS (.cs) FILE IS GENERATED BY MPC(MessagePack-CSharp). DO NOT CHANGE IT. // @@ -1756,7 +1736,6 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: #pragma warning disable 168 #pragma warning disable SA1129 // Do not use default value type constructor -#pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1309 // Field names should not begin with underscore #pragma warning disable SA1312 // Variable names should begin with lower-case letter #pragma warning disable SA1403 // File may only contain a single namespace @@ -1764,9 +1743,6 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: namespace MessagePack.Formatters.SharedData { - using global::System.Buffers; - using global::MessagePack; - public sealed class ArrayOptimizeClassFormatter : global::MessagePack.Formatters.IMessagePackFormatter { @@ -1884,7 +1860,7 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; writer.WriteArrayHeader(1); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.OPQ, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.OPQ, options); } public global::SharedData.BarClass Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) @@ -1904,7 +1880,7 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: switch (i) { case 0: - ____result.OPQ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.OPQ = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); break; default: reader.Skip(); @@ -2026,8 +2002,8 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: writer.WriteArrayHeader(4); writer.Write(value.Prop1); writer.Write(value.Prop2); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.Prop3, options); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.Prop4, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.Prop3, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.Prop4, options); } public global::SharedData.DefaultValueIntKeyClassWithExplicitConstructor Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) @@ -2056,10 +2032,10 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: __Prop2__ = reader.ReadInt32(); break; case 2: - __Prop3__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + __Prop3__ = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); break; case 3: - __Prop4__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + __Prop4__ = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); break; default: reader.Skip(); @@ -2200,15 +2176,15 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: { global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; writer.WriteArrayHeader(9); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.Item1, options); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.Item2, options); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.Item3, options); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.Item4, options); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.Item5, options); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.Item6, options); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.Item7, options); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.Item8, options); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.Item9, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.Item1, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.Item2, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.Item3, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.Item4, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.Item5, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.Item6, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.Item7, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.Item8, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.Item9, options); } public global::SharedData.DynamicArgumentTuple Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) @@ -2236,31 +2212,31 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: switch (i) { case 0: - __Item1__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + __Item1__ = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); break; case 1: - __Item2__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + __Item2__ = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); break; case 2: - __Item3__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + __Item3__ = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); break; case 3: - __Item4__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + __Item4__ = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); break; case 4: - __Item5__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + __Item5__ = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); break; case 5: - __Item6__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + __Item6__ = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); break; case 6: - __Item7__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + __Item7__ = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); break; case 7: - __Item8__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + __Item8__ = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); break; case 8: - __Item9__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + __Item9__ = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); break; default: reader.Skip(); @@ -2360,7 +2336,7 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; writer.WriteArrayHeader(3); writer.Write(value.Prop1); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.Prop2, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.Prop2, options); writer.Write(value.Prop3); } @@ -2384,7 +2360,7 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: ____result.Prop1 = reader.ReadInt32(); break; case 1: - ____result.Prop2 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.Prop2 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); break; case 2: ____result.Prop3 = reader.ReadInt32(); @@ -2457,8 +2433,8 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; writer.WriteArrayHeader(2); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.MyProperty0, options); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.MyProperty1, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.MyProperty0, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.MyProperty1, options); } public global::SharedData.GenericClass Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) @@ -2478,10 +2454,10 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: switch (i) { case 0: - ____result.MyProperty0 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.MyProperty0 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); break; case 1: - ____result.MyProperty1 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.MyProperty1 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); break; default: reader.Skip(); @@ -2509,8 +2485,8 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; writer.WriteArrayHeader(2); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.MyProperty0, options); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.Comparer, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.MyProperty0, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.Comparer, options); } public global::SharedData.GenericConstrainedClassIntKey Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) @@ -2530,10 +2506,10 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: switch (i) { case 0: - ____result.MyProperty0 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.MyProperty0 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); break; case 1: - ____result.Comparer = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.Comparer = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); break; default: reader.Skip(); @@ -2555,8 +2531,8 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: { global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; writer.WriteArrayHeader(2); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.MyProperty0, options); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.Comparer, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.MyProperty0, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.Comparer, options); } public global::SharedData.GenericConstrainedStructIntKey Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) @@ -2576,10 +2552,10 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: switch (i) { case 0: - ____result.MyProperty0 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.MyProperty0 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); break; case 1: - ____result.Comparer = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.Comparer = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); break; default: reader.Skip(); @@ -2599,8 +2575,8 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: { global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; writer.WriteArrayHeader(2); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.MyProperty0, options); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.MyProperty1, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.MyProperty0, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.MyProperty1, options); } public global::SharedData.GenericStruct Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) @@ -2620,10 +2596,10 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: switch (i) { case 0: - ____result.MyProperty0 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.MyProperty0 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); break; case 1: - ____result.MyProperty1 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.MyProperty1 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); break; default: reader.Skip(); @@ -2649,7 +2625,7 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; writer.WriteArrayHeader(2); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.MyProperty1, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.MyProperty1, options); writer.Write(value.After); } @@ -2670,7 +2646,7 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: switch (i) { case 0: - ____result.MyProperty1 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.MyProperty1 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); break; case 1: ____result.After = reader.ReadInt32(); @@ -2699,7 +2675,7 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; writer.WriteArrayHeader(2); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.MyProperty1, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.MyProperty1, options); writer.Write(value.After); } @@ -2720,7 +2696,7 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: switch (i) { case 0: - ____result.MyProperty1 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.MyProperty1 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); break; case 1: ____result.After = reader.ReadInt32(); @@ -2749,7 +2725,7 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; writer.WriteArrayHeader(2); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.MyProperty1, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.MyProperty1, options); writer.Write(value.After); } @@ -2770,7 +2746,7 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: switch (i) { case 0: - ____result.MyProperty1 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.MyProperty1 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); break; case 1: ____result.After = reader.ReadInt32(); @@ -3121,11 +3097,11 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; writer.WriteArrayHeader(7); writer.Write(value.Prop1); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.Prop2, options); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.Prop3, options); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.Prop4, options); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.Prop5, options); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.Prop6, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.Prop2, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.Prop3, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.Prop4, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.Prop5, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.Prop6, options); writer.Write(value.BytesSpecial); } @@ -3149,22 +3125,22 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: ____result.Prop1 = reader.ReadInt32(); break; case 1: - ____result.Prop2 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.Prop2 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); break; case 2: - ____result.Prop3 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.Prop3 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); break; case 3: - ____result.Prop4 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.Prop4 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); break; case 4: - ____result.Prop5 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.Prop5 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); break; case 5: - ____result.Prop6 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.Prop6 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); break; case 6: - ____result.BytesSpecial = reader.ReadBytes()?.ToArray(); + ____result.BytesSpecial = global::MessagePack.Internal.CodeGenHelpers.GetArrayFromNullableSequence(reader.ReadBytes()); break; default: reader.Skip(); @@ -3210,7 +3186,7 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: ____result.Y = reader.ReadInt32(); break; case 2: - ____result.BytesSpecial = reader.ReadBytes()?.ToArray(); + ____result.BytesSpecial = global::MessagePack.Internal.CodeGenHelpers.GetArrayFromNullableSequence(reader.ReadBytes()); break; default: reader.Skip(); @@ -3681,7 +3657,7 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; writer.WriteArrayHeader(3); writer.Write(value.MyProperty); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.UnknownBlock, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.UnknownBlock, options); writer.Write(value.MyProperty2); } @@ -3705,7 +3681,7 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: ____result.MyProperty = reader.ReadInt32(); break; case 1: - ____result.UnknownBlock = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.UnknownBlock = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); break; case 2: ____result.MyProperty2 = reader.ReadInt32(); @@ -3786,7 +3762,7 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; writer.WriteArrayHeader(2); writer.Write(value.Data1); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.Data2, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.Data2, options); } public global::SharedData.WithIndexer Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) @@ -3809,7 +3785,7 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: ____result.Data1 = reader.ReadInt32(); break; case 1: - ____result.Data2 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.Data2 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); break; default: reader.Skip(); @@ -3821,6 +3797,7 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: return ____result; } } + } #pragma warning restore 168 @@ -3829,7 +3806,6 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: #pragma warning restore 612 #pragma warning restore SA1129 // Do not use default value type constructor -#pragma warning restore SA1200 // Using directives should be placed correctly #pragma warning restore SA1309 // Field names should not begin with underscore #pragma warning restore SA1312 // Variable names should begin with lower-case letter #pragma warning restore SA1403 // File may only contain a single namespace @@ -3845,7 +3821,6 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: #pragma warning disable 168 #pragma warning disable SA1129 // Do not use default value type constructor -#pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1309 // Field names should not begin with underscore #pragma warning disable SA1312 // Variable names should begin with lower-case letter #pragma warning disable SA1403 // File may only contain a single namespace @@ -3853,9 +3828,6 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: namespace MessagePack.Formatters.SharedData { - using global::System.Buffers; - using global::MessagePack; - public sealed class Callback2Formatter : global::MessagePack.Formatters.IMessagePackFormatter { // X @@ -4198,9 +4170,9 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: var formatterResolver = options.Resolver; writer.WriteMapHeader(2); writer.WriteRaw(GetSpan_MyProperty0()); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.MyProperty0, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.MyProperty0, options); writer.WriteRaw(GetSpan_Comparer()); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.Comparer, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.Comparer, options); } public global::SharedData.GenericConstrainedClassStringKey Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) @@ -4227,12 +4199,12 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: case 11: if (!global::System.MemoryExtensions.SequenceEqual(stringKey, GetSpan_MyProperty0().Slice(1))) { goto FAIL; } - ____result.MyProperty0 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.MyProperty0 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); continue; case 8: if (global::MessagePack.Internal.AutomataKeyGen.GetKey(ref stringKey) != 8243120455795175235UL) { goto FAIL; } - ____result.Comparer = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.Comparer = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); continue; } @@ -4257,9 +4229,9 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: var formatterResolver = options.Resolver; writer.WriteMapHeader(2); writer.WriteRaw(GetSpan_MyProperty0()); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.MyProperty0, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.MyProperty0, options); writer.WriteRaw(GetSpan_Comparer()); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.Comparer, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.Comparer, options); } public global::SharedData.GenericConstrainedStructStringKey Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) @@ -4286,12 +4258,12 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: case 11: if (!global::System.MemoryExtensions.SequenceEqual(stringKey, GetSpan_MyProperty0().Slice(1))) { goto FAIL; } - ____result.MyProperty0 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.MyProperty0 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); continue; case 8: if (global::MessagePack.Internal.AutomataKeyGen.GetKey(ref stringKey) != 8243120455795175235UL) { goto FAIL; } - ____result.Comparer = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.Comparer = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); continue; } @@ -4376,7 +4348,7 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: writer.WriteRaw(GetSpan_Prop1()); writer.Write(value.Prop1); writer.WriteRaw(GetSpan_Prop2()); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.Prop2, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.Prop2, options); writer.WriteRaw(GetSpan_Prop3()); writer.Write(value.Prop3); } @@ -4410,7 +4382,7 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: ____result.Prop1 = reader.ReadInt32(); continue; case 216634716752UL: - ____result.Prop2 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.Prop2 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); continue; case 220929684048UL: ____result.Prop3 = reader.ReadInt32(); @@ -4439,7 +4411,7 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: writer.WriteRaw(GetSpan_X()); writer.Write(value.X); writer.WriteRaw(GetSpan_Y()); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.Y, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.Y, options); } public global::SharedData.SimpleStructStringKeyData Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) @@ -4471,7 +4443,7 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: ____result.X = reader.ReadInt32(); continue; case 383015019883UL: - ____result.Y = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.Y = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); continue; } @@ -4482,5 +4454,17 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: return ____result; } } + } +#pragma warning restore 168 +#pragma warning restore 414 +#pragma warning restore 618 +#pragma warning restore 612 + +#pragma warning restore SA1129 // Do not use default value type constructor +#pragma warning restore SA1309 // Field names should not begin with underscore +#pragma warning restore SA1312 // Variable names should begin with lower-case letter +#pragma warning restore SA1403 // File may only contain a single namespace +#pragma warning restore SA1649 // File name should match first type name + diff --git a/sandbox/TestData2/Generated.cs b/sandbox/TestData2/Generated.cs index 606e2dca8..e4f08ad53 100644 --- a/sandbox/TestData2/Generated.cs +++ b/sandbox/TestData2/Generated.cs @@ -7,14 +7,11 @@ #pragma warning disable 414 #pragma warning disable 168 -#pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1312 // Variable names should begin with lower-case letter #pragma warning disable SA1649 // File name should match first type name namespace MessagePack.Resolvers { - using System; - public class GeneratedResolver : global::MessagePack.IFormatterResolver { public static readonly global::MessagePack.IFormatterResolver Instance = new GeneratedResolver(); @@ -45,11 +42,11 @@ static FormatterCache() internal static class GeneratedResolverGetFormatterHelper { - private static readonly global::System.Collections.Generic.Dictionary lookup; + private static readonly global::System.Collections.Generic.Dictionary lookup; static GeneratedResolverGetFormatterHelper() { - lookup = new global::System.Collections.Generic.Dictionary(14) + lookup = new global::System.Collections.Generic.Dictionary(14) { { typeof(global::System.Collections.Generic.List), 0 }, { typeof(global::System.Collections.Generic.List), 1 }, @@ -68,7 +65,7 @@ static GeneratedResolverGetFormatterHelper() }; } - internal static object GetFormatter(Type t) + internal static object GetFormatter(global::System.Type t) { int key; if (!lookup.TryGetValue(t, out key)) @@ -104,7 +101,6 @@ internal static object GetFormatter(Type t) #pragma warning restore 612 #pragma warning restore SA1312 // Variable names should begin with lower-case letter -#pragma warning restore SA1200 // Using directives should be placed correctly #pragma warning restore SA1649 // File name should match first type name @@ -117,24 +113,20 @@ internal static object GetFormatter(Type t) #pragma warning disable 414 #pragma warning disable 168 -#pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1403 // File may only contain a single namespace #pragma warning disable SA1649 // File name should match first type name namespace MessagePack.Formatters.TestData2 { - using System; - using System.Buffers; - using MessagePack; public sealed class Nest1_IdFormatter : global::MessagePack.Formatters.IMessagePackFormatter { - public void Serialize(ref MessagePackWriter writer, global::TestData2.Nest1.Id value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::TestData2.Nest1.Id value, global::MessagePack.MessagePackSerializerOptions options) { - writer.Write((Int32)value); + writer.Write((global::System.Int32)value); } - public global::TestData2.Nest1.Id Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::TestData2.Nest1.Id Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { return (global::TestData2.Nest1.Id)reader.ReadInt32(); } @@ -142,12 +134,12 @@ public void Serialize(ref MessagePackWriter writer, global::TestData2.Nest1.Id v public sealed class Nest2_IdFormatter : global::MessagePack.Formatters.IMessagePackFormatter { - public void Serialize(ref MessagePackWriter writer, global::TestData2.Nest2.Id value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::TestData2.Nest2.Id value, global::MessagePack.MessagePackSerializerOptions options) { - writer.Write((Int32)value); + writer.Write((global::System.Int32)value); } - public global::TestData2.Nest2.Id Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::TestData2.Nest2.Id Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { return (global::TestData2.Nest2.Id)reader.ReadInt32(); } @@ -159,7 +151,6 @@ public void Serialize(ref MessagePackWriter writer, global::TestData2.Nest2.Id v #pragma warning restore 618 #pragma warning restore 612 -#pragma warning restore SA1200 // Using directives should be placed correctly #pragma warning restore SA1403 // File may only contain a single namespace #pragma warning restore SA1649 // File name should match first type name @@ -175,7 +166,6 @@ public void Serialize(ref MessagePackWriter writer, global::TestData2.Nest2.Id v #pragma warning disable 168 #pragma warning disable SA1129 // Do not use default value type constructor -#pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1309 // Field names should not begin with underscore #pragma warning disable SA1312 // Variable names should begin with lower-case letter #pragma warning disable SA1403 // File may only contain a single namespace @@ -183,9 +173,6 @@ public void Serialize(ref MessagePackWriter writer, global::TestData2.Nest2.Id v namespace MessagePack.Formatters.TestData2 { - using global::System.Buffers; - using global::MessagePack; - public sealed class AFormatter : global::MessagePack.Formatters.IMessagePackFormatter { // a @@ -208,9 +195,9 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: writer.WriteRaw(GetSpan_a()); writer.Write(value.a); writer.WriteRaw(GetSpan_bs()); - formatterResolver.GetFormatterWithVerify>().Serialize(ref writer, value.bs, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify>(formatterResolver).Serialize(ref writer, value.bs, options); writer.WriteRaw(GetSpan_c()); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.c, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.c, options); } public global::TestData2.A Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) @@ -242,13 +229,13 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: ____result.a = reader.ReadInt32(); continue; case 99UL: - ____result.c = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.c = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); continue; } case 2: if (global::MessagePack.Internal.AutomataKeyGen.GetKey(ref stringKey) != 29538UL) { goto FAIL; } - ____result.bs = formatterResolver.GetFormatterWithVerify>().Deserialize(ref reader, options); + ____result.bs = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify>(formatterResolver).Deserialize(ref reader, options); continue; } @@ -279,9 +266,9 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: var formatterResolver = options.Resolver; writer.WriteMapHeader(3); writer.WriteRaw(GetSpan_ass()); - formatterResolver.GetFormatterWithVerify>().Serialize(ref writer, value.ass, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify>(formatterResolver).Serialize(ref writer, value.ass, options); writer.WriteRaw(GetSpan_c()); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.c, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.c, options); writer.WriteRaw(GetSpan_a()); writer.Write(value.a); } @@ -310,14 +297,14 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: case 3: if (global::MessagePack.Internal.AutomataKeyGen.GetKey(ref stringKey) != 7566177UL) { goto FAIL; } - ____result.ass = formatterResolver.GetFormatterWithVerify>().Deserialize(ref reader, options); + ____result.ass = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify>(formatterResolver).Deserialize(ref reader, options); continue; case 1: switch (global::MessagePack.Internal.AutomataKeyGen.GetKey(ref stringKey)) { default: goto FAIL; case 99UL: - ____result.c = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.c = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); continue; case 97UL: ____result.a = reader.ReadInt32(); @@ -350,7 +337,7 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: var formatterResolver = options.Resolver; writer.WriteMapHeader(2); writer.WriteRaw(GetSpan_b()); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.b, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.b, options); writer.WriteRaw(GetSpan_a()); writer.Write(value.a); } @@ -381,7 +368,7 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: { default: goto FAIL; case 98UL: - ____result.b = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.b = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); continue; case 97UL: ____result.a = reader.ReadInt32(); @@ -414,9 +401,9 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: var formatterResolver = options.Resolver; writer.WriteMapHeader(2); writer.WriteRaw(GetSpan_EnumId()); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.EnumId, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.EnumId, options); writer.WriteRaw(GetSpan_ClassId()); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.ClassId, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.ClassId, options); } public global::TestData2.Nest1 Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) @@ -443,12 +430,12 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: case 6: if (global::MessagePack.Internal.AutomataKeyGen.GetKey(ref stringKey) != 110266531802693UL) { goto FAIL; } - ____result.EnumId = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.EnumId = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); continue; case 7: if (global::MessagePack.Internal.AutomataKeyGen.GetKey(ref stringKey) != 28228257876896835UL) { goto FAIL; } - ____result.ClassId = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.ClassId = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); continue; } @@ -503,9 +490,9 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: var formatterResolver = options.Resolver; writer.WriteMapHeader(2); writer.WriteRaw(GetSpan_EnumId()); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.EnumId, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.EnumId, options); writer.WriteRaw(GetSpan_ClassId()); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.ClassId, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.ClassId, options); } public global::TestData2.Nest2 Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) @@ -532,12 +519,12 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: case 6: if (global::MessagePack.Internal.AutomataKeyGen.GetKey(ref stringKey) != 110266531802693UL) { goto FAIL; } - ____result.EnumId = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.EnumId = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); continue; case 7: if (global::MessagePack.Internal.AutomataKeyGen.GetKey(ref stringKey) != 28228257876896835UL) { goto FAIL; } - ____result.ClassId = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.ClassId = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); continue; } @@ -592,9 +579,9 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: var formatterResolver = options.Resolver; writer.WriteMapHeader(2); writer.WriteRaw(GetSpan_MyProperty1()); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.MyProperty1, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.MyProperty1, options); writer.WriteRaw(GetSpan_MyProperty2()); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.MyProperty2, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.MyProperty2, options); } public global::TestData2.PropNameCheck1 Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) @@ -627,10 +614,10 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: { default: goto FAIL; case 3242356UL: - ____result.MyProperty1 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.MyProperty1 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); continue; case 3307892UL: - ____result.MyProperty2 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.MyProperty2 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); continue; } @@ -662,9 +649,9 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: var formatterResolver = options.Resolver; writer.WriteMapHeader(2); writer.WriteRaw(GetSpan_MyProperty1()); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.MyProperty1, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.MyProperty1, options); writer.WriteRaw(GetSpan_MyProperty2()); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.MyProperty2, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.MyProperty2, options); } public global::TestData2.PropNameCheck2 Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) @@ -697,10 +684,10 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: { default: goto FAIL; case 3242356UL: - ____result.MyProperty1 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.MyProperty1 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); continue; case 3307892UL: - ____result.MyProperty2 = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + ____result.MyProperty2 = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); continue; } @@ -730,7 +717,7 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: var formatterResolver = options.Resolver; writer.WriteMapHeader(1); writer.WriteRaw(GetSpan_SomeProperty()); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.SomeProperty, options); + global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Serialize(ref writer, value.SomeProperty, options); } public global::TestData2.Record Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) @@ -757,7 +744,7 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: case 12: if (!global::System.MemoryExtensions.SequenceEqual(stringKey, GetSpan_SomeProperty().Slice(1))) { goto FAIL; } - __SomeProperty__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + __SomeProperty__ = global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(formatterResolver).Deserialize(ref reader, options); continue; } @@ -768,5 +755,17 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: return ____result; } } + } +#pragma warning restore 168 +#pragma warning restore 414 +#pragma warning restore 618 +#pragma warning restore 612 + +#pragma warning restore SA1129 // Do not use default value type constructor +#pragma warning restore SA1309 // Field names should not begin with underscore +#pragma warning restore SA1312 // Variable names should begin with lower-case letter +#pragma warning restore SA1403 // File may only contain a single namespace +#pragma warning restore SA1649 // File name should match first type name + diff --git a/src/MessagePack.GeneratorCore/CodeAnalysis/Definitions.cs b/src/MessagePack.GeneratorCore/CodeAnalysis/Definitions.cs index 532cdc711..30aaedb98 100644 --- a/src/MessagePack.GeneratorCore/CodeAnalysis/Definitions.cs +++ b/src/MessagePack.GeneratorCore/CodeAnalysis/Definitions.cs @@ -170,7 +170,7 @@ public string GetSerializeMethodString() } else { - return $"formatterResolver.GetFormatterWithVerify<{this.Type}>().Serialize(ref writer, value.{this.Name}, options)"; + return $"global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<{this.Type}>(formatterResolver).Serialize(ref writer, value.{this.Name}, options)"; } } @@ -182,12 +182,18 @@ public string GetDeserializeMethodString() } else if (this.primitiveTypes.Contains(this.Type)) { - string suffix = this.Type == "byte[]" ? "?.ToArray()" : string.Empty; - return $"reader.Read{this.ShortTypeName!.Replace("[]", "s")}()" + suffix; + if (this.Type == "byte[]") + { + return "global::MessagePack.Internal.CodeGenHelpers.GetArrayFromNullableSequence(reader.ReadBytes())"; + } + else + { + return $"reader.Read{this.ShortTypeName!.Replace("[]", "s")}()"; + } } else { - return $"formatterResolver.GetFormatterWithVerify<{this.Type}>().Deserialize(ref reader, options)"; + return $"global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<{this.Type}>(formatterResolver).Deserialize(ref reader, options)"; } } } diff --git a/src/MessagePack.GeneratorCore/Generator/EnumTemplate.cs b/src/MessagePack.GeneratorCore/Generator/EnumTemplate.cs index 814a31230..66c9fc14a 100644 --- a/src/MessagePack.GeneratorCore/Generator/EnumTemplate.cs +++ b/src/MessagePack.GeneratorCore/Generator/EnumTemplate.cs @@ -34,27 +34,27 @@ public virtual string TransformText() #pragma warning disable 414 #pragma warning disable 168 -#pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1403 // File may only contain a single namespace #pragma warning disable SA1649 // File name should match first type name namespace "); this.Write(this.ToStringHelper.ToStringWithCulture(Namespace)); - this.Write("\r\n{\r\n using System;\r\n using System.Buffers;\r\n using MessagePack;\r\n"); + this.Write("\r\n{\r\n"); foreach(var info in EnumSerializationInfos) { this.Write("\r\n public sealed class "); this.Write(this.ToStringHelper.ToStringWithCulture(info.Name)); this.Write("Formatter : global::MessagePack.Formatters.IMessagePackFormatter<"); this.Write(this.ToStringHelper.ToStringWithCulture(info.FullName)); - this.Write(">\r\n {\r\n public void Serialize(ref MessagePackWriter writer, "); + this.Write(">\r\n {\r\n public void Serialize(ref global::MessagePack.MessagePackWriter" + + " writer, "); this.Write(this.ToStringHelper.ToStringWithCulture(info.FullName)); this.Write(" value, global::MessagePack.MessagePackSerializerOptions options)\r\n {\r\n " + - " writer.Write(("); + " writer.Write((global::System."); this.Write(this.ToStringHelper.ToStringWithCulture(info.UnderlyingType)); this.Write(")value);\r\n }\r\n\r\n public "); this.Write(this.ToStringHelper.ToStringWithCulture(info.FullName)); - this.Write(" Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSeriali" + - "zerOptions options)\r\n {\r\n return ("); + this.Write(" Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePac" + + "k.MessagePackSerializerOptions options)\r\n {\r\n return ("); this.Write(this.ToStringHelper.ToStringWithCulture(info.FullName)); this.Write(")reader.Read"); this.Write(this.ToStringHelper.ToStringWithCulture(info.UnderlyingType)); @@ -67,7 +67,6 @@ namespace "); #pragma warning restore 618 #pragma warning restore 612 -#pragma warning restore SA1200 // Using directives should be placed correctly #pragma warning restore SA1403 // File may only contain a single namespace #pragma warning restore SA1649 // File name should match first type name "); diff --git a/src/MessagePack.GeneratorCore/Generator/EnumTemplate.tt b/src/MessagePack.GeneratorCore/Generator/EnumTemplate.tt index 28d34550e..d9fda115b 100644 --- a/src/MessagePack.GeneratorCore/Generator/EnumTemplate.tt +++ b/src/MessagePack.GeneratorCore/Generator/EnumTemplate.tt @@ -12,25 +12,21 @@ #pragma warning disable 414 #pragma warning disable 168 -#pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1403 // File may only contain a single namespace #pragma warning disable SA1649 // File name should match first type name namespace <#= Namespace #> { - using System; - using System.Buffers; - using MessagePack; <# foreach(var info in EnumSerializationInfos) { #> public sealed class <#= info.Name #>Formatter : global::MessagePack.Formatters.IMessagePackFormatter<<#= info.FullName #>> { - public void Serialize(ref MessagePackWriter writer, <#= info.FullName #> value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, <#= info.FullName #> value, global::MessagePack.MessagePackSerializerOptions options) { - writer.Write((<#= info.UnderlyingType #>)value); + writer.Write((global::System.<#= info.UnderlyingType #>)value); } - public <#= info.FullName #> Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public <#= info.FullName #> Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { return (<#= info.FullName #>)reader.Read<#= info.UnderlyingType #>(); } @@ -43,6 +39,5 @@ namespace <#= Namespace #> #pragma warning restore 618 #pragma warning restore 612 -#pragma warning restore SA1200 // Using directives should be placed correctly #pragma warning restore SA1403 // File may only contain a single namespace #pragma warning restore SA1649 // File name should match first type name diff --git a/src/MessagePack.GeneratorCore/Generator/FormatterTemplate.cs b/src/MessagePack.GeneratorCore/Generator/FormatterTemplate.cs index e153d5eb1..dfb84cafc 100644 --- a/src/MessagePack.GeneratorCore/Generator/FormatterTemplate.cs +++ b/src/MessagePack.GeneratorCore/Generator/FormatterTemplate.cs @@ -35,7 +35,6 @@ public virtual string TransformText() #pragma warning disable 168 #pragma warning disable SA1129 // Do not use default value type constructor -#pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1309 // Field names should not begin with underscore #pragma warning disable SA1312 // Variable names should begin with lower-case letter #pragma warning disable SA1403 // File may only contain a single namespace @@ -43,10 +42,10 @@ public virtual string TransformText() namespace "); this.Write(this.ToStringHelper.ToStringWithCulture(Namespace)); - this.Write("\r\n{\r\n using global::System.Buffers;\r\n using global::MessagePack;\r\n"); + this.Write("\r\n{\r\n"); foreach (var objInfo in ObjectSerializationInfos) { bool isFormatterResolverNecessary = ShouldUseFormatterResolverHelper.ShouldUseFormatterResolver(objInfo.Members); - this.Write("\r\n public sealed class "); + this.Write(" public sealed class "); this.Write(this.ToStringHelper.ToStringWithCulture(objInfo.FormatterNameWithoutNameSpace)); this.Write(" : global::MessagePack.Formatters.IMessagePackFormatter<"); this.Write(this.ToStringHelper.ToStringWithCulture(objInfo.FullName)); @@ -205,7 +204,7 @@ namespace "); } this.Write(" reader.Depth--;\r\n return ____result;\r\n"); } - this.Write(" }\r\n }\r\n"); + this.Write(" }\r\n }\r\n\r\n"); } this.Write(@"} @@ -215,7 +214,6 @@ namespace "); #pragma warning restore 612 #pragma warning restore SA1129 // Do not use default value type constructor -#pragma warning restore SA1200 // Using directives should be placed correctly #pragma warning restore SA1309 // Field names should not begin with underscore #pragma warning restore SA1312 // Variable names should begin with lower-case letter #pragma warning restore SA1403 // File may only contain a single namespace diff --git a/src/MessagePack.GeneratorCore/Generator/FormatterTemplate.tt b/src/MessagePack.GeneratorCore/Generator/FormatterTemplate.tt index 631dc9f15..bf96d9e5a 100644 --- a/src/MessagePack.GeneratorCore/Generator/FormatterTemplate.tt +++ b/src/MessagePack.GeneratorCore/Generator/FormatterTemplate.tt @@ -13,7 +13,6 @@ #pragma warning disable 168 #pragma warning disable SA1129 // Do not use default value type constructor -#pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1309 // Field names should not begin with underscore #pragma warning disable SA1312 // Variable names should begin with lower-case letter #pragma warning disable SA1403 // File may only contain a single namespace @@ -21,11 +20,8 @@ namespace <#= Namespace #> { - using global::System.Buffers; - using global::MessagePack; <# foreach (var objInfo in ObjectSerializationInfos) { bool isFormatterResolverNecessary = ShouldUseFormatterResolverHelper.ShouldUseFormatterResolver(objInfo.Members);#> - public sealed class <#= objInfo.FormatterNameWithoutNameSpace #> : global::MessagePack.Formatters.IMessagePackFormatter<<#= objInfo.FullName #>> <# foreach (var typeArg in objInfo.GenericTypeParameters.Where(x => x.HasConstraints)) { #> where <#= typeArg.Name #> : <#= typeArg.Constraints #> @@ -155,8 +151,8 @@ namespace <#= Namespace #> <# } #> } } -<# } #> -} + +<# } #>} #pragma warning restore 168 #pragma warning restore 414 @@ -164,7 +160,6 @@ namespace <#= Namespace #> #pragma warning restore 612 #pragma warning restore SA1129 // Do not use default value type constructor -#pragma warning restore SA1200 // Using directives should be placed correctly #pragma warning restore SA1309 // Field names should not begin with underscore #pragma warning restore SA1312 // Variable names should begin with lower-case letter #pragma warning restore SA1403 // File may only contain a single namespace diff --git a/src/MessagePack.GeneratorCore/Generator/ResolverTemplate.cs b/src/MessagePack.GeneratorCore/Generator/ResolverTemplate.cs index 48e4df6bd..c433e5453 100644 --- a/src/MessagePack.GeneratorCore/Generator/ResolverTemplate.cs +++ b/src/MessagePack.GeneratorCore/Generator/ResolverTemplate.cs @@ -34,13 +34,12 @@ public virtual string TransformText() #pragma warning disable 414 #pragma warning disable 168 -#pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1312 // Variable names should begin with lower-case letter #pragma warning disable SA1649 // File name should match first type name namespace "); this.Write(this.ToStringHelper.ToStringWithCulture(Namespace)); - this.Write("\r\n{\r\n using System;\r\n\r\n public class "); + this.Write("\r\n{\r\n public class "); this.Write(this.ToStringHelper.ToStringWithCulture(ResolverName)); this.Write(" : global::MessagePack.IFormatterResolver\r\n {\r\n public static readonly " + "global::MessagePack.IFormatterResolver Instance = new "); @@ -76,10 +75,10 @@ static FormatterCache() internal static class "); this.Write(this.ToStringHelper.ToStringWithCulture(ResolverName)); this.Write("GetFormatterHelper\r\n {\r\n private static readonly global::System.Collect" + - "ions.Generic.Dictionary lookup;\r\n\r\n static "); + "ions.Generic.Dictionary lookup;\r\n\r\n static "); this.Write(this.ToStringHelper.ToStringWithCulture(ResolverName)); this.Write("GetFormatterHelper()\r\n {\r\n lookup = new global::System.Collecti" + - "ons.Generic.Dictionary("); + "ons.Generic.Dictionary("); this.Write(this.ToStringHelper.ToStringWithCulture(RegisterInfos.Length)); this.Write(")\r\n {\r\n"); for(var i = 0; i < RegisterInfos.Length; i++) { var x = RegisterInfos[i]; @@ -92,7 +91,7 @@ internal static class "); this.Write(@" }; } - internal static object GetFormatter(Type t) + internal static object GetFormatter(global::System.Type t) { int key; if (!lookup.TryGetValue(t, out key)) @@ -122,7 +121,6 @@ internal static object GetFormatter(Type t) #pragma warning restore 612 #pragma warning restore SA1312 // Variable names should begin with lower-case letter -#pragma warning restore SA1200 // Using directives should be placed correctly #pragma warning restore SA1649 // File name should match first type name "); return this.GenerationEnvironment.ToString(); diff --git a/src/MessagePack.GeneratorCore/Generator/ResolverTemplate.tt b/src/MessagePack.GeneratorCore/Generator/ResolverTemplate.tt index e61688a1f..1fcd98395 100644 --- a/src/MessagePack.GeneratorCore/Generator/ResolverTemplate.tt +++ b/src/MessagePack.GeneratorCore/Generator/ResolverTemplate.tt @@ -12,16 +12,11 @@ #pragma warning disable 414 #pragma warning disable 168 -#pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1312 // Variable names should begin with lower-case letter #pragma warning disable SA1649 // File name should match first type name namespace <#= Namespace #> { - using System; - using System.Buffers; - using MessagePack; - public class <#= ResolverName #> : global::MessagePack.IFormatterResolver { public static readonly global::MessagePack.IFormatterResolver Instance = new <#= ResolverName #>(); @@ -52,11 +47,11 @@ namespace <#= Namespace #> internal static class <#= ResolverName #>GetFormatterHelper { - private static readonly global::System.Collections.Generic.Dictionary lookup; + private static readonly global::System.Collections.Generic.Dictionary lookup; static <#= ResolverName #>GetFormatterHelper() { - lookup = new global::System.Collections.Generic.Dictionary(<#= RegisterInfos.Length #>) + lookup = new global::System.Collections.Generic.Dictionary(<#= RegisterInfos.Length #>) { <# for(var i = 0; i < RegisterInfos.Length; i++) { var x = RegisterInfos[i]; #> { typeof(<#= x.FullName #>), <#= i #> }, @@ -64,7 +59,7 @@ namespace <#= Namespace #> }; } - internal static object GetFormatter(Type t) + internal static object GetFormatter(global::System.Type t) { int key; if (!lookup.TryGetValue(t, out key)) @@ -75,7 +70,7 @@ namespace <#= Namespace #> switch (key) { <# for(var i = 0; i < RegisterInfos.Length; i++) { var x = RegisterInfos[i]; #> - case <#= i #>: return new <#= x.FormatterName.StartsWith("global::") ? x.FormatterName: (!string.IsNullOrEmpty(FormatterNamespace) ? FormatterNamespace + "." : FormatterNamespace) + x.FormatterName#>(); + case <#= i #>: return new <#= x.FormatterName.StartsWith("global::") ? x.FormatterName: (!string.IsNullOrEmpty(FormatterNamespace) ? FormatterNamespace + "." : FormatterNamespace) + x.FormatterName #>(); <# } #> default: return null; } @@ -89,5 +84,4 @@ namespace <#= Namespace #> #pragma warning restore 612 #pragma warning restore SA1312 // Variable names should begin with lower-case letter -#pragma warning restore SA1200 // Using directives should be placed correctly #pragma warning restore SA1649 // File name should match first type name diff --git a/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterTemplate.cs b/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterTemplate.cs index a3df9f44e..d598c2025 100644 --- a/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterTemplate.cs +++ b/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterTemplate.cs @@ -35,7 +35,6 @@ public virtual string TransformText() #pragma warning disable 168 #pragma warning disable SA1129 // Do not use default value type constructor -#pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1309 // Field names should not begin with underscore #pragma warning disable SA1312 // Variable names should begin with lower-case letter #pragma warning disable SA1403 // File may only contain a single namespace @@ -43,7 +42,7 @@ public virtual string TransformText() namespace "); this.Write(this.ToStringHelper.ToStringWithCulture(Namespace)); - this.Write("\r\n{\r\n using global::System.Buffers;\r\n using global::MessagePack;\r\n"); + this.Write("\r\n{\r\n"); var list = new List>(); foreach (var objInfo in ObjectSerializationInfos) { list.Clear(); @@ -53,7 +52,7 @@ namespace "); } bool isFormatterResolverNecessary = ShouldUseFormatterResolverHelper.ShouldUseFormatterResolver(objInfo.Members); - this.Write("\r\n public sealed class "); + this.Write(" public sealed class "); this.Write(this.ToStringHelper.ToStringWithCulture(objInfo.FormatterNameWithoutNameSpace)); this.Write(" : global::MessagePack.Formatters.IMessagePackFormatter<"); this.Write(this.ToStringHelper.ToStringWithCulture(objInfo.FullName)); @@ -191,9 +190,21 @@ namespace "); if (objInfo.Members.Length != 0) { this.Write(" reader.Depth--;\r\n"); } - this.Write(" return ____result;\r\n }\r\n }\r\n"); + this.Write(" return ____result;\r\n }\r\n }\r\n\r\n"); } - this.Write("}\r\n"); + this.Write(@"} + +#pragma warning restore 168 +#pragma warning restore 414 +#pragma warning restore 618 +#pragma warning restore 612 + +#pragma warning restore SA1129 // Do not use default value type constructor +#pragma warning restore SA1309 // Field names should not begin with underscore +#pragma warning restore SA1312 // Variable names should begin with lower-case letter +#pragma warning restore SA1403 // File may only contain a single namespace +#pragma warning restore SA1649 // File name should match first type name +"); return this.GenerationEnvironment.ToString(); } } diff --git a/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterTemplate.tt b/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterTemplate.tt index 9bc3e4d8b..296ef4544 100644 --- a/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterTemplate.tt +++ b/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterTemplate.tt @@ -14,7 +14,6 @@ #pragma warning disable 168 #pragma warning disable SA1129 // Do not use default value type constructor -#pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1309 // Field names should not begin with underscore #pragma warning disable SA1312 // Variable names should begin with lower-case letter #pragma warning disable SA1403 // File may only contain a single namespace @@ -22,8 +21,6 @@ namespace <#= Namespace #> { - using global::System.Buffers; - using global::MessagePack; <# var list = new List>(); foreach (var objInfo in ObjectSerializationInfos) { list.Clear(); @@ -33,7 +30,6 @@ foreach (var objInfo in ObjectSerializationInfos) { } bool isFormatterResolverNecessary = ShouldUseFormatterResolverHelper.ShouldUseFormatterResolver(objInfo.Members); #> - public sealed class <#= objInfo.FormatterNameWithoutNameSpace #> : global::MessagePack.Formatters.IMessagePackFormatter<<#= objInfo.FullName #>> <# foreach (var typeArg in objInfo.GenericTypeParameters.Where(x => x.HasConstraints)) {#> where <#= typeArg.Name #> : <#= typeArg.Constraints #> @@ -147,5 +143,16 @@ foreach (var objInfo in ObjectSerializationInfos) { return ____result; } } -<# } #> -} + +<# } #>} + +#pragma warning restore 168 +#pragma warning restore 414 +#pragma warning restore 618 +#pragma warning restore 612 + +#pragma warning restore SA1129 // Do not use default value type constructor +#pragma warning restore SA1309 // Field names should not begin with underscore +#pragma warning restore SA1312 // Variable names should begin with lower-case letter +#pragma warning restore SA1403 // File may only contain a single namespace +#pragma warning restore SA1649 // File name should match first type name diff --git a/src/MessagePack.GeneratorCore/Generator/UnionTemplate.cs b/src/MessagePack.GeneratorCore/Generator/UnionTemplate.cs index 1106f1cb8..6ea73cff1 100644 --- a/src/MessagePack.GeneratorCore/Generator/UnionTemplate.cs +++ b/src/MessagePack.GeneratorCore/Generator/UnionTemplate.cs @@ -34,38 +34,41 @@ public virtual string TransformText() #pragma warning disable 414 #pragma warning disable 168 -#pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1403 // File may only contain a single namespace #pragma warning disable SA1649 // File name should match first type name namespace "); this.Write(this.ToStringHelper.ToStringWithCulture(Namespace)); - this.Write("\r\n{\r\n using System;\r\n using System.Buffers;\r\n using System.Collections.G" + - "eneric;\r\n using MessagePack;\r\n\r\n"); + this.Write("\r\n{\r\n"); foreach(var info in UnionSerializationInfos) { this.Write(" public sealed class "); this.Write(this.ToStringHelper.ToStringWithCulture(info.Name)); this.Write("Formatter : global::MessagePack.Formatters.IMessagePackFormatter<"); this.Write(this.ToStringHelper.ToStringWithCulture(info.FullName)); - this.Write(">\r\n {\r\n private readonly Dictionary> typeToKeyAndJumpMap;\r\n private readonly Dictionary keyT" + - "oJumpMap;\r\n\r\n public "); + this.Write(@"> + { + private readonly global::System.Collections.Generic.Dictionary> typeToKeyAndJumpMap; + private readonly global::System.Collections.Generic.Dictionary keyToJumpMap; + + public "); this.Write(this.ToStringHelper.ToStringWithCulture(info.Name)); - this.Write("Formatter()\r\n {\r\n this.typeToKeyAndJumpMap = new Dictionary>("); + this.Write("Formatter()\r\n {\r\n this.typeToKeyAndJumpMap = new global::System" + + ".Collections.Generic.Dictionary>("); this.Write(this.ToStringHelper.ToStringWithCulture(info.SubTypes.Length)); this.Write(", global::MessagePack.Internal.RuntimeTypeHandleEqualityComparer.Default)\r\n " + " {\r\n"); for(var i = 0; i < info.SubTypes.Length; i++) { var item = info.SubTypes[i]; this.Write(" { typeof("); this.Write(this.ToStringHelper.ToStringWithCulture(item.Type)); - this.Write(").TypeHandle, new KeyValuePair("); + this.Write(").TypeHandle, new global::System.Collections.Generic.KeyValuePair("); this.Write(this.ToStringHelper.ToStringWithCulture(item.Key)); this.Write(", "); this.Write(this.ToStringHelper.ToStringWithCulture(i)); this.Write(") },\r\n"); } - this.Write(" };\r\n this.keyToJumpMap = new Dictionary("); + this.Write(" };\r\n this.keyToJumpMap = new global::System.Collections.Ge" + + "neric.Dictionary("); this.Write(this.ToStringHelper.ToStringWithCulture(info.SubTypes.Length)); this.Write(")\r\n {\r\n"); for(var i = 0; i < info.SubTypes.Length; i++) { var item = info.SubTypes[i]; @@ -75,12 +78,12 @@ namespace "); this.Write(this.ToStringHelper.ToStringWithCulture(i)); this.Write(" },\r\n"); } - this.Write(" };\r\n }\r\n\r\n public void Serialize(ref MessagePackWriter " + - "writer, "); + this.Write(" };\r\n }\r\n\r\n public void Serialize(ref global::MessagePac" + + "k.MessagePackWriter writer, "); this.Write(this.ToStringHelper.ToStringWithCulture(info.FullName)); this.Write(@" value, global::MessagePack.MessagePackSerializerOptions options) { - KeyValuePair keyValuePair; + global::System.Collections.Generic.KeyValuePair keyValuePair; if (value != null && this.typeToKeyAndJumpMap.TryGetValue(value.GetType().TypeHandle, out keyValuePair)) { writer.WriteArrayHeader(2); @@ -101,7 +104,7 @@ namespace "); "\r\n return;\r\n }\r\n\r\n writer.WriteNil();\r\n " + " }\r\n\r\n public "); this.Write(this.ToStringHelper.ToStringWithCulture(info.FullName)); - this.Write(@" Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + this.Write(@" Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { @@ -110,7 +113,7 @@ namespace "); if (reader.ReadArrayHeader() != 2) { - throw new InvalidOperationException(""Invalid Union data was detected. Type:"); + throw new global::System.InvalidOperationException(""Invalid Union data was detected. Type:"); this.Write(this.ToStringHelper.ToStringWithCulture(info.FullName)); this.Write("\");\r\n }\r\n\r\n options.Security.DepthStep(ref reader);\r\n " + " var key = reader.ReadInt32();\r\n\r\n if (!this.keyToJumpMap.TryGet" + @@ -139,7 +142,6 @@ namespace "); #pragma warning restore 618 #pragma warning restore 612 -#pragma warning restore SA1200 // Using directives should be placed correctly #pragma warning restore SA1403 // File may only contain a single namespace #pragma warning restore SA1649 // File name should match first type name "); diff --git a/src/MessagePack.GeneratorCore/Generator/UnionTemplate.tt b/src/MessagePack.GeneratorCore/Generator/UnionTemplate.tt index 216cf3c35..174dd3d27 100644 --- a/src/MessagePack.GeneratorCore/Generator/UnionTemplate.tt +++ b/src/MessagePack.GeneratorCore/Generator/UnionTemplate.tt @@ -12,32 +12,26 @@ #pragma warning disable 414 #pragma warning disable 168 -#pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1403 // File may only contain a single namespace #pragma warning disable SA1649 // File name should match first type name namespace <#= Namespace #> { - using System; - using System.Buffers; - using System.Collections.Generic; - using MessagePack; - <# foreach(var info in UnionSerializationInfos) { #> public sealed class <#= info.Name #>Formatter : global::MessagePack.Formatters.IMessagePackFormatter<<#= info.FullName #>> { - private readonly Dictionary> typeToKeyAndJumpMap; - private readonly Dictionary keyToJumpMap; + private readonly global::System.Collections.Generic.Dictionary> typeToKeyAndJumpMap; + private readonly global::System.Collections.Generic.Dictionary keyToJumpMap; public <#= info.Name #>Formatter() { - this.typeToKeyAndJumpMap = new Dictionary>(<#= info.SubTypes.Length #>, global::MessagePack.Internal.RuntimeTypeHandleEqualityComparer.Default) + this.typeToKeyAndJumpMap = new global::System.Collections.Generic.Dictionary>(<#= info.SubTypes.Length #>, global::MessagePack.Internal.RuntimeTypeHandleEqualityComparer.Default) { <# for(var i = 0; i < info.SubTypes.Length; i++) { var item = info.SubTypes[i]; #> - { typeof(<#= item.Type #>).TypeHandle, new KeyValuePair(<#= item.Key #>, <#= i #>) }, + { typeof(<#= item.Type #>).TypeHandle, new global::System.Collections.Generic.KeyValuePair(<#= item.Key #>, <#= i #>) }, <# } #> }; - this.keyToJumpMap = new Dictionary(<#= info.SubTypes.Length #>) + this.keyToJumpMap = new global::System.Collections.Generic.Dictionary(<#= info.SubTypes.Length #>) { <# for(var i = 0; i < info.SubTypes.Length; i++) { var item = info.SubTypes[i]; #> { <#= item.Key #>, <#= i #> }, @@ -45,9 +39,9 @@ namespace <#= Namespace #> }; } - public void Serialize(ref MessagePackWriter writer, <#= info.FullName #> value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, <#= info.FullName #> value, global::MessagePack.MessagePackSerializerOptions options) { - KeyValuePair keyValuePair; + global::System.Collections.Generic.KeyValuePair keyValuePair; if (value != null && this.typeToKeyAndJumpMap.TryGetValue(value.GetType().TypeHandle, out keyValuePair)) { writer.WriteArrayHeader(2); @@ -69,7 +63,7 @@ namespace <#= Namespace #> writer.WriteNil(); } - public <#= info.FullName #> Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public <#= info.FullName #> Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { @@ -78,7 +72,7 @@ namespace <#= Namespace #> if (reader.ReadArrayHeader() != 2) { - throw new InvalidOperationException("Invalid Union data was detected. Type:<#= info.FullName #>"); + throw new global::System.InvalidOperationException("Invalid Union data was detected. Type:<#= info.FullName #>"); } options.Security.DepthStep(ref reader); @@ -116,6 +110,5 @@ namespace <#= Namespace #> #pragma warning restore 618 #pragma warning restore 612 -#pragma warning restore SA1200 // Using directives should be placed correctly #pragma warning restore SA1403 // File may only contain a single namespace #pragma warning restore SA1649 // File name should match first type name From 1ce9b213a5681704265ce4d25d17373ad7c2f45f Mon Sep 17 00:00:00 2001 From: pCYSl5EDgo Date: Thu, 30 Dec 2021 07:34:01 +0900 Subject: [PATCH 131/161] Global Using and File scoped namespace test --- sandbox/TestData2/A.cs | 14 +++++--------- sandbox/TestData2/B.cs | 14 +++++--------- sandbox/TestData2/C.cs | 13 +++++-------- sandbox/TestData2/TestData2.csproj | 6 +++++- 4 files changed, 20 insertions(+), 27 deletions(-) diff --git a/sandbox/TestData2/A.cs b/sandbox/TestData2/A.cs index 44b0a47f3..d32265ab3 100644 --- a/sandbox/TestData2/A.cs +++ b/sandbox/TestData2/A.cs @@ -1,17 +1,13 @@ // Copyright (c) All contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -using System.Collections.Generic; -using MessagePack; - #pragma warning disable SA1307 // Accessible fields should begin with upper-case letter #pragma warning disable SA1401 // Fields should be private -namespace TestData2 +namespace TestData2; + +[MessagePackObject(true)] +public class A { - [MessagePackObject(true)] - public class A - { - public int a; public List bs; public C c; - } + public int a; public List bs; public C c; } diff --git a/sandbox/TestData2/B.cs b/sandbox/TestData2/B.cs index b44ff0164..70e9f358f 100644 --- a/sandbox/TestData2/B.cs +++ b/sandbox/TestData2/B.cs @@ -1,17 +1,13 @@ // Copyright (c) All contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -using System.Collections.Generic; -using MessagePack; - #pragma warning disable SA1307 // Accessible fields should begin with upper-case letter #pragma warning disable SA1401 // Fields should be private -namespace TestData2 +namespace TestData2; + +[MessagePackObject(true)] +public class B { - [MessagePackObject(true)] - public class B - { - public List ass; public C c; public int a; - } + public List ass; public C c; public int a; } diff --git a/sandbox/TestData2/C.cs b/sandbox/TestData2/C.cs index 4a42584d2..5de4a080e 100644 --- a/sandbox/TestData2/C.cs +++ b/sandbox/TestData2/C.cs @@ -1,16 +1,13 @@ // Copyright (c) All contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -using MessagePack; - #pragma warning disable SA1307 // Accessible fields should begin with upper-case letter #pragma warning disable SA1401 // Fields should be private -namespace TestData2 +namespace TestData2; + +[MessagePackObject(true)] +public class C { - [MessagePackObject(true)] - public class C - { - public B b; public int a; - } + public B b; public int a; } diff --git a/sandbox/TestData2/TestData2.csproj b/sandbox/TestData2/TestData2.csproj index 241bef293..a73130494 100644 --- a/sandbox/TestData2/TestData2.csproj +++ b/sandbox/TestData2/TestData2.csproj @@ -1,7 +1,7 @@  net461 - 9 + 10 @@ -9,4 +9,8 @@ + + + + From c1090cc5e1edd9d9dbc5b4798d8743bdf046f403 Mon Sep 17 00:00:00 2001 From: Steely Wing Date: Fri, 21 Jan 2022 17:31:27 +0800 Subject: [PATCH 132/161] Fix missing switch statement --- README.md | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index e5730bae4..a2ce84c21 100644 --- a/README.md +++ b/README.md @@ -1169,15 +1169,18 @@ public class MySpecialObjectFormatter : IMessagePackFormatter Date: Wed, 26 Jan 2022 08:07:45 -0700 Subject: [PATCH 133/161] Fix documented samples Closes #1384 --- README.md | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index a2ce84c21..35ce5fd3c 100644 --- a/README.md +++ b/README.md @@ -1088,7 +1088,7 @@ Here is an example of such a custom formatter implementation. Note its use of th ```csharp /// Serializes a by its full path as a string. -public class FileInfoFormatter : IMessagePackFormatter +public class FileInfoFormatter : IMessagePackFormatter { public void Serialize( ref MessagePackWriter writer, FileInfo value, MessagePackSerializerOptions options) @@ -1131,7 +1131,7 @@ you must precede it with a map or array header. You must read the entire map/arr For example: ```csharp -public class MySpecialObjectFormatter : IMessagePackFormatter +public class MySpecialObjectFormatter : IMessagePackFormatter { public void Serialize( ref MessagePackWriter writer, MySpecialObject value, MessagePackSerializerOptions options) @@ -1365,12 +1365,6 @@ internal static class SampleCustomResolverGetFormatterHelper return formatter; } - // If target type is generics, use MakeGenericType. - if (t.IsGeneric && t.GetGenericTypeDefinition() == typeof(ValueTuple<,>)) - { - return Activator.CreateInstance(typeof(ValueTupleFormatter<,>).MakeGenericType(t.GenericTypeArguments)); - } - // If type can not get, must return null for fallback mechanism. return null; } From 4eca1e695a4d4d30c711064c457d0cba8e420f80 Mon Sep 17 00:00:00 2001 From: neuecc Date: Thu, 27 Jan 2022 06:58:20 +0900 Subject: [PATCH 134/161] Added ResolverUtilitis.cs.meta, fix #1388 --- .../MessagePack/Resolvers/ResolverUtilities.cs.meta | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/ResolverUtilities.cs.meta diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/ResolverUtilities.cs.meta b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/ResolverUtilities.cs.meta new file mode 100644 index 000000000..1f34c5fff --- /dev/null +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/ResolverUtilities.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d4e2e1ebcc7467944a57bb9a3327820b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: From 8da2ab05f9cc1b1c2c3dd5e32a57ec57ecb4dbd8 Mon Sep 17 00:00:00 2001 From: pCYSl5EDgo <31692496+pCYSl5EDgo@users.noreply.github.com> Date: Sun, 13 Feb 2022 06:14:41 +0900 Subject: [PATCH 135/161] Fix nullable annotation errorneous handling (#1395) * Fix nullable member file name handling Generating multiple files including the letter '?'. Invalid file name char should be avoided. --- global.json | 2 +- sandbox/TestData2/A.cs | 3 +- sandbox/TestData2/B.cs | 3 +- sandbox/TestData2/C.cs | 3 +- .../CodeAnalysis/TypeCollector.cs | 7 +- .../CodeGenerator.cs | 72 +++++++++++++++++-- 6 files changed, 79 insertions(+), 11 deletions(-) diff --git a/global.json b/global.json index d46619b03..2645bb53b 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "6.0.101", + "version": "6.0.102", "rollForward": "patch", "allowPrerelease": false } diff --git a/sandbox/TestData2/A.cs b/sandbox/TestData2/A.cs index d32265ab3..a7eeef9d0 100644 --- a/sandbox/TestData2/A.cs +++ b/sandbox/TestData2/A.cs @@ -3,11 +3,12 @@ #pragma warning disable SA1307 // Accessible fields should begin with upper-case letter #pragma warning disable SA1401 // Fields should be private +#nullable enable namespace TestData2; [MessagePackObject(true)] public class A { - public int a; public List bs; public C c; + public int a; public List? bs; public C? c; } diff --git a/sandbox/TestData2/B.cs b/sandbox/TestData2/B.cs index 70e9f358f..d9c4029ec 100644 --- a/sandbox/TestData2/B.cs +++ b/sandbox/TestData2/B.cs @@ -3,11 +3,12 @@ #pragma warning disable SA1307 // Accessible fields should begin with upper-case letter #pragma warning disable SA1401 // Fields should be private +#nullable enable namespace TestData2; [MessagePackObject(true)] public class B { - public List ass; public C c; public int a; + public List? ass; public C? c; public int a; } diff --git a/sandbox/TestData2/C.cs b/sandbox/TestData2/C.cs index 5de4a080e..741517fff 100644 --- a/sandbox/TestData2/C.cs +++ b/sandbox/TestData2/C.cs @@ -3,11 +3,12 @@ #pragma warning disable SA1307 // Accessible fields should begin with upper-case letter #pragma warning disable SA1401 // Fields should be private +#nullable enable namespace TestData2; [MessagePackObject(true)] public class C { - public B b; public int a; + public B? b; public int a; } diff --git a/src/MessagePack.GeneratorCore/CodeAnalysis/TypeCollector.cs b/src/MessagePack.GeneratorCore/CodeAnalysis/TypeCollector.cs index d2537dcd9..935ceb871 100644 --- a/src/MessagePack.GeneratorCore/CodeAnalysis/TypeCollector.cs +++ b/src/MessagePack.GeneratorCore/CodeAnalysis/TypeCollector.cs @@ -971,10 +971,11 @@ private static string GetMinimallyQualifiedClassName(INamedTypeSymbol type) { var name = type.ContainingType is object ? GetMinimallyQualifiedClassName(type.ContainingType) + "_" : string.Empty; name += type.ToDisplayString(SymbolDisplayFormat.MinimallyQualifiedFormat); - name = name.Replace(".", "_"); - name = name.Replace("<", "_"); - name = name.Replace(">", "_"); + name = name.Replace('.', '_'); + name = name.Replace('<', '_'); + name = name.Replace('>', '_'); name = Regex.Replace(name, @"\[([,])*\]", match => $"Array{match.Length - 1}"); + name = name.Replace("?", string.Empty); return name; } diff --git a/src/MessagePack.GeneratorCore/CodeGenerator.cs b/src/MessagePack.GeneratorCore/CodeGenerator.cs index f96546937..1f48973e3 100644 --- a/src/MessagePack.GeneratorCore/CodeGenerator.cs +++ b/src/MessagePack.GeneratorCore/CodeGenerator.cs @@ -2,6 +2,7 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; +using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; @@ -16,6 +17,8 @@ namespace MessagePackCompiler { public class CodeGenerator { + private static readonly HashSet InvalidFileCharSet = new(Path.GetInvalidFileNameChars()); + private static readonly Encoding NoBomUtf8 = new UTF8Encoding(false); private readonly Action logger; @@ -212,15 +215,76 @@ string GetNamespace(INamespaceInfo x) private Task OutputToDirAsync(string dir, string ns, string name, string multipleOutSymbol, string text) { - if (multipleOutSymbol == string.Empty) + var builder = new StringBuilder(); + void AppendDir(string dir) + { + if (dir.Length != 0) + { + builder.Append(dir); + if (dir[dir.Length - 1] != Path.DirectorySeparatorChar && dir[dir.Length - 1] != Path.AltDirectorySeparatorChar) + { + builder.Append(Path.DirectorySeparatorChar); + } + } + } + + void AppendChar(char c) + { + if (c == '.' || InvalidFileCharSet.Contains(c)) + { + builder.Append('_'); + } + else + { + builder.Append(c); + } + } + + void Append(string text) { - return OutputAsync(Path.Combine(dir, $"{ns}_{name}".Replace(".", "_").Replace("global::", string.Empty) + ".cs"), text); + var span = text.AsSpan(); + while (!span.IsEmpty) + { + var index = span.IndexOf("global::".AsSpan()); + if (index == -1) + { + foreach (var c in span) + { + AppendChar(c); + } + + break; + } + + if (index == 0) + { + span = span.Slice("global::".Length); + continue; + } + + foreach (var c in span.Slice(0, index)) + { + AppendChar(c); + } + + span = span.Slice(index + "global::".Length); + } } - else + + AppendDir(dir); + + if (!string.IsNullOrWhiteSpace(multipleOutSymbol)) { text = $"#if {multipleOutSymbol}" + Environment.NewLine + text + Environment.NewLine + "#endif"; - return OutputAsync(Path.Combine(dir, MultiSymbolToSafeFilePath(multipleOutSymbol), $"{ns}_{name}".Replace(".", "_").Replace("global::", string.Empty) + ".cs"), text); + AppendDir(MultiSymbolToSafeFilePath(multipleOutSymbol)); } + + Append(ns); + builder.Append('_'); + Append(name); + builder.Append(".cs"); + + return OutputAsync(builder.ToString(), text); } private Task OutputAsync(string path, string text) From c9fad94175b6b1d5686325cb96baaacc6f424257 Mon Sep 17 00:00:00 2001 From: maxim Date: Fri, 1 Apr 2022 19:01:45 +1300 Subject: [PATCH 136/161] Fix for "System.NotImplementedException: byref delegate" in System.Linq.Expressions for AOT compilation. --- .../MessagePack/MessagePackSerializer.NonGeneric.cs | 4 ++++ .../Scripts/MessagePack/MessagePackSerializer.cs | 12 ++++++++++++ .../MessagePack/MessagePackSerializerOptions.cs | 5 +++++ .../MessagePack/Resolvers/DynamicObjectResolver.cs | 4 ++++ 4 files changed, 25 insertions(+) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.NonGeneric.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.NonGeneric.cs index 281e20f31..18c52d4e4 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.NonGeneric.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.NonGeneric.cs @@ -221,6 +221,7 @@ internal CompiledMethods(Type type) { // public static void Serialize(ref MessagePackWriter writer, T obj, MessagePackSerializerOptions options) MethodInfo serialize = GetMethod(nameof(Serialize), type, new Type[] { typeof(MessagePackWriter).MakeByRefType(), null, typeof(MessagePackSerializerOptions) }); + MethodInfo serialize = GetMethod(nameof(SerializeSemiGeneric), type, new Type[] { typeof(MessagePackWriter).MakeByRefType(), typeof(Object), typeof(MessagePackSerializerOptions) }); #if ENABLE_IL2CPP this.Serialize_MessagePackWriter_T_Options = (ref MessagePackWriter x, object y, MessagePackSerializerOptions z) => ThrowRefStructNotSupported(); #else @@ -237,12 +238,14 @@ internal CompiledMethods(Type type) MessagePackWriterSerialize lambda = Expression.Lambda(body, param1, param2, param3).Compile(PreferInterpretation); this.Serialize_MessagePackWriter_T_Options = lambda; + this.Serialize_MessagePackWriter_T_Options = (MessagePackWriterSerialize)serialize.CreateDelegate(typeof(MessagePackWriterSerialize)); #endif } { // public static T Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) MethodInfo deserialize = GetMethod(nameof(Deserialize), type, new Type[] { typeof(MessagePackReader).MakeByRefType(), typeof(MessagePackSerializerOptions) }); + MethodInfo deserialize = GetMethod(nameof(DeserializeSemiGeneric), type, new Type[] { typeof(MessagePackReader).MakeByRefType(), typeof(MessagePackSerializerOptions) }); #if ENABLE_IL2CPP this.Deserialize_MessagePackReader_Options = (ref MessagePackReader reader, MessagePackSerializerOptions options) => { ThrowRefStructNotSupported(); return null; }; #else @@ -252,6 +255,7 @@ internal CompiledMethods(Type type) MessagePackReaderDeserialize lambda = Expression.Lambda(body, param1, param2).Compile(); this.Deserialize_MessagePackReader_Options = lambda; + this.Deserialize_MessagePackReader_Options = (MessagePackReaderDeserialize)deserialize.CreateDelegate(typeof(MessagePackReaderDeserialize)); #endif } diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.cs index 0e0188cff..a4f902f59 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.cs @@ -66,6 +66,13 @@ public static void Serialize(IBufferWriter writer, T value, MessagePack /// The value to serialize. /// The options. Use null to use default options. /// Thrown when any error occurs during serialization. + internal static void SerializeSemiGeneric(ref MessagePackWriter writer, Object valueObject, MessagePackSerializerOptions options = null) + { + T value = (T)valueObject; + + Serialize(ref writer, value, options); + } + public static void Serialize(ref MessagePackWriter writer, T value, MessagePackSerializerOptions options = null) { options = options ?? DefaultOptions; @@ -220,6 +227,11 @@ public static T Deserialize(in ReadOnlySequence byteSequence, MessagePa /// The deserialized value. /// Thrown when any error occurs during deserialization. public static T Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options = null) + { + return (T)DeserializeSemiGeneric(ref reader, options); + } + + internal static Object DeserializeSemiGeneric(ref MessagePackReader reader, MessagePackSerializerOptions options = null) { options = options ?? DefaultOptions; diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs index ebf1ca43b..f31174557 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs @@ -29,6 +29,11 @@ public class MessagePackSerializerOptions }; #if !DYNAMICCODEDUMPER +#if DYNAMICCODEDUMPER + static readonly MessagePackSerializerOptions _standard = new MessagePackSerializerOptions(Resolvers.BuiltinResolver.Instance); + + public static MessagePackSerializerOptions Standard => _standard; +#else /// /// Gets a good default set of options that uses the and no compression. /// diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs index 52b92b0e4..643a6643b 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs @@ -1264,6 +1264,9 @@ void OnNotFound() il.Emit(OpCodes.Br, readNext); } +#if NET_STANDARD_2_0 + throw new NotImplementedException("NET_STANDARD_2_0 directive was used"); +#else if (canOverwrite) { automata.EmitMatch(il, buffer, longKey, OnFoundAssignDirect, OnNotFound); @@ -1272,6 +1275,7 @@ void OnNotFound() { automata.EmitMatch(il, buffer, longKey, OnFoundAssignLocalVariable, OnNotFound); } +#endif il.MarkLabel(readNext); reader.EmitLdarg(); From e12b32f643109721491ea0ffe3d20ea898a63204 Mon Sep 17 00:00:00 2001 From: Yoshifumi Kawai Date: Tue, 12 Apr 2022 17:25:10 +0900 Subject: [PATCH 137/161] update package.json to 2.3.85 --- .../Assets/Scripts/MessagePack/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/package.json b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/package.json index 677cba61c..607988075 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/package.json +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/package.json @@ -1,7 +1,7 @@ { "name": "com.neuecc.messagepack", "displayName": "MessagePack", - "version": "2.3.74", + "version": "2.3.85", "unity": "2018.4", "description": "Extremely Fast MessagePack Serializer for C#.", "keywords": [ From 5484c90c04cb5e6b81f650436cc751d57d3f15f7 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 23 May 2022 20:50:08 -0600 Subject: [PATCH 138/161] Update SDK to 6.0.300 --- global.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global.json b/global.json index 2645bb53b..954a92e75 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "6.0.102", + "version": "6.0.300", "rollForward": "patch", "allowPrerelease": false } From 50b549fe1ffa6346675a55e5bb914c0a8def3c37 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 24 May 2022 10:04:44 -0600 Subject: [PATCH 139/161] Update Nerdbank.Streams --- .../DynamicCodeDumper.csproj | 2 +- .../PerfBenchmarkDotNet.csproj | 2 +- .../PerfNetFramework/PerfNetFramework.csproj | 2 +- .../MessagePack/Internal/Sequence`1.cs | 120 ++++++++++++++---- .../MessagePack.GeneratedCode.Tests.csproj | 2 +- .../MessagePack.Generator.Tests.csproj | 2 +- .../MessagePack.Tests.csproj | 2 +- 7 files changed, 104 insertions(+), 28 deletions(-) diff --git a/sandbox/DynamicCodeDumper/DynamicCodeDumper.csproj b/sandbox/DynamicCodeDumper/DynamicCodeDumper.csproj index 633265afe..0daf9da44 100644 --- a/sandbox/DynamicCodeDumper/DynamicCodeDumper.csproj +++ b/sandbox/DynamicCodeDumper/DynamicCodeDumper.csproj @@ -143,7 +143,7 @@ - + diff --git a/sandbox/PerfBenchmarkDotNet/PerfBenchmarkDotNet.csproj b/sandbox/PerfBenchmarkDotNet/PerfBenchmarkDotNet.csproj index 36fe6bafd..d9a575d06 100644 --- a/sandbox/PerfBenchmarkDotNet/PerfBenchmarkDotNet.csproj +++ b/sandbox/PerfBenchmarkDotNet/PerfBenchmarkDotNet.csproj @@ -19,7 +19,7 @@ - + diff --git a/sandbox/PerfNetFramework/PerfNetFramework.csproj b/sandbox/PerfNetFramework/PerfNetFramework.csproj index 080b4fb75..89e5cedfe 100644 --- a/sandbox/PerfNetFramework/PerfNetFramework.csproj +++ b/sandbox/PerfNetFramework/PerfNetFramework.csproj @@ -6,7 +6,7 @@ - + diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Internal/Sequence`1.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Internal/Sequence`1.cs index 9fe752dff..2813b92e0 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Internal/Sequence`1.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Internal/Sequence`1.cs @@ -27,7 +27,11 @@ namespace Nerdbank.Streams [DebuggerDisplay("{" + nameof(DebuggerDisplay) + ",nq}")] internal class Sequence : IBufferWriter, IDisposable { - private static readonly int DefaultLengthFromArrayPool = 1 + (4095 / Marshal.SizeOf()); + private const int MaximumAutoGrowSize = 32 * 1024; + + private static readonly int DefaultLengthFromArrayPool = 1 + (4095 / Unsafe.SizeOf()); + + private static readonly ReadOnlySequence Empty = new ReadOnlySequence(SequenceSegment.Empty, 0, SequenceSegment.Empty, 0); private readonly Stack segmentPool = new Stack(); @@ -87,9 +91,21 @@ public Sequence(ArrayPool arrayPool) /// The in use may itself have a minimum array length as well, /// in which case the higher of the two minimums dictate the minimum array size that will be allocated. /// + /// + /// If is true, this value may be automatically increased as the length of a sequence grows. + /// /// public int MinimumSpanLength { get; set; } = 0; + /// + /// Gets or sets a value indicating whether the should be + /// intelligently increased as the length of the sequence grows. + /// + /// + /// This can help prevent long sequences made up of many very small arrays. + /// + public bool AutoIncreaseMinimumSpanLength { get; set; } = true; + /// /// Gets this sequence expressed as a . /// @@ -112,9 +128,9 @@ public Sequence(ArrayPool arrayPool) /// The sequence to convert. public static implicit operator ReadOnlySequence(Sequence sequence) { - return sequence.first != null + return sequence.first != null && sequence.last != null ? new ReadOnlySequence(sequence.first, sequence.first.Start, sequence.last, sequence.last.End) - : ReadOnlySequence.Empty; + : Empty; } /// @@ -128,10 +144,22 @@ public static implicit operator ReadOnlySequence(Sequence sequence) public void AdvanceTo(SequencePosition position) { var firstSegment = (SequenceSegment)position.GetObject(); + if (firstSegment == null) + { + // Emulate PipeReader behavior which is to just return for default(SequencePosition) + return; + } + + if (ReferenceEquals(firstSegment, SequenceSegment.Empty) && this.Length == 0) + { + // We were called with our own empty buffer segment. + return; + } + int firstIndex = position.GetInteger(); // Before making any mutations, confirm that the block specified belongs to this sequence. - var current = this.first; + Sequence.SequenceSegment current = this.first; while (current != firstSegment && current != null) { current = current.Next; @@ -151,12 +179,7 @@ public void AdvanceTo(SequencePosition position) firstSegment.AdvanceTo(firstIndex); - if (firstSegment.Length == 0) - { - firstSegment = this.RecycleAndGetNext(firstSegment); - } - - this.first = firstSegment; + this.first = firstSegment.Length == 0 ? this.RecycleAndGetNext(firstSegment) : firstSegment; if (this.first == null) { @@ -174,6 +197,7 @@ public void Advance(int count) SequenceSegment last = this.last; Verify.Operation(last != null, "Cannot advance before acquiring memory."); last.Advance(count); + this.ConsiderMinimumSizeIncrease(); } /// @@ -190,6 +214,24 @@ public void Advance(int count) /// The requested memory. public Span GetSpan(int sizeHint) => this.GetSegment(sizeHint).RemainingSpan; + /// + /// Adds an existing memory location to this sequence without copying. + /// + /// The memory to add. + /// + /// This *may* leave significant slack space in a previously allocated block if calls to + /// follow calls to or . + /// + public void Append(ReadOnlyMemory memory) + { + if (memory.Length > 0) + { + Sequence.SequenceSegment segment = this.segmentPool.Count > 0 ? this.segmentPool.Pop() : new SequenceSegment(); + segment.AssignForeign(memory); + this.Append(segment); + } + } + /// /// Clears the entire sequence, recycles associated memory into pools, /// and resets this instance for reuse. @@ -204,7 +246,7 @@ public void Advance(int count) /// public void Reset() { - var current = this.first; + Sequence.SequenceSegment current = this.first; while (current != null) { current = this.RecycleAndGetNext(current); @@ -236,7 +278,7 @@ private SequenceSegment GetSegment(int sizeHint) if (minBufferSize.HasValue) { - var segment = this.segmentPool.Count > 0 ? this.segmentPool.Pop() : new SequenceSegment(); + Sequence.SequenceSegment segment = this.segmentPool.Count > 0 ? this.segmentPool.Pop() : new SequenceSegment(); if (this.arrayPool != null) { segment.Assign(this.arrayPool.Rent(minBufferSize.Value == -1 ? DefaultLengthFromArrayPool : minBufferSize.Value)); @@ -268,7 +310,7 @@ private void Append(SequenceSegment segment) else { // The last block is completely unused. Replace it instead of appending to it. - var current = this.first; + Sequence.SequenceSegment current = this.first; if (this.first != this.last) { while (current.Next != this.last) @@ -291,24 +333,40 @@ private void Append(SequenceSegment segment) private SequenceSegment RecycleAndGetNext(SequenceSegment segment) { - var recycledSegment = segment; - segment = segment.Next; + Sequence.SequenceSegment recycledSegment = segment; + Sequence.SequenceSegment nextSegment = segment.Next; recycledSegment.ResetMemory(this.arrayPool); this.segmentPool.Push(recycledSegment); - return segment; + return nextSegment; + } + + private void ConsiderMinimumSizeIncrease() + { + if (this.AutoIncreaseMinimumSpanLength && this.MinimumSpanLength < MaximumAutoGrowSize) + { + int autoSize = Math.Min(MaximumAutoGrowSize, (int)Math.Min(int.MaxValue, this.Length / 2)); + if (this.MinimumSpanLength < autoSize) + { + this.MinimumSpanLength = autoSize; + } + } } private class SequenceSegment : ReadOnlySequenceSegment { + internal static readonly SequenceSegment Empty = new SequenceSegment(); + /// /// A value indicating whether the element may contain references (and thus must be cleared). /// private static readonly bool MayContainReferences = !typeof(T).GetTypeInfo().IsPrimitive; +#pragma warning disable SA1011 // Closing square brackets should be spaced correctly /// /// Gets the backing array, when using an instead of a . /// private T[] array; +#pragma warning restore SA1011 // Closing square brackets should be spaced correctly /// /// Gets the position within where the data starts. @@ -362,6 +420,11 @@ private class SequenceSegment : ReadOnlySequenceSegment set => base.Next = value; } + /// + /// Gets a value indicating whether this segment refers to memory that came from outside and that we cannot write to nor recycle. + /// + internal bool IsForeignMemory => this.array == null && this.MemoryOwner == null; + /// /// Assigns this (recyclable) segment a new area in memory. /// @@ -382,12 +445,22 @@ internal void Assign(T[] array) this.Memory = array; } + /// + /// Assigns this (recyclable) segment a new area in memory. + /// + /// A memory block obtained from outside, that we do not own and should not recycle. + internal void AssignForeign(ReadOnlyMemory memory) + { + this.Memory = memory; + this.End = memory.Length; + } + /// /// Clears all fields in preparation to recycle this instance. /// internal void ResetMemory(ArrayPool arrayPool) { - this.ClearReferences(this.Start, this.End); + this.ClearReferences(this.Start, this.End - this.Start); this.Memory = default; this.Next = null; this.RunningIndex = 0; @@ -411,14 +484,17 @@ internal void ResetMemory(ArrayPool arrayPool) /// The next segment in the linked list. internal void SetNext(SequenceSegment segment) { - Debug.Assert(segment != null, "Null not allowed."); this.Next = segment; segment.RunningIndex = this.RunningIndex + this.Start + this.Length; - // When setting Memory, we start with index 0 instead of this.Start because - // the first segment has an explicit index set anyway, - // and we don't want to double-count it here. - this.Memory = this.AvailableMemory.Slice(0, this.Start + this.Length); + // Trim any slack on this segment. + if (!this.IsForeignMemory) + { + // When setting Memory, we start with index 0 instead of this.Start because + // the first segment has an explicit index set anyway, + // and we don't want to double-count it here. + this.Memory = this.AvailableMemory.Slice(0, this.Start + this.Length); + } } /// diff --git a/tests/MessagePack.GeneratedCode.Tests/MessagePack.GeneratedCode.Tests.csproj b/tests/MessagePack.GeneratedCode.Tests/MessagePack.GeneratedCode.Tests.csproj index 99ef099c2..0844ff4e4 100644 --- a/tests/MessagePack.GeneratedCode.Tests/MessagePack.GeneratedCode.Tests.csproj +++ b/tests/MessagePack.GeneratedCode.Tests/MessagePack.GeneratedCode.Tests.csproj @@ -8,7 +8,7 @@ - + diff --git a/tests/MessagePack.Generator.Tests/MessagePack.Generator.Tests.csproj b/tests/MessagePack.Generator.Tests/MessagePack.Generator.Tests.csproj index 9f3993898..7c12e7f53 100644 --- a/tests/MessagePack.Generator.Tests/MessagePack.Generator.Tests.csproj +++ b/tests/MessagePack.Generator.Tests/MessagePack.Generator.Tests.csproj @@ -13,7 +13,7 @@ - + diff --git a/tests/MessagePack.Tests/MessagePack.Tests.csproj b/tests/MessagePack.Tests/MessagePack.Tests.csproj index 9f7d98328..f6ff68609 100644 --- a/tests/MessagePack.Tests/MessagePack.Tests.csproj +++ b/tests/MessagePack.Tests/MessagePack.Tests.csproj @@ -27,7 +27,7 @@ - + From c7ef724b09e12284062fb5534d74c78164685fbc Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 23 May 2022 20:47:44 -0600 Subject: [PATCH 140/161] Add built-in support for .NET 6 `DateOnly` and `TimeOnly` types `DateOnly` requires 5 bytes (typically). `TimeOnly` requires 6 bytes for second resolution or 8 bytes for ticks resolution. This is automatically selected based on the original value. Closes #1240 # Conflicts: # src/MessagePack/net6.0/PublicAPI.Unshipped.txt --- README.md | 44 ++++++++------ .../Formatters/DateTimeFormatters.cs | 46 +++++++++++++++ .../MessagePack/Resolvers/BuiltinResolver.cs | 6 +- .../StandardClassLibraryFormatterTests.cs | 57 ++++++++++++++++++- .../Scripts/Tests/ShareTests/TestUtilities.cs | 2 + .../net6.0/PublicAPI.Unshipped.txt | 8 +++ 6 files changed, 145 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index b64275675..77d2c6551 100644 --- a/README.md +++ b/README.md @@ -1499,24 +1499,36 @@ var resolver = MessagePack.Resolvers.CompositeResolver.Create( ## Reserved Extension Types -MessagePack for C# already used some MessagePack extension type codes, be careful to use same ext code. +MessagePack for C# already used some MessagePack extension type codes, be careful to avoid using the same ext code for other purposes. + +Range | Reserved for +--|-- +\[-128, -1\] | Reserved by the msgpack spec for predefined types +\[30, 120) | Reserved for this library's use to support common types in .NET + +This leaves the following ranges for your use: + +- \[0, 30) +- \[120, 127] + +Within the *reserved* ranges, this library defines or implements extensions that use these type codes: | Code | Type | Use by | -| --- | --- | --- | -| -1 | DateTime | MessagePack-spec reserved for timestamp | -| 30 | Vector2[] | for Unity, UnsafeBlitFormatter | -| 31 | Vector3[] | for Unity, UnsafeBlitFormatter | -| 32 | Vector4[] | for Unity, UnsafeBlitFormatter | -| 33 | Quaternion[] | for Unity, UnsafeBlitFormatter | -| 34 | Color[] | for Unity, UnsafeBlitFormatter | -| 35 | Bounds[] | for Unity, UnsafeBlitFormatter | -| 36 | Rect[] | for Unity, UnsafeBlitFormatter | -| 37 | Int[] | for Unity, UnsafeBlitFormatter | -| 38 | Float[] | for Unity, UnsafeBlitFormatter | -| 39 | Double[] | for Unity, UnsafeBlitFormatter | -| 98 | All | MessagePackCompression.Lz4BlockArray | -| 99 | All | MessagePackCompression.Lz4Block | -| 100 | object | TypelessFormatter | +| ---- | ---- | --- | +| -1 | DateTime | MessagePack-spec reserved for timestamp | +| 30 | Vector2[] | for Unity, UnsafeBlitFormatter | +| 31 | Vector3[] | for Unity, UnsafeBlitFormatter | +| 32 | Vector4[] | for Unity, UnsafeBlitFormatter | +| 33 | Quaternion[] | for Unity, UnsafeBlitFormatter | +| 34 | Color[] | for Unity, UnsafeBlitFormatter | +| 35 | Bounds[] | for Unity, UnsafeBlitFormatter | +| 36 | Rect[] | for Unity, UnsafeBlitFormatter | +| 37 | Int[] | for Unity, UnsafeBlitFormatter | +| 38 | Float[] | for Unity, UnsafeBlitFormatter | +| 39 | Double[] | for Unity, UnsafeBlitFormatter | +| 98 | All | MessagePackCompression.Lz4BlockArray | +| 99 | All | MessagePackCompression.Lz4Block | +| 100 | object | TypelessFormatter | ## Unity support diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/DateTimeFormatters.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/DateTimeFormatters.cs index 06d2ef80a..07da2097b 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/DateTimeFormatters.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/DateTimeFormatters.cs @@ -70,4 +70,50 @@ public DateTime[] Deserialize(ref MessagePackReader reader, MessagePackSerialize return array; } } + +#if NET6_0_OR_GREATER + /// + /// Serializes a value as an ordinary using the . + /// + public sealed class DateOnlyFormatter : IMessagePackFormatter + { + public static readonly DateOnlyFormatter Instance = new DateOnlyFormatter(); + + private DateOnlyFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, DateOnly value, MessagePackSerializerOptions options) + { + writer.Write(value.DayNumber); + } + + public DateOnly Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + return DateOnly.FromDayNumber(reader.ReadInt32()); + } + } + + /// + /// Serializes a value as an extension, recording either seconds or ticks depending on the resolution required. + /// + public sealed class TimeOnlyFormatter : IMessagePackFormatter + { + public static readonly TimeOnlyFormatter Instance = new TimeOnlyFormatter(); + + private TimeOnlyFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, TimeOnly value, MessagePackSerializerOptions options) + { + writer.Write(value.Ticks); + } + + public TimeOnly Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + return new TimeOnly(reader.ReadInt64()); + } + } +#endif } diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/BuiltinResolver.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/BuiltinResolver.cs index 000b9fbdb..0defd99f0 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/BuiltinResolver.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/BuiltinResolver.cs @@ -64,9 +64,13 @@ 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 }, - // Nulllable Primitive + // Nullable Primitive { typeof(Int16?), NullableInt16Formatter.Instance }, { typeof(Int32?), NullableInt32Formatter.Instance }, { typeof(Int64?), NullableInt64Formatter.Instance }, diff --git a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/StandardClassLibraryFormatterTests.cs b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/StandardClassLibraryFormatterTests.cs index 12abda441..351234765 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/StandardClassLibraryFormatterTests.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/StandardClassLibraryFormatterTests.cs @@ -2,7 +2,7 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; -using System.Linq; +using Nerdbank.Streams; using Xunit; using Xunit.Abstractions; @@ -77,5 +77,60 @@ public void DeserializeByteArrayFromFixArray_Array32() byte[] byte_array = MessagePackSerializer.Deserialize(input); Assert.Equal(new byte[] { 1, 2, 3 }, byte_array); } + +#if NET6_0_OR_GREATER + [Fact] + public void DateOnly() + { + var value = new DateOnly(2012, 3, 5); + this.AssertRoundtrip(value); + this.AssertRoundtrip(value); + this.AssertRoundtrip(new[] { value }); + } + + [Fact] + public void TimeOnly() + { + TimeOnly lowRes = new TimeOnly(5, 4, 3); + this.AssertRoundtrip(lowRes); + this.AssertRoundtrip(lowRes); + this.AssertRoundtrip(new[] { lowRes }); + + TimeOnly mediumRes = new TimeOnly(5, 4, 3, 2); + this.AssertRoundtrip(mediumRes); + this.AssertRoundtrip(mediumRes); + this.AssertRoundtrip(new[] { mediumRes }); + + TimeOnly highRes = new TimeOnly(lowRes.Ticks + 1); + this.AssertRoundtrip(highRes); + this.AssertRoundtrip(System.TimeOnly.MaxValue); + } +#endif + + private void AssertRoundtrip(T value) + { + Assert.Equal(value, this.Roundtrip(value, breakupBuffer: false)); + Assert.Equal(value, this.Roundtrip(value, breakupBuffer: true)); + } + + private T Roundtrip(T value, bool breakupBuffer = false) + { + byte[] msgpack = MessagePackSerializer.Serialize(value, MessagePackSerializerOptions.Standard); + this.logger.WriteLine("{0} 0x{1}", value, TestUtilities.ToHex(msgpack)); + + if (breakupBuffer) + { + using (Sequence seq = new Sequence()) + { + seq.Append(msgpack.AsMemory(0, msgpack.Length - 1)); + seq.Append(msgpack.AsMemory(msgpack.Length - 1, 1)); + return MessagePackSerializer.Deserialize(seq, MessagePackSerializerOptions.Standard); + } + } + else + { + return MessagePackSerializer.Deserialize(msgpack, MessagePackSerializerOptions.Standard); + } + } } } diff --git a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/TestUtilities.cs b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/TestUtilities.cs index 0a4bf9fbf..abc85b0fb 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/TestUtilities.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/TestUtilities.cs @@ -15,6 +15,8 @@ internal static class TestUtilities /// Gets a value indicating whether the mono runtime is executing this code. /// internal static bool IsRunningOnMono => Type.GetType("Mono.Runtime") != null; + + internal static string ToHex(byte[] buffer) => BitConverter.ToString(buffer).Replace("-", string.Empty).ToLowerInvariant(); } public class NullTestOutputHelper : ITestOutputHelper diff --git a/src/MessagePack/net6.0/PublicAPI.Unshipped.txt b/src/MessagePack/net6.0/PublicAPI.Unshipped.txt index 9ba64088e..78006a920 100644 --- a/src/MessagePack/net6.0/PublicAPI.Unshipped.txt +++ b/src/MessagePack/net6.0/PublicAPI.Unshipped.txt @@ -1,6 +1,14 @@ +MessagePack.Formatters.DateOnlyFormatter +MessagePack.Formatters.DateOnlyFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.DateOnly +MessagePack.Formatters.DateOnlyFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.DateOnly value, MessagePack.MessagePackSerializerOptions options) -> void MessagePack.Formatters.StringInterningFormatter MessagePack.Formatters.StringInterningFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> string MessagePack.Formatters.StringInterningFormatter.Serialize(ref MessagePack.MessagePackWriter writer, string value, MessagePack.MessagePackSerializerOptions options) -> void MessagePack.Formatters.StringInterningFormatter.StringInterningFormatter() -> void +MessagePack.Formatters.TimeOnlyFormatter +MessagePack.Formatters.TimeOnlyFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.TimeOnly +MessagePack.Formatters.TimeOnlyFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.TimeOnly value, MessagePack.MessagePackSerializerOptions options) -> void MessagePack.MessagePackSerializerOptions.CompressionMinLength.get -> int MessagePack.MessagePackSerializerOptions.WithCompressionMinLength(int compressionMinLength) -> MessagePack.MessagePackSerializerOptions +static readonly MessagePack.Formatters.DateOnlyFormatter.Instance -> MessagePack.Formatters.DateOnlyFormatter +static readonly MessagePack.Formatters.TimeOnlyFormatter.Instance -> MessagePack.Formatters.TimeOnlyFormatter From 14ed43cf395c61b4a6aeefa6fe90b72e5d05c0ce Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 24 May 2022 07:30:54 -0600 Subject: [PATCH 141/161] Workaround https://github.com/dotnet/roslyn/issues/61478 --- .../Assets/Scripts/Tests/ShareTests/MessagePackWriterTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/MessagePackWriterTests.cs b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/MessagePackWriterTests.cs index 5d06e78dc..de2aa6741 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/MessagePackWriterTests.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/MessagePackWriterTests.cs @@ -33,7 +33,7 @@ public MessagePackWriterTests() #endif /// - /// Verifies that + /// Verifies that MessagePackWriter.WriteRaw(ReadOnlySpan{byte}) /// accepts a span that came from stackalloc. /// [Fact] From bf892e733963e0ab8306e097ab7aee14cc0eb411 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 7 Jun 2022 09:33:19 -0600 Subject: [PATCH 142/161] Suppress CS1591 warnings in generated code Fixes #1433 --- sandbox/Sandbox/Generated.cs | 11 +++++++++++ sandbox/TestData2/Generated.cs | 3 +++ .../Generator/EnumTemplate.cs | 13 +++++++------ .../Generator/EnumTemplate.tt | 1 + .../Generator/FormatterTemplate.cs | 7 ++++--- .../Generator/FormatterTemplate.tt | 1 + .../Generator/ResolverTemplate.cs | 7 ++++--- .../Generator/ResolverTemplate.tt | 1 + .../StringKey/StringKeyFormatterTemplate.cs | 7 ++++--- .../StringKey/StringKeyFormatterTemplate.tt | 1 + .../Generator/UnionTemplate.cs | 7 ++++--- .../Generator/UnionTemplate.tt | 1 + 12 files changed, 42 insertions(+), 18 deletions(-) diff --git a/sandbox/Sandbox/Generated.cs b/sandbox/Sandbox/Generated.cs index 64f68f84a..5145c2209 100644 --- a/sandbox/Sandbox/Generated.cs +++ b/sandbox/Sandbox/Generated.cs @@ -6,6 +6,7 @@ #pragma warning disable 612 #pragma warning disable 414 #pragma warning disable 168 +#pragma warning disable CS1591 // document public APIs #pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1312 // Variable names should begin with lower-case letter @@ -232,6 +233,7 @@ internal static object GetFormatter(Type t) #pragma warning disable 612 #pragma warning disable 414 #pragma warning disable 168 +#pragma warning disable CS1591 // document public APIs #pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1403 // File may only contain a single namespace @@ -274,6 +276,7 @@ public void Serialize(ref MessagePackWriter writer, global::GlobalMyEnum value, #pragma warning disable 612 #pragma warning disable 414 #pragma warning disable 168 +#pragma warning disable CS1591 // document public APIs #pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1403 // File may only contain a single namespace @@ -317,6 +320,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.ByteEnum #pragma warning disable 612 #pragma warning disable 414 #pragma warning disable 168 +#pragma warning disable CS1591 // document public APIs #pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1403 // File may only contain a single namespace @@ -440,6 +444,7 @@ public void Serialize(ref MessagePackWriter writer, global::IMessageBody value, #pragma warning disable 612 #pragma warning disable 414 #pragma warning disable 168 +#pragma warning disable CS1591 // document public APIs #pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1403 // File may only contain a single namespace @@ -912,6 +917,7 @@ public void Serialize(ref MessagePackWriter writer, global::SharedData.RootUnion #pragma warning disable 612 #pragma warning disable 414 #pragma warning disable 168 +#pragma warning disable CS1591 // document public APIs #pragma warning disable SA1129 // Do not use default value type constructor #pragma warning disable SA1200 // Using directives should be placed correctly @@ -990,6 +996,7 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: #pragma warning disable 612 #pragma warning disable 414 #pragma warning disable 168 +#pragma warning disable CS1591 // document public APIs #pragma warning disable SA1129 // Do not use default value type constructor #pragma warning disable SA1200 // Using directives should be placed correctly @@ -1381,6 +1388,7 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: #pragma warning disable 612 #pragma warning disable 414 #pragma warning disable 168 +#pragma warning disable CS1591 // document public APIs #pragma warning disable SA1129 // Do not use default value type constructor #pragma warning disable SA1200 // Using directives should be placed correctly @@ -1615,6 +1623,7 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: #pragma warning disable 612 #pragma warning disable 414 #pragma warning disable 168 +#pragma warning disable CS1591 // document public APIs #pragma warning disable SA1129 // Do not use default value type constructor #pragma warning disable SA1200 // Using directives should be placed correctly @@ -1754,6 +1763,7 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: #pragma warning disable 612 #pragma warning disable 414 #pragma warning disable 168 +#pragma warning disable CS1591 // document public APIs #pragma warning disable SA1129 // Do not use default value type constructor #pragma warning disable SA1200 // Using directives should be placed correctly @@ -3843,6 +3853,7 @@ public void Serialize(ref global::MessagePack.MessagePackWriter writer, global:: #pragma warning disable 612 #pragma warning disable 414 #pragma warning disable 168 +#pragma warning disable CS1591 // document public APIs #pragma warning disable SA1129 // Do not use default value type constructor #pragma warning disable SA1200 // Using directives should be placed correctly diff --git a/sandbox/TestData2/Generated.cs b/sandbox/TestData2/Generated.cs index 606e2dca8..99ea2a88a 100644 --- a/sandbox/TestData2/Generated.cs +++ b/sandbox/TestData2/Generated.cs @@ -6,6 +6,7 @@ #pragma warning disable 612 #pragma warning disable 414 #pragma warning disable 168 +#pragma warning disable CS1591 // document public APIs #pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1312 // Variable names should begin with lower-case letter @@ -116,6 +117,7 @@ internal static object GetFormatter(Type t) #pragma warning disable 612 #pragma warning disable 414 #pragma warning disable 168 +#pragma warning disable CS1591 // document public APIs #pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1403 // File may only contain a single namespace @@ -173,6 +175,7 @@ public void Serialize(ref MessagePackWriter writer, global::TestData2.Nest2.Id v #pragma warning disable 612 #pragma warning disable 414 #pragma warning disable 168 +#pragma warning disable CS1591 // document public APIs #pragma warning disable SA1129 // Do not use default value type constructor #pragma warning disable SA1200 // Using directives should be placed correctly diff --git a/src/MessagePack.GeneratorCore/Generator/EnumTemplate.cs b/src/MessagePack.GeneratorCore/Generator/EnumTemplate.cs index b64b4912f..ed315724c 100644 --- a/src/MessagePack.GeneratorCore/Generator/EnumTemplate.cs +++ b/src/MessagePack.GeneratorCore/Generator/EnumTemplate.cs @@ -1,10 +1,10 @@ // ------------------------------------------------------------------------------ // -// このコードはツールによって生成されました。 -// ランタイム バージョン: 16.0.0.0 +// This code was generated by a tool. +// Runtime Version: 17.0.0.0 // -// このファイルへの変更は、正しくない動作の原因になる可能性があり、 -// コードが再生成されると失われます。 +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. // // ------------------------------------------------------------------------------ namespace MessagePackCompiler.Generator @@ -17,7 +17,7 @@ namespace MessagePackCompiler.Generator /// /// Class to produce the template output /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "16.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")] public partial class EnumTemplate : EnumTemplateBase { /// @@ -33,6 +33,7 @@ public virtual string TransformText() #pragma warning disable 612 #pragma warning disable 414 #pragma warning disable 168 +#pragma warning disable CS1591 // document public APIs #pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1403 // File may only contain a single namespace @@ -78,7 +79,7 @@ namespace "); /// /// Base class for this transformation /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "16.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")] public class EnumTemplateBase { #region Fields diff --git a/src/MessagePack.GeneratorCore/Generator/EnumTemplate.tt b/src/MessagePack.GeneratorCore/Generator/EnumTemplate.tt index 28d34550e..00190514f 100644 --- a/src/MessagePack.GeneratorCore/Generator/EnumTemplate.tt +++ b/src/MessagePack.GeneratorCore/Generator/EnumTemplate.tt @@ -11,6 +11,7 @@ #pragma warning disable 612 #pragma warning disable 414 #pragma warning disable 168 +#pragma warning disable CS1591 // document public APIs #pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1403 // File may only contain a single namespace diff --git a/src/MessagePack.GeneratorCore/Generator/FormatterTemplate.cs b/src/MessagePack.GeneratorCore/Generator/FormatterTemplate.cs index e153d5eb1..f208fde81 100644 --- a/src/MessagePack.GeneratorCore/Generator/FormatterTemplate.cs +++ b/src/MessagePack.GeneratorCore/Generator/FormatterTemplate.cs @@ -1,7 +1,7 @@ // ------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version: 16.0.0.0 +// Runtime Version: 17.0.0.0 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -17,7 +17,7 @@ namespace MessagePackCompiler.Generator /// /// Class to produce the template output /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "16.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")] public partial class FormatterTemplate : FormatterTemplateBase { /// @@ -33,6 +33,7 @@ public virtual string TransformText() #pragma warning disable 612 #pragma warning disable 414 #pragma warning disable 168 +#pragma warning disable CS1591 // document public APIs #pragma warning disable SA1129 // Do not use default value type constructor #pragma warning disable SA1200 // Using directives should be placed correctly @@ -228,7 +229,7 @@ namespace "); /// /// Base class for this transformation /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "16.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")] public class FormatterTemplateBase { #region Fields diff --git a/src/MessagePack.GeneratorCore/Generator/FormatterTemplate.tt b/src/MessagePack.GeneratorCore/Generator/FormatterTemplate.tt index 631dc9f15..b1fd139ac 100644 --- a/src/MessagePack.GeneratorCore/Generator/FormatterTemplate.tt +++ b/src/MessagePack.GeneratorCore/Generator/FormatterTemplate.tt @@ -11,6 +11,7 @@ #pragma warning disable 612 #pragma warning disable 414 #pragma warning disable 168 +#pragma warning disable CS1591 // document public APIs #pragma warning disable SA1129 // Do not use default value type constructor #pragma warning disable SA1200 // Using directives should be placed correctly diff --git a/src/MessagePack.GeneratorCore/Generator/ResolverTemplate.cs b/src/MessagePack.GeneratorCore/Generator/ResolverTemplate.cs index 48e4df6bd..795bc5e7a 100644 --- a/src/MessagePack.GeneratorCore/Generator/ResolverTemplate.cs +++ b/src/MessagePack.GeneratorCore/Generator/ResolverTemplate.cs @@ -1,7 +1,7 @@ // ------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version: 16.0.0.0 +// Runtime Version: 17.0.0.0 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -17,7 +17,7 @@ namespace MessagePackCompiler.Generator /// /// Class to produce the template output /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "16.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")] public partial class ResolverTemplate : ResolverTemplateBase { /// @@ -33,6 +33,7 @@ public virtual string TransformText() #pragma warning disable 612 #pragma warning disable 414 #pragma warning disable 168 +#pragma warning disable CS1591 // document public APIs #pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1312 // Variable names should begin with lower-case letter @@ -132,7 +133,7 @@ internal static object GetFormatter(Type t) /// /// Base class for this transformation /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "16.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")] public class ResolverTemplateBase { #region Fields diff --git a/src/MessagePack.GeneratorCore/Generator/ResolverTemplate.tt b/src/MessagePack.GeneratorCore/Generator/ResolverTemplate.tt index e61688a1f..d8a026a44 100644 --- a/src/MessagePack.GeneratorCore/Generator/ResolverTemplate.tt +++ b/src/MessagePack.GeneratorCore/Generator/ResolverTemplate.tt @@ -11,6 +11,7 @@ #pragma warning disable 612 #pragma warning disable 414 #pragma warning disable 168 +#pragma warning disable CS1591 // document public APIs #pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1312 // Variable names should begin with lower-case letter diff --git a/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterTemplate.cs b/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterTemplate.cs index a3df9f44e..a6e8cdcdc 100644 --- a/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterTemplate.cs +++ b/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterTemplate.cs @@ -1,7 +1,7 @@ // ------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version: 16.0.0.0 +// Runtime Version: 17.0.0.0 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -17,7 +17,7 @@ namespace MessagePackCompiler.Generator /// /// Class to produce the template output /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "16.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")] public partial class StringKeyFormatterTemplate : StringKeyFormatterTemplateBase { /// @@ -33,6 +33,7 @@ public virtual string TransformText() #pragma warning disable 612 #pragma warning disable 414 #pragma warning disable 168 +#pragma warning disable CS1591 // document public APIs #pragma warning disable SA1129 // Do not use default value type constructor #pragma warning disable SA1200 // Using directives should be placed correctly @@ -201,7 +202,7 @@ namespace "); /// /// Base class for this transformation /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "16.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")] public class StringKeyFormatterTemplateBase { #region Fields diff --git a/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterTemplate.tt b/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterTemplate.tt index 9bc3e4d8b..1a6c32533 100644 --- a/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterTemplate.tt +++ b/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterTemplate.tt @@ -12,6 +12,7 @@ #pragma warning disable 612 #pragma warning disable 414 #pragma warning disable 168 +#pragma warning disable CS1591 // document public APIs #pragma warning disable SA1129 // Do not use default value type constructor #pragma warning disable SA1200 // Using directives should be placed correctly diff --git a/src/MessagePack.GeneratorCore/Generator/UnionTemplate.cs b/src/MessagePack.GeneratorCore/Generator/UnionTemplate.cs index 1106f1cb8..8f3b7cba1 100644 --- a/src/MessagePack.GeneratorCore/Generator/UnionTemplate.cs +++ b/src/MessagePack.GeneratorCore/Generator/UnionTemplate.cs @@ -1,7 +1,7 @@ // ------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version: 16.0.0.0 +// Runtime Version: 17.0.0.0 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -17,7 +17,7 @@ namespace MessagePackCompiler.Generator /// /// Class to produce the template output /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "16.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")] public partial class UnionTemplate : UnionTemplateBase { /// @@ -33,6 +33,7 @@ public virtual string TransformText() #pragma warning disable 612 #pragma warning disable 414 #pragma warning disable 168 +#pragma warning disable CS1591 // document public APIs #pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1403 // File may only contain a single namespace @@ -150,7 +151,7 @@ namespace "); /// /// Base class for this transformation /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "16.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")] public class UnionTemplateBase { #region Fields diff --git a/src/MessagePack.GeneratorCore/Generator/UnionTemplate.tt b/src/MessagePack.GeneratorCore/Generator/UnionTemplate.tt index 216cf3c35..59618f96d 100644 --- a/src/MessagePack.GeneratorCore/Generator/UnionTemplate.tt +++ b/src/MessagePack.GeneratorCore/Generator/UnionTemplate.tt @@ -11,6 +11,7 @@ #pragma warning disable 612 #pragma warning disable 414 #pragma warning disable 168 +#pragma warning disable CS1591 // document public APIs #pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1403 // File may only contain a single namespace From cf86d7cbbe2b798bd5347d0e02210314267f68bd Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 9 Jun 2022 07:38:55 -0600 Subject: [PATCH 143/161] Update package.json version to 2.3.112 to match latest release --- .../Assets/Scripts/MessagePack/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/package.json b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/package.json index 607988075..87e187eb7 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/package.json +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/package.json @@ -1,7 +1,7 @@ { "name": "com.neuecc.messagepack", "displayName": "MessagePack", - "version": "2.3.85", + "version": "2.3.112", "unity": "2018.4", "description": "Extremely Fast MessagePack Serializer for C#.", "keywords": [ From 9a3eb9c7da26b38d56b61b69512fc4d93b2a0f36 Mon Sep 17 00:00:00 2001 From: Yoshifumi Kawai Date: Fri, 10 Jun 2022 10:40:38 +0900 Subject: [PATCH 144/161] MessagePack.Generator RollForward to Major --- src/MessagePack.Generator/MessagePack.Generator.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/src/MessagePack.Generator/MessagePack.Generator.csproj b/src/MessagePack.Generator/MessagePack.Generator.csproj index b684a5b89..e75433d54 100644 --- a/src/MessagePack.Generator/MessagePack.Generator.csproj +++ b/src/MessagePack.Generator/MessagePack.Generator.csproj @@ -9,6 +9,7 @@ true true mpc + Major MessagePack.Generator From c0e85a1c1cac6e955f57c52c6053868e51e5c2fb Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 14 Jun 2022 13:46:16 -0600 Subject: [PATCH 145/161] Build 2.4 as stable version --- version.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.json b/version.json index 6fc917f32..fff14ab3f 100644 --- a/version.json +++ b/version.json @@ -1,6 +1,6 @@ { "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", - "version": "2.4-alpha", + "version": "2.4", "publicReleaseRefSpec": [ "^refs/heads/master$", "^refs/heads/v1\\.x$", From a0324060aaad24b9f7f10feee04d575a017e8061 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 14 Jun 2022 13:51:42 -0600 Subject: [PATCH 146/161] Apply better workaround for https://github.com/dotnet/roslyn/issues/61478 --- .../Assets/Scripts/Tests/ShareTests/MessagePackWriterTests.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/MessagePackWriterTests.cs b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/MessagePackWriterTests.cs index de2aa6741..85d293650 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/MessagePackWriterTests.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/MessagePackWriterTests.cs @@ -10,6 +10,7 @@ using Nerdbank.Streams; using Xunit; using Xunit.Abstractions; +using MessagePackWriterCref = MessagePack.MessagePackWriter; namespace MessagePack.Tests { @@ -33,7 +34,7 @@ public MessagePackWriterTests() #endif /// - /// Verifies that MessagePackWriter.WriteRaw(ReadOnlySpan{byte}) + /// Verifies that /// accepts a span that came from stackalloc. /// [Fact] From a346d11182fb658aea8d86c3dcf7b85b30e7b22c Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 14 Jun 2022 13:59:19 -0600 Subject: [PATCH 147/161] Drop net5.0 runtime targets Where we already had a .NET 6 target, we just drop net5.0. Where .NET 5 was the latest target, we change it to target .NET 6. This is because .NET 5 is no longer supported by Microsoft, so no one is expected to be using that runtime at this point. --- azure-pipelines/build_nonWindows.yml | 8 -------- sandbox/PerfBenchmarkDotNet/PerfBenchmarkDotNet.csproj | 2 +- sandbox/PerfNetFramework/PerfNetFramework.csproj | 2 +- src/MessagePack.Generator/MessagePack.Generator.csproj | 2 +- src/MessagePack/MessagePack.csproj | 2 +- tests/MessagePack.Tests/MessagePack.Tests.csproj | 2 +- 6 files changed, 5 insertions(+), 13 deletions(-) diff --git a/azure-pipelines/build_nonWindows.yml b/azure-pipelines/build_nonWindows.yml index 9a57e2f9d..cf3f51d76 100644 --- a/azure-pipelines/build_nonWindows.yml +++ b/azure-pipelines/build_nonWindows.yml @@ -13,14 +13,6 @@ steps: arguments: --no-build -c $(BuildConfiguration) -f netcoreapp3.1 -v n --settings "$(Build.Repository.LocalPath)/azure-pipelines/$(Agent.OS).runsettings" testRunTitle: netcoreapp3.1-$(Agent.JobName) -- task: DotNetCoreCLI@2 - displayName: Run MessagePack.Tests (net5.0) - inputs: - command: test - projects: tests/MessagePack.Tests/MessagePack.Tests.csproj - arguments: --no-build -c $(BuildConfiguration) -f net5.0 -v n --settings "$(Build.Repository.LocalPath)/azure-pipelines/$(Agent.OS).runsettings" - testRunTitle: net5.0-$(Agent.JobName) - - task: DotNetCoreCLI@2 displayName: Run MessagePack.Tests (net6.0) inputs: diff --git a/sandbox/PerfBenchmarkDotNet/PerfBenchmarkDotNet.csproj b/sandbox/PerfBenchmarkDotNet/PerfBenchmarkDotNet.csproj index d9a575d06..6804253df 100644 --- a/sandbox/PerfBenchmarkDotNet/PerfBenchmarkDotNet.csproj +++ b/sandbox/PerfBenchmarkDotNet/PerfBenchmarkDotNet.csproj @@ -1,7 +1,7 @@  Exe - net472;net5.0 + net472;net6.0 true true diff --git a/sandbox/PerfNetFramework/PerfNetFramework.csproj b/sandbox/PerfNetFramework/PerfNetFramework.csproj index 89e5cedfe..57cbfd36e 100644 --- a/sandbox/PerfNetFramework/PerfNetFramework.csproj +++ b/sandbox/PerfNetFramework/PerfNetFramework.csproj @@ -1,7 +1,7 @@  Exe - net472;net5.0 + net472;net6.0 true diff --git a/src/MessagePack.Generator/MessagePack.Generator.csproj b/src/MessagePack.Generator/MessagePack.Generator.csproj index be7a10271..c0a154356 100644 --- a/src/MessagePack.Generator/MessagePack.Generator.csproj +++ b/src/MessagePack.Generator/MessagePack.Generator.csproj @@ -3,7 +3,7 @@ mpc Exe - netcoreapp3.1;net5.0;net6.0 + netcoreapp3.1;net6.0 10 enable true diff --git a/src/MessagePack/MessagePack.csproj b/src/MessagePack/MessagePack.csproj index cb24047ad..801ab7de1 100644 --- a/src/MessagePack/MessagePack.csproj +++ b/src/MessagePack/MessagePack.csproj @@ -1,7 +1,7 @@  - netstandard2.0;netcoreapp3.1;net5.0;net6.0 + netstandard2.0;netcoreapp3.1;net6.0 $(NoWarn);CS0649 True $(DefineConstants);SPAN_BUILTIN diff --git a/tests/MessagePack.Tests/MessagePack.Tests.csproj b/tests/MessagePack.Tests/MessagePack.Tests.csproj index f6ff68609..5fb26383b 100644 --- a/tests/MessagePack.Tests/MessagePack.Tests.csproj +++ b/tests/MessagePack.Tests/MessagePack.Tests.csproj @@ -1,6 +1,6 @@  - net472;netcoreapp3.1;net5.0;net6.0 + net472;netcoreapp3.1;net6.0 true 10 true From c357cd8acd315ef6bba9ceb6afc7f72b1aee1772 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 22 Jun 2022 15:25:13 +0000 Subject: [PATCH 148/161] Bump Newtonsoft.Json from 10.0.3 to 13.0.1 in /sandbox/Sandbox Bumps [Newtonsoft.Json](https://github.com/JamesNK/Newtonsoft.Json) from 10.0.3 to 13.0.1. - [Release notes](https://github.com/JamesNK/Newtonsoft.Json/releases) - [Commits](https://github.com/JamesNK/Newtonsoft.Json/compare/10.0.3...13.0.1) --- updated-dependencies: - dependency-name: Newtonsoft.Json dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- sandbox/Sandbox/Sandbox.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sandbox/Sandbox/Sandbox.csproj b/sandbox/Sandbox/Sandbox.csproj index a15617098..17da2db30 100644 --- a/sandbox/Sandbox/Sandbox.csproj +++ b/sandbox/Sandbox/Sandbox.csproj @@ -9,7 +9,7 @@ - + From 0eeb64b4fffe7c899477e2a2a6b9f422bfcf8096 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 22 Jun 2022 20:44:48 +0000 Subject: [PATCH 149/161] Bump Newtonsoft.Json in /benchmark/SerializerBenchmark Bumps [Newtonsoft.Json](https://github.com/JamesNK/Newtonsoft.Json) from 12.0.3 to 13.0.1. - [Release notes](https://github.com/JamesNK/Newtonsoft.Json/releases) - [Commits](https://github.com/JamesNK/Newtonsoft.Json/compare/12.0.3...13.0.1) --- updated-dependencies: - dependency-name: Newtonsoft.Json dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- benchmark/SerializerBenchmark/SerializerBenchmark.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/benchmark/SerializerBenchmark/SerializerBenchmark.csproj b/benchmark/SerializerBenchmark/SerializerBenchmark.csproj index 78d2ad218..b6be2ea09 100644 --- a/benchmark/SerializerBenchmark/SerializerBenchmark.csproj +++ b/benchmark/SerializerBenchmark/SerializerBenchmark.csproj @@ -20,7 +20,7 @@ - + From 3074ea91278b1690243bf33e6fa2bbf9110c76c3 Mon Sep 17 00:00:00 2001 From: neuecc Date: Thu, 23 Jun 2022 17:55:27 +0900 Subject: [PATCH 150/161] add meta --- .../Formatters/StringInterningFormatter.cs.meta | 11 +++++++++++ .../Tests/ShareTests/StringInterningTests.cs.meta | 11 +++++++++++ 2 files changed, 22 insertions(+) create mode 100644 src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/StringInterningFormatter.cs.meta create mode 100644 src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/StringInterningTests.cs.meta diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/StringInterningFormatter.cs.meta b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/StringInterningFormatter.cs.meta new file mode 100644 index 000000000..329667d48 --- /dev/null +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Formatters/StringInterningFormatter.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 78f9cfd44a10b334582b112b07143434 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/StringInterningTests.cs.meta b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/StringInterningTests.cs.meta new file mode 100644 index 000000000..a6117b9c2 --- /dev/null +++ b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/StringInterningTests.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 593d09755237d984a95626a65167c3a7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: From 9a2acd8e1bcc843e4ab9ff704f688749d526ee88 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 23 Jun 2022 11:01:23 -0600 Subject: [PATCH 151/161] Add option to avoid large buffer allocations Allocating 1MB buffers contribute to the large object heap and should be avoidable for applications that it is a problem for. --- .../MessagePack/MessagePackSerializer.cs | 5 ++- .../MessagePackSerializerOptions.cs | 33 +++++++++++++++++++ .../MessagePackSerializerOptionsTests.cs | 31 ++++++++++++++++- .../net6.0/PublicAPI.Unshipped.txt | 2 ++ .../netcoreapp3.1/PublicAPI.Unshipped.txt | 2 ++ .../netstandard2.0/PublicAPI.Unshipped.txt | 4 ++- 6 files changed, 72 insertions(+), 5 deletions(-) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.cs index 24b5373c4..8c4a454c6 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.cs @@ -18,7 +18,6 @@ namespace MessagePack [System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Each overload has sufficiently unique required parameters.")] public static partial class MessagePackSerializer { - private const int MaxHintSize = 1024 * 1024; private static MessagePackSerializerOptions defaultOptions; /// @@ -349,7 +348,7 @@ public static T Deserialize(Stream stream, MessagePackSerializerOptions optio do { cancellationToken.ThrowIfCancellationRequested(); - Span span = sequence.GetSpan(stream.CanSeek ? (int)Math.Min(MaxHintSize, stream.Length - stream.Position) : 0); + Span span = sequence.GetSpan(stream.CanSeek ? (int)Math.Min(options.SuggestedContiguousMemorySize, stream.Length - stream.Position) : 0); bytesRead = stream.Read(span); sequence.Advance(bytesRead); } @@ -397,7 +396,7 @@ public static async ValueTask DeserializeAsync(Stream stream, MessagePackS int bytesRead; do { - Memory memory = sequence.GetMemory(stream.CanSeek ? (int)Math.Min(MaxHintSize, stream.Length - stream.Position) : 0); + Memory memory = sequence.GetMemory(stream.CanSeek ? (int)Math.Min(options.SuggestedContiguousMemorySize, stream.Length - stream.Position) : 0); bytesRead = await stream.ReadAsync(memory, cancellationToken).ConfigureAwait(false); sequence.Advance(bytesRead); } diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs index 771aa25fd..a9a9ec515 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs @@ -58,6 +58,7 @@ protected MessagePackSerializerOptions(MessagePackSerializerOptions copyFrom) this.Resolver = copyFrom.Resolver; this.Compression = copyFrom.Compression; this.CompressionMinLength = copyFrom.CompressionMinLength; + this.SuggestedContiguousMemorySize = copyFrom.SuggestedContiguousMemorySize; this.OldSpec = copyFrom.OldSpec; this.OmitAssemblyVersion = copyFrom.OmitAssemblyVersion; this.AllowAssemblyVersionMismatch = copyFrom.AllowAssemblyVersionMismatch; @@ -92,6 +93,16 @@ protected MessagePackSerializerOptions(MessagePackSerializerOptions copyFrom) /// public int CompressionMinLength { get; private set; } = 64; + /// + /// Gets the size of contiguous memory blocks in bytes that may be allocated for buffering purposes. + /// + /// The default value is 1MB. + /// + /// Larger values may perform a bit faster, but may result in adding a runtime perf tax due to using the + /// Large Object Heap. + /// + public int SuggestedContiguousMemorySize { get; private set; } = 1024 * 1024; + /// /// Gets a value indicating whether to serialize with set to some value /// causing messagepack spec compliance to be explicitly set to the old or new format. @@ -227,6 +238,28 @@ public MessagePackSerializerOptions WithCompressionMinLength(int compressionMinL return result; } + /// + /// Gets a copy of these options with the property set to a new value. + /// + /// The new value for the property. Must be at least 256. + /// The new instance; or the original if the value is unchanged. + public MessagePackSerializerOptions WithSuggestedContiguousMemorySize(int suggestedContiguousMemorySize) + { + if (this.SuggestedContiguousMemorySize == suggestedContiguousMemorySize) + { + return this; + } + + if (suggestedContiguousMemorySize < 256) + { + throw new ArgumentOutOfRangeException(nameof(suggestedContiguousMemorySize), "This should be at least 256"); + } + + var result = this.Clone(); + result.SuggestedContiguousMemorySize = suggestedContiguousMemorySize; + return result; + } + /// /// Gets a copy of these options with the property set to a new value. /// diff --git a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/MessagePackSerializerOptionsTests.cs b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/MessagePackSerializerOptionsTests.cs index dfe988f8a..0db5157c0 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/MessagePackSerializerOptionsTests.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests/MessagePackSerializerOptionsTests.cs @@ -14,7 +14,8 @@ public class MessagePackSerializerOptionsTests .WithOmitAssemblyVersion(true) .WithResolver(BuiltinResolver.Instance) .WithOldSpec(false) - .WithSecurity(MySecurityOptions.Instance); + .WithSecurity(MySecurityOptions.Instance) + .WithSuggestedContiguousMemorySize(64 * 1024); [Fact] public void AllowAssemblyVersionMismatch() @@ -47,6 +48,16 @@ public void CompressionMinLength() Assert.Equal(128, options.CompressionMinLength); } + [Fact] + public void SuggestedContiguousMemorySize() + { + Assert.Equal(1024 * 1024, MessagePackSerializerOptions.Standard.SuggestedContiguousMemorySize); + Assert.Throws(() => MessagePackSerializerOptions.Standard.WithSuggestedContiguousMemorySize(0)); + Assert.Throws(() => MessagePackSerializerOptions.Standard.WithSuggestedContiguousMemorySize(4)); + MessagePackSerializerOptions options = MessagePackSerializerOptions.Standard.WithSuggestedContiguousMemorySize(512); + Assert.Equal(512, options.SuggestedContiguousMemorySize); + } + [Fact] public void OldSpec() { @@ -74,6 +85,7 @@ public void WithOldSpec_PreservesOtherProperties() var mutated = NonDefaultOptions.WithOldSpec(true); Assert.True(mutated.OldSpec.Value); Assert.Equal(NonDefaultOptions.Compression, mutated.Compression); + Assert.Equal(NonDefaultOptions.SuggestedContiguousMemorySize, mutated.SuggestedContiguousMemorySize); Assert.Equal(NonDefaultOptions.AllowAssemblyVersionMismatch, mutated.AllowAssemblyVersionMismatch); Assert.Equal(NonDefaultOptions.OmitAssemblyVersion, mutated.OmitAssemblyVersion); Assert.Same(NonDefaultOptions.Resolver, mutated.Resolver); @@ -92,12 +104,26 @@ public void WithLZ4Compression_PreservesOtherProperties() Assert.Same(MySecurityOptions.Instance, mutated.Security); } + [Fact] + public void WithSuggestedContiguousMemorySize_PreservesOtherProperties() + { + var mutated = NonDefaultOptions.WithSuggestedContiguousMemorySize(612); + Assert.Equal(612, mutated.SuggestedContiguousMemorySize); + Assert.Equal(NonDefaultOptions.Compression, mutated.Compression); + Assert.Equal(NonDefaultOptions.OldSpec, mutated.OldSpec); + Assert.Equal(NonDefaultOptions.AllowAssemblyVersionMismatch, mutated.AllowAssemblyVersionMismatch); + Assert.Equal(NonDefaultOptions.OmitAssemblyVersion, mutated.OmitAssemblyVersion); + Assert.Same(NonDefaultOptions.Resolver, mutated.Resolver); + Assert.Same(MySecurityOptions.Instance, mutated.Security); + } + [Fact] public void WithAllowAssemblyVersionMismatch_PreservesOtherProperties() { var mutated = NonDefaultOptions.WithAllowAssemblyVersionMismatch(false); Assert.False(mutated.AllowAssemblyVersionMismatch); Assert.Equal(NonDefaultOptions.Compression, mutated.Compression); + Assert.Equal(NonDefaultOptions.SuggestedContiguousMemorySize, mutated.SuggestedContiguousMemorySize); Assert.Equal(NonDefaultOptions.OldSpec, mutated.OldSpec); Assert.Equal(NonDefaultOptions.OmitAssemblyVersion, mutated.OmitAssemblyVersion); Assert.Same(NonDefaultOptions.Resolver, mutated.Resolver); @@ -110,6 +136,7 @@ public void WithOmitAssemblyVersion_PreservesOtherProperties() var mutated = NonDefaultOptions.WithOmitAssemblyVersion(false); Assert.False(mutated.OmitAssemblyVersion); Assert.Equal(NonDefaultOptions.Compression, mutated.Compression); + Assert.Equal(NonDefaultOptions.SuggestedContiguousMemorySize, mutated.SuggestedContiguousMemorySize); Assert.Equal(NonDefaultOptions.OldSpec, mutated.OldSpec); Assert.Equal(NonDefaultOptions.AllowAssemblyVersionMismatch, mutated.AllowAssemblyVersionMismatch); Assert.Same(NonDefaultOptions.Resolver, mutated.Resolver); @@ -122,6 +149,7 @@ public void WithResolver_PreservesOtherProperties() var mutated = NonDefaultOptions.WithResolver(ContractlessStandardResolver.Instance); Assert.Same(ContractlessStandardResolver.Instance, mutated.Resolver); Assert.Equal(NonDefaultOptions.Compression, mutated.Compression); + Assert.Equal(NonDefaultOptions.SuggestedContiguousMemorySize, mutated.SuggestedContiguousMemorySize); Assert.Equal(NonDefaultOptions.OldSpec, mutated.OldSpec); Assert.Equal(NonDefaultOptions.AllowAssemblyVersionMismatch, mutated.AllowAssemblyVersionMismatch); Assert.Equal(NonDefaultOptions.OmitAssemblyVersion, mutated.OmitAssemblyVersion); @@ -135,6 +163,7 @@ public void WithSecurity_PreservesOtherProperties() Assert.Same(MessagePackSecurity.TrustedData, mutated.Security); Assert.Same(NonDefaultOptions.Resolver, mutated.Resolver); Assert.Equal(NonDefaultOptions.Compression, mutated.Compression); + Assert.Equal(NonDefaultOptions.SuggestedContiguousMemorySize, mutated.SuggestedContiguousMemorySize); Assert.Equal(NonDefaultOptions.OldSpec, mutated.OldSpec); Assert.Equal(NonDefaultOptions.AllowAssemblyVersionMismatch, mutated.AllowAssemblyVersionMismatch); Assert.Equal(NonDefaultOptions.OmitAssemblyVersion, mutated.OmitAssemblyVersion); diff --git a/src/MessagePack/net6.0/PublicAPI.Unshipped.txt b/src/MessagePack/net6.0/PublicAPI.Unshipped.txt index 78006a920..89697310e 100644 --- a/src/MessagePack/net6.0/PublicAPI.Unshipped.txt +++ b/src/MessagePack/net6.0/PublicAPI.Unshipped.txt @@ -9,6 +9,8 @@ MessagePack.Formatters.TimeOnlyFormatter MessagePack.Formatters.TimeOnlyFormatter.Deserialize(ref MessagePack.MessagePackReader reader, MessagePack.MessagePackSerializerOptions options) -> System.TimeOnly MessagePack.Formatters.TimeOnlyFormatter.Serialize(ref MessagePack.MessagePackWriter writer, System.TimeOnly value, MessagePack.MessagePackSerializerOptions options) -> void MessagePack.MessagePackSerializerOptions.CompressionMinLength.get -> int +MessagePack.MessagePackSerializerOptions.SuggestedContiguousMemorySize.get -> int MessagePack.MessagePackSerializerOptions.WithCompressionMinLength(int compressionMinLength) -> MessagePack.MessagePackSerializerOptions +MessagePack.MessagePackSerializerOptions.WithSuggestedContiguousMemorySize(int suggestedContiguousMemorySize) -> MessagePack.MessagePackSerializerOptions static readonly MessagePack.Formatters.DateOnlyFormatter.Instance -> MessagePack.Formatters.DateOnlyFormatter static readonly MessagePack.Formatters.TimeOnlyFormatter.Instance -> MessagePack.Formatters.TimeOnlyFormatter diff --git a/src/MessagePack/netcoreapp3.1/PublicAPI.Unshipped.txt b/src/MessagePack/netcoreapp3.1/PublicAPI.Unshipped.txt index 9ba64088e..ba449cacb 100644 --- a/src/MessagePack/netcoreapp3.1/PublicAPI.Unshipped.txt +++ b/src/MessagePack/netcoreapp3.1/PublicAPI.Unshipped.txt @@ -3,4 +3,6 @@ MessagePack.Formatters.StringInterningFormatter.Deserialize(ref MessagePack.Mess MessagePack.Formatters.StringInterningFormatter.Serialize(ref MessagePack.MessagePackWriter writer, string value, MessagePack.MessagePackSerializerOptions options) -> void MessagePack.Formatters.StringInterningFormatter.StringInterningFormatter() -> void MessagePack.MessagePackSerializerOptions.CompressionMinLength.get -> int +MessagePack.MessagePackSerializerOptions.SuggestedContiguousMemorySize.get -> int MessagePack.MessagePackSerializerOptions.WithCompressionMinLength(int compressionMinLength) -> MessagePack.MessagePackSerializerOptions +MessagePack.MessagePackSerializerOptions.WithSuggestedContiguousMemorySize(int suggestedContiguousMemorySize) -> MessagePack.MessagePackSerializerOptions diff --git a/src/MessagePack/netstandard2.0/PublicAPI.Unshipped.txt b/src/MessagePack/netstandard2.0/PublicAPI.Unshipped.txt index 49e84ad1e..2cdd3d32f 100644 --- a/src/MessagePack/netstandard2.0/PublicAPI.Unshipped.txt +++ b/src/MessagePack/netstandard2.0/PublicAPI.Unshipped.txt @@ -3,4 +3,6 @@ MessagePack.Formatters.StringInterningFormatter.Deserialize(ref MessagePack.Mess MessagePack.Formatters.StringInterningFormatter.Serialize(ref MessagePack.MessagePackWriter writer, string value, MessagePack.MessagePackSerializerOptions options) -> void MessagePack.Formatters.StringInterningFormatter.StringInterningFormatter() -> void MessagePack.MessagePackSerializerOptions.CompressionMinLength.get -> int -MessagePack.MessagePackSerializerOptions.WithCompressionMinLength(int compressionMinLength) -> MessagePack.MessagePackSerializerOptions \ No newline at end of file +MessagePack.MessagePackSerializerOptions.SuggestedContiguousMemorySize.get -> int +MessagePack.MessagePackSerializerOptions.WithCompressionMinLength(int compressionMinLength) -> MessagePack.MessagePackSerializerOptions +MessagePack.MessagePackSerializerOptions.WithSuggestedContiguousMemorySize(int suggestedContiguousMemorySize) -> MessagePack.MessagePackSerializerOptions \ No newline at end of file From 7a4a9ef9fbe1d8eb2b9139afa10e6d8f691ff976 Mon Sep 17 00:00:00 2001 From: maxim Date: Tue, 28 Jun 2022 13:02:50 +1200 Subject: [PATCH 152/161] Several lines of code were deleted (which were not deleted in previous commit by some unknown accident). --- .../MessagePackSerializer.NonGeneric.cs | 21 ------------------- .../MessagePackSerializerOptions.cs | 1 - 2 files changed, 22 deletions(-) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.NonGeneric.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.NonGeneric.cs index 18c52d4e4..019eb8e78 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.NonGeneric.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.NonGeneric.cs @@ -220,41 +220,20 @@ internal CompiledMethods(Type type) { // public static void Serialize(ref MessagePackWriter writer, T obj, MessagePackSerializerOptions options) - MethodInfo serialize = GetMethod(nameof(Serialize), type, new Type[] { typeof(MessagePackWriter).MakeByRefType(), null, typeof(MessagePackSerializerOptions) }); MethodInfo serialize = GetMethod(nameof(SerializeSemiGeneric), type, new Type[] { typeof(MessagePackWriter).MakeByRefType(), typeof(Object), typeof(MessagePackSerializerOptions) }); #if ENABLE_IL2CPP this.Serialize_MessagePackWriter_T_Options = (ref MessagePackWriter x, object y, MessagePackSerializerOptions z) => ThrowRefStructNotSupported(); #else - ParameterExpression param1 = Expression.Parameter(typeof(MessagePackWriter).MakeByRefType(), "writer"); - ParameterExpression param2 = Expression.Parameter(typeof(object), "obj"); - ParameterExpression param3 = Expression.Parameter(typeof(MessagePackSerializerOptions), "options"); - - MethodCallExpression body = Expression.Call( - null, - serialize, - param1, - ti.IsValueType ? Expression.Unbox(param2, type) : Expression.Convert(param2, type), - param3); - MessagePackWriterSerialize lambda = Expression.Lambda(body, param1, param2, param3).Compile(PreferInterpretation); - - this.Serialize_MessagePackWriter_T_Options = lambda; this.Serialize_MessagePackWriter_T_Options = (MessagePackWriterSerialize)serialize.CreateDelegate(typeof(MessagePackWriterSerialize)); #endif } { // public static T Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) - MethodInfo deserialize = GetMethod(nameof(Deserialize), type, new Type[] { typeof(MessagePackReader).MakeByRefType(), typeof(MessagePackSerializerOptions) }); MethodInfo deserialize = GetMethod(nameof(DeserializeSemiGeneric), type, new Type[] { typeof(MessagePackReader).MakeByRefType(), typeof(MessagePackSerializerOptions) }); #if ENABLE_IL2CPP this.Deserialize_MessagePackReader_Options = (ref MessagePackReader reader, MessagePackSerializerOptions options) => { ThrowRefStructNotSupported(); return null; }; #else - ParameterExpression param1 = Expression.Parameter(typeof(MessagePackReader).MakeByRefType(), "reader"); - ParameterExpression param2 = Expression.Parameter(typeof(MessagePackSerializerOptions), "options"); - UnaryExpression body = Expression.Convert(Expression.Call(null, deserialize, param1, param2), typeof(object)); - MessagePackReaderDeserialize lambda = Expression.Lambda(body, param1, param2).Compile(); - - this.Deserialize_MessagePackReader_Options = lambda; this.Deserialize_MessagePackReader_Options = (MessagePackReaderDeserialize)deserialize.CreateDelegate(typeof(MessagePackReaderDeserialize)); #endif } diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs index f31174557..bc1557b02 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs @@ -28,7 +28,6 @@ public class MessagePackSerializerOptions "System.Management.IWbemClassObjectFreeThreaded", }; -#if !DYNAMICCODEDUMPER #if DYNAMICCODEDUMPER static readonly MessagePackSerializerOptions _standard = new MessagePackSerializerOptions(Resolvers.BuiltinResolver.Instance); From eab5122e95f32443c686548e646523038ceb7543 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 28 Jun 2022 09:28:49 -0600 Subject: [PATCH 153/161] Set unity package.json file for v2.4.35 --- .../Assets/Scripts/MessagePack/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/package.json b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/package.json index 19011e4fc..ea203c5ce 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/package.json +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/package.json @@ -1,7 +1,7 @@ { "name": "com.neuecc.messagepack", "displayName": "MessagePack", - "version": "2.4.25", + "version": "2.4.35", "unity": "2018.4", "description": "Extremely Fast MessagePack Serializer for C#.", "keywords": [ From ebb2040b53747eed245aa8afa133d102b3c14608 Mon Sep 17 00:00:00 2001 From: Gleb Lebedev Date: Wed, 29 Jun 2022 12:34:19 +0100 Subject: [PATCH 154/161] Skip type collection if property has MessagePackFormatterAttribute --- .../CodeAnalysis/TypeCollector.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/MessagePack.GeneratorCore/CodeAnalysis/TypeCollector.cs b/src/MessagePack.GeneratorCore/CodeAnalysis/TypeCollector.cs index 935ceb871..eeedbdadc 100644 --- a/src/MessagePack.GeneratorCore/CodeAnalysis/TypeCollector.cs +++ b/src/MessagePack.GeneratorCore/CodeAnalysis/TypeCollector.cs @@ -720,7 +720,12 @@ private ObjectSerializationInfo GetObjectInfo(INamedTypeSymbol type) stringMembers.Add(member.StringKey, member); } - this.CollectCore(item.Type); // recursive collect + var messagePackFormatter = item.GetAttributes().FirstOrDefault(x => x.AttributeClass.ApproximatelyEqual(this.typeReferences.MessagePackFormatterAttribute))?.ConstructorArguments[0]; + + if (messagePackFormatter == null) + { + this.CollectCore(item.Type); // recursive collect + } } foreach (IFieldSymbol item in type.GetAllMembers().OfType()) From 3cd55341c145b01fb4087aa4f407995533d732c0 Mon Sep 17 00:00:00 2001 From: maxim Date: Sun, 3 Jul 2022 20:03:26 +1200 Subject: [PATCH 155/161] Changes to fixx issues to pass CI build pipeline. --- .../MessagePack/MessagePackSerializer.cs | 24 +++++++++---------- .../MessagePackSerializerOptions.cs | 6 +---- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.cs index f3773f700..4348e4c3d 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.cs @@ -71,13 +71,6 @@ public static void Serialize(IBufferWriter writer, T value, MessagePack fastWriter.Flush(); } - /// - /// Serializes a given value with the specified buffer writer. - /// - /// The buffer writer to serialize with. - /// The value to serialize. - /// The options. Use null to use default options. - /// Thrown when any error occurs during serialization. internal static void SerializeSemiGeneric(ref MessagePackWriter writer, Object valueObject, MessagePackSerializerOptions options = null) { T value = (T)valueObject; @@ -85,6 +78,13 @@ internal static void SerializeSemiGeneric(ref MessagePackWriter writer, Objec Serialize(ref writer, value, options); } + /// + /// Serializes a given value with the specified buffer writer. + /// + /// The buffer writer to serialize with. + /// The value to serialize. + /// The options. Use null to use default options. + /// Thrown when any error occurs during serialization. public static void Serialize(ref MessagePackWriter writer, T value, MessagePackSerializerOptions options = null) { options = options ?? DefaultOptions; @@ -239,11 +239,6 @@ public static T Deserialize(in ReadOnlySequence byteSequence, MessagePa /// The deserialized value. /// Thrown when any error occurs during deserialization. public static T Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options = null) - { - return (T)DeserializeSemiGeneric(ref reader, options); - } - - internal static Object DeserializeSemiGeneric(ref MessagePackReader reader, MessagePackSerializerOptions options = null) { options = options ?? DefaultOptions; @@ -276,6 +271,11 @@ internal static Object DeserializeSemiGeneric(ref MessagePackReader reader, M } } + internal static Object DeserializeSemiGeneric(ref MessagePackReader reader, MessagePackSerializerOptions options = null) + { + return DeserializeSemiGeneric(ref reader, options); + } + /// /// Deserializes a value of a given type from a sequence of bytes. /// diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs index de2bb4b8e..a9a9ec515 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs @@ -28,11 +28,7 @@ public class MessagePackSerializerOptions "System.Management.IWbemClassObjectFreeThreaded", }; -#if DYNAMICCODEDUMPER - static readonly MessagePackSerializerOptions _standard = new MessagePackSerializerOptions(Resolvers.BuiltinResolver.Instance); - - public static MessagePackSerializerOptions Standard => _standard; -#else +#if !DYNAMICCODEDUMPER /// /// Gets a good default set of options that uses the and no compression. /// From 287c4f7a7a2d6f93d98bd143cb7578cd9ea204da Mon Sep 17 00:00:00 2001 From: maxim Date: Sun, 3 Jul 2022 20:26:50 +1200 Subject: [PATCH 156/161] Small bug fix --- .../Assets/Scripts/MessagePack/MessagePackSerializer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.cs index 4348e4c3d..9510ea893 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.cs @@ -273,7 +273,7 @@ public static T Deserialize(ref MessagePackReader reader, MessagePackSerializ internal static Object DeserializeSemiGeneric(ref MessagePackReader reader, MessagePackSerializerOptions options = null) { - return DeserializeSemiGeneric(ref reader, options); + return Deserialize(ref reader, options); } /// From eb6b93bb63794566ebb4d36e37ea173782851c79 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sat, 23 Jul 2022 08:03:47 -0600 Subject: [PATCH 157/161] Revise the fix slightly --- .../MessagePackSerializer.NonGeneric.cs | 22 ++++++++++++++++--- .../MessagePack/MessagePackSerializer.cs | 12 ---------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.NonGeneric.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.NonGeneric.cs index 019eb8e78..bd6f9b431 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.NonGeneric.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.NonGeneric.cs @@ -82,6 +82,22 @@ public static object Deserialize(Type type, ReadOnlySequence bytes, Messag return GetOrAdd(type).Deserialize_ReadOnlySequence_Options_CancellationToken.Invoke(bytes, options, cancellationToken); } + /// + /// Helper method used by reflection. + /// + private static void SerializeSemiGeneric(ref MessagePackWriter writer, object valueObject, MessagePackSerializerOptions options = null) + { + Serialize(ref writer, (T)valueObject, options); + } + + /// + /// Helper method used by reflection. + /// + private static object DeserializeSemiGeneric(ref MessagePackReader reader, MessagePackSerializerOptions options = null) + { + return Deserialize(ref reader, options); + } + private static async ValueTask DeserializeObjectAsync(Stream stream, MessagePackSerializerOptions options, CancellationToken cancellationToken) => await DeserializeAsync(stream, options, cancellationToken).ConfigureAwait(false); private static CompiledMethods GetOrAdd(Type type) @@ -219,8 +235,8 @@ internal CompiledMethods(Type type) } { - // public static void Serialize(ref MessagePackWriter writer, T obj, MessagePackSerializerOptions options) - MethodInfo serialize = GetMethod(nameof(SerializeSemiGeneric), type, new Type[] { typeof(MessagePackWriter).MakeByRefType(), typeof(Object), typeof(MessagePackSerializerOptions) }); + // private static void SerializeSemiGeneric(ref MessagePackWriter writer, object obj, MessagePackSerializerOptions options) + MethodInfo serialize = GetMethod(nameof(SerializeSemiGeneric), type, new Type[] { typeof(MessagePackWriter).MakeByRefType(), typeof(object), typeof(MessagePackSerializerOptions) }); #if ENABLE_IL2CPP this.Serialize_MessagePackWriter_T_Options = (ref MessagePackWriter x, object y, MessagePackSerializerOptions z) => ThrowRefStructNotSupported(); #else @@ -229,7 +245,7 @@ internal CompiledMethods(Type type) } { - // public static T Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + // private static object DeserializeSemiGeneric(ref MessagePackReader reader, MessagePackSerializerOptions options) MethodInfo deserialize = GetMethod(nameof(DeserializeSemiGeneric), type, new Type[] { typeof(MessagePackReader).MakeByRefType(), typeof(MessagePackSerializerOptions) }); #if ENABLE_IL2CPP this.Deserialize_MessagePackReader_Options = (ref MessagePackReader reader, MessagePackSerializerOptions options) => { ThrowRefStructNotSupported(); return null; }; diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.cs index 9510ea893..8c4a454c6 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/MessagePackSerializer.cs @@ -71,13 +71,6 @@ public static void Serialize(IBufferWriter writer, T value, MessagePack fastWriter.Flush(); } - internal static void SerializeSemiGeneric(ref MessagePackWriter writer, Object valueObject, MessagePackSerializerOptions options = null) - { - T value = (T)valueObject; - - Serialize(ref writer, value, options); - } - /// /// Serializes a given value with the specified buffer writer. /// @@ -271,11 +264,6 @@ public static T Deserialize(ref MessagePackReader reader, MessagePackSerializ } } - internal static Object DeserializeSemiGeneric(ref MessagePackReader reader, MessagePackSerializerOptions options = null) - { - return Deserialize(ref reader, options); - } - /// /// Deserializes a value of a given type from a sequence of bytes. /// From 1092f85b68ceff6667eadf43081097e02adb77c8 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 2 Aug 2022 07:10:46 -0600 Subject: [PATCH 158/161] Fix PerBenchmarkDotNet project This has evidently been broken since I regressed it in 5c0220eecc34. --- .../MessagePackWriterBenchmark.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/sandbox/PerfBenchmarkDotNet/MessagePackWriterBenchmark.cs b/sandbox/PerfBenchmarkDotNet/MessagePackWriterBenchmark.cs index 8afaccc14..64e7c89a3 100644 --- a/sandbox/PerfBenchmarkDotNet/MessagePackWriterBenchmark.cs +++ b/sandbox/PerfBenchmarkDotNet/MessagePackWriterBenchmark.cs @@ -13,7 +13,7 @@ namespace PerfBenchmarkDotNet { [GroupBenchmarksBy(BenchmarkLogicalGroupRule.ByCategory)] [CategoriesColumn] - public sealed class MessagePackWriterBenchmark : IDisposable + public class MessagePackWriterBenchmark : IDisposable { private const int RepsOverArray = 300 * 1024; private readonly Sequence sequence = new Sequence(); @@ -152,7 +152,16 @@ public void WriteString() public void Dispose() { - this.sequence.Dispose(); + this.Dispose(true); + GC.SuppressFinalize(this); + } + + protected virtual void Dispose(bool disposing) + { + if (disposing) + { + this.sequence.Dispose(); + } } } } From 37e2dbc2420e13f5b70f4d38bdb0457dfc191146 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 2 Aug 2022 08:32:40 -0600 Subject: [PATCH 159/161] Add non-generic serialize/deserialize perf tests --- sandbox/PerfBenchmarkDotNet/DeserializeBenchmark.cs | 8 +++++++- sandbox/PerfBenchmarkDotNet/SerializeBenchmark.cs | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/sandbox/PerfBenchmarkDotNet/DeserializeBenchmark.cs b/sandbox/PerfBenchmarkDotNet/DeserializeBenchmark.cs index 3c0ef2f29..68af163a9 100644 --- a/sandbox/PerfBenchmarkDotNet/DeserializeBenchmark.cs +++ b/sandbox/PerfBenchmarkDotNet/DeserializeBenchmark.cs @@ -1,4 +1,4 @@ -// Copyright (c) All contributors. All rights reserved. +// Copyright (c) All contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. extern alias newmsgpack; @@ -60,6 +60,12 @@ public IntKeySerializerTarget IntKey() return newmsgpack.MessagePack.MessagePackSerializer.Deserialize(intObj); } + [Benchmark] + public IntKeySerializerTarget IntKey_NonGeneric() + { + return (IntKeySerializerTarget)newmsgpack.MessagePack.MessagePackSerializer.Deserialize(typeof(IntKeySerializerTarget), intObj); + } + [Benchmark] public StringKeySerializerTarget StringKey() { diff --git a/sandbox/PerfBenchmarkDotNet/SerializeBenchmark.cs b/sandbox/PerfBenchmarkDotNet/SerializeBenchmark.cs index 0ed114b06..fc9a3a06d 100644 --- a/sandbox/PerfBenchmarkDotNet/SerializeBenchmark.cs +++ b/sandbox/PerfBenchmarkDotNet/SerializeBenchmark.cs @@ -1,4 +1,4 @@ -// Copyright (c) All contributors. All rights reserved. +// Copyright (c) All contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. extern alias newmsgpack; @@ -35,6 +35,12 @@ public byte[] IntKey() return newmsgpack.MessagePack.MessagePackSerializer.Serialize(intData); } + [Benchmark] + public byte[] IntKey_NonGeneric() + { + return newmsgpack.MessagePack.MessagePackSerializer.Serialize(typeof(IntKeySerializerTarget), intData); + } + [Benchmark] public byte[] StringKey() { From 0eccfe506044da8d1a1ca2ca3d4270d6c8e319d2 Mon Sep 17 00:00:00 2001 From: Oleksii Kharkov Date: Fri, 12 Aug 2022 15:40:34 +0300 Subject: [PATCH 160/161] Bug with long & double is fixed. There was a bug, which produced "System.OverflowException: Arithmetic operation resulted in an overflow". --- .../Assets/Scripts/MessagePack/SafeBitConverter.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/SafeBitConverter.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/SafeBitConverter.cs index 7eb77a006..8bbc141a9 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/SafeBitConverter.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/SafeBitConverter.cs @@ -13,15 +13,15 @@ internal static long ToInt64(ReadOnlySpan value) #if UNITY_ANDROID if (BitConverter.IsLittleEndian) { - int i1 = value[0] | (value[1] << 8) | (value[2] << 16) | (value[3] << 24); - int i2 = value[4] | (value[5] << 8) | (value[6] << 16) | (value[7] << 24); - return (uint)i1 | ((long)i2 << 32); + long i1 = value[0] | (value[1] << 8) | (value[2] << 16) | (value[3] << 24); + long i2 = value[4] | (value[5] << 8) | (value[6] << 16) | (value[7] << 24); + return i1 | (i2 << 32); } else { - int i1 = (value[0] << 24) | (value[1] << 16) | (value[2] << 8) | value[3]; - int i2 = (value[4] << 24) | (value[5] << 16) | (value[6] << 8) | value[7]; - return (uint)i2 | ((long)i1 << 32); + long i1 = (value[0] << 24) | (value[1] << 16) | (value[2] << 8) | value[3]; + long i2 = (value[4] << 24) | (value[5] << 16) | (value[6] << 8) | value[7]; + return i2 | (i1 << 32); } #else return MemoryMarshal.Cast(value)[0]; From 3d1b75b8a33c65eadf6a6d72a4c26cc2d91a87ec Mon Sep 17 00:00:00 2001 From: Pranav K Date: Wed, 24 Feb 2021 14:03:24 -0800 Subject: [PATCH 161/161] Scrub nuget.config --- nuget.config | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 nuget.config diff --git a/nuget.config b/nuget.config deleted file mode 100644 index ad08d4e2a..000000000 --- a/nuget.config +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - -