diff --git a/sandbox/Sandbox/Generated.cs b/sandbox/Sandbox/Generated.cs index 64f68f84..9b5c623c 100644 --- a/sandbox/Sandbox/Generated.cs +++ b/sandbox/Sandbox/Generated.cs @@ -7,14 +7,11 @@ #pragma warning disable 414 #pragma warning disable 168 -#pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1312 // Variable names should begin with lower-case letter #pragma warning disable SA1649 // File name should match first type name namespace MessagePack.Resolvers { - using System; - public class GeneratedResolver : global::MessagePack.IFormatterResolver { public static readonly global::MessagePack.IFormatterResolver Instance = new GeneratedResolver(); @@ -45,11 +42,11 @@ namespace MessagePack.Resolvers internal static class GeneratedResolverGetFormatterHelper { - private static readonly global::System.Collections.Generic.Dictionary 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 @@ namespace MessagePack.Resolvers }; } - internal static object GetFormatter(Type t) + internal static object GetFormatter(global::System.Type t) { int key; if (!lookup.TryGetValue(t, out key)) @@ -220,7 +217,6 @@ namespace MessagePack.Resolvers #pragma warning restore 612 #pragma warning restore SA1312 // Variable names should begin with lower-case letter -#pragma warning restore SA1200 // Using directives should be placed correctly #pragma warning restore SA1649 // File name should match first type name @@ -233,24 +229,20 @@ namespace MessagePack.Resolvers #pragma warning disable 414 #pragma warning disable 168 -#pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1403 // File may only contain a single namespace #pragma warning disable SA1649 // File name should match first type name namespace MessagePack.Formatters { - using System; - using System.Buffers; - using MessagePack; public sealed class GlobalMyEnumFormatter : global::MessagePack.Formatters.IMessagePackFormatter { - public void Serialize(ref MessagePackWriter writer, global::GlobalMyEnum value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::GlobalMyEnum value, global::MessagePack.MessagePackSerializerOptions options) { - writer.Write((Int32)value); + writer.Write((global::System.Int32)value); } - public global::GlobalMyEnum Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::GlobalMyEnum Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { return (global::GlobalMyEnum)reader.ReadInt32(); } @@ -262,7 +254,6 @@ namespace MessagePack.Formatters #pragma warning restore 618 #pragma warning restore 612 -#pragma warning restore SA1200 // Using directives should be placed correctly #pragma warning restore SA1403 // File may only contain a single namespace #pragma warning restore SA1649 // File name should match first type name @@ -275,24 +266,20 @@ namespace MessagePack.Formatters #pragma warning disable 414 #pragma warning disable 168 -#pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1403 // File may only contain a single namespace #pragma warning disable SA1649 // File name should match first type name namespace MessagePack.Formatters.SharedData { - using System; - using System.Buffers; - using MessagePack; public sealed class ByteEnumFormatter : global::MessagePack.Formatters.IMessagePackFormatter { - public void Serialize(ref MessagePackWriter writer, global::SharedData.ByteEnum value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.ByteEnum value, global::MessagePack.MessagePackSerializerOptions options) { - writer.Write((Byte)value); + writer.Write((global::System.Byte)value); } - public global::SharedData.ByteEnum Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::SharedData.ByteEnum Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { return (global::SharedData.ByteEnum)reader.ReadByte(); } @@ -304,7 +291,6 @@ namespace MessagePack.Formatters.SharedData #pragma warning restore 618 #pragma warning restore 612 -#pragma warning restore SA1200 // Using directives should be placed correctly #pragma warning restore SA1403 // File may only contain a single namespace #pragma warning restore SA1649 // File name should match first type name @@ -318,31 +304,25 @@ namespace MessagePack.Formatters.SharedData #pragma warning disable 414 #pragma warning disable 168 -#pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1403 // File may only contain a single namespace #pragma warning disable SA1649 // File name should match first type name namespace MessagePack.Formatters { - using System; - using System.Buffers; - using System.Collections.Generic; - using MessagePack; - public sealed class IMessageBodyFormatter : global::MessagePack.Formatters.IMessagePackFormatter { - 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 @@ namespace MessagePack.Formatters }; } - public void Serialize(ref MessagePackWriter writer, global::IMessageBody value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::IMessageBody value, global::MessagePack.MessagePackSerializerOptions options) { - KeyValuePair 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 @@ namespace MessagePack.Formatters writer.WriteNil(); } - public global::IMessageBody Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::IMessageBody Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { @@ -387,7 +367,7 @@ namespace MessagePack.Formatters if (reader.ReadArrayHeader() != 2) { - throw new InvalidOperationException("Invalid Union data was detected. Type:global::IMessageBody"); + throw new global::System.InvalidOperationException("Invalid Union data was detected. Type:global::IMessageBody"); } options.Security.DepthStep(ref reader); @@ -428,7 +408,6 @@ namespace MessagePack.Formatters #pragma warning restore 618 #pragma warning restore 612 -#pragma warning restore SA1200 // Using directives should be placed correctly #pragma warning restore SA1403 // File may only contain a single namespace #pragma warning restore SA1649 // File name should match first type name @@ -441,37 +420,31 @@ namespace MessagePack.Formatters #pragma warning disable 414 #pragma warning disable 168 -#pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1403 // File may only contain a single namespace #pragma warning disable SA1649 // File name should match first type name namespace MessagePack.Formatters.SharedData { - using System; - using System.Buffers; - using System.Collections.Generic; - using MessagePack; - public sealed class IIVersioningUnionFormatter : global::MessagePack.Formatters.IMessagePackFormatter { - 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 @@ namespace MessagePack.Formatters.SharedData writer.WriteNil(); } - public global::SharedData.IIVersioningUnion Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::SharedData.IIVersioningUnion Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { @@ -500,7 +473,7 @@ namespace MessagePack.Formatters.SharedData if (reader.ReadArrayHeader() != 2) { - throw new InvalidOperationException("Invalid Union data was detected. Type:global::SharedData.IIVersioningUnion"); + throw new global::System.InvalidOperationException("Invalid Union data was detected. Type:global::SharedData.IIVersioningUnion"); } options.Security.DepthStep(ref reader); @@ -529,19 +502,19 @@ namespace MessagePack.Formatters.SharedData public sealed class IUnionCheckerFormatter : global::MessagePack.Formatters.IMessagePackFormatter { - 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 @@ namespace MessagePack.Formatters.SharedData }; } - public void Serialize(ref MessagePackWriter writer, global::SharedData.IUnionChecker value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.IUnionChecker value, global::MessagePack.MessagePackSerializerOptions options) { - KeyValuePair 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 @@ namespace MessagePack.Formatters.SharedData writer.WriteNil(); } - public global::SharedData.IUnionChecker Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::SharedData.IUnionChecker Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { @@ -590,7 +563,7 @@ namespace MessagePack.Formatters.SharedData if (reader.ReadArrayHeader() != 2) { - throw new InvalidOperationException("Invalid Union data was detected. Type:global::SharedData.IUnionChecker"); + throw new global::System.InvalidOperationException("Invalid Union data was detected. Type:global::SharedData.IUnionChecker"); } options.Security.DepthStep(ref reader); @@ -628,19 +601,19 @@ namespace MessagePack.Formatters.SharedData public sealed class IUnionChecker2Formatter : global::MessagePack.Formatters.IMessagePackFormatter { - 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 @@ namespace MessagePack.Formatters.SharedData }; } - public void Serialize(ref MessagePackWriter writer, global::SharedData.IUnionChecker2 value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::SharedData.IUnionChecker2 value, global::MessagePack.MessagePackSerializerOptions options) { - KeyValuePair 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 @@ namespace MessagePack.Formatters.SharedData writer.WriteNil(); } - public global::SharedData.IUnionChecker2 Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::SharedData.IUnionChecker2 Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { @@ -689,7 +662,7 @@ namespace MessagePack.Formatters.SharedData if (reader.ReadArrayHeader() != 2) { - throw new InvalidOperationException("Invalid Union data was detected. Type:global::SharedData.IUnionChecker2"); + throw new global::System.InvalidOperationException("Invalid Union data was detected. Type:global::SharedData.IUnionChecker2"); } options.Security.DepthStep(ref reader); @@ -727,26 +700,26 @@ namespace MessagePack.Formatters.SharedData public sealed class IUnionSampleFormatter : global::MessagePack.Formatters.IMessagePackFormatter { - 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 @@ namespace MessagePack.Formatters.SharedData writer.WriteNil(); } - public global::SharedData.IUnionSample Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::SharedData.IUnionSample Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { @@ -778,7 +751,7 @@ namespace MessagePack.Formatters.SharedData if (reader.ReadArrayHeader() != 2) { - throw new InvalidOperationException("Invalid Union data was detected. Type:global::SharedData.IUnionSample"); + throw new global::System.InvalidOperationException("Invalid Union data was detected. Type:global::SharedData.IUnionSample"); } options.Security.DepthStep(ref reader); @@ -810,26 +783,26 @@ namespace MessagePack.Formatters.SharedData public sealed class RootUnionTypeFormatter : global::MessagePack.Formatters.IMessagePackFormatter { - 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 @@ namespace MessagePack.Formatters.SharedData writer.WriteNil(); } - public global::SharedData.RootUnionType Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::SharedData.RootUnionType Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { if (reader.TryReadNil()) { @@ -861,7 +834,7 @@ namespace MessagePack.Formatters.SharedData if (reader.ReadArrayHeader() != 2) { - throw new InvalidOperationException("Invalid Union data was detected. Type:global::SharedData.RootUnionType"); + throw new global::System.InvalidOperationException("Invalid Union data was detected. Type:global::SharedData.RootUnionType"); } options.Security.DepthStep(ref reader); @@ -899,7 +872,6 @@ namespace MessagePack.Formatters.SharedData #pragma warning restore 618 #pragma warning restore 612 -#pragma warning restore SA1200 // Using directives should be placed correctly #pragma warning restore SA1403 // File may only contain a single namespace #pragma warning restore SA1649 // File name should match first type name @@ -914,7 +886,6 @@ namespace MessagePack.Formatters.SharedData #pragma warning disable 168 #pragma warning disable SA1129 // Do not use default value type constructor -#pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1309 // Field names should not begin with underscore #pragma warning disable SA1312 // Variable names should begin with lower-case letter #pragma warning disable SA1403 // File may only contain a single namespace @@ -922,9 +893,6 @@ namespace MessagePack.Formatters.SharedData namespace MessagePack.Formatters.Abcdefg.Efcdigjl.Ateatatea.Hgfagfafgad { - using global::System.Buffers; - using global::MessagePack; - public sealed class TnonodsfarnoiuAtatqagaFormatter : global::MessagePack.Formatters.IMessagePackFormatter { @@ -968,6 +936,7 @@ namespace MessagePack.Formatters.Abcdefg.Efcdigjl.Ateatatea.Hgfagfafgad return ____result; } } + } #pragma warning restore 168 @@ -976,7 +945,6 @@ namespace MessagePack.Formatters.Abcdefg.Efcdigjl.Ateatatea.Hgfagfafgad #pragma warning restore 612 #pragma warning restore SA1129 // Do not use default value type constructor -#pragma warning restore SA1200 // Using directives should be placed correctly #pragma warning restore SA1309 // Field names should not begin with underscore #pragma warning restore SA1312 // Variable names should begin with lower-case letter #pragma warning restore SA1403 // File may only contain a single namespace @@ -992,7 +960,6 @@ namespace MessagePack.Formatters.Abcdefg.Efcdigjl.Ateatatea.Hgfagfafgad #pragma warning disable 168 #pragma warning disable SA1129 // Do not use default value type constructor -#pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1309 // Field names should not begin with underscore #pragma warning disable SA1312 // Variable names should begin with lower-case letter #pragma warning disable SA1403 // File may only contain a single namespace @@ -1000,9 +967,6 @@ namespace MessagePack.Formatters.Abcdefg.Efcdigjl.Ateatatea.Hgfagfafgad namespace MessagePack.Formatters { - using global::System.Buffers; - using global::MessagePack; - public sealed class ArrayTestTestFormatter : global::MessagePack.Formatters.IMessagePackFormatter { @@ -1016,13 +980,13 @@ namespace MessagePack.Formatters 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 @@ namespace MessagePack.Formatters 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 @@ namespace MessagePack.Formatters 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 @@ namespace MessagePack.Formatters ____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 @@ namespace MessagePack.Formatters 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 @@ namespace MessagePack.Formatters ____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 @@ namespace MessagePack.Formatters 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 @@ namespace MessagePack.Formatters 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 @@ namespace MessagePack.Formatters return ____result; } } + } #pragma warning restore 168 @@ -1367,7 +1332,6 @@ namespace MessagePack.Formatters #pragma warning restore 612 #pragma warning restore SA1129 // Do not use default value type constructor -#pragma warning restore SA1200 // Using directives should be placed correctly #pragma warning restore SA1309 // Field names should not begin with underscore #pragma warning restore SA1312 // Variable names should begin with lower-case letter #pragma warning restore SA1403 // File may only contain a single namespace @@ -1383,7 +1347,6 @@ namespace MessagePack.Formatters #pragma warning disable 168 #pragma warning disable SA1129 // Do not use default value type constructor -#pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1309 // Field names should not begin with underscore #pragma warning disable SA1312 // Variable names should begin with lower-case letter #pragma warning disable SA1403 // File may only contain a single namespace @@ -1391,9 +1354,6 @@ namespace MessagePack.Formatters namespace MessagePack.Formatters { - using global::System.Buffers; - using global::MessagePack; - public sealed class ComplexModelFormatter : global::MessagePack.Formatters.IMessagePackFormatter { // AdditionalProperty @@ -1420,17 +1380,17 @@ namespace MessagePack.Formatters 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 @@ namespace MessagePack.Formatters 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 @@ namespace MessagePack.Formatters 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 @@ namespace MessagePack.Formatters 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 @@ namespace MessagePack.Formatters 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 @@ namespace MessagePack.Formatters 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 @@ namespace MessagePack.Formatters return ____result; } } + } +#pragma warning restore 168 +#pragma warning restore 414 +#pragma warning restore 618 +#pragma warning restore 612 + +#pragma warning restore SA1129 // Do not use default value type constructor +#pragma warning restore SA1309 // Field names should not begin with underscore +#pragma warning restore SA1312 // Variable names should begin with lower-case letter +#pragma warning restore SA1403 // File may only contain a single namespace +#pragma warning restore SA1649 // File name should match first type name + // // THIS (.cs) FILE IS GENERATED BY MPC(MessagePack-CSharp). DO NOT CHANGE IT. // @@ -1617,7 +1589,6 @@ namespace MessagePack.Formatters #pragma warning disable 168 #pragma warning disable SA1129 // Do not use default value type constructor -#pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1309 // Field names should not begin with underscore #pragma warning disable SA1312 // Variable names should begin with lower-case letter #pragma warning disable SA1403 // File may only contain a single namespace @@ -1625,9 +1596,6 @@ namespace MessagePack.Formatters namespace MessagePack.Formatters.PerfBenchmarkDotNet { - using global::System.Buffers; - using global::MessagePack; - public sealed class StringKeySerializerTargetFormatter : global::MessagePack.Formatters.IMessagePackFormatter { // MyProperty1 @@ -1744,8 +1712,20 @@ namespace MessagePack.Formatters.PerfBenchmarkDotNet return ____result; } } + } +#pragma warning restore 168 +#pragma warning restore 414 +#pragma warning restore 618 +#pragma warning restore 612 + +#pragma warning restore SA1129 // Do not use default value type constructor +#pragma warning restore SA1309 // Field names should not begin with underscore +#pragma warning restore SA1312 // Variable names should begin with lower-case letter +#pragma warning restore SA1403 // File may only contain a single namespace +#pragma warning restore SA1649 // File name should match first type name + // // THIS (.cs) FILE IS GENERATED BY MPC(MessagePack-CSharp). DO NOT CHANGE IT. // @@ -1756,7 +1736,6 @@ namespace MessagePack.Formatters.PerfBenchmarkDotNet #pragma warning disable 168 #pragma warning disable SA1129 // Do not use default value type constructor -#pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1309 // Field names should not begin with underscore #pragma warning disable SA1312 // Variable names should begin with lower-case letter #pragma warning disable SA1403 // File may only contain a single namespace @@ -1764,9 +1743,6 @@ namespace MessagePack.Formatters.PerfBenchmarkDotNet namespace MessagePack.Formatters.SharedData { - using global::System.Buffers; - using global::MessagePack; - public sealed class ArrayOptimizeClassFormatter : global::MessagePack.Formatters.IMessagePackFormatter { @@ -1884,7 +1860,7 @@ namespace MessagePack.Formatters.SharedData 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 @@ namespace MessagePack.Formatters.SharedData 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 @@ namespace MessagePack.Formatters.SharedData 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 @@ namespace MessagePack.Formatters.SharedData __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 @@ namespace MessagePack.Formatters.SharedData { 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 @@ namespace MessagePack.Formatters.SharedData 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 @@ namespace MessagePack.Formatters.SharedData 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 @@ namespace MessagePack.Formatters.SharedData ____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 @@ namespace MessagePack.Formatters.SharedData 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 @@ namespace MessagePack.Formatters.SharedData 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 @@ namespace MessagePack.Formatters.SharedData 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 @@ namespace MessagePack.Formatters.SharedData 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 @@ namespace MessagePack.Formatters.SharedData { 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 @@ namespace MessagePack.Formatters.SharedData 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 @@ namespace MessagePack.Formatters.SharedData { 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 @@ namespace MessagePack.Formatters.SharedData 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 @@ namespace MessagePack.Formatters.SharedData 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 @@ namespace MessagePack.Formatters.SharedData 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 @@ namespace MessagePack.Formatters.SharedData 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 @@ namespace MessagePack.Formatters.SharedData 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 @@ namespace MessagePack.Formatters.SharedData 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 @@ namespace MessagePack.Formatters.SharedData 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 @@ namespace MessagePack.Formatters.SharedData 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 @@ namespace MessagePack.Formatters.SharedData ____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 @@ namespace MessagePack.Formatters.SharedData ____result.Y = reader.ReadInt32(); break; case 2: - ____result.BytesSpecial = reader.ReadBytes()?.ToArray(); + ____result.BytesSpecial = global::MessagePack.Internal.CodeGenHelpers.GetArrayFromNullableSequence(reader.ReadBytes()); break; default: reader.Skip(); @@ -3681,7 +3657,7 @@ namespace MessagePack.Formatters.SharedData global::MessagePack.IFormatterResolver formatterResolver = options.Resolver; writer.WriteArrayHeader(3); writer.Write(value.MyProperty); - formatterResolver.GetFormatterWithVerify().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 @@ namespace MessagePack.Formatters.SharedData ____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 @@ namespace MessagePack.Formatters.SharedData 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 @@ namespace MessagePack.Formatters.SharedData ____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 @@ namespace MessagePack.Formatters.SharedData return ____result; } } + } #pragma warning restore 168 @@ -3829,7 +3806,6 @@ namespace MessagePack.Formatters.SharedData #pragma warning restore 612 #pragma warning restore SA1129 // Do not use default value type constructor -#pragma warning restore SA1200 // Using directives should be placed correctly #pragma warning restore SA1309 // Field names should not begin with underscore #pragma warning restore SA1312 // Variable names should begin with lower-case letter #pragma warning restore SA1403 // File may only contain a single namespace @@ -3845,7 +3821,6 @@ namespace MessagePack.Formatters.SharedData #pragma warning disable 168 #pragma warning disable SA1129 // Do not use default value type constructor -#pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1309 // Field names should not begin with underscore #pragma warning disable SA1312 // Variable names should begin with lower-case letter #pragma warning disable SA1403 // File may only contain a single namespace @@ -3853,9 +3828,6 @@ namespace MessagePack.Formatters.SharedData namespace MessagePack.Formatters.SharedData { - using global::System.Buffers; - using global::MessagePack; - public sealed class Callback2Formatter : global::MessagePack.Formatters.IMessagePackFormatter { // X @@ -4198,9 +4170,9 @@ namespace MessagePack.Formatters.SharedData 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 @@ namespace MessagePack.Formatters.SharedData 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 @@ namespace MessagePack.Formatters.SharedData 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 @@ namespace MessagePack.Formatters.SharedData 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 @@ namespace MessagePack.Formatters.SharedData 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 @@ namespace MessagePack.Formatters.SharedData ____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 @@ namespace MessagePack.Formatters.SharedData 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 @@ namespace MessagePack.Formatters.SharedData ____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 @@ namespace MessagePack.Formatters.SharedData return ____result; } } + } +#pragma warning restore 168 +#pragma warning restore 414 +#pragma warning restore 618 +#pragma warning restore 612 + +#pragma warning restore SA1129 // Do not use default value type constructor +#pragma warning restore SA1309 // Field names should not begin with underscore +#pragma warning restore SA1312 // Variable names should begin with lower-case letter +#pragma warning restore SA1403 // File may only contain a single namespace +#pragma warning restore SA1649 // File name should match first type name + diff --git a/sandbox/TestData2/Generated.cs b/sandbox/TestData2/Generated.cs index 606e2dca..e4f08ad5 100644 --- a/sandbox/TestData2/Generated.cs +++ b/sandbox/TestData2/Generated.cs @@ -7,14 +7,11 @@ #pragma warning disable 414 #pragma warning disable 168 -#pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1312 // Variable names should begin with lower-case letter #pragma warning disable SA1649 // File name should match first type name namespace MessagePack.Resolvers { - using System; - public class GeneratedResolver : global::MessagePack.IFormatterResolver { public static readonly global::MessagePack.IFormatterResolver Instance = new GeneratedResolver(); @@ -45,11 +42,11 @@ namespace MessagePack.Resolvers internal static class GeneratedResolverGetFormatterHelper { - private static readonly global::System.Collections.Generic.Dictionary 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 @@ namespace MessagePack.Resolvers }; } - internal static object GetFormatter(Type t) + internal static object GetFormatter(global::System.Type t) { int key; if (!lookup.TryGetValue(t, out key)) @@ -104,7 +101,6 @@ namespace MessagePack.Resolvers #pragma warning restore 612 #pragma warning restore SA1312 // Variable names should begin with lower-case letter -#pragma warning restore SA1200 // Using directives should be placed correctly #pragma warning restore SA1649 // File name should match first type name @@ -117,24 +113,20 @@ namespace MessagePack.Resolvers #pragma warning disable 414 #pragma warning disable 168 -#pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1403 // File may only contain a single namespace #pragma warning disable SA1649 // File name should match first type name namespace MessagePack.Formatters.TestData2 { - using System; - using System.Buffers; - using MessagePack; public sealed class Nest1_IdFormatter : global::MessagePack.Formatters.IMessagePackFormatter { - public void Serialize(ref MessagePackWriter writer, global::TestData2.Nest1.Id value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::TestData2.Nest1.Id value, global::MessagePack.MessagePackSerializerOptions options) { - writer.Write((Int32)value); + writer.Write((global::System.Int32)value); } - public global::TestData2.Nest1.Id Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::TestData2.Nest1.Id Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { return (global::TestData2.Nest1.Id)reader.ReadInt32(); } @@ -142,12 +134,12 @@ namespace MessagePack.Formatters.TestData2 public sealed class Nest2_IdFormatter : global::MessagePack.Formatters.IMessagePackFormatter { - public void Serialize(ref MessagePackWriter writer, global::TestData2.Nest2.Id value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, global::TestData2.Nest2.Id value, global::MessagePack.MessagePackSerializerOptions options) { - writer.Write((Int32)value); + writer.Write((global::System.Int32)value); } - public global::TestData2.Nest2.Id Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public global::TestData2.Nest2.Id Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { return (global::TestData2.Nest2.Id)reader.ReadInt32(); } @@ -159,7 +151,6 @@ namespace MessagePack.Formatters.TestData2 #pragma warning restore 618 #pragma warning restore 612 -#pragma warning restore SA1200 // Using directives should be placed correctly #pragma warning restore SA1403 // File may only contain a single namespace #pragma warning restore SA1649 // File name should match first type name @@ -175,7 +166,6 @@ namespace MessagePack.Formatters.TestData2 #pragma warning disable 168 #pragma warning disable SA1129 // Do not use default value type constructor -#pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1309 // Field names should not begin with underscore #pragma warning disable SA1312 // Variable names should begin with lower-case letter #pragma warning disable SA1403 // File may only contain a single namespace @@ -183,9 +173,6 @@ namespace MessagePack.Formatters.TestData2 namespace MessagePack.Formatters.TestData2 { - using global::System.Buffers; - using global::MessagePack; - public sealed class AFormatter : global::MessagePack.Formatters.IMessagePackFormatter { // a @@ -208,9 +195,9 @@ namespace MessagePack.Formatters.TestData2 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 @@ namespace MessagePack.Formatters.TestData2 ____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 @@ namespace MessagePack.Formatters.TestData2 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 @@ namespace MessagePack.Formatters.TestData2 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 @@ namespace MessagePack.Formatters.TestData2 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 @@ namespace MessagePack.Formatters.TestData2 { 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 @@ namespace MessagePack.Formatters.TestData2 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 @@ namespace MessagePack.Formatters.TestData2 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 @@ namespace MessagePack.Formatters.TestData2 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 @@ namespace MessagePack.Formatters.TestData2 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 @@ namespace MessagePack.Formatters.TestData2 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 @@ namespace MessagePack.Formatters.TestData2 { 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 @@ namespace MessagePack.Formatters.TestData2 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 @@ namespace MessagePack.Formatters.TestData2 { 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 @@ namespace MessagePack.Formatters.TestData2 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 @@ namespace MessagePack.Formatters.TestData2 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 @@ namespace MessagePack.Formatters.TestData2 return ____result; } } + } +#pragma warning restore 168 +#pragma warning restore 414 +#pragma warning restore 618 +#pragma warning restore 612 + +#pragma warning restore SA1129 // Do not use default value type constructor +#pragma warning restore SA1309 // Field names should not begin with underscore +#pragma warning restore SA1312 // Variable names should begin with lower-case letter +#pragma warning restore SA1403 // File may only contain a single namespace +#pragma warning restore SA1649 // File name should match first type name + diff --git a/src/MessagePack.GeneratorCore/CodeAnalysis/Definitions.cs b/src/MessagePack.GeneratorCore/CodeAnalysis/Definitions.cs index 532cdc71..30aaedb9 100644 --- a/src/MessagePack.GeneratorCore/CodeAnalysis/Definitions.cs +++ b/src/MessagePack.GeneratorCore/CodeAnalysis/Definitions.cs @@ -170,7 +170,7 @@ namespace MessagePackCompiler.CodeAnalysis } else { - return $"formatterResolver.GetFormatterWithVerify<{this.Type}>().Serialize(ref writer, value.{this.Name}, options)"; + return $"global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<{this.Type}>(formatterResolver).Serialize(ref writer, value.{this.Name}, options)"; } } @@ -182,12 +182,18 @@ namespace MessagePackCompiler.CodeAnalysis } else if (this.primitiveTypes.Contains(this.Type)) { - string suffix = this.Type == "byte[]" ? "?.ToArray()" : string.Empty; - return $"reader.Read{this.ShortTypeName!.Replace("[]", "s")}()" + suffix; + if (this.Type == "byte[]") + { + return "global::MessagePack.Internal.CodeGenHelpers.GetArrayFromNullableSequence(reader.ReadBytes())"; + } + else + { + return $"reader.Read{this.ShortTypeName!.Replace("[]", "s")}()"; + } } else { - return $"formatterResolver.GetFormatterWithVerify<{this.Type}>().Deserialize(ref reader, options)"; + return $"global::MessagePack.FormatterResolverExtensions.GetFormatterWithVerify<{this.Type}>(formatterResolver).Deserialize(ref reader, options)"; } } } diff --git a/src/MessagePack.GeneratorCore/Generator/EnumTemplate.cs b/src/MessagePack.GeneratorCore/Generator/EnumTemplate.cs index 814a3123..66c9fc14 100644 --- a/src/MessagePack.GeneratorCore/Generator/EnumTemplate.cs +++ b/src/MessagePack.GeneratorCore/Generator/EnumTemplate.cs @@ -34,27 +34,27 @@ namespace MessagePackCompiler.Generator #pragma warning disable 414 #pragma warning disable 168 -#pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1403 // File may only contain a single namespace #pragma warning disable SA1649 // File name should match first type name namespace "); this.Write(this.ToStringHelper.ToStringWithCulture(Namespace)); - this.Write("\r\n{\r\n using System;\r\n using System.Buffers;\r\n using MessagePack;\r\n"); + this.Write("\r\n{\r\n"); foreach(var info in EnumSerializationInfos) { this.Write("\r\n public sealed class "); this.Write(this.ToStringHelper.ToStringWithCulture(info.Name)); this.Write("Formatter : global::MessagePack.Formatters.IMessagePackFormatter<"); this.Write(this.ToStringHelper.ToStringWithCulture(info.FullName)); - this.Write(">\r\n {\r\n public void Serialize(ref MessagePackWriter writer, "); + this.Write(">\r\n {\r\n public void Serialize(ref global::MessagePack.MessagePackWriter" + + " writer, "); this.Write(this.ToStringHelper.ToStringWithCulture(info.FullName)); this.Write(" value, global::MessagePack.MessagePackSerializerOptions options)\r\n {\r\n " + - " writer.Write(("); + " writer.Write((global::System."); this.Write(this.ToStringHelper.ToStringWithCulture(info.UnderlyingType)); this.Write(")value);\r\n }\r\n\r\n public "); this.Write(this.ToStringHelper.ToStringWithCulture(info.FullName)); - this.Write(" Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSeriali" + - "zerOptions options)\r\n {\r\n return ("); + this.Write(" Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePac" + + "k.MessagePackSerializerOptions options)\r\n {\r\n return ("); this.Write(this.ToStringHelper.ToStringWithCulture(info.FullName)); this.Write(")reader.Read"); this.Write(this.ToStringHelper.ToStringWithCulture(info.UnderlyingType)); @@ -67,7 +67,6 @@ namespace "); #pragma warning restore 618 #pragma warning restore 612 -#pragma warning restore SA1200 // Using directives should be placed correctly #pragma warning restore SA1403 // File may only contain a single namespace #pragma warning restore SA1649 // File name should match first type name "); diff --git a/src/MessagePack.GeneratorCore/Generator/EnumTemplate.tt b/src/MessagePack.GeneratorCore/Generator/EnumTemplate.tt index 28d34550..d9fda115 100644 --- a/src/MessagePack.GeneratorCore/Generator/EnumTemplate.tt +++ b/src/MessagePack.GeneratorCore/Generator/EnumTemplate.tt @@ -12,25 +12,21 @@ #pragma warning disable 414 #pragma warning disable 168 -#pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1403 // File may only contain a single namespace #pragma warning disable SA1649 // File name should match first type name namespace <#= Namespace #> { - using System; - using System.Buffers; - using MessagePack; <# foreach(var info in EnumSerializationInfos) { #> public sealed class <#= info.Name #>Formatter : global::MessagePack.Formatters.IMessagePackFormatter<<#= info.FullName #>> { - public void Serialize(ref MessagePackWriter writer, <#= info.FullName #> value, global::MessagePack.MessagePackSerializerOptions options) + public void Serialize(ref global::MessagePack.MessagePackWriter writer, <#= info.FullName #> value, global::MessagePack.MessagePackSerializerOptions options) { - writer.Write((<#= info.UnderlyingType #>)value); + writer.Write((global::System.<#= info.UnderlyingType #>)value); } - public <#= info.FullName #> Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + public <#= info.FullName #> Deserialize(ref global::MessagePack.MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) { return (<#= info.FullName #>)reader.Read<#= info.UnderlyingType #>(); } @@ -43,6 +39,5 @@ namespace <#= Namespace #> #pragma warning restore 618 #pragma warning restore 612 -#pragma warning restore SA1200 // Using directives should be placed correctly #pragma warning restore SA1403 // File may only contain a single namespace #pragma warning restore SA1649 // File name should match first type name diff --git a/src/MessagePack.GeneratorCore/Generator/FormatterTemplate.cs b/src/MessagePack.GeneratorCore/Generator/FormatterTemplate.cs index e153d5eb..dfb84caf 100644 --- a/src/MessagePack.GeneratorCore/Generator/FormatterTemplate.cs +++ b/src/MessagePack.GeneratorCore/Generator/FormatterTemplate.cs @@ -35,7 +35,6 @@ namespace MessagePackCompiler.Generator #pragma warning disable 168 #pragma warning disable SA1129 // Do not use default value type constructor -#pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1309 // Field names should not begin with underscore #pragma warning disable SA1312 // Variable names should begin with lower-case letter #pragma warning disable SA1403 // File may only contain a single namespace @@ -43,10 +42,10 @@ namespace MessagePackCompiler.Generator namespace "); this.Write(this.ToStringHelper.ToStringWithCulture(Namespace)); - this.Write("\r\n{\r\n using global::System.Buffers;\r\n using global::MessagePack;\r\n"); + this.Write("\r\n{\r\n"); foreach (var objInfo in ObjectSerializationInfos) { bool isFormatterResolverNecessary = ShouldUseFormatterResolverHelper.ShouldUseFormatterResolver(objInfo.Members); - this.Write("\r\n public sealed class "); + this.Write(" public sealed class "); this.Write(this.ToStringHelper.ToStringWithCulture(objInfo.FormatterNameWithoutNameSpace)); this.Write(" : global::MessagePack.Formatters.IMessagePackFormatter<"); this.Write(this.ToStringHelper.ToStringWithCulture(objInfo.FullName)); @@ -205,7 +204,7 @@ namespace "); } this.Write(" reader.Depth--;\r\n return ____result;\r\n"); } - this.Write(" }\r\n }\r\n"); + this.Write(" }\r\n }\r\n\r\n"); } this.Write(@"} @@ -215,7 +214,6 @@ namespace "); #pragma warning restore 612 #pragma warning restore SA1129 // Do not use default value type constructor -#pragma warning restore SA1200 // Using directives should be placed correctly #pragma warning restore SA1309 // Field names should not begin with underscore #pragma warning restore SA1312 // Variable names should begin with lower-case letter #pragma warning restore SA1403 // File may only contain a single namespace diff --git a/src/MessagePack.GeneratorCore/Generator/FormatterTemplate.tt b/src/MessagePack.GeneratorCore/Generator/FormatterTemplate.tt index 631dc9f1..bf96d9e5 100644 --- a/src/MessagePack.GeneratorCore/Generator/FormatterTemplate.tt +++ b/src/MessagePack.GeneratorCore/Generator/FormatterTemplate.tt @@ -13,7 +13,6 @@ #pragma warning disable 168 #pragma warning disable SA1129 // Do not use default value type constructor -#pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1309 // Field names should not begin with underscore #pragma warning disable SA1312 // Variable names should begin with lower-case letter #pragma warning disable SA1403 // File may only contain a single namespace @@ -21,11 +20,8 @@ namespace <#= Namespace #> { - using global::System.Buffers; - using global::MessagePack; <# foreach (var objInfo in ObjectSerializationInfos) { bool isFormatterResolverNecessary = ShouldUseFormatterResolverHelper.ShouldUseFormatterResolver(objInfo.Members);#> - public sealed class <#= objInfo.FormatterNameWithoutNameSpace #> : global::MessagePack.Formatters.IMessagePackFormatter<<#= objInfo.FullName #>> <# foreach (var typeArg in objInfo.GenericTypeParameters.Where(x => x.HasConstraints)) { #> where <#= typeArg.Name #> : <#= typeArg.Constraints #> @@ -155,8 +151,8 @@ namespace <#= Namespace #> <# } #> } } -<# } #> -} + +<# } #>} #pragma warning restore 168 #pragma warning restore 414 @@ -164,7 +160,6 @@ namespace <#= Namespace #> #pragma warning restore 612 #pragma warning restore SA1129 // Do not use default value type constructor -#pragma warning restore SA1200 // Using directives should be placed correctly #pragma warning restore SA1309 // Field names should not begin with underscore #pragma warning restore SA1312 // Variable names should begin with lower-case letter #pragma warning restore SA1403 // File may only contain a single namespace diff --git a/src/MessagePack.GeneratorCore/Generator/ResolverTemplate.cs b/src/MessagePack.GeneratorCore/Generator/ResolverTemplate.cs index 48e4df6b..c433e545 100644 --- a/src/MessagePack.GeneratorCore/Generator/ResolverTemplate.cs +++ b/src/MessagePack.GeneratorCore/Generator/ResolverTemplate.cs @@ -34,13 +34,12 @@ namespace MessagePackCompiler.Generator #pragma warning disable 414 #pragma warning disable 168 -#pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1312 // Variable names should begin with lower-case letter #pragma warning disable SA1649 // File name should match first type name namespace "); this.Write(this.ToStringHelper.ToStringWithCulture(Namespace)); - this.Write("\r\n{\r\n using System;\r\n\r\n public class "); + this.Write("\r\n{\r\n public class "); this.Write(this.ToStringHelper.ToStringWithCulture(ResolverName)); this.Write(" : global::MessagePack.IFormatterResolver\r\n {\r\n public static readonly " + "global::MessagePack.IFormatterResolver Instance = new "); @@ -76,10 +75,10 @@ namespace "); internal static class "); this.Write(this.ToStringHelper.ToStringWithCulture(ResolverName)); this.Write("GetFormatterHelper\r\n {\r\n private static readonly global::System.Collect" + - "ions.Generic.Dictionary 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 @@ namespace "); this.Write(@" }; } - internal static object GetFormatter(Type t) + internal static object GetFormatter(global::System.Type t) { int key; if (!lookup.TryGetValue(t, out key)) @@ -122,7 +121,6 @@ namespace "); #pragma warning restore 612 #pragma warning restore SA1312 // Variable names should begin with lower-case letter -#pragma warning restore SA1200 // Using directives should be placed correctly #pragma warning restore SA1649 // File name should match first type name "); return this.GenerationEnvironment.ToString(); diff --git a/src/MessagePack.GeneratorCore/Generator/ResolverTemplate.tt b/src/MessagePack.GeneratorCore/Generator/ResolverTemplate.tt index e61688a1..1fcd9839 100644 --- a/src/MessagePack.GeneratorCore/Generator/ResolverTemplate.tt +++ b/src/MessagePack.GeneratorCore/Generator/ResolverTemplate.tt @@ -12,16 +12,11 @@ #pragma warning disable 414 #pragma warning disable 168 -#pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1312 // Variable names should begin with lower-case letter #pragma warning disable SA1649 // File name should match first type name namespace <#= Namespace #> { - using System; - using System.Buffers; - using MessagePack; - public class <#= ResolverName #> : global::MessagePack.IFormatterResolver { public static readonly global::MessagePack.IFormatterResolver Instance = new <#= ResolverName #>(); @@ -52,11 +47,11 @@ namespace <#= Namespace #> internal static class <#= ResolverName #>GetFormatterHelper { - private static readonly global::System.Collections.Generic.Dictionary 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 a3df9f44..d598c202 100644 --- a/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterTemplate.cs +++ b/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterTemplate.cs @@ -35,7 +35,6 @@ namespace MessagePackCompiler.Generator #pragma warning disable 168 #pragma warning disable SA1129 // Do not use default value type constructor -#pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1309 // Field names should not begin with underscore #pragma warning disable SA1312 // Variable names should begin with lower-case letter #pragma warning disable SA1403 // File may only contain a single namespace @@ -43,7 +42,7 @@ namespace MessagePackCompiler.Generator namespace "); this.Write(this.ToStringHelper.ToStringWithCulture(Namespace)); - this.Write("\r\n{\r\n using global::System.Buffers;\r\n using global::MessagePack;\r\n"); + this.Write("\r\n{\r\n"); var list = new List>(); foreach (var objInfo in ObjectSerializationInfos) { list.Clear(); @@ -53,7 +52,7 @@ foreach (var objInfo in ObjectSerializationInfos) { } bool isFormatterResolverNecessary = ShouldUseFormatterResolverHelper.ShouldUseFormatterResolver(objInfo.Members); - this.Write("\r\n public sealed class "); + this.Write(" public sealed class "); this.Write(this.ToStringHelper.ToStringWithCulture(objInfo.FormatterNameWithoutNameSpace)); this.Write(" : global::MessagePack.Formatters.IMessagePackFormatter<"); this.Write(this.ToStringHelper.ToStringWithCulture(objInfo.FullName)); @@ -191,9 +190,21 @@ foreach (var objInfo in ObjectSerializationInfos) { if (objInfo.Members.Length != 0) { this.Write(" reader.Depth--;\r\n"); } - this.Write(" return ____result;\r\n }\r\n }\r\n"); + this.Write(" return ____result;\r\n }\r\n }\r\n\r\n"); } - this.Write("}\r\n"); + this.Write(@"} + +#pragma warning restore 168 +#pragma warning restore 414 +#pragma warning restore 618 +#pragma warning restore 612 + +#pragma warning restore SA1129 // Do not use default value type constructor +#pragma warning restore SA1309 // Field names should not begin with underscore +#pragma warning restore SA1312 // Variable names should begin with lower-case letter +#pragma warning restore SA1403 // File may only contain a single namespace +#pragma warning restore SA1649 // File name should match first type name +"); return this.GenerationEnvironment.ToString(); } } diff --git a/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterTemplate.tt b/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterTemplate.tt index 9bc3e4d8..296ef454 100644 --- a/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterTemplate.tt +++ b/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterTemplate.tt @@ -14,7 +14,6 @@ #pragma warning disable 168 #pragma warning disable SA1129 // Do not use default value type constructor -#pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1309 // Field names should not begin with underscore #pragma warning disable SA1312 // Variable names should begin with lower-case letter #pragma warning disable SA1403 // File may only contain a single namespace @@ -22,8 +21,6 @@ namespace <#= Namespace #> { - using global::System.Buffers; - using global::MessagePack; <# var list = new List>(); foreach (var objInfo in ObjectSerializationInfos) { list.Clear(); @@ -33,7 +30,6 @@ foreach (var objInfo in ObjectSerializationInfos) { } bool isFormatterResolverNecessary = ShouldUseFormatterResolverHelper.ShouldUseFormatterResolver(objInfo.Members); #> - public sealed class <#= objInfo.FormatterNameWithoutNameSpace #> : global::MessagePack.Formatters.IMessagePackFormatter<<#= objInfo.FullName #>> <# foreach (var typeArg in objInfo.GenericTypeParameters.Where(x => x.HasConstraints)) {#> where <#= typeArg.Name #> : <#= typeArg.Constraints #> @@ -147,5 +143,16 @@ foreach (var objInfo in ObjectSerializationInfos) { return ____result; } } -<# } #> -} + +<# } #>} + +#pragma warning restore 168 +#pragma warning restore 414 +#pragma warning restore 618 +#pragma warning restore 612 + +#pragma warning restore SA1129 // Do not use default value type constructor +#pragma warning restore SA1309 // Field names should not begin with underscore +#pragma warning restore SA1312 // Variable names should begin with lower-case letter +#pragma warning restore SA1403 // File may only contain a single namespace +#pragma warning restore SA1649 // File name should match first type name diff --git a/src/MessagePack.GeneratorCore/Generator/UnionTemplate.cs b/src/MessagePack.GeneratorCore/Generator/UnionTemplate.cs index 1106f1cb..6ea73cff 100644 --- a/src/MessagePack.GeneratorCore/Generator/UnionTemplate.cs +++ b/src/MessagePack.GeneratorCore/Generator/UnionTemplate.cs @@ -34,38 +34,41 @@ namespace MessagePackCompiler.Generator #pragma warning disable 414 #pragma warning disable 168 -#pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1403 // File may only contain a single namespace #pragma warning disable SA1649 // File name should match first type name namespace "); this.Write(this.ToStringHelper.ToStringWithCulture(Namespace)); - this.Write("\r\n{\r\n using System;\r\n using System.Buffers;\r\n using System.Collections.G" + - "eneric;\r\n using MessagePack;\r\n\r\n"); + this.Write("\r\n{\r\n"); foreach(var info in UnionSerializationInfos) { this.Write(" public sealed class "); this.Write(this.ToStringHelper.ToStringWithCulture(info.Name)); this.Write("Formatter : global::MessagePack.Formatters.IMessagePackFormatter<"); this.Write(this.ToStringHelper.ToStringWithCulture(info.FullName)); - this.Write(">\r\n {\r\n private readonly Dictionary> 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 216cf3c3..174dd3d2 100644 --- a/src/MessagePack.GeneratorCore/Generator/UnionTemplate.tt +++ b/src/MessagePack.GeneratorCore/Generator/UnionTemplate.tt @@ -12,32 +12,26 @@ #pragma warning disable 414 #pragma warning disable 168 -#pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1403 // File may only contain a single namespace #pragma warning disable SA1649 // File name should match first type name namespace <#= Namespace #> { - using System; - using System.Buffers; - using System.Collections.Generic; - using MessagePack; - <# foreach(var info in UnionSerializationInfos) { #> public sealed class <#= info.Name #>Formatter : global::MessagePack.Formatters.IMessagePackFormatter<<#= info.FullName #>> { - private readonly Dictionary> 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