(\"k__BackingField\");\n AssertEx.SetEqual(fieldAttributesExpected.Concat(new[] { \"A(1)\" }), GetAttributeStrings(field1.GetAttributes()));\n\n var prop2 = @class.GetMember(\"P2\");\n Assert.Empty(prop2.GetAttributes());\n AssertEx.SetEqual(propAttributesExpected, GetAttributeStrings(prop2.GetMethod.GetAttributes()));\n Assert.Null(prop2.SetMethod);\n\n var field2 = @class.GetMember(\"k__BackingField\");\n AssertEx.SetEqual(fieldAttributesExpected.Concat(new[] { \"A(2)\" }), GetAttributeStrings(field2.GetAttributes()));\n\n var prop3 = @class.GetMember(\"P3\");\n Assert.Equal(\"B(3)\", prop3.GetAttributes().Single().ToString());\n AssertEx.SetEqual(propAttributesExpected, GetAttributeStrings(prop3.GetMethod.GetAttributes()));\n Assert.Null(prop3.SetMethod);\n\n var field3 = @class.GetMember(\"k__BackingField\");\n AssertEx.SetEqual(fieldAttributesExpected.Concat(new[] { \"A(33)\" }), GetAttributeStrings(field3.GetAttributes()));\n\n var prop4 = @class.GetMember(\"P4\");\n Assert.Equal(\"B(4)\", prop4.GetAttributes().Single().ToString());\n AssertEx.SetEqual(propAttributesExpected, GetAttributeStrings(prop3.GetMethod.GetAttributes()));\n Assert.Null(prop4.SetMethod);\n\n var field4 = @class.GetMember(\"k__BackingField\");\n AssertEx.SetEqual(fieldAttributesExpected.Concat(new[] { \"A(44)\", \"A(444)\" }), GetAttributeStrings(field4.GetAttributes()));\n };\n\n var comp = CompileAndVerify(source, sourceSymbolValidator: symbolValidator, symbolValidator: symbolValidator,\n options: TestOptions.DebugDll.WithMetadataImportOptions(MetadataImportOptions.All));\n comp.VerifyDiagnostics();\n }\n\n [Fact]\n public void TestGeneratedTupleAndDynamicAttributesOnAutoProperty()\n {\n string source = @\"\npublic class Test\n{\n public (dynamic a, int b) P { get; set; }\n}\n\";\n Action symbolValidator = moduleSymbol =>\n {\n var @class = moduleSymbol.GlobalNamespace.GetMember(\"Test\");\n bool isFromSource = @class is SourceNamedTypeSymbol;\n\n var field1 = @class.GetMember(\"k__BackingField\");\n if (isFromSource)\n {\n Assert.Empty(field1.GetAttributes());\n }\n else\n {\n var dynamicAndTupleNames = new[] {\n \"System.Runtime.CompilerServices.DynamicAttribute({false, true, false})\",\n @\"System.Runtime.CompilerServices.TupleElementNamesAttribute({\"\"a\"\", \"\"b\"\"})\" };\n\n AssertEx.SetEqual(s_backingFieldAttributes.Concat(dynamicAndTupleNames), GetAttributeStrings(field1.GetAttributes()));\n }\n };\n\n var comp = CompileAndVerify(source, sourceSymbolValidator: symbolValidator, symbolValidator: symbolValidator,\n options: TestOptions.DebugDll.WithMetadataImportOptions(MetadataImportOptions.All));\n comp.VerifyDiagnostics();\n }\n\n [Fact]\n public void TestWellKnownAttributeOnProperty_SpecialName()\n {\n string source = @\"\npublic struct Test\n{\n [field: System.Runtime.CompilerServices.SpecialName]\n public static int P { get; set; }\n\n public static int P2 { get; set; }\n\n [field: System.Runtime.CompilerServices.SpecialName]\n public static int f;\n}\n\";\n Action symbolValidator = moduleSymbol =>\n {\n var @class = moduleSymbol.GlobalNamespace.GetMember(\"Test\");\n bool isFromSource = @class is SourceNamedTypeSymbol;\n\n var fieldAttributesExpected = isFromSource ? new string[0] : s_backingFieldAttributes;\n\n var prop1 = @class.GetMember(\"P\");\n Assert.Empty(prop1.GetAttributes());\n\n var field1 = @class.GetMember(\"k__BackingField\");\n var attributes1 = field1.GetAttributes();\n if (isFromSource)\n {\n AssertEx.SetEqual(new[] { \"System.Runtime.CompilerServices.SpecialNameAttribute\" }, GetAttributeStrings(attributes1));\n }\n else\n {\n AssertEx.SetEqual(fieldAttributesExpected, GetAttributeStrings(attributes1));\n }\n Assert.True(field1.HasSpecialName);\n\n var prop2 = @class.GetMember(\"P2\");\n Assert.Empty(prop2.GetAttributes());\n\n var field2 = @class.GetMember(\"k__BackingField\");\n AssertEx.SetEqual(fieldAttributesExpected, GetAttributeStrings(field2.GetAttributes()));\n Assert.False(field2.HasSpecialName);\n\n var field3 = @class.GetMember(\"f\");\n var attributes3 = field3.GetAttributes();\n if (isFromSource)\n {\n AssertEx.SetEqual(new[] { \"System.Runtime.CompilerServices.SpecialNameAttribute\" }, GetAttributeStrings(attributes3));\n }\n else\n {\n Assert.Empty(GetAttributeStrings(attributes3));\n }\n };\n\n var comp = CompileAndVerify(source, sourceSymbolValidator: symbolValidator, symbolValidator: symbolValidator,\n options: TestOptions.DebugDll.WithMetadataImportOptions(MetadataImportOptions.All));\n comp.VerifyDiagnostics();\n }\n\n [Fact]\n public void TestWellKnownAttributeOnProperty_NonSerialized()\n {\n string source = @\"\npublic class Test\n{\n [field: System.NonSerialized]\n public int P { get; set; }\n\n public int P2 { get; set; }\n\n [field: System.NonSerialized]\n public int f;\n}\n\";\n\n Action symbolValidator = moduleSymbol =>\n {\n var @class = moduleSymbol.GlobalNamespace.GetMember(\"Test\");\n bool isFromSource = @class is SourceNamedTypeSymbol;\n\n var fieldAttributesExpected = isFromSource ? new string[0] : s_backingFieldAttributes;\n\n var prop1 = @class.GetMember(\"P\");\n Assert.Empty(prop1.GetAttributes());\n\n var field1 = @class.GetMember(\"k__BackingField\");\n var attributes1 = field1.GetAttributes();\n if (isFromSource)\n {\n AssertEx.SetEqual(new[] { \"System.NonSerializedAttribute\" }, GetAttributeStrings(attributes1));\n }\n else\n {\n AssertEx.SetEqual(fieldAttributesExpected, GetAttributeStrings(attributes1));\n }\n Assert.True(field1.IsNotSerialized);\n\n var prop2 = @class.GetMember(\"P2\");\n Assert.Empty(prop2.GetAttributes());\n\n var field2 = @class.GetMember(\"k__BackingField\");\n AssertEx.SetEqual(fieldAttributesExpected, GetAttributeStrings(field2.GetAttributes()));\n Assert.False(field2.IsNotSerialized);\n\n var field3 = @class.GetMember(\"f\");\n var attributes3 = field3.GetAttributes();\n if (isFromSource)\n {\n AssertEx.SetEqual(new[] { \"System.NonSerializedAttribute\" }, GetAttributeStrings(attributes3));\n }\n else\n {\n Assert.Empty(GetAttributeStrings(attributes3));\n }\n Assert.True(field3.IsNotSerialized);\n };\n\n var comp = CompileAndVerify(source, sourceSymbolValidator: symbolValidator, symbolValidator: symbolValidator,\n options: TestOptions.DebugDll.WithMetadataImportOptions(MetadataImportOptions.All));\n comp.VerifyDiagnostics();\n }\n\n [Fact]\n public void TestWellKnownAttributeOnProperty_FieldOffset()\n {\n string source = @\"\npublic struct Test\n{\n [field: System.Runtime.InteropServices.FieldOffset(0)]\n public static int P { get; set; }\n}\n\";\n var comp = CreateCompilation(source);\n comp.VerifyDiagnostics(\n // (4,13): error CS0637: The FieldOffset attribute is not allowed on static or const fields\n // [field: System.Runtime.InteropServices.FieldOffset(0)]\n Diagnostic(ErrorCode.ERR_StructOffsetOnBadField, \"System.Runtime.InteropServices.FieldOffset\").WithArguments(\"System.Runtime.InteropServices.FieldOffset\").WithLocation(4, 13)\n );\n }\n\n [Fact]\n public void TestWellKnownAttributeOnProperty_FieldOffset2()\n {\n string source = @\"\npublic struct Test\n{\n [field: System.Runtime.InteropServices.FieldOffset(-1)]\n public int P { get; set; }\n}\n\";\n var comp = CreateCompilation(source);\n comp.VerifyDiagnostics(\n // (4,56): error CS0591: Invalid value for argument to 'System.Runtime.InteropServices.FieldOffset' attribute\n // [field: System.Runtime.InteropServices.FieldOffset(-1)]\n Diagnostic(ErrorCode.ERR_InvalidAttributeArgument, \"-1\").WithArguments(\"System.Runtime.InteropServices.FieldOffset\").WithLocation(4, 56),\n // (4,13): error CS0636: The FieldOffset attribute can only be placed on members of types marked with the StructLayout(LayoutKind.Explicit)\n // [field: System.Runtime.InteropServices.FieldOffset(-1)]\n Diagnostic(ErrorCode.ERR_StructOffsetOnBadStruct, \"System.Runtime.InteropServices.FieldOffset\").WithLocation(4, 13)\n );\n }\n\n [Fact]\n public void TestWellKnownAttributeOnProperty_FieldOffset3()\n {\n string source = @\"\nusing System.Runtime.InteropServices;\n\n[StructLayout(LayoutKind.Auto)]\npublic class Test\n{\n [field: FieldOffset(4)]\n public int P { get; set; }\n}\n\";\n var comp = CreateCompilation(source);\n comp.VerifyDiagnostics(\n // (7,13): error CS0636: The FieldOffset attribute can only be placed on members of types marked with the StructLayout(LayoutKind.Explicit)\n // [field: FieldOffset(4)]\n Diagnostic(ErrorCode.ERR_StructOffsetOnBadStruct, \"FieldOffset\").WithLocation(7, 13)\n );\n }\n\n [Fact]\n public void TestWellKnownAttributeOnProperty_FieldOffset4()\n {\n string source = @\"\nusing System.Runtime.InteropServices;\n\npublic struct Test\n{\n [field: FieldOffset(4)]\n public int P { get; set; }\n}\n\";\n var comp = CreateCompilation(source);\n comp.VerifyDiagnostics(\n // (6,13): error CS0636: The FieldOffset attribute can only be placed on members of types marked with the StructLayout(LayoutKind.Explicit)\n // [field: FieldOffset(4)]\n Diagnostic(ErrorCode.ERR_StructOffsetOnBadStruct, \"FieldOffset\").WithLocation(6, 13)\n );\n }\n\n [Fact]\n public void TestWellKnownAttributeOnProperty_FieldOffset5()\n {\n string source = @\"\nusing System.Runtime.InteropServices;\n\n[StructLayout(LayoutKind.Explicit)]\npublic struct Test\n{\n public int P { get; set; }\n}\n\";\n var comp = CreateCompilation(source);\n comp.VerifyDiagnostics(\n // (7,16): error CS0625: 'Test.P': instance field in types marked with StructLayout(LayoutKind.Explicit) must have a FieldOffset attribute\n // public int P { get; set; }\n Diagnostic(ErrorCode.ERR_MissingStructOffset, \"P\").WithArguments(\"Test.P\").WithLocation(7, 16)\n );\n }\n\n [Fact]\n public void TestWellKnownAttributeOnProperty_FixedBuffer()\n {\n string source = @\"\npublic class Test\n{\n [field: System.Runtime.CompilerServices.FixedBuffer(typeof(int), 0)]\n public int P { get; set; }\n}\n\";\n var comp = CreateCompilation(source);\n comp.VerifyDiagnostics(\n // (4,13): error CS8362: Do not use 'System.Runtime.CompilerServices.FixedBuffer' attribute on a property\n // [field: System.Runtime.CompilerServices.FixedBuffer(typeof(int), 0)]\n Diagnostic(ErrorCode.ERR_DoNotUseFixedBufferAttrOnProperty, \"System.Runtime.CompilerServices.FixedBuffer\").WithLocation(4, 13)\n );\n }\n\n [ConditionalFact(typeof(DesktopOnly))]\n public void TestWellKnownAttributeOnProperty_DynamicAttribute()\n {\n string source = @\"\npublic class Test\n{\n [field: System.Runtime.CompilerServices.DynamicAttribute()]\n public int P { get; set; }\n}\n\";\n var comp = CreateCompilation(source);\n comp.VerifyDiagnostics(\n // (4,13): error CS1970: Do not use 'System.Runtime.CompilerServices.DynamicAttribute'. Use the 'dynamic' keyword instead.\n // [field: System.Runtime.CompilerServices.DynamicAttribute()]\n Diagnostic(ErrorCode.ERR_ExplicitDynamicAttr, \"System.Runtime.CompilerServices.DynamicAttribute()\").WithLocation(4, 13)\n );\n }\n\n [Fact]\n public void TestWellKnownAttributeOnProperty_IsReadOnlyAttribute()\n {\n string source = @\"\nnamespace System.Runtime.CompilerServices\n{\n public class IsReadOnlyAttribute : System.Attribute { }\n}\npublic class Test\n{\n [field: System.Runtime.CompilerServices.IsReadOnlyAttribute()]\n public int P { get; set; }\n}\n\";\n var comp = CreateCompilation(source);\n comp.VerifyDiagnostics(\n // (8,13): error CS8335: Do not use 'System.Runtime.CompilerServices.IsReadOnlyAttribute'. This is reserved for compiler usage.\n // [field: System.Runtime.CompilerServices.IsReadOnlyAttribute()]\n Diagnostic(ErrorCode.ERR_ExplicitReservedAttr, \"System.Runtime.CompilerServices.IsReadOnlyAttribute()\").WithArguments(\"System.Runtime.CompilerServices.IsReadOnlyAttribute\").WithLocation(8, 13)\n );\n }\n\n [Fact]\n public void TestWellKnownAttributeOnProperty_IsByRefLikeAttribute()\n {\n string source = @\"\nnamespace System.Runtime.CompilerServices\n{\n public class IsByRefLikeAttribute : System.Attribute { }\n}\npublic class Test\n{\n [field: System.Runtime.CompilerServices.IsByRefLikeAttribute()]\n public int P { get; set; }\n}\n\";\n var comp = CreateCompilation(source);\n comp.VerifyDiagnostics(\n // (8,13): error CS8335: Do not use 'System.Runtime.CompilerServices.IsByRefLikeAttribute'. This is reserved for compiler usage.\n // [field: System.Runtime.CompilerServices.IsByRefLikeAttribute()]\n Diagnostic(ErrorCode.ERR_ExplicitReservedAttr, \"System.Runtime.CompilerServices.IsByRefLikeAttribute()\").WithArguments(\"System.Runtime.CompilerServices.IsByRefLikeAttribute\").WithLocation(8, 13)\n );\n }\n\n [Fact]\n public void TestWellKnownAttributeOnProperty_DateTimeConstant()\n {\n string source = @\"\npublic class Test\n{\n [field: System.Runtime.CompilerServices.DateTimeConstant(123456)]\n public System.DateTime P { get; set; }\n\n [field: System.Runtime.CompilerServices.DateTimeConstant(123456)]\n public int P2 { get; set; }\n}\n\";\n Action symbolValidator = moduleSymbol =>\n {\n var @class = moduleSymbol.GlobalNamespace.GetMember(\"Test\");\n bool isFromSource = @class is SourceNamedTypeSymbol;\n var fieldAttributesExpected = isFromSource ? new string[0] : s_backingFieldAttributes;\n\n var prop1 = @class.GetMember(\"P\");\n Assert.Empty(prop1.GetAttributes());\n\n var field1 = @class.GetMember(\"k__BackingField\");\n AssertEx.SetEqual(fieldAttributesExpected.Concat(new[] { \"System.Runtime.CompilerServices.DateTimeConstantAttribute(123456)\" }),\n GetAttributeStrings(field1.GetAttributes()));\n\n var prop2 = @class.GetMember(\"P2\");\n Assert.Empty(prop2.GetAttributes());\n\n var field2 = @class.GetMember(\"k__BackingField\");\n AssertEx.SetEqual(fieldAttributesExpected.Concat(new[] { \"System.Runtime.CompilerServices.DateTimeConstantAttribute(123456)\" }),\n GetAttributeStrings(field2.GetAttributes()));\n };\n\n var comp = CompileAndVerify(source, sourceSymbolValidator: symbolValidator, symbolValidator: symbolValidator,\n options: TestOptions.DebugDll.WithMetadataImportOptions(MetadataImportOptions.All));\n comp.VerifyDiagnostics();\n }\n\n [Fact]\n public void TestWellKnownAttributeOnProperty_DecimalConstant()\n {\n string source = @\"\npublic class Test\n{\n [field: System.Runtime.CompilerServices.DecimalConstant(0, 0, 100, 100, 100)]\n public decimal P { get; set; }\n\n [field: System.Runtime.CompilerServices.DecimalConstant(0, 0, 100, 100, 100)]\n public int P2 { get; set; }\n\n [field: System.Runtime.CompilerServices.DecimalConstant(0, 0, 100, 100, 100)]\n public decimal field;\n}\n\";\n Action symbolValidator = moduleSymbol =>\n {\n var @class = moduleSymbol.GlobalNamespace.GetMember