40 overrides of GetAttributes
Microsoft.CodeAnalysis.CSharp (40)
Lowering\StateMachineRewriter\StateMachineTypeSymbol.cs (1)
53
public sealed override ImmutableArray<CSharpAttributeData>
GetAttributes
()
Lowering\StateMachineRewriter\SynthesizedStateMachineMethod.cs (1)
70
public override ImmutableArray<CSharpAttributeData>
GetAttributes
()
Symbols\Extensions\RewrittenMethodSymbol.cs (1)
86
public sealed override ImmutableArray<CSharpAttributeData>
GetAttributes
()
Symbols\Metadata\PE\PEAssemblySymbol.cs (1)
140
public override ImmutableArray<CSharpAttributeData>
GetAttributes
()
Symbols\Metadata\PE\PEEventSymbol.cs (1)
360
public override ImmutableArray<CSharpAttributeData>
GetAttributes
()
Symbols\Metadata\PE\PEFieldSymbol.cs (1)
580
public override ImmutableArray<CSharpAttributeData>
GetAttributes
()
Symbols\Metadata\PE\PEMethodSymbol.cs (1)
991
public override ImmutableArray<CSharpAttributeData>
GetAttributes
()
Symbols\Metadata\PE\PEModuleSymbol.cs (1)
242
public override ImmutableArray<CSharpAttributeData>
GetAttributes
()
Symbols\Metadata\PE\PENamedTypeSymbol.cs (1)
901
public override ImmutableArray<CSharpAttributeData>
GetAttributes
()
Symbols\Metadata\PE\PEParameterSymbol.cs (1)
1076
public override ImmutableArray<CSharpAttributeData>
GetAttributes
()
Symbols\Metadata\PE\PEPropertySymbol.cs (1)
730
public override ImmutableArray<CSharpAttributeData>
GetAttributes
()
Symbols\Metadata\PE\PETypeParameterSymbol.cs (1)
640
public override ImmutableArray<CSharpAttributeData>
GetAttributes
()
Symbols\ReducedExtensionMethodSymbol.cs (1)
459
public override ImmutableArray<CSharpAttributeData>
GetAttributes
()
Symbols\Retargeting\RetargetingAssemblySymbol.cs (1)
210
public override ImmutableArray<CSharpAttributeData>
GetAttributes
()
Symbols\Retargeting\RetargetingEventSymbol.cs (1)
156
public override ImmutableArray<CSharpAttributeData>
GetAttributes
()
Symbols\Retargeting\RetargetingFieldSymbol.cs (1)
78
public override ImmutableArray<CSharpAttributeData>
GetAttributes
()
Symbols\Retargeting\RetargetingMethodSymbol.cs (1)
211
public override ImmutableArray<CSharpAttributeData>
GetAttributes
()
Symbols\Retargeting\RetargetingModuleSymbol.cs (1)
276
public override ImmutableArray<CSharpAttributeData>
GetAttributes
()
Symbols\Retargeting\RetargetingNamedTypeSymbol.cs (1)
255
public override ImmutableArray<CSharpAttributeData>
GetAttributes
()
Symbols\Retargeting\RetargetingPropertySymbol.cs (1)
216
public override ImmutableArray<CSharpAttributeData>
GetAttributes
()
Symbols\Source\FieldSymbolWithAttributesAndModifiers.cs (1)
72
public sealed override ImmutableArray<CSharpAttributeData>
GetAttributes
()
Symbols\Source\ImplicitNamedTypeSymbol.cs (1)
34
public override ImmutableArray<CSharpAttributeData>
GetAttributes
()
Symbols\Source\SourceAssemblySymbol.cs (1)
1596
public sealed override ImmutableArray<CSharpAttributeData>
GetAttributes
()
Symbols\Source\SourceClonedParameterSymbol.cs (1)
115
public override ImmutableArray<CSharpAttributeData>
GetAttributes
()
Symbols\Source\SourceEventSymbol.cs (1)
259
public sealed override ImmutableArray<CSharpAttributeData>
GetAttributes
()
Symbols\Source\SourceMethodSymbolWithAttributes.cs (1)
316
public override ImmutableArray<CSharpAttributeData>
GetAttributes
()
Symbols\Source\SourceModuleSymbol.cs (1)
538
public sealed override ImmutableArray<CSharpAttributeData>
GetAttributes
()
Symbols\Source\SourceNamedTypeSymbol.cs (1)
862
public sealed override ImmutableArray<CSharpAttributeData>
GetAttributes
()
Symbols\Source\SourceParameterSymbol.cs (1)
197
public sealed override ImmutableArray<CSharpAttributeData>
GetAttributes
()
Symbols\Source\SourcePropertySymbolBase.cs (1)
1349
public sealed override ImmutableArray<CSharpAttributeData>
GetAttributes
()
Symbols\Source\SourceTypeParameterSymbol.cs (1)
167
public sealed override ImmutableArray<CSharpAttributeData>
GetAttributes
()
Symbols\SubstitutedEventSymbol.cs (1)
54
public override ImmutableArray<CSharpAttributeData>
GetAttributes
()
Symbols\SubstitutedFieldSymbol.cs (1)
77
public override ImmutableArray<CSharpAttributeData>
GetAttributes
()
Symbols\SubstitutedMethodSymbol.cs (1)
206
public sealed override ImmutableArray<CSharpAttributeData>
GetAttributes
()
Symbols\SubstitutedNamedTypeSymbol.cs (1)
209
public sealed override ImmutableArray<CSharpAttributeData>
GetAttributes
()
Symbols\SubstitutedPropertySymbol.cs (1)
63
public override ImmutableArray<CSharpAttributeData>
GetAttributes
()
Symbols\Synthesized\SynthesizedParameterSymbol.cs (1)
378
public override ImmutableArray<CSharpAttributeData>
GetAttributes
()
Symbols\Tuples\TupleFieldSymbol.cs (1)
134
public override ImmutableArray<CSharpAttributeData>
GetAttributes
()
Symbols\Wrapped\WrappedParameterSymbol.cs (1)
69
public override ImmutableArray<CSharpAttributeData>
GetAttributes
()
Symbols\Wrapped\WrappedTypeParameterSymbol.cs (1)
178
public override ImmutableArray<CSharpAttributeData>
GetAttributes
()
1448 references to GetAttributes
Microsoft.CodeAnalysis.CSharp (50)
Binder\Binder.cs (1)
672
leastOverriddenSymbol.
GetAttributes
();
Compiler\ClsComplianceChecker.cs (4)
342
foreach (CSharpAttributeData attribute in symbol.
GetAttributes
())
588
CheckForAttributeWithArrayArgumentInternal(symbol.
GetAttributes
());
695
if (TryGetClsComplianceAttributeLocation(parameters[i].
GetAttributes
(), out attributeLocation))
1187
foreach (CSharpAttributeData data in symbol.
GetAttributes
())
Emitter\Model\SymbolAdapter.cs (1)
100
userDefined = this.
GetAttributes
();
Emitter\NoPia\EmbeddedEvent.cs (1)
73
foreach (var attrData in underlyingContainingType.
GetAttributes
())
Lowering\ClosureConversion\LambdaCapturedVariable.cs (1)
190
foreach (CSharpAttributeData attr in definition.
GetAttributes
())
Lowering\DiagnosticsPass_ExpressionTrees.cs (2)
611
if (!lambda.
GetAttributes
().IsEmpty || !lambda.GetReturnTypeAttributes().IsEmpty)
628
if (!reportedAttributes && !p.
GetAttributes
().IsEmpty)
Lowering\LocalRewriter\LocalRewriter_Event.cs (1)
28
foreach (var attrData in @interface.
GetAttributes
())
Lowering\StateMachineRewriter\StateMachineFieldSymbol.cs (1)
105
foreach (CSharpAttributeData attr in definition.
GetAttributes
())
Lowering\StateMachineRewriter\StateMachineTypeSymbol.cs (2)
57
Debug.Assert(base.
GetAttributes
().Length == 0);
63
foreach (var attribute in kickoffType.
GetAttributes
())
Lowering\StateMachineRewriter\SynthesizedStateMachineMethod.cs (2)
74
Debug.Assert(base.
GetAttributes
().Length == 0);
80
foreach (var attribute in kickoffMethod.
GetAttributes
())
Lowering\SynthesizedMethodBaseSymbol.cs (1)
154
? BaseMethod.
GetAttributes
()
Symbols\EventSymbol.cs (1)
119
this.AssociatedField.
GetAttributes
();
Symbols\Extensions\RewrittenMethodSymbol.cs (1)
88
return _originalMethod.
GetAttributes
();
Symbols\PublicModel\Symbol.cs (1)
122
return StaticCast<AttributeData>.From(UnderlyingSymbol.
GetAttributes
());
Symbols\ReducedExtensionMethodSymbol.cs (1)
461
return _reducedFrom.
GetAttributes
();
Symbols\Retargeting\RetargetingEventSymbol.cs (1)
158
return _underlyingEvent.
GetAttributes
();
Symbols\Retargeting\RetargetingFieldSymbol.cs (1)
80
return this.RetargetingTranslator.GetRetargetedAttributes(_underlyingField.
GetAttributes
(), ref _lazyCustomAttributes);
Symbols\Retargeting\RetargetingMethodSymbol.cs (1)
213
return this.RetargetingTranslator.GetRetargetedAttributes(_underlyingMethod.
GetAttributes
(), ref _lazyCustomAttributes);
Symbols\Retargeting\RetargetingNamedTypeSymbol.cs (1)
257
return this.RetargetingTranslator.GetRetargetedAttributes(_underlyingType.
GetAttributes
(), ref _lazyCustomAttributes);
Symbols\Retargeting\RetargetingParameterSymbol.cs (1)
67
return this.RetargetingModule.RetargetingTranslator.GetRetargetedAttributes(_underlyingParameter.
GetAttributes
(), ref _lazyCustomAttributes);
Symbols\Retargeting\RetargetingPropertySymbol.cs (1)
218
return this.RetargetingTranslator.GetRetargetedAttributes(_underlyingProperty.
GetAttributes
(), ref _lazyCustomAttributes);
Symbols\Retargeting\RetargetingSymbolTranslator.cs (1)
344
foreach (var attrData in type.
GetAttributes
())
Symbols\Retargeting\RetargetingTypeParameterSymbol.cs (1)
65
return this.RetargetingTranslator.GetRetargetedAttributes(_underlyingTypeParameter.
GetAttributes
(), ref _lazyCustomAttributes);
Symbols\Source\SourceMemberContainerSymbol.cs (3)
561
GetAttributes
();
1464
foreach (var attr in symbol.
GetAttributes
())
6062
member.
GetAttributes
();
Symbols\Source\SourceMemberMethodSymbol.cs (1)
910
field.
GetAttributes
();
Symbols\Source\SourceNamedTypeSymbol_Extension.cs (2)
419
appendAttributes(typeParameter.
GetAttributes
(), builder);
436
appendAttributes(extensionParameter.
GetAttributes
(), builder);
Symbols\SubstitutedEventSymbol.cs (1)
56
return OriginalDefinition.
GetAttributes
();
Symbols\SubstitutedFieldSymbol.cs (1)
79
return OriginalDefinition.
GetAttributes
();
Symbols\SubstitutedMethodSymbol.cs (1)
208
return this.OriginalDefinition.
GetAttributes
();
Symbols\SubstitutedNamedTypeSymbol.cs (1)
211
return OriginalDefinition.
GetAttributes
();
Symbols\SubstitutedPropertySymbol.cs (1)
65
return OriginalDefinition.
GetAttributes
();
Symbols\Symbol_Attributes.cs (1)
952
this.
GetAttributes
();
Symbols\SymbolCompletionState.cs (2)
43
/// of <see cref="Symbol.
GetAttributes
"/> will set the part <see cref="CompletionPart.Attributes"/> on
53
_ = symbol.
GetAttributes
();
Symbols\Synthesized\Records\SynthesizedPrimaryConstructorParameterBackingFieldSymbol.cs (1)
73
foreach (CSharpAttributeData attr in ParameterSymbol.
GetAttributes
())
Symbols\Synthesized\SynthesizedSubstitutedTypeParameterSymbol.cs (1)
62
return _underlyingTypeParameter.
GetAttributes
();
Symbols\Tuples\TupleFieldSymbol.cs (2)
136
return _underlyingField.
GetAttributes
();
327
return _underlyingField.
GetAttributes
();
Symbols\TypeSymbol.cs (1)
1982
foreach (var attributeData in implementingSymbol.
GetAttributes
())
Symbols\Wrapped\WrappedParameterSymbol.cs (1)
71
return _underlyingParameter.
GetAttributes
();
Symbols\Wrapped\WrappedTypeParameterSymbol.cs (1)
180
return _underlyingTypeParameter.
GetAttributes
();
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (92)
CodeGen\CodeGenAsyncIteratorTests.cs (6)
1148
GetAttributeNames(method.
GetAttributes
()));
1150
var attribute = method.
GetAttributes
().Single();
1175
Assert.Empty(GetAttributeNames(method.
GetAttributes
()));
10598
m.GlobalNamespace.GetMember<NamedTypeSymbol>("Test1.<M2>d__0").TypeParameters.Single().
GetAttributes
().Select(a => a.ToString()));
10644
m.GlobalNamespace.GetMember("Test1.<M2>d__0.x").
GetAttributes
().Select(a => a.ToString()));
10648
m.GlobalNamespace.GetMember("Test1.<M2>d__0.<>3__x").
GetAttributes
().Select(a => a.ToString()));
CodeGen\CodeGenAsyncTests.cs (2)
6305
m.GlobalNamespace.GetMember<NamedTypeSymbol>("Test1.<M2>d__0").TypeParameters.Single().
GetAttributes
().Select(a => a.ToString()));
6349
m.GlobalNamespace.GetMember("Test1.<M2>d__0.x").
GetAttributes
().Select(a => a.ToString()));
CodeGen\CodeGenDynamicTests.cs (6)
595
AssertEx.SetEqual(new[] { "CompilerGeneratedAttribute" }, GetAttributeNames(container.
GetAttributes
()));
608
Assert.Equal(0, field.
GetAttributes
().Length);
653
var attributes = d.
GetAttributes
();
686
Assert.Equal(0, member.
GetAttributes
().Length);
804
Assert.Equal(0, container.GetMembers().Single().
GetAttributes
().Length);
832
AssertEx.SetEqual(new[] { "CompilerGeneratedAttribute" }, GetAttributeNames(d.
GetAttributes
()));
CodeGen\CodeGenFunctionPointersTests.cs (15)
5414
string getAttribute(string fieldName) => c.GetField(fieldName).
GetAttributes
().Single().ToString()!;
5470
Assert.Empty(field.
GetAttributes
());
5474
Assert.Equal(expectedAttribute, field.
GetAttributes
().Single().ToString());
5556
Assert.Empty(f.
GetAttributes
());
5560
Assert.Equal(expectedAttribute, f.
GetAttributes
().Single().ToString());
5609
Assert.Equal("System.Runtime.CompilerServices.DynamicAttribute({false, false, false, false, false, true, false, true})", param.
GetAttributes
().Single().ToString());
11676
var attr = c.
GetAttributes
().Single(d => d.AttributeClass?.Name == "A");
11739
var attr = c.
GetAttributes
().Single(d => d.AttributeClass?.Name == "A");
11802
var attr = c.
GetAttributes
().Single(d => d.AttributeClass?.Name == "A");
11861
var attr = c.
GetAttributes
().Single(d => d.AttributeClass?.Name == "A");
11895
var attr = c.
GetAttributes
().Single(d => d.AttributeClass?.Name == "A");
12136
var attr = c.
GetAttributes
().Single(d => d.AttributeClass?.Name == "A");
12279
var attr = c.
GetAttributes
().Single(d => d.AttributeClass?.Name == "A");
12318
var attr = c.
GetAttributes
().Single(d => d.AttributeClass?.Name == "A");
12362
var attr = c.
GetAttributes
().Single(d => d.AttributeClass?.Name == "A");
CodeGen\CodeGenLocalFunctionTests.cs (20)
5236
var attrs1 = localFn1.
GetAttributes
();
5246
var attrs3 = localFn3.GetParameters().Single().
GetAttributes
();
5250
var attrs4 = localFn4.TypeParameters.Single().
GetAttributes
();
5285
var attrs = localFn1.
GetAttributes
();
5326
var attrs1 = localFn1.
GetAttributes
();
5359
var attrs1 = localFn1.
GetAttributes
();
5366
Assert.Empty(param.
GetAttributes
());
5393
var attrs1 = localFn1.
GetAttributes
();
5399
Assert.Equal("DynamicAttribute", param.
GetAttributes
().Single().AttributeClass.Name);
5426
var attrs1 = localFn1.
GetAttributes
();
5432
Assert.Empty(param.
GetAttributes
());
5539
var attrs1 = localFn1.
GetAttributes
();
5635
var attrs1 = localFn1.
GetAttributes
();
5638
Assert.Equal(new[] { "Attr" }, GetAttributeNames(localFn1.TypeParameters.Single().
GetAttributes
()));
5639
Assert.Equal(new[] { "Attr" }, GetAttributeNames(localFn1.Parameters.Single().
GetAttributes
()));
5646
var attrs1 = localFn1.
GetAttributes
();
5649
Assert.Empty(localFn1.TypeParameters.Single().
GetAttributes
());
5650
Assert.Empty(localFn1.Parameters.Single().
GetAttributes
());
5760
var attrs1 = localFn1.
GetAttributes
().As<CSharpAttributeData>();
5834
var attrs1 = localFn1.
GetAttributes
().As<CSharpAttributeData>();
CodeGen\CodeGenReadonlyStructTests.cs (1)
912
Assert.Empty(s1.
GetAttributes
());
CodeGen\CodeGenTupleTest.cs (35)
3371
Assert.True(mFirst.
GetAttributes
().IsEmpty);
3389
Assert.True(mItem1.
GetAttributes
().IsEmpty);
4607
Assert.True(mItem1.
GetAttributes
().IsEmpty);
11211
Assert.True(m1Tuple.
GetAttributes
().IsEmpty);
11253
Assert.True(m1Item1.
GetAttributes
().IsEmpty);
11274
Assert.True(m2Item1.
GetAttributes
().IsEmpty);
11295
Assert.True(m2a2.
GetAttributes
().IsEmpty);
11501
Assert.True(m1Tuple.
GetAttributes
().IsEmpty);
11548
Assert.True(m1Item9.
GetAttributes
().IsEmpty);
11563
Assert.True(m2Item9.
GetAttributes
().IsEmpty);
11580
Assert.True(m2i2.
GetAttributes
().IsEmpty);
11782
Assert.True(m3Item8.
GetAttributes
().IsEmpty);
11975
Assert.True(m4Item8.
GetAttributes
().IsEmpty);
11994
Assert.True(m4h4.
GetAttributes
().IsEmpty);
12223
Assert.True(m5Item8.
GetAttributes
().IsEmpty);
12591
Assert.True(m8Item8.
GetAttributes
().IsEmpty);
12611
Assert.True(m8Item1.
GetAttributes
().IsEmpty);
12758
Assert.True(m1Tuple.
GetAttributes
().IsEmpty);
12804
Assert.True(m1Item1.
GetAttributes
().IsEmpty);
12823
Assert.True(m2Item1.
GetAttributes
().IsEmpty);
12842
Assert.True(m2a2.
GetAttributes
().IsEmpty);
12862
Assert.True(m1ToString.
GetAttributes
().IsEmpty);
13203
Assert.Equal("System.ObsoleteAttribute", m10Tuple.
GetAttributes
().Single().ToString());
13217
Assert.Equal("System.ObsoleteAttribute", m10Item1.
GetAttributes
().Single().ToString());
13218
Assert.Equal("System.ObsoleteAttribute", m102Item20.
GetAttributes
().Single().ToString());
13219
Assert.Equal("System.ObsoleteAttribute", m102a.
GetAttributes
().Single().ToString());
13256
Assert.Equal("System.ObsoleteAttribute", m10M2.
GetAttributes
().Single().ToString());
13268
Assert.Equal("System.ObsoleteAttribute", m10P2.
GetAttributes
().Single().ToString());
13280
Assert.Equal("System.ObsoleteAttribute", m10E2.
GetAttributes
().Single().ToString());
15827
Assert.True(m1P1.
GetAttributes
().IsEmpty);
15857
Assert.True(m1this.
GetAttributes
().IsEmpty);
16057
Assert.True(m1E1.
GetAttributes
().IsEmpty);
16088
Assert.True(m1E2.
GetAttributes
().IsEmpty);
28971
Assert.Empty(field.
GetAttributes
());
28975
Assert.Equal(expectedAttribute, field.
GetAttributes
().Single().ToString());
Emit\CompilationEmitTests.cs (4)
2154
compWithReal.SourceModule.GetReferencedAssemblySymbols().Last().
GetAttributes
().Select(a => a.AttributeClass.ToTestDisplayString()));
2185
compWithReal2.SourceModule.GetReferencedAssemblySymbols().Last().
GetAttributes
().Select(a => a.AttributeClass.ToTestDisplayString()));
2212
compWithMetadata.SourceModule.GetReferencedAssemblySymbols().Last().
GetAttributes
().Select(a => a.AttributeClass.ToTestDisplayString()));
2240
compWithRef.SourceModule.GetReferencedAssemblySymbols().Last().
GetAttributes
().Select(a => a.AttributeClass.ToTestDisplayString()));
Emit\EmitMetadataTests.cs (1)
1304
var attribute = backingField.
GetAttributes
().Single();
Emit\NoPiaEmbedTypes.cs (1)
3326
Assert.Equal(0, m1.Parameters[0].
GetAttributes
().Length);
Emit\OptionalArgumentsTests.cs (1)
218
var attributes = parameter.
GetAttributes
();
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (1)
CodeGen\CodeGenMethodGroupConversionCachingTests.cs (1)
6389
m.GlobalNamespace.GetMember<NamedTypeSymbol>("Test1.<M2>O__0_0").TypeParameters.Single().
GetAttributes
().Select(a => a.ToString()));
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (725)
Attributes\AttributeTests.cs (194)
489
var attrs = assembly.
GetAttributes
();
588
var attributeData = (SourceAttributeData)program.
GetAttributes
()[0];
619
var attributeData = (SourceAttributeData)program.
GetAttributes
()[0];
649
var attributeData = (SourceAttributeData)program.
GetAttributes
()[0];
682
var attrs = m0.
GetAttributes
();
1022
var attrs = program.
GetAttributes
();
1067
var attrs = program.
GetAttributes
();
1122
var attributeData = (SourceAttributeData)program.
GetAttributes
()[0];
1128
attributeData = (SourceAttributeData)comp.GetMember("Program.M1").
GetAttributes
().Single();
1132
attributeData = (SourceAttributeData)comp.GetMember("Program.M2").
GetAttributes
().Single();
1136
attributeData = (SourceAttributeData)comp.GetMember("Program.M3").
GetAttributes
().Single();
1140
attributeData = (SourceAttributeData)comp.GetMember("Program.M4").
GetAttributes
().Single();
1144
attributeData = (SourceAttributeData)comp.GetMember("Program.M5").
GetAttributes
().Single();
1148
attributeData = (SourceAttributeData)comp.GetMember("Program.M6").
GetAttributes
().Single();
1186
var attributeData = (SourceAttributeData)program.
GetAttributes
()[0];
1225
var attributeData = (SourceAttributeData)program.
GetAttributes
()[0];
1264
var attributeData = (SourceAttributeData)program.
GetAttributes
()[0];
1302
var attributeData = (SourceAttributeData)program.
GetAttributes
()[0];
1342
var attributeData = (SourceAttributeData)program.
GetAttributes
()[0];
1427
var attrs = compilation.Assembly.
GetAttributes
();
1494
var attrs = compilation.SourceModule.GlobalNamespace.GetMember("A").
GetAttributes
();
1518
var attrs = compilation.SourceModule.GlobalNamespace.GetMember("Goo").
GetAttributes
();
1604
var attrs = prop.
GetAttributes
();
1708
var attrs = type.
GetAttributes
();
1714
attrs = prop.GetMethod.
GetAttributes
();
1719
attrs = prop.
GetAttributes
();
1722
attrs = prop.SetMethod.
GetAttributes
();
1804
Assert.Empty(prop1.
GetAttributes
());
1805
AssertEx.SetEqual(propAttributesExpected, GetAttributeStrings(prop1.GetMethod.
GetAttributes
()));
1806
AssertEx.SetEqual(propAttributesExpected, GetAttributeStrings(prop1.SetMethod.
GetAttributes
()));
1809
AssertEx.SetEqual(fieldAttributesExpected.Concat(new[] { "A(1)" }), GetAttributeStrings(field1.
GetAttributes
()));
1812
Assert.Empty(prop2.
GetAttributes
());
1813
AssertEx.SetEqual(propAttributesExpected, GetAttributeStrings(prop2.GetMethod.
GetAttributes
()));
1817
AssertEx.SetEqual(fieldAttributesExpected.Concat(new[] { "A(2)" }), GetAttributeStrings(field2.
GetAttributes
()));
1820
Assert.Equal("B(3)", prop3.
GetAttributes
().Single().ToString());
1821
AssertEx.SetEqual(propAttributesExpected, GetAttributeStrings(prop3.GetMethod.
GetAttributes
()));
1825
AssertEx.SetEqual(fieldAttributesExpected.Concat(new[] { "A(33)" }), GetAttributeStrings(field3.
GetAttributes
()));
1828
Assert.Equal("B(4)", prop4.
GetAttributes
().Single().ToString());
1829
AssertEx.SetEqual(propAttributesExpected, GetAttributeStrings(prop3.GetMethod.
GetAttributes
()));
1833
AssertEx.SetEqual(fieldAttributesExpected.Concat(new[] { "A(44)", "A(444)" }), GetAttributeStrings(field4.
GetAttributes
()));
1858
Assert.Empty(field1.
GetAttributes
());
1866
AssertEx.SetEqual(s_backingFieldAttributes.Concat(dynamicAndTupleNames), GetAttributeStrings(field1.
GetAttributes
()));
1898
Assert.Empty(prop1.
GetAttributes
());
1901
var attributes1 = field1.
GetAttributes
();
1913
Assert.Empty(prop2.
GetAttributes
());
1916
AssertEx.SetEqual(fieldAttributesExpected, GetAttributeStrings(field2.
GetAttributes
()));
1920
var attributes3 = field3.
GetAttributes
();
1960
Assert.Empty(prop1.
GetAttributes
());
1963
var attributes1 = field1.
GetAttributes
();
1975
Assert.Empty(prop2.
GetAttributes
());
1978
AssertEx.SetEqual(fieldAttributesExpected, GetAttributeStrings(field2.
GetAttributes
()));
1982
var attributes3 = field3.
GetAttributes
();
2199
Assert.Empty(prop1.
GetAttributes
());
2203
GetAttributeStrings(field1.
GetAttributes
()));
2206
Assert.Empty(prop2.
GetAttributes
());
2210
GetAttributeStrings(field2.
GetAttributes
()));
2248
Assert.Empty(prop1.
GetAttributes
());
2253
AssertEx.SetEqual(fieldAttributesExpected.Concat(decimalAttributeExpected), GetAttributeStrings(field1.
GetAttributes
()));
2257
AssertEx.SetEqual(fieldAttributesExpected, GetAttributeStrings(field1.
GetAttributes
()));
2262
Assert.Empty(prop2.
GetAttributes
());
2265
AssertEx.SetEqual(fieldAttributesExpected.Concat(decimalAttributeExpected), GetAttributeStrings(field2.
GetAttributes
()));
2270
AssertEx.SetEqual(decimalAttributeExpected, GetAttributeStrings(field3.
GetAttributes
()));
2274
Assert.Empty(GetAttributeStrings(field3.
GetAttributes
()));
2330
Assert.Empty(prop1.
GetAttributes
());
2334
GetAttributeStrings(field1.
GetAttributes
()));
2340
Assert.Empty(prop2.
GetAttributes
());
2344
GetAttributeStrings(field2.
GetAttributes
()));
2464
Assert.Equal("A(2)", prop1.
GetAttributes
().Single().ToString());
2465
AssertEx.SetEqual(propAttributesExpected, GetAttributeStrings(prop1.GetMethod.
GetAttributes
()));
2466
AssertEx.SetEqual(propAttributesExpected, GetAttributeStrings(prop1.SetMethod.
GetAttributes
()));
2469
AssertEx.SetEqual(fieldAttributesExpected.Concat(new[] { "A(1)" }), GetAttributeStrings(field1.
GetAttributes
()));
2474
Assert.Empty(prop2.
GetAttributes
());
2475
AssertEx.SetEqual(propAttributesExpected, GetAttributeStrings(prop2.GetMethod.
GetAttributes
()));
2476
AssertEx.SetEqual(propAttributesExpected, GetAttributeStrings(prop2.SetMethod.
GetAttributes
()));
2479
AssertEx.SetEqual(fieldAttributesExpected, GetAttributeStrings(field2.
GetAttributes
()));
2635
AssertEx.SetEqual(accessorsExpected, GetAttributeNames(event1.AddMethod.
GetAttributes
()));
2636
AssertEx.SetEqual(accessorsExpected, GetAttributeNames(event1.RemoveMethod.
GetAttributes
()));
2645
AssertEx.SetEqual(accessorsExpected, GetAttributeNames(event2.AddMethod.
GetAttributes
()));
2646
AssertEx.SetEqual(accessorsExpected, GetAttributeNames(event2.RemoveMethod.
GetAttributes
()));
2654
AssertEx.SetEqual(accessorsExpected.Concat(new[] { "CC" }), GetAttributeNames(event3.AddMethod.
GetAttributes
()));
2655
AssertEx.SetEqual(accessorsExpected.Concat(new[] { "CC" }), GetAttributeNames(event3.RemoveMethod.
GetAttributes
()));
2663
AssertEx.SetEqual(accessorsExpected, GetAttributeNames(event4.AddMethod.
GetAttributes
()));
2664
AssertEx.SetEqual(accessorsExpected, GetAttributeNames(event4.RemoveMethod.
GetAttributes
()));
2827
return symbol.
GetAttributes
().Single().AttributeClass.Name;
2832
Assert.Equal(0, symbol.
GetAttributes
().Length);
2901
Assert.Equal(0, parameters[0].
GetAttributes
().Length);
2902
Assert.Equal(0, parameters[1].
GetAttributes
().Length);
3025
Assert.Equal(0, parameters[0].
GetAttributes
().Length);
3026
Assert.Equal(0, parameters[1].
GetAttributes
().Length);
3097
var attrs = m.
GetAttributes
();
3103
attrs = assembly.
GetAttributes
();
3113
attrs = field.
GetAttributes
();
3120
attrs = nenum.
GetAttributes
();
3129
attrs = nenum.GetMember("three").
GetAttributes
();
3176
var attrs = dele.
GetAttributes
();
3182
attrs = mem.Parameters[0].
GetAttributes
();
3184
attrs = mem.Parameters[1].
GetAttributes
();
3216
var attrs = type.GetMember<MethodSymbol>("F").
GetAttributes
();
3264
var attrs = cDoc.
GetAttributes
();
3312
var attrs = cDoc.
GetAttributes
();
3364
var attrs = cDoc.
GetAttributes
();
3416
var attrs = cDoc.
GetAttributes
();
3450
var attrs = type.
GetAttributes
();
3463
var attrs = type.
GetAttributes
();
3589
var attrs = type.
GetAttributes
();
3602
var attrs = type.
GetAttributes
();
3637
var attrs = type.
GetAttributes
();
3683
var attrs = type.
GetAttributes
();
4080
var attrs = type.
GetAttributes
();
4096
attrs = fieldSymbol.
GetAttributes
();
4102
attrs = fieldSymbol.
GetAttributes
();
4138
var attrs = type.
GetAttributes
();
4181
var attrs = type.
GetAttributes
();
4225
var attrs = type.
GetAttributes
();
4270
var attrs = type.
GetAttributes
();
4314
var attrs = type.
GetAttributes
();
4645
var attr = c.
GetAttributes
().Single(d => d.AttributeClass?.Name == "A");
4677
var attr = c.
GetAttributes
().Single(d => d.AttributeClass?.Name == "A");
4710
var attr = c.
GetAttributes
().Single(d => d.AttributeClass?.Name == "A");
4742
var attr = c.
GetAttributes
().Single(d => d.AttributeClass?.Name == "A");
4778
var attr = c.
GetAttributes
().Single(d => d.AttributeClass?.Name == "A2");
4809
var attr = c.
GetAttributes
().Single(d => d.AttributeClass?.Name == "A");
4835
var attr = c.
GetAttributes
().Single(d => d.AttributeClass?.Name == "A");
4867
var attr = c.
GetAttributes
().Single(d => d.AttributeClass?.Name == "A");
4901
var ca = goo.
GetAttributes
().First().CommonConstructorArguments.First();
5142
Assert.Equal(2, type.
GetAttributes
().Length);
5179
Assert.Equal(2, typeParameter.
GetAttributes
().Length);
5492
var attrs = classC1.
GetAttributes
();
5497
attrs = classC2.
GetAttributes
();
5502
attrs = classC3.
GetAttributes
();
5508
attrs = classC4.
GetAttributes
();
5515
attrs = classC5.
GetAttributes
();
5524
attrs = classC6.
GetAttributes
();
5616
var attributes = field.
GetAttributes
();
5754
var attr = c.
GetAttributes
().Single();
5798
var attr = c.
GetAttributes
().Single();
5830
Assert.Empty(classTypeParameter.
GetAttributes
());
5832
var attribute = methodTypeParameter.
GetAttributes
().Single();
8354
var attrs = type.
GetAttributes
();
8361
var attrs = type.
GetAttributes
();
8682
Assert.Equal(0, assembly.
GetAttributes
().Length);
8684
Assert.Equal(0, type.
GetAttributes
().Length);
8725
Assert.Equal(0, assembly.
GetAttributes
().Length);
8727
Assert.Equal(0, type.
GetAttributes
().Length);
8772
Assert.Equal(0, assembly.
GetAttributes
().Length);
8774
Assert.Equal(0, type.
GetAttributes
().Length);
8820
Assert.Equal(0, yParam.
GetAttributes
().Length);
8857
Assert.Equal(0, type.
GetAttributes
()[0].ConstructorArguments.Count());
9413
var attrs1 = method1.
GetAttributes
();
9419
var attrs2 = method2.
GetAttributes
();
9424
var attrs3 = method3.
GetAttributes
();
9494
var attrs1 = method1.
GetAttributes
();
9501
var attrs2 = method2.
GetAttributes
();
9507
var attrs3 = method3.
GetAttributes
();
9513
var attrs4 = method4.
GetAttributes
();
9578
var attrs1 = method1.
GetAttributes
();
9584
var attrs2 = method2.
GetAttributes
();
9589
var attrs3 = method3.
GetAttributes
();
9594
var attrs4 = method4.
GetAttributes
();
9651
var attrs1 = method1.
GetAttributes
();
9656
var attrs2 = method2.
GetAttributes
();
9661
var attrs3 = method3.
GetAttributes
();
9725
var attrs1 = method1.
GetAttributes
();
9731
var attrs2 = method2.
GetAttributes
();
9737
var attrs3 = method3.
GetAttributes
();
9743
var attrs4 = method4.
GetAttributes
();
9805
var attrs1 = method1.
GetAttributes
();
9811
var attrs2 = method2.
GetAttributes
();
9816
var attrs3 = method3.
GetAttributes
();
9821
var attrs4 = method4.
GetAttributes
();
9871
var attrs = methods.Select(m => m.
GetAttributes
().Single()).ToArray();
9915
var typeInAttribute = (INamedTypeSymbol)type.
GetAttributes
()[0].ConstructorArguments.First().Value;
9917
Assert.True(((NamedTypeSymbol)type.
GetAttributes
()[0].ConstructorArguments.First().ValueInternal).IsUnboundGenericType);
9925
typeInAttribute = (INamedTypeSymbol)type.
GetAttributes
()[0].ConstructorArguments.First().Value;
9927
Assert.True(((NamedTypeSymbol)type.
GetAttributes
()[0].ConstructorArguments.First().ValueInternal).IsUnboundGenericType);
9999
Assert.True(cc.TypeParameters.Single().
GetAttributes
().IsEmpty);
10000
Assert.Equal("XAttribute", mm.TypeParameters.Single().
GetAttributes
().Single().ToString());
10242
Assert.False(comp.GlobalNamespace.GetTypeMember("C").
GetAttributes
().Single().AttributeClass.IsGenericType);
10246
Assert.False(comp.GlobalNamespace.GetTypeMember("C").
GetAttributes
().Single().AttributeClass.IsGenericType);
10263
Assert.False(comp.GlobalNamespace.GetTypeMember("C").
GetAttributes
().Single().AttributeClass.IsGenericType);
10271
Assert.False(comp.GlobalNamespace.GetTypeMember("C").
GetAttributes
().Single().AttributeClass.IsGenericType);
10292
Assert.False(comp.GlobalNamespace.GetTypeMember("C").
GetAttributes
().Single().AttributeClass.IsGenericType);
10296
Assert.False(comp.GlobalNamespace.GetTypeMember("C").
GetAttributes
().Single().AttributeClass.IsGenericType);
10318
Assert.False(comp.GlobalNamespace.GetTypeMember("C").
GetAttributes
().Single().AttributeClass.IsGenericType);
10322
Assert.False(comp.GlobalNamespace.GetTypeMember("C").
GetAttributes
().Single().AttributeClass.IsGenericType);
10344
Assert.False(comp.GlobalNamespace.GetTypeMember("C").
GetAttributes
().Single().AttributeClass.IsGenericType);
10348
Assert.False(comp.GlobalNamespace.GetTypeMember("C").
GetAttributes
().Single().AttributeClass.IsGenericType);
10369
var attribute = m.
GetAttributes
().Single();
11016
var attrs = lambda.
GetAttributes
();
11151
var attrs = program.
GetAttributes
();
11245
var attrs = holder.
GetAttributes
();
11296
var attrs = module.ContainingAssembly.
GetAttributes
();
11309
var attrs = module.ContainingAssembly.
GetAttributes
();
11368
var attrs = c.
GetAttributes
();
Attributes\AttributeTests_Assembly.cs (20)
871
var attrs = comp.Assembly.
GetAttributes
();
894
var attrs = comp.Assembly.
GetAttributes
();
1022
.
GetAttributes
()
1035
.
GetAttributes
()
1083
var attrs = consoleappCompilation.Assembly.
GetAttributes
();
1126
Assert.Equal(0, consoleappCompilation.Assembly.
GetAttributes
().Length);
1204
var attrs = consoleappCompilation.Assembly.
GetAttributes
();
1241
Assert.Equal(0, consoleappCompilation.Assembly.
GetAttributes
().Length);
1284
var attrs = consoleappCompilation.Assembly.
GetAttributes
();
1332
foreach (var a in module.ContainingAssembly.
GetAttributes
())
1377
var attrs = consoleappCompilation.Assembly.
GetAttributes
();
1425
var attrs = compilation.Assembly.
GetAttributes
();
1436
attrs = compilation.Assembly.
GetAttributes
();
1444
attrs = compilation.Assembly.
GetAttributes
();
1845
var attrs = moduleSymbol.ContainingAssembly.
GetAttributes
().Select(a => a.ToString()).ToArray();
2136
return assembly.
GetAttributes
().Where(data => data.IsTargetAttribute(AttributeDescription.AssemblyDescriptionAttribute));
2246
var attrs = m.ContainingAssembly.
GetAttributes
();
2297
var attrs = m.ContainingAssembly.
GetAttributes
();
2353
var attrs = m.ContainingAssembly.
GetAttributes
();
2381
var attrs = m.ContainingAssembly.
GetAttributes
();
Attributes\AttributeTests_CallerInfoAttributes.cs (7)
2299
var arguments = compilation.GetTypeByMetadataName("Program").
GetAttributes
().Single().CommonConstructorArguments;
3243
AssertEx.Equal(["System.Runtime.CompilerServices.CallerLineNumberAttribute"], goo.Parameters[0].
GetAttributes
().SelectAsArray(attr => attr.ToString()));
3244
AssertEx.Equal(["System.Runtime.CompilerServices.CallerMemberNameAttribute"], goo.Parameters[1].
GetAttributes
().SelectAsArray(attr => attr.ToString()));
3245
AssertEx.Equal(["System.Runtime.CompilerServices.CallerFilePathAttribute"], goo.Parameters[2].
GetAttributes
().SelectAsArray(attr => attr.ToString()));
4406
var attr = ctor.Parameters.Single().
GetAttributes
().Single();
4436
var attr = ctor.Parameters.Single().
GetAttributes
()[0];
5950
AssertEx.Equal(["""System.Runtime.CompilerServices.CallerArgumentExpressionAttribute("value")"""], indexer.Parameters[1].
GetAttributes
().SelectAsArray(attr => attr.ToString()));
Attributes\AttributeTests_Conditional.cs (23)
142
attributesArrayBuilder.Add(classZ.
GetAttributes
());
143
attributesArrayBuilder.Add(classZ.TypeParameters[0].
GetAttributes
());
146
attributesArrayBuilder.Add(methodM.
GetAttributes
());
149
attributesArrayBuilder.Add(param1.
GetAttributes
());
152
attributesArrayBuilder.Add(fieldF.
GetAttributes
());
155
attributesArrayBuilder.Add(propP1.
GetAttributes
());
157
attributesArrayBuilder.Add(propGetMethod.
GetAttributes
());
160
attributesArrayBuilder.Add(propSetMethod.
GetAttributes
());
161
attributesArrayBuilder.Add(propSetMethod.Parameters[0].
GetAttributes
());
164
attributesArrayBuilder.Add(propP2.
GetAttributes
());
166
attributesArrayBuilder.Add(propGetMethod.
GetAttributes
());
170
attributesArrayBuilder.Add(propP3.
GetAttributes
());
172
attributesArrayBuilder.Add(propGetMethod.
GetAttributes
());
175
attributesArrayBuilder.Add(propSetMethod.
GetAttributes
());
176
attributesArrayBuilder.Add(propSetMethod.Parameters[0].
GetAttributes
());
179
attributesArrayBuilder.Add(eventE.
GetAttributes
());
180
attributesArrayBuilder.Add(eventE.AddMethod.
GetAttributes
());
181
attributesArrayBuilder.Add(eventE.RemoveMethod.
GetAttributes
());
184
attributesArrayBuilder.Add(eventE.AssociatedField.
GetAttributes
());
188
attributesArrayBuilder.Add(enumE.
GetAttributes
());
191
attributesArrayBuilder.Add(fieldA.
GetAttributes
());
194
attributesArrayBuilder.Add(structS.
GetAttributes
());
634
var attributes = paramY.
GetAttributes
();
Attributes\AttributeTests_Dynamic.cs (64)
164
ValidateDynamicAttribute(_base0Class.
GetAttributes
(), expectedDynamicAttribute: false);
167
ValidateDynamicAttribute(_base1Class.
GetAttributes
(), expectedDynamicAttribute: false);
170
ValidateDynamicAttribute(_base2Class.
GetAttributes
(), expectedDynamicAttribute: false);
176
ValidateDynamicAttribute(_derivedClass.
GetAttributes
(), expectedDynamicAttribute: true, expectedTransformFlags: _expectedTransformFlags);
182
ValidateDynamicAttribute(_outerClass.
GetAttributes
(), expectedDynamicAttribute: true, expectedTransformFlags: _expectedTransformFlags);
188
ValidateDynamicAttribute(_innerClass.
GetAttributes
(), expectedDynamicAttribute: true, expectedTransformFlags: _expectedTransformFlags);
194
ValidateDynamicAttribute(_innerInnerClass.
GetAttributes
(), expectedDynamicAttribute: true, expectedTransformFlags: _expectedTransformFlags);
200
ValidateDynamicAttribute(_outer2Class.
GetAttributes
(), expectedDynamicAttribute: true, expectedTransformFlags: _expectedTransformFlags);
204
ValidateDynamicAttribute(_inner2Class.
GetAttributes
(), expectedDynamicAttribute: false);
208
ValidateDynamicAttribute(_innerInner2Class.
GetAttributes
(), expectedDynamicAttribute: false);
211
ValidateDynamicAttribute(_inner3Class.
GetAttributes
(), expectedDynamicAttribute: false);
221
ValidateDynamicAttribute(field1.
GetAttributes
(), expectedDynamicAttribute: true);
227
ValidateDynamicAttribute(field2.
GetAttributes
(), expectedDynamicAttribute: true, expectedTransformFlags: expectedTransformFlags);
233
ValidateDynamicAttribute(field3.
GetAttributes
(), expectedDynamicAttribute: true, expectedTransformFlags: expectedTransformFlags);
238
ValidateDynamicAttribute(field4.
GetAttributes
(), expectedDynamicAttribute: true);
244
ValidateDynamicAttribute(field5.
GetAttributes
(), expectedDynamicAttribute: true, expectedTransformFlags: expectedTransformFlags);
250
ValidateDynamicAttribute(field6.
GetAttributes
(), expectedDynamicAttribute: true, expectedTransformFlags: expectedTransformFlags);
256
ValidateDynamicAttribute(field7.
GetAttributes
(), expectedDynamicAttribute: true, expectedTransformFlags: expectedTransformFlags);
262
ValidateDynamicAttribute(field8.
GetAttributes
(), expectedDynamicAttribute: true, expectedTransformFlags: expectedTransformFlags);
268
ValidateDynamicAttribute(field9.
GetAttributes
(), expectedDynamicAttribute: true, expectedTransformFlags: expectedTransformFlags);
274
ValidateDynamicAttribute(field10.
GetAttributes
(), expectedDynamicAttribute: true, expectedTransformFlags: expectedTransformFlags);
280
ValidateDynamicAttribute(field11.
GetAttributes
(), expectedDynamicAttribute: true, expectedTransformFlags: expectedTransformFlags);
286
ValidateDynamicAttribute(field12.
GetAttributes
(), expectedDynamicAttribute: true, expectedTransformFlags: expectedTransformFlags);
292
ValidateDynamicAttribute(field13.
GetAttributes
(), expectedDynamicAttribute: true, expectedTransformFlags: expectedTransformFlags);
298
ValidateDynamicAttribute(field14.
GetAttributes
(), expectedDynamicAttribute: true, expectedTransformFlags: expectedTransformFlags);
304
ValidateDynamicAttribute(field15.
GetAttributes
(), expectedDynamicAttribute: true, expectedTransformFlags: expectedTransformFlags);
310
ValidateDynamicAttribute(field16.
GetAttributes
(), expectedDynamicAttribute: true, expectedTransformFlags: expectedTransformFlags);
316
ValidateDynamicAttribute(field17.
GetAttributes
(), expectedDynamicAttribute: true, expectedTransformFlags: expectedTransformFlags);
322
ValidateDynamicAttribute(field1.
GetAttributes
(), expectedDynamicAttribute: true, expectedTransformFlags: expectedTransformFlags);
329
ValidateDynamicAttribute(f1.
GetAttributes
(), expectedDynamicAttribute: false);
335
ValidateDynamicAttribute(f1.Parameters[0].
GetAttributes
(), expectedDynamicAttribute: true);
339
ValidateDynamicAttribute(f2.
GetAttributes
(), expectedDynamicAttribute: false);
346
ValidateDynamicAttribute(f2.Parameters[0].
GetAttributes
(), expectedDynamicAttribute: true, expectedTransformFlags: _expectedTransformFlags);
350
ValidateDynamicAttribute(f3.
GetAttributes
(), expectedDynamicAttribute: false);
356
ValidateDynamicAttribute(f3.Parameters[0].
GetAttributes
(), expectedDynamicAttribute: true, expectedTransformFlags: _expectedTransformFlags);
360
ValidateDynamicAttribute(f4.
GetAttributes
(), expectedDynamicAttribute: false);
367
ValidateDynamicAttribute(f4.Parameters[0].
GetAttributes
(), expectedDynamicAttribute: true, expectedTransformFlags: _expectedTransformFlags);
371
ValidateDynamicAttribute(f5.
GetAttributes
(), expectedDynamicAttribute: false);
378
ValidateDynamicAttribute(f5.Parameters[0].
GetAttributes
(), expectedDynamicAttribute: true, expectedTransformFlags: _expectedTransformFlags);
386
ValidateDynamicAttribute(prop1.
GetAttributes
(), expectedDynamicAttribute: true);
397
ValidateDynamicAttribute(prop2.
GetAttributes
(), expectedDynamicAttribute: true, expectedTransformFlags: _expectedTransformFlags);
407
ValidateDynamicAttribute(prop2.SetMethod.Parameters[0].
GetAttributes
(), expectedDynamicAttribute: true, expectedTransformFlags: _expectedTransformFlags);
415
ValidateDynamicAttribute(indexer.
GetAttributes
(), expectedDynamicAttribute: true);
423
ValidateDynamicAttribute(indexer.GetMethod.Parameters[0].
GetAttributes
(), expectedDynamicAttribute: true);
431
ValidateDynamicAttribute(indexer.SetMethod.Parameters[0].
GetAttributes
(), expectedDynamicAttribute: true);
432
ValidateDynamicAttribute(indexer.SetMethod.Parameters[1].
GetAttributes
(), expectedDynamicAttribute: true);
442
ValidateDynamicAttribute(_unsafeClass.
GetAttributes
(), expectedDynamicAttribute: true, expectedTransformFlags: _expectedTransformFlags);
451
ValidateDynamicAttribute(nullableField.
GetAttributes
(), expectedDynamicAttribute: true, expectedTransformFlags: _expectedTransformFlags);
460
ValidateDynamicAttribute(_synthesizedMyDelegateType.
GetAttributes
(), expectedDynamicAttribute: false);
470
ValidateDynamicAttribute(ctor.
GetAttributes
(), expectedDynamicAttribute: false);
474
ValidateDynamicAttribute(param.
GetAttributes
(), expectedDynamicAttribute: false);
482
ValidateDynamicAttribute(invokeMethod.
GetAttributes
(), expectedDynamicAttribute: false);
488
ValidateDynamicAttribute(invokeMethod.Parameters[0].
GetAttributes
(), expectedDynamicAttribute: true, expectedTransformFlags: expectedTransformFlags);
498
ValidateDynamicAttribute(beginInvokeMethod.
GetAttributes
(), expectedDynamicAttribute: false);
503
ValidateDynamicAttribute(parameters[0].
GetAttributes
(), expectedDynamicAttribute: true, expectedTransformFlags: expectedTransformFlags);
504
ValidateDynamicAttribute(parameters[1].
GetAttributes
(), expectedDynamicAttribute: false);
505
ValidateDynamicAttribute(parameters[2].
GetAttributes
(), expectedDynamicAttribute: false);
512
ValidateDynamicAttribute(endInvokeMethod.
GetAttributes
(), expectedDynamicAttribute: false);
516
ValidateDynamicAttribute(endInvokeMethod.Parameters[0].
GetAttributes
(), expectedDynamicAttribute: false);
828
DynamicAttributeValidator.ValidateDynamicAttribute(implicitField.
GetAttributes
(), expectedDynamicAttribute: true);
861
DynamicAttributeValidator.ValidateDynamicAttribute(implicitField.
GetAttributes
(), expectedDynamicAttribute: true, expectedTransformFlags: expectedTransformsFlags);
896
DynamicAttributeValidator.ValidateDynamicAttribute(implicitField.
GetAttributes
(), expectedDynamicAttribute: true, expectedTransformFlags: expectedTransformsFlags);
918
DynamicAttributeValidator.ValidateDynamicAttribute(implicitField.
GetAttributes
(), expectedDynamicAttribute: true, expectedTransformFlags: expectedTransformsFlags);
1092
var attrs = getEnumerator.
GetAttributes
();
Attributes\AttributeTests_Embedded.cs (7)
239
Assert.Equal("Microsoft.CodeAnalysis.EmbeddedAttribute", embeddedAttribute.
GetAttributes
().Single(a => a.AttributeClass.Name != "AttributeUsageAttribute").AttributeClass.ToTestDisplayString());
266
Assert.Equal(["System.Runtime.CompilerServices.CompilerGeneratedAttribute", "Microsoft.CodeAnalysis.EmbeddedAttribute"], embeddedAttribute.
GetAttributes
().Select(a => a.AttributeClass.ToTestDisplayString()));
359
AssertEx.Equal("Microsoft.CodeAnalysis.EmbeddedAttribute@<unknown>", embeddedAttributeFile.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
436
Assert.Equal(["Microsoft.CodeAnalysis.EmbeddedAttribute"], embeddedAttribute.
GetAttributes
().Where(a => a.AttributeClass.Name != "ObsoleteAttribute").Select(a => a.AttributeClass.ToTestDisplayString()));
462
Assert.Equal("Microsoft.CodeAnalysis.EmbeddedAttribute", embeddedAttribute.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
502
AssertEx.Equal("Microsoft.CodeAnalysis.EmbeddedAttribute", isReadonlyAttribute.
GetAttributes
().Single(a => a.AttributeClass.Name == "EmbeddedAttribute").AttributeClass.ToTestDisplayString());
544
AssertEx.Equal("Microsoft.CodeAnalysis.EmbeddedAttribute", isReadonlyAttribute.
GetAttributes
().Single(a => a.AttributeClass.Name == "EmbeddedAttribute").AttributeClass.ToTestDisplayString());
Attributes\AttributeTests_IsByRefLike.cs (5)
623
AssertNotReferencedIsByRefLikeAttribute(property.Type.
GetAttributes
());
674
var attribute = type.
GetAttributes
().Single();
759
var attribute = type.
GetAttributes
().Single();
810
var attributes = type.
GetAttributes
();
1095
var attributes = typeSymbol.
GetAttributes
().OrderBy(attribute => attribute.AttributeClass.Name).ToArray();
Attributes\AttributeTests_NativeInteger.cs (4)
1111
AssertNativeIntegerAttribute(method.Parameters[0].
GetAttributes
());
1135
AssertAttributes(method.
GetAttributes
(), "System.Runtime.CompilerServices.CompilerGeneratedAttribute");
1158
AssertNativeIntegerAttribute(method.Parameters[0].
GetAttributes
());
1495
var attributes = member.
GetAttributes
();
Attributes\AttributeTests_Nullable.cs (28)
528
CompileAndVerify(comp, symbolValidator: m => CheckAttribute(m.GlobalNamespace.GetMember("A.F").
GetAttributes
().Single(), "A"));
538
CompileAndVerify(comp, symbolValidator: m => CheckAttribute(m.GlobalNamespace.GetMember("B.G").
GetAttributes
().Single(), "B"));
563
CompileAndVerify(comp, symbolValidator: m => CheckAttribute(m.GlobalNamespace.GetMember("A.F").
GetAttributes
().Single(), "A"));
573
CompileAndVerify(comp, symbolValidator: m => CheckAttribute(m.GlobalNamespace.GetMember("B.G").
GetAttributes
().Single(), "A"));
803
AssertNoNullableAttribute(field.
GetAttributes
());
804
AssertNoNullableAttribute(module.
GetAttributes
());
805
AssertAttributes(assembly.
GetAttributes
(),
817
AssertNoNullableAttribute(field.
GetAttributes
());
818
AssertNoNullableAttribute(module.
GetAttributes
());
819
AssertAttributes(assembly.
GetAttributes
(),
976
AssertNullableAttribute(field.
GetAttributes
());
977
AssertNoNullableAttribute(module.
GetAttributes
());
978
AssertAttributes(assembly.
GetAttributes
(),
1007
AssertAttributes(module.
GetAttributes
());
2170
AssertAttributes(method.
GetAttributes
());
2197
AssertAttributes(method.
GetAttributes
(), "System.Runtime.CompilerServices.NullableContextAttribute");
2198
AssertAttributes(method.Parameters[0].
GetAttributes
());
2225
AssertAttributes(method.Parameters[0].
GetAttributes
());
2226
AssertNullableAttribute(method.Parameters[1].
GetAttributes
());
2278
AssertAttributes(method.
GetAttributes
(), "System.Runtime.CompilerServices.CompilerGeneratedAttribute");
2301
AssertNullableAttribute(method.Parameters[0].
GetAttributes
());
2302
AssertNoNullableAttribute(method.Parameters[1].
GetAttributes
());
2511
AssertNoNullableAttribute(method.
GetAttributes
());
2535
AssertNoNullableAttribute(property.
GetAttributes
());
2538
AssertAttributes(method.
GetAttributes
(), "System.Diagnostics.DebuggerHiddenAttribute");
2561
AssertNoNullableAttribute(property.
GetAttributes
());
2564
AssertAttributes(method.
GetAttributes
(), "System.Diagnostics.DebuggerHiddenAttribute");
4996
var attributes = method.Parameters[0].
GetAttributes
();
Attributes\AttributeTests_NullablePublicOnly.cs (1)
587
var attribute = module.
GetAttributes
().SingleOrDefault();
Attributes\AttributeTests_ReadOnlyStruct.cs (10)
41
Assert.Empty(type.
GetAttributes
());
60
Assert.Empty(type.
GetAttributes
());
78
Assert.Empty(type.
GetAttributes
());
96
Assert.Empty(type.
GetAttributes
());
114
Assert.Empty(type.
GetAttributes
());
140
Assert.Empty(type.
GetAttributes
());
436
Assert.Empty(type.
GetAttributes
());
586
AssertNotReferencedIsReadOnlyAttribute(type.
GetAttributes
());
615
AssertNotReferencedIsReadOnlyAttribute(property.Type.
GetAttributes
());
662
var attributes = typeSymbol.
GetAttributes
().OrderBy(attribute => attribute.AttributeClass.Name).ToArray();
Attributes\AttributeTests_RefReadOnly.cs (87)
44
Assert.Empty(parameter.
GetAttributes
());
69
Assert.Empty(parameter.
GetAttributes
());
126
Assert.Empty(parameter.
GetAttributes
());
155
Assert.Empty(parameter.
GetAttributes
());
177
Assert.Empty(parameter.
GetAttributes
());
207
Assert.Empty(parameter.
GetAttributes
());
234
Assert.Empty(parameter.
GetAttributes
());
251
Assert.Empty(parameter.
GetAttributes
());
278
Assert.Empty(parameter.
GetAttributes
());
313
Assert.Empty(property.
GetAttributes
());
342
Assert.Empty(property.
GetAttributes
());
378
Assert.Empty(property.
GetAttributes
());
408
Assert.Empty(parameter.
GetAttributes
());
409
Assert.Empty(indexer.
GetAttributes
());
428
Assert.Empty(parameter.
GetAttributes
());
449
Assert.Empty(indexer.
GetAttributes
());
480
Assert.Empty(parameter.
GetAttributes
());
481
Assert.Empty(indexer.
GetAttributes
());
507
Assert.Empty(parameter.
GetAttributes
());
523
Assert.Empty(parameter.
GetAttributes
());
567
Assert.Empty(parameter.
GetAttributes
());
604
Assert.Empty(parameter.
GetAttributes
());
627
Assert.Empty(parameter.
GetAttributes
());
692
Assert.Empty(parameter.
GetAttributes
());
731
Assert.Empty(parameter.
GetAttributes
());
758
Assert.Empty(parameter.
GetAttributes
());
825
Assert.Empty(parameter.
GetAttributes
());
1162
Assert.Empty(parameter.
GetAttributes
());
1313
Assert.Empty(parameter.
GetAttributes
());
1350
Assert.Empty(parameter.
GetAttributes
());
1593
Assert.Empty(method.Parameters.Single().
GetAttributes
());
1596
Assert.Empty(@operator.Parameters[0].
GetAttributes
());
1597
Assert.Empty(@operator.Parameters[1].
GetAttributes
());
1600
Assert.Empty(property.
GetAttributes
());
1603
Assert.Empty(indexer.
GetAttributes
());
1604
Assert.Empty(indexer.Parameters.Single().
GetAttributes
());
1635
Assert.Empty(method.Parameters.Single().
GetAttributes
());
1638
Assert.Empty(@operator.Parameters[0].
GetAttributes
());
1639
Assert.Empty(@operator.Parameters[1].
GetAttributes
());
1642
Assert.Empty(property.
GetAttributes
());
1645
Assert.Empty(indexer.
GetAttributes
());
1646
Assert.Empty(indexer.Parameters.Single().
GetAttributes
());
1679
Assert.Empty(method.Parameters.Single().
GetAttributes
());
1682
Assert.Empty(@operator.Parameters[0].
GetAttributes
());
1683
Assert.Empty(@operator.Parameters[1].
GetAttributes
());
1686
Assert.Empty(property.
GetAttributes
());
1689
Assert.Empty(indexer.
GetAttributes
());
1690
Assert.Empty(indexer.Parameters.Single().
GetAttributes
());
1728
Assert.Empty(method.Parameters.Single().
GetAttributes
());
1731
Assert.Empty(property.
GetAttributes
());
1734
Assert.Empty(indexer.
GetAttributes
());
1735
Assert.Empty(indexer.Parameters.Single().
GetAttributes
());
1775
Assert.Empty(method.Parameters.Single().
GetAttributes
());
1778
Assert.Empty(property.
GetAttributes
());
1781
Assert.Empty(indexer.
GetAttributes
());
1782
Assert.Empty(indexer.Parameters.Single().
GetAttributes
());
1819
Assert.Empty(method.Parameters.Single().
GetAttributes
());
1822
Assert.Empty(property.
GetAttributes
());
1825
Assert.Empty(indexer.
GetAttributes
());
1826
Assert.Empty(indexer.Parameters.Single().
GetAttributes
());
1868
Assert.Empty(method.Parameters.Single().
GetAttributes
());
1871
Assert.Empty(property.
GetAttributes
());
1874
Assert.Empty(indexer.
GetAttributes
());
1875
Assert.Empty(indexer.Parameters.Single().
GetAttributes
());
1908
Assert.Empty(method.Parameters.Single().
GetAttributes
());
1911
Assert.Empty(@operator.Parameters[0].
GetAttributes
());
1912
Assert.Empty(@operator.Parameters[1].
GetAttributes
());
1915
Assert.Empty(property.
GetAttributes
());
1918
Assert.Empty(indexer.
GetAttributes
());
1919
Assert.Empty(indexer.Parameters.Single().
GetAttributes
());
1977
Assert.Empty(method.Parameters.Single().
GetAttributes
());
1980
Assert.Empty(property.
GetAttributes
());
1983
Assert.Empty(indexer.
GetAttributes
());
1984
Assert.Empty(indexer.Parameters.Single().
GetAttributes
());
2026
Assert.Empty(method.Parameters.Single().
GetAttributes
());
2029
Assert.Empty(property.
GetAttributes
());
2032
Assert.Empty(indexer.
GetAttributes
());
2033
Assert.Empty(indexer.Parameters.Single().
GetAttributes
());
2066
Assert.Empty(method.Parameters.Single().
GetAttributes
());
2069
Assert.Empty(property.
GetAttributes
());
2072
Assert.Empty(indexer.
GetAttributes
());
2073
Assert.Empty(indexer.Parameters.Single().
GetAttributes
());
2108
Assert.Empty(method.Parameters.Single().
GetAttributes
());
2111
Assert.Empty(property.
GetAttributes
());
2114
Assert.Empty(indexer.
GetAttributes
());
2115
Assert.Empty(indexer.Parameters.Single().
GetAttributes
());
2554
var attributes = typeSymbol.
GetAttributes
().OrderBy(attribute => attribute.AttributeClass.Name).ToArray();
Attributes\AttributeTests_RefSafetyRules.cs (1)
222
var attribute = module.
GetAttributes
().SingleOrDefault();
Attributes\AttributeTests_Synthesized.cs (69)
130
var actualAttrs = GetAttributeNames(pid.
GetAttributes
());
152
var actualAttrs = GetAttributeNames(bufferType.
GetAttributes
());
265
AssertEx.SetEqual(new[] { "CompilerGeneratedAttribute" }, GetAttributeNames(displayClass.
GetAttributes
()));
269
Assert.Equal(0, member.
GetAttributes
().Length);
304
AssertEx.SetEqual(expected, GetAttributeNames(anon.
GetAttributes
()));
308
var actual = GetAttributeNames(member.
GetAttributes
());
405
var dd = anon.
GetAttributes
().Where(a => a.AttributeClass.Name == "DebuggerDisplayAttribute").Single();
431
AssertEx.SetEqual(new[] { "CompilerGeneratedAttribute" }, GetAttributeNames(iter.
GetAttributes
()));
444
AssertEx.SetEqual(new[] { "DebuggerHiddenAttribute" }, GetAttributeNames(member.
GetAttributes
()));
450
AssertEx.SetEqual(new string[] { }, GetAttributeNames(member.
GetAttributes
()));
488
new[] { "AsyncStateMachineAttribute" }, GetAttributeNames(goo.
GetAttributes
()));
491
AssertEx.SetEqual(new[] { "CompilerGeneratedAttribute" }, GetAttributeNames(iter.
GetAttributes
()));
501
AssertEx.SetEqual(new[] { "DebuggerHiddenAttribute" }, GetAttributeNames(member.
GetAttributes
()));
505
AssertEx.SetEqual(new string[] { }, GetAttributeNames(member.
GetAttributes
()));
543
var attributes = module.GlobalNamespace.GetTypeMember("B").GetMember<MethodSymbol>("<>n__0").
GetAttributes
();
582
AssertEx.SetEqual(new[] { "CompilerGeneratedAttribute", "DebuggerHiddenAttribute" }, GetAttributeNames(baseMethodWrapper.
GetAttributes
()));
586
Assert.Empty(parameter.
GetAttributes
());
625
AssertEx.SetEqual(new[] { "CompilerGeneratedAttribute", "DebuggerHiddenAttribute" }, GetAttributeNames(baseMethodWrapper.
GetAttributes
()));
629
Assert.Empty(parameter.
GetAttributes
());
632
Assert.Empty(typeParameter.
GetAttributes
());
652
Assert.Equal(new[] { "Attr" }, GetAttributeNames(typeParam.
GetAttributes
()));
703
Assert.Empty(ctor[1].
GetAttributes
()); // shouldn't have attribute.
709
Assert.Empty(myProperty.
GetAttributes
());
720
var attributeNames = GetAttributeNames(symbol.
GetAttributes
());
763
Assert.Empty(ctor.
GetAttributes
());
766
Assert.Empty(myProperty.
GetAttributes
());
777
var attributeNames = GetAttributeNames(symbol.
GetAttributes
());
845
Assert.Empty(ctor[0].
GetAttributes
());
854
Assert.Empty(p1.
GetAttributes
());
859
var attributeNames = GetAttributeNames(symbol.
GetAttributes
());
885
Assert.Empty(ctor[0].
GetAttributes
());
886
Assert.Empty(ctor[1].
GetAttributes
());
918
Assert.Empty(p1.
GetAttributes
());
923
var attributeNames = GetAttributeNames(symbol.
GetAttributes
());
946
Assert.Empty(ctor.
GetAttributes
());
949
Assert.Empty(toString.
GetAttributes
());
952
Assert.Empty(op_Equality.
GetAttributes
());
955
Assert.Empty(op_Inequality.
GetAttributes
());
958
Assert.Empty(getHashCode.
GetAttributes
());
962
Assert.Empty(equals[0].
GetAttributes
());
963
Assert.Empty(equals[1].
GetAttributes
());
984
var attributes = module.ContainingAssembly.
GetAttributes
();
1019
var attributes = module.ContainingAssembly.
GetAttributes
();
1054
var attributes = module.ContainingAssembly.
GetAttributes
();
1089
var attributes = module.ContainingAssembly.
GetAttributes
();
1126
VerifyDebuggableAttribute(module.
GetAttributes
().Single(), optimizationLevel, isSynthesized: false);
1128
var attributes = module.ContainingAssembly.
GetAttributes
();
1164
var attributes = module.ContainingAssembly.
GetAttributes
();
1200
VerifyCompilationRelaxationsAttribute(module.
GetAttributes
().Single(), isSynthesized: false);
1202
var assemblyAttributes = module.ContainingAssembly.
GetAttributes
();
1238
VerifyDebuggableAttribute(module.
GetAttributes
().Single(), options.OptimizationLevel, isSynthesized: false);
1240
var assemblyAttributes = module.ContainingAssembly.
GetAttributes
();
1280
var assemblyAttributes = module.ContainingAssembly.
GetAttributes
();
1310
var attributes = module.ContainingAssembly.
GetAttributes
();
1359
var attributes = module.ContainingAssembly.
GetAttributes
();
1406
var attributes = module.ContainingAssembly.
GetAttributes
();
1450
var attributes = module.ContainingAssembly.
GetAttributes
();
1495
var assemblyAttributes = module.ContainingAssembly.
GetAttributes
();
1535
var attributes = module.ContainingAssembly.
GetAttributes
();
1576
var attributes = module.ContainingAssembly.
GetAttributes
();
1613
var unverifiableCode = module.
GetAttributes
().Single();
1680
var attributes = asyncMethod.
GetAttributes
();
1723
var attributes = asyncMethod.
GetAttributes
();
1765
var attributes = asyncMethod.
GetAttributes
();
1812
Assert.Equal("DebuggerStepThroughAttribute", asyncMethod.
GetAttributes
().Single().AttributeClass.Name);
1816
Assert.Empty(asyncMethod.
GetAttributes
());
1846
var iteratorAttribute = iteratorMethod.
GetAttributes
().Single();
1876
var iteratorAttribute = iteratorMethod.
GetAttributes
().Single();
1907
Assert.Empty(type.GetMember<MethodSymbol>("F").
GetAttributes
());
Attributes\AttributeTests_Tuples.cs (30)
349
ValidateTupleNameAttribute(invokeMethod.
GetAttributes
(), expectedTupleNamesAttribute: false);
355
ValidateTupleNameAttribute(sender.
GetAttributes
(), expectedTupleNamesAttribute: false);
364
ValidateTupleNameAttribute(args.
GetAttributes
(),
369
args.
GetAttributes
(),
386
ValidateTupleNameAttribute(event1.
GetAttributes
(),
393
event1.
GetAttributes
(),
405
ValidateTupleNameAttribute(_base0Class.
GetAttributes
(), expectedTupleNamesAttribute: false);
408
ValidateTupleNameAttribute(_base1Class.
GetAttributes
(), expectedTupleNamesAttribute: false);
411
ValidateTupleNameAttribute(_base2Class.
GetAttributes
(), expectedTupleNamesAttribute: false);
416
ValidateTupleNameAttribute(_outerClass.
GetAttributes
(),
429
ValidateTupleNameAttribute(_derivedClass.
GetAttributes
(),
439
ValidateTupleNameAttribute(field1.
GetAttributes
(), expectedTupleNamesAttribute: true, expectedElementNames: expectedElementNames);
444
ValidateTupleNameAttribute(field2.
GetAttributes
(), expectedTupleNamesAttribute: true, expectedElementNames: expectedElementNames);
449
ValidateTupleNameAttribute(field3.
GetAttributes
(), expectedTupleNamesAttribute: true, expectedElementNames: expectedElementNames);
454
ValidateTupleNameAttribute(field4.
GetAttributes
(), expectedTupleNamesAttribute: true, expectedElementNames: expectedElementNames);
456
field4.
GetAttributes
(),
469
ValidateTupleNameAttribute(field5.
GetAttributes
(),
473
field5.
GetAttributes
(),
484
ValidateTupleNameAttribute(field6.
GetAttributes
(), expectedTupleNamesAttribute: false);
499
ValidateTupleNameAttribute(field7.
GetAttributes
(), expectedTupleNamesAttribute: false);
510
ValidateTupleNameAttribute(field8.
GetAttributes
(), expectedTupleNamesAttribute: true,
520
ValidateTupleNameAttribute(field9.
GetAttributes
(), expectedTupleNamesAttribute: true,
536
ValidateTupleNameAttribute(method2.Parameters.Single().
GetAttributes
(),
547
ValidateTupleNameAttribute(method3.Parameters.Single().
GetAttributes
(),
558
ValidateTupleNameAttribute(method4.Parameters.Single().
GetAttributes
(),
571
ValidateTupleNameAttribute(method5.Parameters.Single().
GetAttributes
(), expectedTupleNamesAttribute: false);
590
ValidateTupleNameAttribute(prop1.
GetAttributes
(),
597
ValidateTupleNameAttribute(prop2.
GetAttributes
(),
604
ValidateTupleNameAttribute(indexer.
GetAttributes
(),
608
ValidateTupleNameAttribute(indexer.Parameters.Single().
GetAttributes
(),
Attributes\AttributeTests_WellKnownAttributes.cs (38)
135
var attrs = assembly.
GetAttributes
();
156
Assert.Equal(6, igoo.
GetAttributes
().Length);
182
Assert.Equal(1, mem.
GetAttributes
().Length);
183
attrSym = mem.
GetAttributes
().First();
188
attrSym = mem.
GetAttributes
().First();
193
Assert.Equal(1, mem.
GetAttributes
().Length);
196
attrSym = mem.
GetAttributes
().First();
264
Assert.Equal(2, type1.
GetAttributes
().Length);
280
Assert.Equal(2, type2.
GetAttributes
().Length);
304
Assert.Equal(2, type3.
GetAttributes
().Length);
313
Assert.Equal(0, field.
GetAttributes
().Length);
316
Assert.Equal(1, field.
GetAttributes
().Length);
317
attrSym = field.
GetAttributes
().First();
321
attrSym = field.
GetAttributes
().First();
423
Assert.Equal(3, parm.
GetAttributes
().Length);
434
Assert.Equal(3, parm.
GetAttributes
().Length);
444
attrSym = method.
GetAttributes
().First();
448
attrSym = parm.
GetAttributes
().First();
453
attrSym = parm.
GetAttributes
().First();
464
Assert.Equal(2, type2.
GetAttributes
().Length);
477
Assert.Equal(3, field.
GetAttributes
().Length);
874
Assert.Equal(0, ps[0].
GetAttributes
().Length);
904
Assert.Equal(0, ps[0].
GetAttributes
().Length);
933
Assert.Equal(0, ps[0].
GetAttributes
().Length);
2478
var attrSym = method.
GetAttributes
().First();
2486
attrSym = method.
GetAttributes
().First();
3676
Assert.Equal(2, typeA.
GetAttributes
().Length);
3690
Assert.Equal(1, typeA.
GetAttributes
().Length);
3756
var attrs = worksheetInterface.
GetAttributes
().AsEnumerable();
3887
var attrs = worksheetInterface.
GetAttributes
().AsEnumerable();
4900
AssertEx.SetEqual(expectedAttributes, typeC.
GetAttributes
().Select(a => a.ToString()));
5079
Assert.Empty(noParamsParameter.
GetAttributes
());
5644
Assert.Equal(0, typeA.
GetAttributes
().Length);
5710
Assert.Equal(0, method.
GetAttributes
().Length);
5753
Assert.Equal(new[] { "CompilerGeneratedAttribute" }, GetAttributeNames(method.
GetAttributes
()));
13227
GetMember<MethodSymbol>("MoveNext").
GetAttributes
().Length);
13237
GetMember<MethodSymbol>("MoveNext").
GetAttributes
().Length);
13541
var attribute = module.ContainingAssembly.GetTypeByMetadataName("Program").GetMethod("Test").Parameters.Single().
GetAttributes
().Single();
Attributes\InternalsVisibleToAndStrongNameTests.cs (3)
117
foreach (var attrData in m.ContainingAssembly.
GetAttributes
())
263
foreach (var attrData in m.ContainingAssembly.
GetAttributes
())
2804
Assert.False(assembly.
GetAttributes
().Any(attr => attr.IsTargetAttribute(AttributeDescription.InternalsVisibleToAttribute)));
FieldKeywordTests.cs (6)
10080
AssertEx.Equal(["A(2)"], actualFields[0].
GetAttributes
().ToStrings());
10081
AssertEx.Equal(["A(3)"], actualFields[1].
GetAttributes
().ToStrings());
10082
AssertEx.Equal(["A(5)", "A(6)"], actualFields[2].
GetAttributes
().ToStrings());
10147
AssertEx.Equal(["A(2)"], actualFields[0].
GetAttributes
().ToStrings());
10148
AssertEx.Equal(["A(3)"], actualFields[1].
GetAttributes
().ToStrings());
10149
AssertEx.Equal(["A(5)", "A(6)"], actualFields[2].
GetAttributes
().ToStrings());
OverloadResolutionPriorityTests.cs (5)
906
var attr = c!.
GetAttributes
().Single();
992
var attrs = ctors.SelectAsArray(ctor => ctor.
GetAttributes
());
1001
AssertEx.Equal("System.Runtime.CompilerServices.OverloadResolutionPriorityAttribute..ctor(System.Int32 priority)", m.
GetAttributes
().First().AttributeConstructor.ToTestDisplayString());
1101
m.ContainingAssembly.GetTypeByMetadataName("C")!.
GetAttributes
().Single().AttributeConstructor.ToTestDisplayString());
1144
m.ContainingAssembly.GetTypeByMetadataName("C")!.
GetAttributes
().Single().AttributeConstructor.ToTestDisplayString());
PartialEventsAndConstructorsTests.cs (25)
3258
assertEqual([declAttributes, implAttributes], ctor.
GetAttributes
());
3261
assertEqual([implAttributes, declAttributes], ctorParam.
GetAttributes
());
3264
assertEqual([declAttributes, implAttributes], ev.
GetAttributes
());
3268
assertEqual([declAttributes, implAttributes], ((SourceConstructorSymbol)ctor).PartialImplementationPart!.
GetAttributes
());
3269
assertEqual([declAttributes, implAttributes], ((SourceEventSymbol)ev).PartialImplementationPart!.
GetAttributes
());
3380
AssertEx.Equal(["A(1)", "A(41)", "A(2)", "A(42)"], e.
GetAttributes
().ToStrings());
3381
AssertEx.Equal(["A(3)", "A(13)"], e.AddMethod!.
GetAttributes
().ToStrings());
3382
AssertEx.Equal(["A(23)"], e.AddMethod.Parameters.Single().
GetAttributes
().ToStrings());
3384
AssertEx.Equal(["A(4)", "A(14)"], e.RemoveMethod!.
GetAttributes
().ToStrings());
3385
AssertEx.Equal(["A(24)"], e.RemoveMethod.Parameters.Single().
GetAttributes
().ToStrings());
3391
AssertEx.Equal(["A(1)", "A(41)", "A(2)", "A(42)"], eImpl.
GetAttributes
().ToStrings());
3392
AssertEx.Equal(["A(3)", "A(13)"], eImpl.AddMethod!.
GetAttributes
().ToStrings());
3393
AssertEx.Equal(["A(23)"], eImpl.AddMethod.Parameters.Single().
GetAttributes
().ToStrings());
3395
AssertEx.Equal(["A(4)", "A(14)"], eImpl.RemoveMethod!.
GetAttributes
().ToStrings());
3396
AssertEx.Equal(["A(24)"], eImpl.RemoveMethod.Parameters.Single().
GetAttributes
().ToStrings());
3401
AssertEx.Equal(["A(1)", "A(41)", "A(2)", "A(42)"], f.
GetAttributes
().ToStrings());
3402
AssertEx.Equal([.. compiledGeneratedAttr, "A(11)", "A(12)"], f.AddMethod!.
GetAttributes
().ToStrings());
3403
AssertEx.Equal(["A(22)", "A(21)"], f.AddMethod.Parameters.Single().
GetAttributes
().ToStrings());
3405
AssertEx.Equal([.. compiledGeneratedAttr, "A(11)", "A(12)"], f.RemoveMethod!.
GetAttributes
().ToStrings());
3406
AssertEx.Equal(["A(22)", "A(21)"], f.RemoveMethod.Parameters.Single().
GetAttributes
().ToStrings());
3412
AssertEx.Equal(["A(1)", "A(41)", "A(2)", "A(42)"], fImpl.
GetAttributes
().ToStrings());
3413
AssertEx.Equal([.. compiledGeneratedAttr, "A(11)", "A(12)"], fImpl.AddMethod!.
GetAttributes
().ToStrings());
3414
AssertEx.Equal(["A(22)", "A(21)"], fImpl.AddMethod.Parameters.Single().
GetAttributes
().ToStrings());
3416
AssertEx.Equal([.. compiledGeneratedAttr, "A(11)", "A(12)"], fImpl.RemoveMethod!.
GetAttributes
().ToStrings());
3417
AssertEx.Equal(["A(22)", "A(21)"], fImpl.RemoveMethod.Parameters.Single().
GetAttributes
().ToStrings());
RefReadonlyParameterTests.cs (8)
70
Assert.Empty(parameter.
GetAttributes
());
336
var attribute = Assert.Single(p.
GetAttributes
());
443
var attribute = Assert.Single(p.
GetAttributes
());
976
Assert.Empty(p.
GetAttributes
());
1073
Assert.Empty(p.
GetAttributes
());
1125
Assert.Empty(p.
GetAttributes
());
1177
Assert.Empty(p.
GetAttributes
());
1227
Assert.Empty(p.
GetAttributes
());
Semantics\CollectionExpressionTests.cs (3)
13986
Assert.Collection(type.
GetAttributes
(),
13989
m => m.
GetAttributes
().Any(a => a.AttributeClass?.ToTestDisplayString() == "System.Runtime.CompilerServices.CompilerGeneratedAttribute"));
28184
var argument = program.
GetAttributes
().Single().ConstructorArguments.Single();
Semantics\ExtensionTests.cs (15)
5750
AssertEx.Equal("System.Runtime.CompilerServices.IteratorStateMachineAttribute(typeof(Extensions.<M>d__1))", implementation.
GetAttributes
().Single().ToString());
6151
AssertEx.Equal("System.Runtime.CompilerServices.AsyncStateMachineAttribute(typeof(Extensions.<M>d__1))", implementation.
GetAttributes
().Single().ToString());
7226
AssertEx.Equal("System.Runtime.CompilerServices.IteratorStateMachineAttribute(typeof(Extensions.<M>d__1<,>))", implementation.
GetAttributes
().Single().ToString());
7615
AssertEx.Equal("System.Runtime.CompilerServices.AsyncStateMachineAttribute(typeof(Extensions.<M>d__1<,>))", implementation.
GetAttributes
().Single().ToString());
8777
AssertEx.Equal("System.Runtime.CompilerServices.IteratorStateMachineAttribute(typeof(Extensions.<M>d__1))", implementation.
GetAttributes
().Single().ToString());
9142
AssertEx.Equal("System.Runtime.CompilerServices.AsyncStateMachineAttribute(typeof(Extensions.<M>d__1))", implementation.
GetAttributes
().Single().ToString());
32102
AssertEx.Equal("System.Runtime.CompilerServices.OverloadResolutionPriorityAttribute(0)", implementations[0].
GetAttributes
().Single().ToString());
32105
AssertEx.Equal("System.Runtime.CompilerServices.OverloadResolutionPriorityAttribute(1)", implementations[1].
GetAttributes
().Single().ToString());
32334
AssertEx.Equal("System.Runtime.CompilerServices.OverloadResolutionPriorityAttribute(0)", implementations[0].
GetAttributes
().Single().ToString());
32337
AssertEx.Equal("System.Runtime.CompilerServices.OverloadResolutionPriorityAttribute(1)", implementations[1].
GetAttributes
().Single().ToString());
32502
Assert.Equal("System.Runtime.CompilerServices.OverloadResolutionPriorityAttribute(1)", implementations[0].
GetAttributes
().Single().ToString());
32505
Assert.Empty(implementations[1].
GetAttributes
());
32548
Assert.Equal("System.Runtime.CompilerServices.OverloadResolutionPriorityAttribute(1)", implementations[0].
GetAttributes
().Single().ToString());
32551
Assert.Equal("System.Runtime.CompilerServices.OverloadResolutionPriorityAttribute(0)", implementations[1].
GetAttributes
().Single().ToString());
32635
implementation.
GetAttributes
().ToStrings());
Semantics\ExtensionTests2.cs (13)
841
m.GlobalNamespace.GetMember<MethodSymbol>("E.M").Parameters[1].
GetAttributes
().ToStrings());
868
m.GlobalNamespace.GetMember<MethodSymbol>("E.M").Parameters[0].
GetAttributes
().ToStrings());
871
m.GlobalNamespace.GetMember<MethodSymbol>("E.get_Property").Parameters[0].
GetAttributes
().ToStrings());
1633
Assert.Empty(m.GlobalNamespace.GetMember<MethodSymbol>("E.set_P").Parameters[0].
GetAttributes
());
1638
Assert.Empty(m.GlobalNamespace.GetMember<MethodSymbol>("E.set_P2").Parameters[0].
GetAttributes
());
1700
Assert.Empty(m.GlobalNamespace.GetMember<MethodSymbol>("E.set_P").Parameters[0].
GetAttributes
());
1705
Assert.Empty(m.GlobalNamespace.GetMember<MethodSymbol>("E.set_P2").Parameters[0].
GetAttributes
());
1746
m.GlobalNamespace.GetMember<MethodSymbol>("E.set_P").Parameters[0].
GetAttributes
().ToStrings());
1750
Assert.Empty(m.GlobalNamespace.GetMember<MethodSymbol>("E.set_P2").Parameters[0].
GetAttributes
());
1809
m.GlobalNamespace.GetMember<MethodSymbol>("E.set_P").Parameters[0].
GetAttributes
().ToStrings());
1813
Assert.Empty(m.GlobalNamespace.GetMember<MethodSymbol>("E.set_P2").Parameters[0].
GetAttributes
());
2134
m.GlobalNamespace.GetTypeMember("E").
GetAttributes
().ToStrings());
2168
m.GlobalNamespace.GetTypeMember("E").
GetAttributes
().ToStrings());
Semantics\ParamsCollectionTests.cs (23)
239
var attributeData1 = comp.GetTypeByMetadataName(name).
GetAttributes
().Single();
355
var attributeData1 = comp.GetTypeByMetadataName(name).
GetAttributes
().Single();
538
var attributeData1 = comp.GetTypeByMetadataName(name).
GetAttributes
().Single();
683
var attributeData1 = comp.GetTypeByMetadataName(name).
GetAttributes
().Single();
1427
var attributeData1 = comp.GetTypeByMetadataName(name).
GetAttributes
().Single();
2551
var attributeData1 = comp.GetTypeByMetadataName(name).
GetAttributes
().Single();
2687
var attributeData1 = comp.GetTypeByMetadataName(name).
GetAttributes
().Single();
10398
Assert.Empty(test1.
GetAttributes
());
10399
Assert.Empty(test2.
GetAttributes
());
10412
Assert.Empty(test1.
GetAttributes
());
10413
Assert.Empty(test2.
GetAttributes
());
10521
Assert.Empty(test1.
GetAttributes
());
10522
Assert.Empty(test2.
GetAttributes
());
10536
Assert.Empty(test1.
GetAttributes
());
10537
Assert.Empty(test2.
GetAttributes
());
10645
Assert.Empty(test1.
GetAttributes
());
10646
Assert.Empty(test2.
GetAttributes
());
10660
Assert.Empty(test1.
GetAttributes
());
10661
Assert.Empty(test2.
GetAttributes
());
10763
Assert.Empty(test1.
GetAttributes
());
10764
Assert.Empty(test2.
GetAttributes
());
10777
Assert.Empty(test1.
GetAttributes
());
10778
Assert.Empty(test2.
GetAttributes
());
Semantics\PrimaryConstructorTests.cs (27)
3048
return GetAttributeStrings(symbol.
GetAttributes
());
3103
Assert.Empty(comp.GetTypeByMetadataName("Test1").InstanceConstructors.Where(c => !c.IsDefaultValueTypeConstructor()).Single().Parameters[0].
GetAttributes
());
3104
Assert.Equal(2, comp.GetTypeByMetadataName("Test2").InstanceConstructors.Where(c => !c.IsDefaultValueTypeConstructor()).Single().Parameters[0].
GetAttributes
().Count());
3146
Assert.Empty(comp.GetTypeByMetadataName("Test1").InstanceConstructors.Where(c => !c.IsDefaultValueTypeConstructor()).Single().Parameters[0].
GetAttributes
());
3147
Assert.Equal(1, comp.GetTypeByMetadataName("Test2").InstanceConstructors.Where(c => !c.IsDefaultValueTypeConstructor()).Single().Parameters[0].
GetAttributes
().Count());
3225
Assert.True(c.Constructors.Where(ctor => ctor != c.PrimaryConstructor).All(ctor => ctor.
GetAttributes
().IsEmpty));
3250
Assert.Empty(c.
GetAttributes
());
3251
Assert.True(c.Constructors.All(ctor => ctor.
GetAttributes
().IsEmpty));
3327
Assert.True(e.Constructors.All(ctor => ctor.
GetAttributes
().IsEmpty));
3359
Assert.True(c.Constructors.All(ctor => ctor.
GetAttributes
().IsEmpty));
3380
Assert.Equal("A", c.
GetAttributes
().Single().ToString());
3381
Assert.True(c.Constructors.All(ctor => ctor.
GetAttributes
().IsEmpty));
3401
Assert.Equal("A", c.
GetAttributes
().Single().ToString());
3402
Assert.True(c.Constructors.All(ctor => ctor.
GetAttributes
().IsEmpty));
3446
Assert.True(c1.Constructors.Where(ctor => ctor != c1.PrimaryConstructor).All(ctor => ctor.
GetAttributes
().IsEmpty));
3452
Assert.True(c2.Constructors.Where(ctor => ctor != c2.PrimaryConstructor).All(ctor => ctor.
GetAttributes
().IsEmpty));
3508
Assert.True(c1.Constructors.Where(ctor => ctor != c1.PrimaryConstructor).All(ctor => ctor.
GetAttributes
().IsEmpty));
3514
Assert.True(c2.Constructors.Where(ctor => ctor != c2.PrimaryConstructor).All(ctor => ctor.
GetAttributes
().IsEmpty));
15716
var attr = m.GlobalNamespace.GetTypeMember("C1").GetMembers().OfType<FieldSymbol>().Single().
GetAttributes
();
15738
var attr = m.GlobalNamespace.GetTypeMember("C1").GetMembers().OfType<FieldSymbol>().Single().
GetAttributes
();
15759
var attr = m.GlobalNamespace.GetTypeMember("C1").GetMembers().OfType<FieldSymbol>().Single().
GetAttributes
();
15780
var attr = m.GlobalNamespace.GetTypeMember("C1").GetMembers().OfType<FieldSymbol>().Single().
GetAttributes
();
22450
m.GlobalNamespace.GetMember("Test1.<P1>P").
GetAttributes
().Select(a => a.ToString()));
22498
m.GlobalNamespace.GetMember("Test1.<P1>k__BackingField").
GetAttributes
().Select(a => a.ToString()));
22534
m.GlobalNamespace.GetMember("Test1.<P1>k__BackingField").
GetAttributes
().Select(a => a.ToString()));
22593
m.GlobalNamespace.GetMember("Test1.<P1>P").
GetAttributes
().Select(a => a.ToString()));
22650
m.GlobalNamespace.GetMember("Test1.<P1>P").
GetAttributes
().Select(a => a.ToString()));
Semantics\RecordTests.cs (7)
25211
return GetAttributeStrings(symbol.
GetAttributes
().Where(a => a.AttributeClass!.Name is "A" or "B" or "C" or "D"));
25271
return GetAttributeStrings(symbol.
GetAttributes
().Where(a =>
25348
return GetAttributeStrings(symbol.
GetAttributes
().Where(a =>
25409
return GetAttributeStrings(symbol.
GetAttributes
().Where(a =>
25490
return GetAttributeStrings(symbol.
GetAttributes
().Where(a =>
25574
return GetAttributeStrings(symbol.
GetAttributes
().Where(a =>
25638
return GetAttributeStrings(symbol.
GetAttributes
().Where(a =>
Symbols\UserDefinedCompoundAssignmentOperatorsTests.cs (2)
83
Assert.Empty(m.
GetAttributes
());
8043
Assert.Empty(m.
GetAttributes
());
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (369)
Semantics\BindingTests.cs (3)
2603
var a = x.
GetAttributes
()[0];
2633
var a = foo.
GetAttributes
()[0];
2663
var a = tt.
GetAttributes
()[0];
Semantics\DynamicTests.cs (1)
11731
m.GlobalNamespace.GetMember<NamedTypeSymbol>("Test1.<>o__0").TypeParameters.Single().
GetAttributes
().Select(a => a.ToString()));
Semantics\InitOnlyMemberTests.cs (4)
1458
var propertyAttributes = property.
GetAttributes
().Select(a => a.ToString());
1465
var getterAttributes = getter.
GetAttributes
().Select(a => a.ToString());
1478
var setterAttributes = property.SetMethod.
GetAttributes
().Select(a => a.ToString());
1493
var backingFieldAttributes = backingField.
GetAttributes
().Select(a => a.ToString());
Semantics\InterpolationTests.cs (46)
5024
Assert.Equal("Attr..ctor(System.String s)", attr.
GetAttributes
().Single().AttributeConstructor.ToTestDisplayString());
5049
Assert.Equal("Attr..ctor(System.String s)", attr.
GetAttributes
().Single().AttributeConstructor.ToTestDisplayString());
6838
sParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
6864
sParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
6896
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
6931
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
6971
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
7006
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
7046
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
7084
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
7124
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
7159
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
7199
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
7234
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
7267
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
7307
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
7347
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
7387
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
7427
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
7462
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
7504
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
7539
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
7581
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
7622
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
7662
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
7730
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
7824
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
7936
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
8002
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
8032
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
8134
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
8276
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
8336
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
8456
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
8694
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
8819
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
8970
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
9081
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
9148
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
9204
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
9320
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
9436
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
9561
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
9822
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
9897
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
11956
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
Semantics\IteratorTests.cs (3)
796
m.GlobalNamespace.GetMember<NamedTypeSymbol>("Test1.<M2>d__0").TypeParameters.Single().
GetAttributes
().Select(a => a.ToString()));
839
m.GlobalNamespace.GetMember("Test1.<M2>d__0.x").
GetAttributes
().Select(a => a.ToString()));
843
m.GlobalNamespace.GetMember("Test1.<M2>d__0.<>3__x").
GetAttributes
().Select(a => a.ToString()));
Semantics\LambdaTests.cs (4)
3632
return format(expr, method.
GetAttributes
(), method.GetReturnTypeAttributes(), method.Parameters.SelectMany(p => p.
GetAttributes
()));
8829
m.GlobalNamespace.GetMember<NamedTypeSymbol>("Test1.<>c__DisplayClass0_0").TypeParameters.Single().
GetAttributes
().Select(a => a.ToString()));
8870
m.GlobalNamespace.GetMember("Test1.<>c__DisplayClass0_0.x").
GetAttributes
().Select(a => a.ToString()));
Semantics\LocalFunctionTests.cs (4)
1723
var attrs = typeParam.
GetAttributes
();
1928
var attrs = typeParam.
GetAttributes
();
1978
var attrs = param.
GetAttributes
();
1984
attrs = param.
GetAttributes
();
Semantics\MultiDimensionalArrayTests.cs (4)
1681
var a1 = (IArrayTypeSymbol)p.GetMember<MethodSymbol>("Test1").
GetAttributes
().Single().ConstructorArguments.Single().Value;
1686
var a2 = (IArrayTypeSymbol)p.GetMember<MethodSymbol>("Test2").
GetAttributes
().Single().ConstructorArguments.Single().Value;
1691
Assert.True(((ITypeSymbol)p.GetMember<MethodSymbol>("Test3").
GetAttributes
().Single().ConstructorArguments.Single().Value).IsErrorType());
1692
Assert.True(((ITypeSymbol)p.GetMember<MethodSymbol>("Test4").
GetAttributes
().Single().ConstructorArguments.Single().Value).IsErrorType());
Semantics\NamedAndOptionalTests.cs (34)
2056
Assert.Equal(0, parameters[0].
GetAttributes
().Length);
2062
Assert.Equal(0, parameters[1].
GetAttributes
().Length);
2068
Assert.Equal(0, parameters[2].
GetAttributes
().Length);
2074
Assert.Equal(isFromSource ? 1 : 0, parameters[3].
GetAttributes
().Length);
2081
Assert.Equal(isFromSource ? 1 : 0, parameters[4].
GetAttributes
().Length);
2088
Assert.Equal(isFromSource ? 1 : 0, parameters[5].
GetAttributes
().Length);
2094
Assert.Equal(isFromSource ? 2 : 0, parameters[6].
GetAttributes
().Length);
2100
Assert.Equal(isFromSource ? 2 : 0, parameters[7].
GetAttributes
().Length);
2138
Assert.Equal(0, parameters[0].
GetAttributes
().Length);
2144
Assert.Equal(0, parameters[1].
GetAttributes
().Length);
2150
Assert.Equal(isFromSource ? 1 : 0, parameters[2].
GetAttributes
().Length);
2189
Assert.Equal(0, parameters[0].
GetAttributes
().Length);
2195
Assert.Equal(0, parameters[1].
GetAttributes
().Length);
2201
Assert.Equal(0, parameters[2].
GetAttributes
().Length);
2207
Assert.Equal(isFromSource ? 1 : 0, parameters[3].
GetAttributes
().Length);
2214
Assert.Equal(isFromSource ? 1 : 0, parameters[4].
GetAttributes
().Length);
2220
Assert.Equal(isFromSource ? 2 : 0, parameters[5].
GetAttributes
().Length);
2227
Assert.Equal(isFromSource ? 1 : 0, parameters[6].
GetAttributes
().Length);
2233
Assert.Equal(isFromSource ? 2 : 0, parameters[7].
GetAttributes
().Length);
2272
Assert.Equal(0, parameters[0].
GetAttributes
().Length);
2278
Assert.Equal(0, parameters[1].
GetAttributes
().Length);
2284
Assert.Equal(0, parameters[2].
GetAttributes
().Length);
2290
Assert.Equal(isFromSource ? 1 : 0, parameters[3].
GetAttributes
().Length);
2297
Assert.Equal(1, parameters[4].
GetAttributes
().Length); // DecimalConstantAttribute
2304
Assert.Equal(1, parameters[5].
GetAttributes
().Length); // DecimalConstantAttribute
2310
Assert.Equal(isFromSource ? 2 : 0, parameters[6].
GetAttributes
().Length); // Optional+DecimalConstantAttribute / DecimalConstantAttribute
2316
Assert.Equal(isFromSource ? 2 : 0, parameters[7].
GetAttributes
().Length); // Optional+DecimalConstantAttribute / DecimalConstantAttribute
2354
Assert.Equal(0, parameters[0].
GetAttributes
().Length);
2360
Assert.Equal(0, parameters[1].
GetAttributes
().Length); // As in dev11, [DateTimeConstant] is not emitted in this case.
2366
Assert.Equal(isFromSource ? 1 : 0, parameters[2].
GetAttributes
().Length);
2373
Assert.Equal(1, parameters[3].
GetAttributes
().Length); // DateTimeConstant
2380
Assert.Equal(1, parameters[4].
GetAttributes
().Length); // DateTimeConstant
2386
Assert.Equal(isFromSource ? 2 : 0, parameters[5].
GetAttributes
().Length); // Optional+DateTimeConstant / DateTimeConstant
2392
Assert.Equal(isFromSource ? 2 : 0, parameters[6].
GetAttributes
().Length); // Optional+DateTimeConstant / DateTimeConstant
Semantics\NullableReferenceTypesTests.cs (211)
6468
var attribute = c.
GetAttributes
().Single();
6490
var attribute = c.
GetAttributes
().Single();
30172
var copenAttributes = copen.
GetAttributes
().Select(a => a.ToString());
30183
var propertyAttributes = property.
GetAttributes
().Select(a => a.ToString());
30194
var getterAttributes = getter.
GetAttributes
().Select(a => a.ToString());
30216
var setterAttributes = setter.
GetAttributes
();
30275
var copenAttributes = copen.
GetAttributes
().Select(a => a.ToString());
30286
var propertyAttributes = property.
GetAttributes
().Select(a => a.ToString());
30297
var getterAttributes = getter.
GetAttributes
().Select(a => a.ToString());
30799
var fieldAttributes = field.
GetAttributes
().Select(a => a.ToString());
40786
var fieldAttributes = field.
GetAttributes
().Select(a => a.ToString());
40960
var copenAttributes = copen.
GetAttributes
().Select(a => a.ToString());
40971
var propertyAttributes = property.
GetAttributes
().Select(a => a.ToString());
40982
var setterAttributes = setter.
GetAttributes
();
40985
var setterValueAttributes = setter.Parameters.Last().
GetAttributes
().Select(a => a.ToString());
41021
var copenAttributes = copen.
GetAttributes
().Select(a => a.ToString());
41032
var propertyAttributes = property.
GetAttributes
().Select(a => a.ToString());
41043
var setterAttributes = setter.
GetAttributes
();
41046
var setterValueAttributes = setter.Parameters.Last().
GetAttributes
().Select(a => a.ToString());
44641
var copenAttributes = copen.
GetAttributes
().Select(a => a.ToString());
44652
var propertyAttributes = property.
GetAttributes
().Select(a => a.ToString());
44663
var setterAttributes = setter.
GetAttributes
().Select(a => a.ToString());
44673
var setterValueAttributes = setter.Parameters.Last().
GetAttributes
().Select(a => a.ToString());
44890
var fieldAttributes = field.
GetAttributes
().Select(a => a.ToString());
47978
var copenAttributes = copen.
GetAttributes
().Select(a => a.ToString());
47989
var propertyAttributes = property.
GetAttributes
().Select(a => a.ToString());
48000
Assert.Empty(getter.
GetAttributes
());
48090
var fieldAttributes = field.
GetAttributes
().Select(a => a.ToString());
97685
Assert.Empty(b.
GetAttributes
());
97689
Assert.Equal("System.Runtime.CompilerServices.NullableContextAttribute(1)", b.
GetAttributes
().First().ToString());
97695
Assert.Empty(t1.
GetAttributes
());
97707
Assert.Empty(t2.
GetAttributes
());
97711
Assert.Equal("System.Runtime.CompilerServices.NullableAttribute(2)", t2.
GetAttributes
().Single().ToString());
97748
Assert.Empty(t1.
GetAttributes
());
97752
Assert.Equal("System.Runtime.CompilerServices.NullableAttribute(1)", t1.
GetAttributes
().Single().ToString());
97761
Assert.Empty(t2.
GetAttributes
());
97765
Assert.Equal("System.Runtime.CompilerServices.NullableAttribute(2)", t2.
GetAttributes
().Single().ToString());
97806
Assert.Empty(t1.
GetAttributes
());
97812
Assert.Empty(t2.
GetAttributes
());
97855
Assert.Empty(t1.
GetAttributes
());
97859
Assert.Equal("System.Runtime.CompilerServices.NullableAttribute(2)", t1.
GetAttributes
().Single().ToString());
97868
Assert.Empty(t2.
GetAttributes
());
97872
Assert.Equal("System.Runtime.CompilerServices.NullableAttribute(2)", t2.
GetAttributes
().Single().ToString());
98464
Assert.Empty(bf1.
GetAttributes
());
98468
Assert.Equal("System.Runtime.CompilerServices.NullableContextAttribute(1)", bf1.
GetAttributes
().Single().ToString());
98472
Assert.Empty(t11.
GetAttributes
());
98478
Assert.Empty(bf2.
GetAttributes
());
98482
Assert.Equal("System.Runtime.CompilerServices.NullableContextAttribute(2)", bf2.
GetAttributes
().Single().ToString());
98487
Assert.Empty(t22.
GetAttributes
());
98655
Assert.Empty(bf1.
GetAttributes
());
98659
Assert.Equal("System.Runtime.CompilerServices.NullableContextAttribute(1)", bf1.
GetAttributes
().Single().ToString());
98663
Assert.Empty(t11.
GetAttributes
());
98669
Assert.Empty(bf2.
GetAttributes
());
98673
Assert.Equal("System.Runtime.CompilerServices.NullableContextAttribute(2)", bf2.
GetAttributes
().Single().ToString());
98678
Assert.Empty(t22.
GetAttributes
());
98762
Assert.Empty(bf1.
GetAttributes
());
98766
Assert.Equal("System.Runtime.CompilerServices.NullableContextAttribute(1)", bf1.
GetAttributes
().Single().ToString());
98770
Assert.Empty(t11.
GetAttributes
());
98776
Assert.Empty(bf2.
GetAttributes
());
98780
Assert.Equal("System.Runtime.CompilerServices.NullableContextAttribute(2)", bf2.
GetAttributes
().Single().ToString());
98785
Assert.Empty(t22.
GetAttributes
());
98828
Assert.Empty(bf1.
GetAttributes
());
98832
Assert.Equal("System.Runtime.CompilerServices.NullableContextAttribute(1)", bf1.
GetAttributes
().Single().ToString());
98836
Assert.Empty(t11.
GetAttributes
());
98842
Assert.Empty(bf2.
GetAttributes
());
98846
CSharpAttributeData nullableAttribute = bf2.
GetAttributes
().Single();
98854
Assert.Empty(t22.
GetAttributes
());
98900
Assert.Empty(bf1.
GetAttributes
());
98904
Assert.Equal("System.Runtime.CompilerServices.NullableContextAttribute(1)", bf1.
GetAttributes
().Single().ToString());
98909
Assert.Empty(t11.
GetAttributes
());
98915
Assert.Empty(bf2.
GetAttributes
());
98919
CSharpAttributeData nullableAttribute = bf2.
GetAttributes
().Single();
98926
Assert.Empty(t22.
GetAttributes
());
98969
Assert.Empty(bf1.
GetAttributes
());
98973
Assert.Equal("System.Runtime.CompilerServices.NullableContextAttribute(1)", bf1.
GetAttributes
().Single().ToString());
98977
Assert.Empty(t11.
GetAttributes
());
98983
Assert.Empty(bf2.
GetAttributes
());
98987
Assert.Equal("System.Runtime.CompilerServices.NullableContextAttribute(2)", bf2.
GetAttributes
().Single().ToString());
98992
Assert.Empty(t22.
GetAttributes
());
99059
Assert.Empty(f2.
GetAttributes
());
99063
Assert.Equal("System.Runtime.CompilerServices.NullableContextAttribute(2)", f2.
GetAttributes
().Single().ToString());
99067
Assert.Empty(t2.
GetAttributes
());
99094
Assert.Empty(t2.
GetAttributes
());
99098
Assert.Equal("System.Runtime.CompilerServices.NullableAttribute(2)", t2.
GetAttributes
().Single().ToString());
99135
Assert.Empty(t2.
GetAttributes
());
99343
Assert.Empty(bf1.
GetAttributes
());
99347
Assert.Equal("System.Runtime.CompilerServices.NullableContextAttribute(1)", bf1.
GetAttributes
().Single().ToString());
99351
Assert.Empty(t11.
GetAttributes
());
99357
Assert.Empty(bf2.
GetAttributes
());
99361
Assert.Equal("System.Runtime.CompilerServices.NullableContextAttribute(2)", bf2.
GetAttributes
().Single().ToString());
99366
Assert.Empty(t22.
GetAttributes
());
100337
Assert.Empty(f1.
GetAttributes
());
100341
Assert.Equal("System.Runtime.CompilerServices.NullableContextAttribute(1)", f1.
GetAttributes
().Single().ToString());
100346
var attributes = t1.
GetAttributes
();
100375
Assert.Empty(f1.
GetAttributes
());
100379
Assert.Equal("System.Runtime.CompilerServices.NullableContextAttribute(1)", f1.
GetAttributes
().Single().ToString());
100385
var attributes = t1.
GetAttributes
();
100428
Assert.Empty(t1.
GetAttributes
());
100435
Assert.Empty(t2.
GetAttributes
());
100467
Assert.Empty(t1.
GetAttributes
());
100487
Assert.Empty(t1.
GetAttributes
());
100543
Assert.Empty(t1.
GetAttributes
());
100551
Assert.Empty(t2.
GetAttributes
());
100586
Assert.Empty(t1.
GetAttributes
());
100593
Assert.Empty(t2.
GetAttributes
());
100631
Assert.Empty(t1.
GetAttributes
());
100638
Assert.Empty(t2.
GetAttributes
());
100714
Assert.Equal("System.Runtime.CompilerServices.NullableContextAttribute(1)", af1.
GetAttributes
().Single().ToString());
100723
Assert.Empty(at1.
GetAttributes
());
100728
Assert.Equal("System.Runtime.CompilerServices.NullableAttribute(0)", at1.
GetAttributes
().Single().ToString());
100744
Assert.Equal("System.Runtime.CompilerServices.NullableContextAttribute(1)", bf1.
GetAttributes
().Single().ToString());
100752
Assert.Empty(tf1.
GetAttributes
());
100757
var attributes = tf1.
GetAttributes
();
100809
Assert.Equal("System.Runtime.CompilerServices.NullableContextAttribute(1)", af1.
GetAttributes
().Single().ToString());
100818
Assert.Empty(at1.
GetAttributes
());
100823
Assert.Equal("System.Runtime.CompilerServices.NullableAttribute(0)", at1.
GetAttributes
().Single().ToString());
100837
Assert.Empty(bf1.
GetAttributes
());
100845
Assert.Empty(tf1.
GetAttributes
());
100850
Assert.Empty(tf1.
GetAttributes
());
101972
Assert.Empty(tf1.
GetAttributes
());
101996
Assert.Empty(tf1.
GetAttributes
());
102024
Assert.Empty(tf1.
GetAttributes
());
102051
Assert.Empty(tf1.
GetAttributes
());
102078
Assert.Empty(tf1.
GetAttributes
());
102105
Assert.Empty(tf1.
GetAttributes
());
102132
Assert.Empty(tf1.
GetAttributes
());
102163
Assert.Empty(i1.
GetAttributes
());
102167
Assert.Equal("System.Runtime.CompilerServices.NullableContextAttribute(2)", i1.
GetAttributes
().Single().ToString());
102174
Assert.Empty(tf1.
GetAttributes
());
102205
Assert.Empty(tf1.
GetAttributes
());
102232
Assert.Empty(i1.
GetAttributes
());
102236
Assert.Equal("System.Runtime.CompilerServices.NullableContextAttribute(2)", i1.
GetAttributes
().Single().ToString());
102243
Assert.Empty(tf1.
GetAttributes
());
102266
Assert.Empty(i1.
GetAttributes
());
102270
Assert.Equal("System.Runtime.CompilerServices.NullableContextAttribute(2)", i1.
GetAttributes
().Single().ToString());
102278
Assert.Empty(tf1.
GetAttributes
());
102306
Assert.Empty(i1.
GetAttributes
());
102310
Assert.Equal("System.Runtime.CompilerServices.NullableContextAttribute(2)", i1.
GetAttributes
().Single().ToString());
102317
Assert.Empty(tf1.
GetAttributes
());
102344
Assert.Empty(i1.
GetAttributes
());
102348
Assert.Equal("System.Runtime.CompilerServices.NullableContextAttribute(1)", i1.
GetAttributes
().Single().ToString());
102355
Assert.Empty(tf1.
GetAttributes
());
102382
var attributes = tf1.
GetAttributes
();
102410
var attributes = tf1.
GetAttributes
();
102438
var attributes = tf1.
GetAttributes
();
102466
Assert.Empty(i1.
GetAttributes
());
102470
Assert.Equal("System.Runtime.CompilerServices.NullableContextAttribute(2)", i1.
GetAttributes
().Single().ToString());
102477
var attributes = tf1.
GetAttributes
();
102505
var attributes = tf1.
GetAttributes
();
102532
Assert.Empty(tf1.
GetAttributes
());
102555
Assert.Empty(tf1.
GetAttributes
());
102582
Assert.Empty(tf1.
GetAttributes
());
102608
Assert.Empty(tf1.
GetAttributes
());
102634
Assert.Empty(tf1.
GetAttributes
());
102660
Assert.Empty(tf1.
GetAttributes
());
102686
Assert.Empty(tf1.
GetAttributes
());
102717
Assert.Empty(i1.
GetAttributes
());
102721
Assert.Equal("System.Runtime.CompilerServices.NullableContextAttribute(2)", i1.
GetAttributes
().Single().ToString());
102726
var attributes = tf1.
GetAttributes
();
102757
Assert.Empty(tf1.
GetAttributes
());
102784
Assert.Empty(i1.
GetAttributes
());
102788
Assert.Equal("System.Runtime.CompilerServices.NullableContextAttribute(2)", i1.
GetAttributes
().Single().ToString());
102793
var attributes = tf1.
GetAttributes
();
102817
Assert.Empty(i1.
GetAttributes
());
102821
Assert.Equal("System.Runtime.CompilerServices.NullableContextAttribute(2)", i1.
GetAttributes
().Single().ToString());
102827
var attributes = tf1.
GetAttributes
();
102856
Assert.Empty(i1.
GetAttributes
());
102860
Assert.Equal("System.Runtime.CompilerServices.NullableContextAttribute(2)", i1.
GetAttributes
().Single().ToString());
102865
var attributes = tf1.
GetAttributes
();
102893
Assert.Empty(i1.
GetAttributes
());
102897
Assert.Equal("System.Runtime.CompilerServices.NullableContextAttribute(1)", i1.
GetAttributes
().Single().ToString());
102902
var attributes = tf1.
GetAttributes
();
102929
var attributes = tf1.
GetAttributes
();
102956
var attributes = tf1.
GetAttributes
();
102983
var attributes = tf1.
GetAttributes
();
103011
Assert.Empty(i1.
GetAttributes
());
103015
Assert.Equal("System.Runtime.CompilerServices.NullableContextAttribute(2)", i1.
GetAttributes
().Single().ToString());
103020
var attributes = tf1.
GetAttributes
();
103047
var attributes = tf1.
GetAttributes
();
103079
var attributes = tf1.
GetAttributes
();
103111
Assert.Empty(i1.
GetAttributes
());
103115
Assert.Equal("System.Runtime.CompilerServices.NullableContextAttribute(2)", i1.
GetAttributes
().Single().ToString());
103120
var attributes = tf1.
GetAttributes
();
103154
Assert.Empty(i1.
GetAttributes
());
103158
Assert.Equal("System.Runtime.CompilerServices.NullableContextAttribute(2)", i1.
GetAttributes
().Single().ToString());
103163
var attributes = tf1.
GetAttributes
();
103198
Assert.Empty(i1.
GetAttributes
());
103202
Assert.Equal("System.Runtime.CompilerServices.NullableContextAttribute(2)", i1.
GetAttributes
().Single().ToString());
103207
var attributes = tf1.
GetAttributes
();
104856
Assert.Empty(t11.
GetAttributes
());
104860
Assert.Equal("System.Runtime.CompilerServices.NullableAttribute(1)", t11.
GetAttributes
().Single().ToString());
104869
Assert.Empty(t1.
GetAttributes
());
104873
Assert.Equal("System.Runtime.CompilerServices.NullableAttribute(1)", t1.
GetAttributes
().Single().ToString());
104883
Assert.Empty(t22.
GetAttributes
());
104887
Assert.Equal("System.Runtime.CompilerServices.NullableAttribute(2)", t22.
GetAttributes
().Single().ToString());
104897
Assert.Empty(t2.
GetAttributes
());
104901
Assert.Equal("System.Runtime.CompilerServices.NullableAttribute(2)", t2.
GetAttributes
().Single().ToString());
104948
Assert.Empty(b.
GetAttributes
());
104952
Assert.Equal("System.Runtime.CompilerServices.NullableContextAttribute(1)", b.
GetAttributes
().First().ToString());
104958
Assert.Empty(t11.
GetAttributes
());
104967
Assert.Empty(t22.
GetAttributes
());
104971
CSharpAttributeData nullableAttribute = t22.
GetAttributes
().Single();
105025
Assert.Empty(b.
GetAttributes
());
105029
Assert.Equal("System.Runtime.CompilerServices.NullableContextAttribute(1)", b.
GetAttributes
().First().ToString());
105035
Assert.Empty(t11.
GetAttributes
());
105044
Assert.Empty(t22.
GetAttributes
());
105048
CSharpAttributeData nullableAttribute = t22.
GetAttributes
().Single();
108319
Assert.Empty(tm1.
GetAttributes
());
123961
Assert.Empty(f.
GetAttributes
());
123965
Assert.Equal(baseline[i].attribute, f.
GetAttributes
().Single().ToString());
124239
Assert.Equal(typeParametersBaseline[i].attribute, t.
GetAttributes
().Single().ToString());
Semantics\RawInterpolationTests_Handler.cs (42)
3229
Assert.Equal("Attr..ctor(System.String s)", attr.
GetAttributes
().Single().AttributeConstructor.ToTestDisplayString());
3254
Assert.Equal("Attr..ctor(System.String s)", attr.
GetAttributes
().Single().AttributeConstructor.ToTestDisplayString());
5090
sParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
5118
sParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
5155
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
5195
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
5242
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
5282
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
5329
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
5372
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
5419
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
5459
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
5506
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
5546
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
5593
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
5640
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
5687
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
5727
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
5776
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
5816
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
5865
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
5911
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
5958
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
5988
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
6114
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
6183
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
6213
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
6447
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
6509
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
6631
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
6871
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
6998
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
7151
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
7264
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
7335
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
7395
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
7513
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
7631
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
7759
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
8031
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
8109
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
8536
cParam.
GetAttributes
().Single().AttributeClass.ToTestDisplayString());
Semantics\RecordStructTests.cs (1)
10592
return GetAttributeStrings(symbol.
GetAttributes
().Where(a => a.AttributeClass!.Name is "A" or "B" or "C" or "D"));
Semantics\RefFieldTests.cs (3)
12066
var attribute = parameter.
GetAttributes
().FirstOrDefault(a => a.GetTargetAttributeSignatureIndex(AttributeDescription.ScopedRefAttribute) != -1);
22692
var a = m.Parameters[0].
GetAttributes
().Single().AttributeClass.ToTestDisplayString();
22737
Assert.Empty(m.Parameters[0].
GetAttributes
());
Semantics\TopLevelStatementsTests.cs (9)
6172
var programAttributes = GetAttributeNames(program.
GetAttributes
().As<CSharpAttributeData>());
6184
Assert.Empty(method.
GetAttributes
());
6190
Assert.Equal(new[] { "CompilerGeneratedAttribute" }, GetAttributeNames(localFn1.
GetAttributes
().As<CSharpAttributeData>()));
9068
Assert.Empty(program.
GetAttributes
().As<CSharpAttributeData>());
9072
Assert.Equal(new[] { "CompilerGeneratedAttribute" }, GetAttributeNames(program.
GetAttributes
().As<CSharpAttributeData>()));
9074
Assert.Empty(program.GetMethod(WellKnownMemberNames.TopLevelStatementsEntryPointMethodName).
GetAttributes
());
9119
Assert.Empty(program.
GetAttributes
().As<CSharpAttributeData>());
9121
Assert.Empty(program.GetMethod(WellKnownMemberNames.TopLevelStatementsEntryPointMethodName).
GetAttributes
().As<CSharpAttributeData>());
9506
var fieldAttributes = GetAttributeNames(field.
GetAttributes
().As<CSharpAttributeData>());
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (196)
Symbols\AnonymousTypesSymbolTests.cs (1)
1147
var actual = symbol.
GetAttributes
();
Symbols\DefaultInterfaceImplementationTests.cs (12)
11093
Assert.Equal(2, m2.
GetAttributes
().Length);
11094
Assert.Equal("Test2(1)", m2.
GetAttributes
()[0].ToString());
11095
Assert.Equal("Test2(2)", m2.
GetAttributes
()[1].ToString());
11111
Assert.Equal(2, m2Impl.
GetAttributes
().Length);
11112
Assert.Equal("Test2(1)", m2Impl.
GetAttributes
()[0].ToString());
11113
Assert.Equal("Test2(2)", m2Impl.
GetAttributes
()[1].ToString());
11200
Assert.Equal(2, m2.
GetAttributes
().Length);
11201
Assert.Equal("Test2(1)", m2.
GetAttributes
()[0].ToString());
11202
Assert.Equal("Test2(2)", m2.
GetAttributes
()[1].ToString());
11218
Assert.Equal(2, m2Impl.
GetAttributes
().Length);
11219
Assert.Equal("Test2(1)", m2Impl.
GetAttributes
()[0].ToString());
11220
Assert.Equal("Test2(2)", m2Impl.
GetAttributes
()[1].ToString());
Symbols\ImplicitClassTests.cs (2)
32
Assert.Equal(0, implicitClass.
GetAttributes
().Length);
61
Assert.Equal(0, scriptClass.
GetAttributes
().Length);
Symbols\IndexerTests.cs (1)
2132
Assert.True(indexer.
GetAttributes
().Single().IsTargetAttribute(AttributeDescription.IndexerNameAttribute));
Symbols\LocalFunctionTests.cs (5)
560
m.GlobalNamespace.GetMember<NamedTypeSymbol>("Test1.<>c__DisplayClass0_0").TypeParameters.Single().
GetAttributes
().Select(a => a.ToString()));
591
m.GlobalNamespace.GetMember<MethodSymbol>("Test1.<M2>g__local|0_0").TypeParameters.Single().
GetAttributes
().Select(a => a.ToString()));
627
m.GlobalNamespace.GetMember<NamedTypeSymbol>("Test1.<>c__DisplayClass0_0").TypeParameters.Single().
GetAttributes
().Select(a => a.ToString()));
630
m.GlobalNamespace.GetMember<MethodSymbol>("Test1.<M2>g__local|0_0").TypeParameters.Single().
GetAttributes
().Select(a => a.ToString()));
672
m.GlobalNamespace.GetMember("Test1.<>c__DisplayClass0_0.x").
GetAttributes
().Select(a => a.ToString()));
Symbols\Metadata\PE\LoadingAttributes.cs (71)
205
c1.
GetAttributes
().First().VerifyValue(0, TypedConstantKind.Primitive, "C1");
208
innerC1.
GetAttributes
().First().VerifyValue(0, TypedConstantKind.Primitive, "InnerC1");
215
innerC2.
GetAttributes
().First().VerifyValue(0, TypedConstantKind.Primitive, "InnerC2");
218
field1.
GetAttributes
().First().VerifyValue(0, TypedConstantKind.Primitive, "field1");
221
property1.
GetAttributes
().First().VerifyValue(0, TypedConstantKind.Primitive, "Property1");
224
sub1.
GetAttributes
().First().VerifyValue(0, TypedConstantKind.Primitive, "Sub1");
227
sub1P1.
GetAttributes
().First().VerifyValue(0, TypedConstantKind.Primitive, "p1");
230
function1.
GetAttributes
().First().VerifyValue(0, TypedConstantKind.Primitive, "Function1");
385
c1.
GetAttributes
().First().VerifyValue(0, TypedConstantKind.Primitive, "C1");
432
l.
GetAttributes
().First().VerifyValue(0, TypedConstantKind.Type, "System.Collections.Generic.List<>");
435
l.
GetAttributes
().First().VerifyValue(0, TypedConstantKind.Type, "System.Collections.Generic.List<C1>");
438
l.
GetAttributes
().First().VerifyValue(0, TypedConstantKind.Type, "System.Collections.Generic.List<System.String>");
441
l.
GetAttributes
().First().VerifyValue(0, TypedConstantKind.Type, "System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<C1, System.String>>");
444
l.
GetAttributes
().First().VerifyValue(0, TypedConstantKind.Type, "System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<System.String, C1.InnerC1<System.Int32>.InnerC2<System.String, System.String>>>");
476
var arg = field.
GetAttributes
().Single();
480
arg = field.
GetAttributes
().Single();
484
arg = field.
GetAttributes
().Single();
488
arg = field.
GetAttributes
().Single();
492
arg = field.
GetAttributes
().Single();
496
var t = field.
GetAttributes
().First().CommonConstructorArguments.Single().Type;
498
arg = field.
GetAttributes
().Single();
502
arg = field.
GetAttributes
().Single();
508
arg = field.
GetAttributes
().Single();
546
foreach (var sa in s.
GetAttributes
())
598
var attrs = asm.
GetAttributes
();
688
Assert.Equal(4, igoo.
GetAttributes
().Length);
711
Assert.Equal(1, mem.
GetAttributes
().Length);
713
Assert.Equal(1, mem.
GetAttributes
().Length);
715
Assert.Equal(1, mem.
GetAttributes
().Length);
717
attrSym = mem.
GetAttributes
().First();
742
Assert.Equal(2, dfoo.
GetAttributes
().Length);
781
var modattr = assemblies[0].Modules[0].
GetAttributes
().First();
787
Assert.Equal(2, myEnum.
GetAttributes
().Length);
791
Assert.Equal(0, field.
GetAttributes
().Length);
794
Assert.Equal(1, field.
GetAttributes
().Length);
795
var attrSym = field.
GetAttributes
().First();
848
Assert.Equal(5, ibar.
GetAttributes
().Length);
849
var atts = ibar.
GetAttributes
();
863
mem.
GetAttributes
().First().VerifyValue(0, TypedConstantKind.Primitive, 10);
871
Assert.Equal(1, mem2.
GetAttributes
().Length);
875
Assert.Equal(1, mem2.
GetAttributes
().Length);
894
Assert.Equal(1, mem2.
GetAttributes
().Length);
895
attrSym = mem2.
GetAttributes
().First();
920
Assert.Equal(4, assemblies[0].
GetAttributes
().Length);
929
attrSym = assemblies[0].Modules[0].
GetAttributes
().First();
964
var attrSym = tp.
GetAttributes
().First();
985
Assert.Equal(1, mtd.
GetAttributes
().Length);
986
attrSym = mtd.
GetAttributes
().First();
1060
var attrs = (from a in foo.
GetAttributes
()
1064
Assert.Equal(foo.
GetAttributes
().Length, attrs.Count());
1109
Assert.Equal(2, tp.
GetAttributes
().Length);
1113
Assert.Equal(2, fld.
GetAttributes
().Length);
1114
Assert.Equal(0, fld.
GetAttributes
().First().CommonNamedArguments.Length);
1118
Assert.Equal(1, prop.
GetAttributes
().Length);
1119
Assert.Equal(-1, prop.
GetAttributes
().First().CommonConstructorArguments[0].Value);
1121
Assert.Equal(3, prop.GetMethod.
GetAttributes
().Length);
1122
Assert.Equal(1, prop.SetMethod.
GetAttributes
().Length);
1128
Assert.Equal(3, mtd.
GetAttributes
().Length);
1130
attrs = (from a in mtd.
GetAttributes
()
1141
attrs = (from a in mtd.
GetAttributes
()
1241
var attr = prop.
GetAttributes
().First();
1433
Assert.Empty(field1.
GetAttributes
());
1438
Assert.Equal(2, field2.
GetAttributes
().Length);
1444
Assert.Empty(parameters.First().
GetAttributes
());
1447
Assert.Empty(parameters.Last().
GetAttributes
());
1461
Assert.Empty(field1.
GetAttributes
());
1466
Assert.Equal(2, field2.
GetAttributes
().Length);
1472
Assert.Empty(parameters.First().
GetAttributes
());
1475
Assert.Empty(parameters.Last().
GetAttributes
());
1514
Assert.Equal(expected, c.GetTypeByMetadataName("Test").
GetAttributes
().Single().ToString());
1518
Assert.Equal(expected, m.GlobalNamespace.GetTypeMember("Test").
GetAttributes
().Single().ToString());
Symbols\Metadata\PE\LoadingNamespacesAndTypes.cs (1)
260
Assert.Equal(0, collections.
GetAttributes
().Length);
Symbols\PartialPropertiesTests.cs (41)
3665
AssertEx.Equal([declAttribute, implAttribute], property.PartialImplementationPart!.
GetAttributes
().ToStrings());
3698
AssertEx.Equal([declAttribute, implAttribute], property.
GetAttributes
().ToStrings());
3701
AssertEx.Equal([declAttribute, implAttribute], ((SourcePropertySymbol)property).PartialImplementationPart!.
GetAttributes
().ToStrings());
3735
AssertEx.Equal(["A(1)", "B(1)", "A(2)", "B(2)"], property.PartialImplementationPart!.
GetAttributes
().ToStrings());
3774
AssertEx.Equal(["A(1)", "B(1)", "A(2)", "B(2)"], accessor.
GetAttributes
().ToStrings());
3775
AssertEx.Equal(["A(1)", "B(1)", "A(2)", "B(2)"], accessor.PartialImplementationPart!.
GetAttributes
().ToStrings());
3823
AssertEx.Equal(["A(1)", "B(1)", "A(2)", "B(2)"], accessor.
GetAttributes
().ToStrings());
3824
AssertEx.Equal(["A(1)", "B(1)", "A(2)", "B(2)"], accessor.PartialImplementationPart!.
GetAttributes
().ToStrings());
3864
AssertEx.Equal([], accessor.
GetAttributes
().ToStrings());
3865
AssertEx.Equal([], accessor.PartialImplementationPart.
GetAttributes
().ToStrings());
3866
AssertEx.Equal(["A(2)", "B(2)", "A(1)", "B(1)"], accessor.Parameters.Single().
GetAttributes
().ToStrings());
3867
AssertEx.Equal(["A(2)", "B(2)", "A(1)", "B(1)"], accessor.PartialImplementationPart!.Parameters.Single().
GetAttributes
().ToStrings());
3898
AssertEx.Equal(["A(1)", "B(1)", "A(2)", "B(2)"], indexer.PartialImplementationPart!.
GetAttributes
().ToStrings());
3939
AssertEx.Equal(["A(2)", "B(2)", "A(1)", "B(1)"], param.
GetAttributes
().ToStrings());
3992
AssertEx.Equal(["Attr", "Attr"], property.GetMethod!.
GetAttributes
().ToStrings());
3993
AssertEx.Equal(["Attr", "Attr"], property.SetMethod!.
GetAttributes
().ToStrings());
3994
AssertEx.Equal(["Attr", "Attr"], property.SetMethod!.Parameters.Single().
GetAttributes
().ToStrings());
4054
AssertEx.Equal(["Attr", "Attr"], property.GetMethod!.
GetAttributes
().ToStrings());
4055
AssertEx.Equal(["Attr", "Attr"], property.GetMethod!.Parameters[0].
GetAttributes
().ToStrings());
4056
AssertEx.Equal(["Attr", "Attr"], property.GetMethod!.Parameters[1].
GetAttributes
().ToStrings());
4057
AssertEx.Equal(["Attr", "Attr"], property.SetMethod!.
GetAttributes
().ToStrings());
4058
AssertEx.Equal(["Attr", "Attr"], property.SetMethod!.Parameters[0].
GetAttributes
().ToStrings());
4059
AssertEx.Equal(["Attr", "Attr"], property.SetMethod!.Parameters[1].
GetAttributes
().ToStrings());
4060
AssertEx.Equal(["Attr", "Attr"], property.SetMethod!.Parameters[2].
GetAttributes
().ToStrings());
4147
Assert.Empty(comp.GetMember<FieldSymbol>("C.<P1>k__BackingField").
GetAttributes
());
4148
Assert.Empty(comp.GetMember<FieldSymbol>("C.<P2>k__BackingField").
GetAttributes
());
4149
Assert.Empty(comp.GetMember<FieldSymbol>("C.<P3>k__BackingField").
GetAttributes
());
4215
Assert.Empty(comp.GetMember<FieldSymbol>("C.<P1>k__BackingField").
GetAttributes
());
4216
Assert.Empty(comp.GetMember<FieldSymbol>("C.<P2>k__BackingField").
GetAttributes
());
4217
Assert.Empty(comp.GetMember<FieldSymbol>("C.<P3>k__BackingField").
GetAttributes
());
4299
Assert.Empty(comp.GetMember<FieldSymbol>("C.<P1>k__BackingField").
GetAttributes
());
4300
Assert.Empty(comp.GetMember<FieldSymbol>("C.<P2>k__BackingField").
GetAttributes
());
4301
Assert.Empty(comp.GetMember<FieldSymbol>("C.<P3>k__BackingField").
GetAttributes
());
4372
AssertEx.Equal(["System.Runtime.CompilerServices.CallerLineNumberAttribute"], indexer.Parameters[1].
GetAttributes
().ToStrings());
4415
AssertEx.Equal(["System.Runtime.CompilerServices.CallerLineNumberAttribute"], indexer.Parameters[1].
GetAttributes
().ToStrings());
4451
AssertEx.Equal(["System.Runtime.CompilerServices.CallerFilePathAttribute"], indexer.Parameters[1].
GetAttributes
().ToStrings());
4493
AssertEx.Equal(["System.Runtime.CompilerServices.CallerFilePathAttribute"], indexer.Parameters[1].
GetAttributes
().ToStrings());
4529
AssertEx.Equal(["System.Runtime.CompilerServices.CallerMemberNameAttribute"], indexer.Parameters[1].
GetAttributes
().ToStrings());
4571
AssertEx.Equal(["System.Runtime.CompilerServices.CallerMemberNameAttribute"], indexer.Parameters[1].
GetAttributes
().ToStrings());
4622
AssertEx.Equal(["""System.Runtime.CompilerServices.CallerArgumentExpressionAttribute("x")"""], indexer.Parameters[1].
GetAttributes
().ToStrings());
4679
AssertEx.Equal(["""System.Runtime.CompilerServices.CallerArgumentExpressionAttribute("x")"""], indexer.Parameters[1].
GetAttributes
().ToStrings());
Symbols\RequiredMembersTests.cs (19)
43
Assert.All(member.
GetAttributes
(), attr => AssertEx.NotEqual("System.Runtime.CompilerServices.RequiredMemberAttribute", attr.AttributeClass.ToTestDisplayString()));
72
var ctorAttributes = ctor.
GetAttributes
();
3948
var attr = c.
GetAttributes
().Single();
3977
var attr = attrAttribute.
GetAttributes
().Where(a => a.AttributeClass!.Name == "AttrAttribute").Single();
4007
var attr = p.
GetAttributes
().Where(a => a.AttributeClass!.Name == "AttrAttribute").Single();
4037
var attr = f.
GetAttributes
().Where(a => a.AttributeClass!.Name == "AttrAttribute").Single();
6535
Assert.Empty(copyCtor.
GetAttributes
());
6540
copyCtor.
GetAttributes
().Single(a => a.AttributeClass!.IsWellKnownSetsRequiredMembersAttribute()).AttributeConstructor.ToTestDisplayString());
6597
Assert.Empty(copyCtor.
GetAttributes
());
6602
copyCtor.
GetAttributes
().Single(a => a.AttributeClass!.IsWellKnownSetsRequiredMembersAttribute()).AttributeConstructor.ToTestDisplayString());
6886
var attrData = ctor.
GetAttributes
().Single();
6932
var attrData = ctor.
GetAttributes
().Single();
7186
Assert.Empty(c.
GetAttributes
());
7187
Assert.Empty(field1.
GetAttributes
());
7188
Assert.Empty(property1.
GetAttributes
());
7189
Assert.Empty(d.
GetAttributes
());
7190
Assert.Empty(field2.
GetAttributes
());
7191
Assert.Empty(property2.
GetAttributes
());
7981
constructor.
GetAttributes
().Select(a => $"{a.AttributeClass.ToTestDisplayString()}({string.Join(", ", a.CommonConstructorArguments.Select(arg => arg.ToCSharpString()))})"));
Symbols\Retargeting\NoPia.cs (18)
2057
var args = attrTest1.
GetAttributes
()[0].CommonConstructorArguments;
2072
args = attrTest1.
GetAttributes
()[0].CommonConstructorArguments;
2087
args = attrTest1.
GetAttributes
()[0].CommonConstructorArguments;
2102
args = attrTest1.
GetAttributes
()[0].CommonConstructorArguments;
2182
var args = attrTest1.
GetAttributes
()[0].CommonConstructorArguments;
2197
args = attrTest1.
GetAttributes
()[0].CommonConstructorArguments;
2212
args = attrTest1.
GetAttributes
()[0].CommonConstructorArguments;
2227
args = attrTest1.
GetAttributes
()[0].CommonConstructorArguments;
2307
var args = attrTest1.
GetAttributes
()[0].CommonConstructorArguments;
2322
args = attrTest1.
GetAttributes
()[0].CommonConstructorArguments;
2337
args = attrTest1.
GetAttributes
()[0].CommonConstructorArguments;
2352
args = attrTest1.
GetAttributes
()[0].CommonConstructorArguments;
2419
var args = attrTest1.
GetAttributes
()[0].CommonConstructorArguments;
2434
args = attrTest1.
GetAttributes
()[0].CommonConstructorArguments;
2515
var args = attrTest1.
GetAttributes
()[0].CommonConstructorArguments;
2530
args = attrTest1.
GetAttributes
()[0].CommonConstructorArguments;
2545
args = attrTest1.
GetAttributes
()[0].CommonConstructorArguments;
2560
args = attrTest1.
GetAttributes
()[0].CommonConstructorArguments;
Symbols\Retargeting\RetargetCustomAttributes.cs (4)
104
TestAttributeRetargeting(symbol.
GetAttributes
());
304
var attr = c.
GetAttributes
().Single();
350
var a = c1.
GetAttributes
().Single();
392
var a = c1.
GetAttributes
().Single();
Symbols\Source\EventTests.cs (16)
2858
AssertEx.Equal(["A(1)", "A(5)"], e.
GetAttributes
().ToStrings());
2859
AssertEx.Equal([.. compiledGeneratedAttr, "A(2)"], e.AddMethod!.
GetAttributes
().ToStrings());
2860
AssertEx.Equal(["A(3)"], e.AddMethod.Parameters.Single().
GetAttributes
().ToStrings());
2862
AssertEx.Equal([.. compiledGeneratedAttr, "A(2)"], e.RemoveMethod!.
GetAttributes
().ToStrings());
2863
AssertEx.Equal(["A(3)"], e.RemoveMethod.Parameters.Single().
GetAttributes
().ToStrings());
2865
AssertEx.Equal([.. compiledGeneratedAttr, "A(6)"], e.AssociatedField.
GetAttributes
().ToStrings());
2868
AssertEx.Equal(["A(1)", "A(5)"], f.
GetAttributes
().ToStrings());
2869
AssertEx.Equal([.. compiledGeneratedAttr, "A(2)"], f.AddMethod!.
GetAttributes
().ToStrings());
2870
AssertEx.Equal(["A(3)"], f.AddMethod.Parameters.Single().
GetAttributes
().ToStrings());
2872
AssertEx.Equal([.. compiledGeneratedAttr, "A(2)"], f.RemoveMethod!.
GetAttributes
().ToStrings());
2873
AssertEx.Equal(["A(3)"], f.RemoveMethod.Parameters.Single().
GetAttributes
().ToStrings());
2877
AssertEx.Equal(["A(1)", "A(5)"], g.
GetAttributes
().ToStrings());
2878
AssertEx.Equal(["A(21)", "A(22)"], g.AddMethod!.
GetAttributes
().ToStrings());
2879
AssertEx.Equal(["A(23)"], g.AddMethod.Parameters.Single().
GetAttributes
().ToStrings());
2881
AssertEx.Equal(["A(31)", "A(32)"], g.RemoveMethod!.
GetAttributes
().ToStrings());
2882
AssertEx.Equal(["A(33)"], g.RemoveMethod.Parameters.Single().
GetAttributes
().ToStrings());
Symbols\Source\PropertyTests.cs (2)
3062
m.GlobalNamespace.GetMember("Test1.<P1>k__BackingField").
GetAttributes
().Select(a => a.ToString()));
3096
m.GlobalNamespace.GetMember("Test1.<P1>k__BackingField").
GetAttributes
().Select(a => a.ToString()));
Symbols\TypeTests.cs (3)
501
Assert.Equal(0, retType.
GetAttributes
().Length); // Enumerable.Empty<SymbolAttribute>()
1882
i1.
GetAttributes
();
1934
i1.
GetAttributes
();
Microsoft.CodeAnalysis.CSharp.Test.Utilities (13)
AttributeValidation.cs (1)
30
var isUnmanagedTypeAttributes = attributeType.
GetAttributes
().OrderBy(attribute => attribute.AttributeClass.Name).ToArray();
Extensions.cs (7)
366
return @this.
GetAttributes
().Where(a => TypeSymbol.Equals(a.AttributeClass, c, TypeCompareKind.ConsiderEverything2));
371
return @this.
GetAttributes
().Where(a => a.IsTargetAttribute(namespaceName, typeName));
376
return @this.
GetAttributes
().Where(a => a.IsTargetAttribute(description));
381
return @this.
GetAttributes
().Where(a => TypeSymbol.Equals(a.AttributeClass, c, TypeCompareKind.ConsiderEverything2)).First();
386
return @this.
GetAttributes
().Where(a => a.IsTargetAttribute(namespaceName, typeName)).First();
391
return (from a in @this.
GetAttributes
()
398
return (from a in @this.
GetAttributes
()
NullableAttributesVisitor.cs (4)
37
_nullableContext = GetNullableContextAttribute(type.
GetAttributes
()) ?? _nullableContext;
47
_nullableContext = GetNullableContextAttribute(method.
GetAttributes
()) ?? _nullableContext;
63
var nullableContextAttribute = GetNullableContextAttribute(symbol.
GetAttributes
());
64
var nullableAttribute = GetNullableAttribute((symbol is MethodSymbol method) ? method.GetReturnTypeAttributes() : symbol.
GetAttributes
());
TestAttributesVisitor.cs (1)
141
var attribute = GetTargetAttribute((symbol is MethodSymbol method) ? method.GetReturnTypeAttributes() : symbol.
GetAttributes
());
Microsoft.CodeAnalysis.CSharp.WinRT.UnitTests (2)
Metadata\WinMdDumpTest.cs (2)
44
if (container.
GetAttributes
().Length > 0)
221
var attributes = symbol.
GetAttributes
();