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