304 references to ConstructorArguments
Aspire.Hosting.Integration.Analyzers (6)
AspireExportAnalyzer.cs (6)
716if (attr.ConstructorArguments.Length == 0) 726var typesArg = attr.ConstructorArguments[0]; 784if (attribute.ConstructorArguments.Length > 0 && 785attribute.ConstructorArguments[0].Value is string id) 1149if (attribute.ConstructorArguments.Length > 0 && 1150attribute.ConstructorArguments[0].Value is ITypeSymbol constructorType)
ConfigurationSchemaGenerator (5)
ConfigSchemaEmitter.cs (2)
422attribute.ConstructorArguments.Length == 1 && 423attribute.ConstructorArguments[0].Value is int value &&
ConfigSchemaGenerator.cs (2)
64ImmutableArray<TypedConstant> args = attribute.ConstructorArguments; 87ImmutableArray<TypedConstant> args = attribute.ConstructorArguments;
RuntimeSource\Configuration.Binder\ConfigurationBindingGenerator.Parser.cs (1)
675string configKeyName = attributeData?.ConstructorArguments.FirstOrDefault().Value as string ?? propertyName;
GenerateDocumentationAndConfigFiles (3)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\CollectionExpressionUtilities.cs (1)
155if (attribute is not { ConstructorArguments: [{ Value: INamedTypeSymbol builderType }, { Value: string builderMethodName }] })
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\InterceptsLocationUtilities.cs (1)
49ConstructorArguments: [{ Value: int version }, { Value: string attributeData }]
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (1)
583if (attributeUsageAttribute.ConstructorArguments is [{ Value: int targetsValue }, ..])
ILLink.RoslynAnalyzer (23)
COMAnalyzer.cs (3)
67marshalAsAttribute.ConstructorArguments.Length >= 1 && marshalAsAttribute.ConstructorArguments[0] is TypedConstant typedConstant && 133(LayoutKind)structLayoutAttribute.ConstructorArguments[0].Value! == LayoutKind.Auto)
DataFlow\LocalDataFlowVisitor.cs (2)
1450attributeData.ConstructorArguments.Length != 1 || 1451attributeData.ConstructorArguments[0] is not
ISymbolExtensions.cs (3)
64return (DynamicallyAccessedMemberTypes)dynamicallyAccessedMembers.ConstructorArguments[0].Value!; 81return (DynamicallyAccessedMemberTypes)dynamicallyAccessedMembers.ConstructorArguments[0].Value!; 89if (featureGuardAttribute.ConstructorArguments is [TypedConstant { Value: INamedTypeSymbol featureType }])
RequiresAnalyzerBase.cs (3)
435attr.ConstructorArguments.Length == 2 && 436attr.ConstructorArguments[0].Value?.ToString() == assemblyMetadataName && 437string.Equals(attr.ConstructorArguments[1].Value?.ToString(), "True", StringComparison.OrdinalIgnoreCase));
RequiresAssemblyFilesAnalyzer.cs (5)
135protected override bool VerifyAttributeArguments(AttributeData attribute) => attribute.ConstructorArguments.Length == 0 || 136attribute.ConstructorArguments.Length >= 1 && attribute.ConstructorArguments is [{ Type.SpecialType: SpecialType.System_String }, ..]; 141if (requiresAttribute.ConstructorArguments.Length >= 1) 143message = requiresAttribute.ConstructorArguments[0].Value?.ToString() ?? "";
RequiresDynamicCodeAnalyzer.cs (3)
190attribute.ConstructorArguments.Length >= 1 && attribute.ConstructorArguments is [{ Type.SpecialType: SpecialType.System_String }, ..]; 194var message = (string)requiresAttribute!.ConstructorArguments[0].Value!;
RequiresUnreferencedCodeUtils.cs (3)
37=> attribute.ConstructorArguments.Length >= 1 && attribute.ConstructorArguments is [{ Type.SpecialType: SpecialType.System_String }, ..]; 41var message = (string)requiresAttribute!.ConstructorArguments[0].Value!;
UnsafeMigrationAnalyzerHelpers.cs (1)
204&& attribute.ConstructorArguments is [{ Value: int layoutKind }]
Microsoft.Analyzers.Extra (3)
LegacyLoggingFixer.cs (3)
203var argLevel = GetLogMethodAttributeParameter(methodAttr.AttributeConstructor.Parameters, methodAttr.ConstructorArguments, "level"); 211var argMessage = GetLogMethodAttributeParameter(methodAttr.AttributeConstructor.Parameters, methodAttr.ConstructorArguments, "message"); 642var arg = GetLogMethodAttributeParameter(methodAttr.AttributeConstructor.Parameters, methodAttr.ConstructorArguments, "eventId");
Microsoft.AspNetCore.App.Analyzers (6)
Mvc\DetectAmbiguousActionRoutes.cs (2)
123if (actionNameAttribute != null && actionNameAttribute.ConstructorArguments.Length > 0 && actionNameAttribute.ConstructorArguments[0].Value is string name)
Mvc\MvcAnalyzer.cs (2)
128if (!attribute.ConstructorArguments.IsEmpty) 172if (attribute.ConstructorArguments.IsEmpty || attribute.ApplicationSyntaxReference is null)
RouteEmbeddedLanguage\Infrastructure\RouteStringSyntaxDetector.cs (2)
331if (attribute.ConstructorArguments.Length == 0) 357var argument = attribute.ConstructorArguments[0];
Microsoft.AspNetCore.Http.RequestDelegateGenerator (1)
StaticRouteHandlerModel\EndpointParameter.cs (1)
159var constructorArgument = keyedServicesAttribute.ConstructorArguments.FirstOrDefault();
Microsoft.CodeAnalysis.Analyzers (10)
ImplementationIsObsoleteAnalyzer.cs (2)
54if (attributes.FirstOrDefault(a => a is { AttributeClass.Name: ImplementationIsObsoleteAttributeName, ConstructorArguments: [{ Value: string }] } 58context.ReportDiagnostic(namedTypeSymbol.CreateDiagnostic(Rule, namedTypeSymbol.Name, iface.Name, (string)attr.ConstructorArguments[0].Value!));
MetaAnalyzers\CompilerExtensionStrictApiAnalyzer.cs (1)
181foreach (var arg in attribute.ConstructorArguments)
MetaAnalyzers\CompilerExtensionTargetFrameworkAnalyzer.cs (3)
59if (appliedTargetFrameworkAttribute.ConstructorArguments.IsEmpty) 65switch (appliedTargetFrameworkAttribute.ConstructorArguments[0].Value as string) 80?? appliedTargetFrameworkAttribute.ConstructorArguments[0].Value as string
MetaAnalyzers\DiagnosticAnalyzerAttributeAnalyzer.cs (1)
106foreach (TypedConstant arg in attribute.ConstructorArguments)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\CollectionExpressionUtilities.cs (1)
155if (attribute is not { ConstructorArguments: [{ Value: INamedTypeSymbol builderType }, { Value: string builderMethodName }] })
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\InterceptsLocationUtilities.cs (1)
49ConstructorArguments: [{ Value: int version }, { Value: string attributeData }]
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (1)
583if (attributeUsageAttribute.ConstructorArguments is [{ Value: int targetsValue }, ..])
Microsoft.CodeAnalysis.AnalyzerUtilities (3)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\CollectionExpressionUtilities.cs (1)
155if (attribute is not { ConstructorArguments: [{ Value: INamedTypeSymbol builderType }, { Value: string builderMethodName }] })
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\InterceptsLocationUtilities.cs (1)
49ConstructorArguments: [{ Value: int version }, { Value: string attributeData }]
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (1)
583if (attributeUsageAttribute.ConstructorArguments is [{ Value: int targetsValue }, ..])
Microsoft.CodeAnalysis.CodeStyle (6)
src\roslyn\src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (2)
850attribute.ConstructorArguments is [_, { Kind: TypedConstantKind.Primitive, Value: string checkId }, ..]) 859attribute.ConstructorArguments[0] is
src\roslyn\src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (1)
902if (attribute.ConstructorArguments is [{ Kind: TypedConstantKind.Primitive, Type.SpecialType: SpecialType.System_String, Value: string value }])
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\CollectionExpressionUtilities.cs (1)
155if (attribute is not { ConstructorArguments: [{ Value: INamedTypeSymbol builderType }, { Value: string builderMethodName }] })
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\InterceptsLocationUtilities.cs (1)
49ConstructorArguments: [{ Value: int version }, { Value: string attributeData }]
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (1)
583if (attributeUsageAttribute.ConstructorArguments is [{ Value: int targetsValue }, ..])
Microsoft.CodeAnalysis.CSharp.CodeStyle (2)
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (2)
327if (collectionBuilderAttribute.ConstructorArguments is not 908if (collectionBuilderAttributeData?.ConstructorArguments is not [{ Value: ITypeSymbol collectionBuilderType }, { Value: CreateName }])
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (2)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\AttributeGenerator.cs (2)
81if (attribute.ConstructorArguments.Length == 0 && attribute.NamedArguments.Length == 0) 86foreach (var argument in attribute.ConstructorArguments)
Microsoft.CodeAnalysis.CSharp.Features (4)
ConvertToExtension\ExtensionMethodEqualityComparer.cs (2)
54return x.ConstructorArguments.SequenceEqual(y.ConstructorArguments) &&
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (2)
327if (collectionBuilderAttribute.ConstructorArguments is not 908if (collectionBuilderAttributeData?.ConstructorArguments is not [{ Value: ITypeSymbol collectionBuilderType }, { Value: CreateName }])
Microsoft.CodeAnalysis.CSharp.Workspaces (2)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\AttributeGenerator.cs (2)
81if (attribute.ConstructorArguments.Length == 0 && attribute.NamedArguments.Length == 0) 86foreach (var argument in attribute.ConstructorArguments)
Microsoft.CodeAnalysis.Extensions.Package (1)
Symbols\ISymbolExtensions.cs (1)
583if (attributeUsageAttribute.ConstructorArguments is [{ Value: int targetsValue }, ..])
Microsoft.CodeAnalysis.Features (10)
DesignerAttribute\DesignerAttributeDiscoveryService.cs (1)
321if (attribute is { ConstructorArguments: [{ Type.SpecialType: SpecialType.System_String, Value: string stringValue }] })
EditAndContinue\AbstractEditAndContinueAnalyzer.cs (4)
4961match.ConstructorArguments.SequenceEqual(attribute.ConstructorArguments, TypedConstantComparer.Instance) && 5466if (attribute.AttributeClass.Equals(layoutAttribute) && attribute.ConstructorArguments.Length == 1) 5468return attribute.ConstructorArguments.Single().Value switch
EmbeddedLanguages\EmbeddedLanguageDetector.cs (2)
508if (attribute.ConstructorArguments.Length == 0) 532var argument = attribute.ConstructorArguments[0];
src\roslyn\src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (2)
850attribute.ConstructorArguments is [_, { Kind: TypedConstantKind.Primitive, Value: string checkId }, ..]) 859attribute.ConstructorArguments[0] is
src\roslyn\src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (1)
902if (attribute.ConstructorArguments is [{ Kind: TypedConstantKind.Primitive, Type.SpecialType: SpecialType.System_String, Value: string value }])
Microsoft.CodeAnalysis.NetAnalyzers (38)
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\MarkAssembliesWithComVisible.cs (3)
73if (!attributeInstance.ConstructorArguments.IsEmpty && 74attributeInstance.ConstructorArguments[0].Kind == TypedConstantKind.Primitive && 75Equals(attributeInstance.ConstructorArguments[0].Value, true))
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\ProvideObsoleteAttributeMessage.cs (2)
72(attribute.ConstructorArguments.IsEmpty || 73string.IsNullOrEmpty(attribute.ConstructorArguments.First().Value as string)))
Microsoft.CodeQuality.Analyzers\Maintainability\AvoidUninstantiatedInternalClasses.cs (6)
189attribute.ConstructorArguments.Length == 1 && 190attribute.ConstructorArguments[0].Kind == TypedConstantKind.Type && 191attribute.ConstructorArguments[0].Value is INamedTypeSymbol typeSymbol && 207if (attribute.ConstructorArguments.Length is not (1 or 2) || 214switch (attribute.ConstructorArguments[0].Value) 246switch (attribute.ConstructorArguments[0].Value)
Microsoft.CodeQuality.Analyzers\Maintainability\AvoidUnusedPrivateFields.cs (2)
64if (attribute.ConstructorArguments.Length == 1) 66var argument = attribute.ConstructorArguments[0];
Microsoft.NetCore.Analyzers\InteropServices\DisableRuntimeMarshallingAnalyzer.AutoLayoutTypeCache.cs (2)
59if (attr.ConstructorArguments.Length > 0 60&& attr.ConstructorArguments[0] is TypedConstant argument
Microsoft.NetCore.Analyzers\InteropServices\PInvokeDiagnosticAnalyzer.cs (2)
172if (!attributeData.ConstructorArguments.IsEmpty) 174TypedConstant argument = attributeData.ConstructorArguments.First();
Microsoft.NetCore.Analyzers\InteropServices\PlatformCompatibilityAnalyzer.cs (4)
2102if (!attribute.ConstructorArguments.IsEmpty && 2103attribute.ConstructorArguments[0] is { } argument && 2243if (attribute.ConstructorArguments.Length == 2) 2245return attribute.ConstructorArguments[1].Value?.ToString();
Microsoft.NetCore.Analyzers\InteropServices\UseValidPlatformString.cs (1)
179var constructorArguments = attributeData.ConstructorArguments;
Microsoft.NetCore.Analyzers\Resources\MarkAssembliesWithNeutralResourcesLanguage.cs (1)
158if (data.ConstructorArguments.Any(c => c.Value is string constantValue && !string.IsNullOrWhiteSpace(constantValue)))
Microsoft.NetCore.Analyzers\Runtime\AttributeStringLiteralsShouldParseCorrectly.cs (1)
156var constructorArguments = attributeData.ConstructorArguments;
Microsoft.NetCore.Analyzers\Runtime\DetectPreviewFeatureAnalyzer.cs (1)
875ImmutableArray<TypedConstant> constructorArguments = attribute.ConstructorArguments;
Microsoft.NetCore.Analyzers\Runtime\DoNotPassLiteralsAsLocalizedParameters.cs (3)
319localizableAttribute.ConstructorArguments.Length == 1 && 320localizableAttribute.ConstructorArguments[0].Kind == TypedConstantKind.Primitive && 321localizableAttribute.ConstructorArguments[0].Value is bool isLocalizable)
Microsoft.NetCore.Analyzers\Runtime\ProvideCorrectArgumentsToFormattingMethods.cs (1)
501ImmutableArray<TypedConstant> arguments = attribute.ConstructorArguments;
Microsoft.NetCore.Analyzers\Security\DoNotDisableRequestValidation.cs (1)
77var constructorArguments = attr.ConstructorArguments;
Microsoft.NetCore.Analyzers\Security\Helpers\InsecureDeserializationTypeDecider.cs (4)
338|| knownTypeAttributeData.ConstructorArguments.Length != 1) 343var typedConstant = knownTypeAttributeData.ConstructorArguments[0]; 373|| xmlIncludeAttributeData.ConstructorArguments.Length != 1) 378var typedConstant = xmlIncludeAttributeData.ConstructorArguments[0];
Microsoft.NetCore.Analyzers\Security\UseDefaultDllImportSearchPathsAttribute.cs (2)
115var constructorArguments = primaryAttribute.ConstructorArguments; 129validatedDefaultDllImportSearchPathsAttribute.ConstructorArguments.FirstOrDefault().Value is int dllImportSearchPath)
Microsoft.NetFramework.Analyzers\MarkVerbHandlersWithValidateAntiforgeryTokenAnalyzer.MvcAttributeSymbols.cs (2)
102foreach (TypedConstant tc in a.ConstructorArguments[0].Values) 118int i = (int)a.ConstructorArguments[0].Value!;
Microsoft.CodeAnalysis.Razor.Compiler (9)
CSharp\DefaultTagHelperDescriptorFactory.cs (5)
69return editorBrowsableAttribute?.ConstructorArguments is [{ Value: object value }, ..] && 154var constructorArguments = restrictChildrenAttribute.ConstructorArguments; 191attribute.ConstructorArguments is [{ Value: string value }, ..]) 204var (hasExplicitName, attributeName) = attributeNameAttribute?.ConstructorArguments is [{ Value: string { Length: > 0 } value }, ..] 361if (attribute.ConstructorArguments is [{ Value: string value }, ..])
Language\TagHelpers\Producers\BindTagHelperProducer.cs (1)
129var constructorArguments = attribute.ConstructorArguments;
Language\TagHelpers\Producers\ComponentTagHelperProducer.cs (2)
160attribute.ConstructorArguments.FirstOrDefault() is { Value: string value }) 546foreach (var arg in attribute.ConstructorArguments)
Language\TagHelpers\Producers\EventHandlerTagHelperProducer.cs (1)
68var arguments = attribute.ConstructorArguments;
Microsoft.CodeAnalysis.ResxSourceGenerator (3)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\CollectionExpressionUtilities.cs (1)
155if (attribute is not { ConstructorArguments: [{ Value: INamedTypeSymbol builderType }, { Value: string builderMethodName }] })
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\InterceptsLocationUtilities.cs (1)
49ConstructorArguments: [{ Value: int version }, { Value: string attributeData }]
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (1)
583if (attributeUsageAttribute.ConstructorArguments is [{ Value: int targetsValue }, ..])
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (2)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\AttributeGenerator.vb (2)
45If attribute.ConstructorArguments.Length = 0 AndAlso attribute.NamedArguments.Length = 0 Then 51arguments.AddRange(attribute.ConstructorArguments.Select(
Microsoft.CodeAnalysis.VisualBasic.Workspaces (2)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\AttributeGenerator.vb (2)
45If attribute.ConstructorArguments.Length = 0 AndAlso attribute.NamedArguments.Length = 0 Then 51arguments.AddRange(attribute.ConstructorArguments.Select(
Microsoft.CodeAnalysis.Workspaces (9)
Editing\SyntaxGenerator.cs (1)
1077var args = attribute.ConstructorArguments.Select(a => this.AttributeArgument(this.TypedConstantExpression(a)))
FindSymbols\FindReferences\DependentProjectsFinder.cs (1)
299var typeNameConstant = attr.ConstructorArguments.FirstOrDefault();
FindSymbols\FindReferences\Finders\OrdinaryMethodReferenceFinder.cs (1)
150attribute.ConstructorArguments is [{ Value: INamedTypeSymbol builderType }, { Value: string factoryName }] &&
Shared\Extensions\ISymbolExtensions.cs (3)
136attribute.ConstructorArguments is [{ Value: int value }]) 186if (attribute.ConstructorArguments.Length == 1) 193var argumentValue = attribute.ConstructorArguments.First().Value;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\CollectionExpressionUtilities.cs (1)
155if (attribute is not { ConstructorArguments: [{ Value: INamedTypeSymbol builderType }, { Value: string builderMethodName }] })
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\InterceptsLocationUtilities.cs (1)
49ConstructorArguments: [{ Value: int version }, { Value: string attributeData }]
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (1)
583if (attributeUsageAttribute.ConstructorArguments is [{ Value: int targetsValue }, ..])
Microsoft.Diagnostics.DataContractReader.DataGenerator (10)
Parser.cs (10)
48cdacAttr.ConstructorArguments[0].Values 220(string)customInitAttr.ConstructorArguments[0].Value!; 242int offset = fieldOffsetAttr.ConstructorArguments.Length > 0 && fieldOffsetAttr.ConstructorArguments[0].Value is int o ? o : 0; 270string[]? ctorNames = fieldAttr.ConstructorArguments.Length > 0 ? ReadStringArray(fieldAttr.ConstructorArguments[0]) : null; 307string[]? ctorNames = addrAttr.ConstructorArguments.Length > 0 ? ReadStringArray(addrAttr.ConstructorArguments[0]) : null; 378string fieldName = (a.ConstructorArguments.Length > 0 && a.ConstructorArguments[0].Value is string s) ? s : method.Name;
Microsoft.DotNet.ApiCompatibility (2)
Comparing\AttributeDataEqualityComparer.cs (2)
29if (!Enumerable.SequenceEqual(x.ConstructorArguments, y.ConstructorArguments, typedConstantEqualityComparer))
Microsoft.DotNet.ApiSymbolExtensions (1)
AttributeDataExtensions.cs (1)
37.Concat(attributeData.ConstructorArguments)
Microsoft.Extensions.Configuration.Binder.SourceGeneration (1)
ConfigurationBindingGenerator.Parser.cs (1)
752string configKeyName = attributeData?.ConstructorArguments.FirstOrDefault().Value as string ?? propertyName;
Microsoft.Extensions.Logging.Generators (3)
LoggerMessageGenerator.Parser.cs (3)
134if (attributeData.ConstructorArguments.Any()) 136foreach (TypedConstant typedConstant in attributeData.ConstructorArguments) 145ImmutableArray<TypedConstant> items = attributeData.ConstructorArguments;
Microsoft.Extensions.Options.SourceGeneration (7)
Parser.cs (7)
378if (attribute.ConstructorArguments.Length == 1) 380var transValidatorType = attribute.ConstructorArguments[0].Value as INamedTypeSymbol; 441if (attribute.ConstructorArguments.Length == 1) 443var enumerationValidatorType = attribute.ConstructorArguments[0].Value as INamedTypeSymbol; 516ImmutableArray<TypedConstant> arguments = attribute.ConstructorArguments; 637trackedTypeList!.Add((modelType.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat), (string)attribute.ConstructorArguments[0].Value!)); 668argumentValue = attribute.ConstructorArguments[i].Value;
Microsoft.Extensions.Validation.ValidationsGenerator (3)
Extensions\ISymbolExtensions.cs (2)
63&& !displayNameAttr.ConstructorArguments.IsDefaultOrEmpty 64&& displayNameAttr.ConstructorArguments[0].Value is string dn)
Extensions\ITypeSymbolExtensions.cs (1)
121var derivedType = (INamedTypeSymbol?)attribute.ConstructorArguments[0].Value;
Microsoft.Gen.Logging (4)
AttributeProcessors.cs (4)
40foreach (var a in attr.ConstructorArguments) 186providerType = attr.ConstructorArguments[0].Value as ITypeSymbol; 187providerMethodName = attr.ConstructorArguments[1].Value as string; 193=> attr.ConstructorArguments[0].Value as string ?? string.Empty;
Microsoft.Gen.MetadataExtractor (8)
Parser_2.cs (8)
265&& !attributeData.ConstructorArguments.IsDefaultOrEmpty 266&& attributeData.ConstructorArguments[0].Kind == TypedConstantKind.Primitive) 268var ctorArg0 = attributeData.ConstructorArguments[0].Value as string; 306if (!attribute.ConstructorArguments.IsDefaultOrEmpty) 308foreach (var arg in attribute.ConstructorArguments) 426if (!methodAttribute.ConstructorArguments.IsDefaultOrEmpty 427&& methodAttribute.ConstructorArguments[0].Kind == TypedConstantKind.Type) 430var ctorArg = methodAttribute.ConstructorArguments[0];
Microsoft.Gen.Metrics (8)
Parser.cs (8)
265&& !attributeData.ConstructorArguments.IsDefaultOrEmpty 266&& attributeData.ConstructorArguments[0].Kind == TypedConstantKind.Primitive) 268var ctorArg0 = attributeData.ConstructorArguments[0].Value as string; 306if (!attribute.ConstructorArguments.IsDefaultOrEmpty) 308foreach (var arg in attribute.ConstructorArguments) 426if (!methodAttribute.ConstructorArguments.IsDefaultOrEmpty 427&& methodAttribute.ConstructorArguments[0].Kind == TypedConstantKind.Type) 430var ctorArg = methodAttribute.ConstructorArguments[0];
Microsoft.Gen.MetricsReports (8)
Parser.cs (8)
265&& !attributeData.ConstructorArguments.IsDefaultOrEmpty 266&& attributeData.ConstructorArguments[0].Kind == TypedConstantKind.Primitive) 268var ctorArg0 = attributeData.ConstructorArguments[0].Value as string; 306if (!attribute.ConstructorArguments.IsDefaultOrEmpty) 308foreach (var arg in attribute.ConstructorArguments) 426if (!methodAttribute.ConstructorArguments.IsDefaultOrEmpty 427&& methodAttribute.ConstructorArguments[0].Kind == TypedConstantKind.Type) 430var ctorArg = methodAttribute.ConstructorArguments[0];
Microsoft.Interop.ComInterfaceGenerator (12)
Analyzers\AddGeneratedComClassFixer.cs (2)
52&& attr.ConstructorArguments.Length == 1 53&& attr.ConstructorArguments[0].Value is true).ToArray();
Analyzers\ConvertComImportToGeneratedComInterfaceAnalyzer.cs (1)
53|| interfaceTypeAttributeData is not { ConstructorArguments: [{ Value: (int)ComInterfaceType.InterfaceIsIUnknown }] })
Analyzers\GeneratedComInterfaceAttributeAnalyzer.cs (2)
51if (comInterfaceAttribute.ConstructorArguments.IsEmpty) 56TypedConstant ctorArg0 = comInterfaceAttribute.ConstructorArguments[0];
AttributeInfo.cs (1)
18var args = attribute.ConstructorArguments.Select(ca => ca.ToCSharpString());
ComInterfaceInfo.cs (2)
380&& guidAttr.ConstructorArguments.Length == 1 381&& guidAttr.ConstructorArguments[0].Value is string guidStr
ComMethodInfo.cs (1)
563&& attr.ConstructorArguments.Length == 0)
VtableIndexStubGenerator.cs (3)
201if (attrData.ConstructorArguments.Length == 0 || attrData.ConstructorArguments[0].Value is not int) 249return new VirtualMethodIndexCompilationData((int)attrData.ConstructorArguments[0].Value).WithValuesFromNamedArguments(namedArguments) with
Microsoft.Interop.JavaScript.JSImportGenerator (5)
JSImportGenerator.cs (5)
123if (attrData.ConstructorArguments.Length == 1) 125return new JSImportData(attrData.ConstructorArguments[0].Value!.ToString(), null); 127if (attrData.ConstructorArguments.Length == 2) 129return new JSImportData(attrData.ConstructorArguments[0].Value!.ToString(), attrData.ConstructorArguments[1].Value!.ToString());
Microsoft.Interop.LibraryImportGenerator (13)
Analyzers\ConvertToLibraryImportAnalyzer.cs (2)
189return bestFitMappingContainingType.ConstructorArguments[0].Value is true; 195return bestFitMappingContainingAssembly.ConstructorArguments[0].Value is true;
Analyzers\CustomMarshallerAttributeFixer.cs (1)
184&& attr.ApplicationSyntaxReference.Span.Contains(locationInAttribute.SourceSpan)).ConstructorArguments[0].Value!;
Analyzers\LibraryImportDiagnosticsAnalyzer.cs (4)
145&& attr.ConstructorArguments.Length >= 1 146&& attr.ConstructorArguments[0].Value is string toolName 327if (attrData.ConstructorArguments.Length == 0) 344return new LibraryImportCompilationData(attrData.ConstructorArguments[0].Value!.ToString())
Analyzers\ShapeBreakingDiagnosticSuppressor.cs (3)
63&& !attr.ConstructorArguments[0].IsNull 64&& attr.ConstructorArguments[2].Value is INamedTypeSymbol marshallerTypeInAttribute 69return (containingType, (INamedTypeSymbol)attrData.ConstructorArguments[0].Value);
LibraryImportGenerator.cs (3)
137Literal((int)defaultDllImportSearchPathsAttribute.ConstructorArguments[0].Value!)))))); 180if (attrData.ConstructorArguments.Length == 0) 197return new LibraryImportCompilationData(attrData.ConstructorArguments[0].Value!.ToString())
Microsoft.Interop.LibraryImportGenerator.Downlevel (7)
DownlevelLibraryImportDiagnosticsAnalyzer.cs (4)
147&& attr.ConstructorArguments.Length >= 1 148&& attr.ConstructorArguments[0].Value is string toolName 331if (attrData.ConstructorArguments.Length == 0) 348return new LibraryImportCompilationData(attrData.ConstructorArguments[0].Value!.ToString())
DownlevelLibraryImportGenerator.cs (3)
122Literal((int)defaultDllImportSearchPathsAttribute.ConstructorArguments[0].Value!)))))); 161if (attrData.ConstructorArguments.Length == 0) 178return new LibraryImportCompilationData(attrData.ConstructorArguments[0].Value!.ToString())
Microsoft.Interop.SourceGeneration (11)
ManualTypeMarshallingHelper.cs (5)
177if (attr.ConstructorArguments.Length != 3) 179Debug.WriteLine($"{attr} has {attr.ConstructorArguments.Length} constructor arguments - expected 3"); 184ITypeSymbol? managedTypeOnAttr = attr.ConstructorArguments[0].Value as ITypeSymbol; 206var marshalMode = (MarshalMode)attr.ConstructorArguments[1].Value!; 208ITypeSymbol? marshallerTypeOnAttr = attr.ConstructorArguments[2].Value as ITypeSymbol;
MarshalAsParser.cs (1)
202object unmanagedTypeObj = attributeData.ConstructorArguments[0].Value!;
MarshalUsingAttributeParser.cs (2)
37if (attributeData.ConstructorArguments.Length == 0) 46if (attributeData.ConstructorArguments[0].Value is not INamedTypeSymbol namedType)
NativeMarshallingAttributeParser.cs (1)
31if (attributeData.ConstructorArguments[0].Value is not INamedTypeSymbol entryPointType)
TypeSymbolExtensions.cs (2)
141return attr.ConstructorArguments.Length == 1 && (LayoutKind)(int)attr.ConstructorArguments[0].Value! == LayoutKind.Auto;
Microsoft.Maui.Controls.BindingSourceGen (2)
ISymbolExtensions.cs (2)
58 return (attribute.ConstructorArguments.Length > 0 ? attribute.ConstructorArguments[0].Value as string : null) ?? defaultName;
Microsoft.Maui.Controls.SourceGen (3)
CodeBehindGenerator.cs (3)
217 var xmlnsDef = new XmlnsDefinitionAttribute(attr.ConstructorArguments[0].Value as string, attr.ConstructorArguments[1].Value as string); 232 if (attr.ConstructorArguments[0].Value is string assemblyName && new AssemblyName(assemblyName).Name == compilation.Assembly.Identity.Name)
Roslyn.Diagnostics.Analyzers (10)
AbstractApplyTraitToClass`1.cs (2)
108if (!expectedAttributeData.ConstructorArguments.SequenceEqual(actualAttributeData.ConstructorArguments))
ImportingConstructorShouldBeObsolete.cs (5)
120if (attributeData.ConstructorArguments.Length != 2) 122if (attributeData.ConstructorArguments.IsEmpty) 128else if (attributeData.ConstructorArguments.Length == 1) 142if (!Equals(attributeData.ConstructorArguments[0].Value, "This exported object must be obtained through the MEF export provider.")) 149if (!Equals(attributeData.ConstructorArguments[1].Value, true))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\CollectionExpressionUtilities.cs (1)
155if (attribute is not { ConstructorArguments: [{ Value: INamedTypeSymbol builderType }, { Value: string builderMethodName }] })
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\InterceptsLocationUtilities.cs (1)
49ConstructorArguments: [{ Value: int version }, { Value: string attributeData }]
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (1)
583if (attributeUsageAttribute.ConstructorArguments is [{ Value: int targetsValue }, ..])
Roslyn.Diagnostics.CSharp.Analyzers (2)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\AttributeGenerator.cs (2)
81if (attribute.ConstructorArguments.Length == 0 && attribute.NamedArguments.Length == 0) 86foreach (var argument in attribute.ConstructorArguments)
Roslyn.Diagnostics.VisualBasic.Analyzers (2)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\AttributeGenerator.vb (2)
45If attribute.ConstructorArguments.Length = 0 AndAlso attribute.NamedArguments.Length = 0 Then 51arguments.AddRange(attribute.ConstructorArguments.Select(
System.Private.CoreLib.Generators (2)
IntrinsicsInSystemPrivateCoreLibAnalyzer.cs (2)
388if (attributeData.ConstructorArguments[0].Value is INamedTypeSymbol attributeTypeSymbol) 521if (attributeData.ConstructorArguments[0].Value is INamedTypeSymbol attributeTypeSymbol)
System.Text.Json.SourceGeneration (28)
JsonSourceGenerator.Parser.cs (28)
274attributeData.ConstructorArguments.Length > 0 && 275attributeData.ConstructorArguments[0].Value is string diagnosticId && 438if (attributeData.ConstructorArguments.Length > 0) 440Debug.Assert(attributeData.ConstructorArguments.Length == 1 & attributeData.ConstructorArguments[0].Type?.Name is nameof(JsonSerializerDefaults)); 441defaults = (JsonSerializerDefaults)attributeData.ConstructorArguments[0].Value!; 629Debug.Assert(attributeData.ConstructorArguments.Length == 1); 630var typeSymbol = (ITypeSymbol?)attributeData.ConstructorArguments[0].Value; 1005numberHandling = (JsonNumberHandling)attributeData.ConstructorArguments[0].Value!; 1010unmappedMemberHandling = (JsonUnmappedMemberHandling)attributeData.ConstructorArguments[0].Value!; 1015objectCreationHandling = (JsonObjectCreationHandling)attributeData.ConstructorArguments[0].Value!; 1020if (attributeData.ConstructorArguments.Length == 1 && 1021attributeData.ConstructorArguments[0].Value is int knownPolicyValue) 1063Debug.Assert(attributeData.ConstructorArguments.Length > 0); 1065ITypeSymbol derivedType = (ITypeSymbol)attributeData.ConstructorArguments[0].Value!; 1068if (attributeData.ConstructorArguments.Length == 2) 1070typeDiscriminator = attributeData.ConstructorArguments[1].Value; 2004attr.ConstructorArguments.Length > 0 && 2005attr.ConstructorArguments[0].Value is int handlingValue && 2634if (attributeData.ConstructorArguments.Length == 1 && 2635attributeData.ConstructorArguments[0].Value is int knownPolicyValue) 2672ImmutableArray<TypedConstant> ctorArgs = attributeData.ConstructorArguments; 2678ImmutableArray<TypedConstant> ctorArgs = attributeData.ConstructorArguments; 2684ImmutableArray<TypedConstant> ctorArgs = attributeData.ConstructorArguments; 2691ImmutableArray<TypedConstant> ctorArgs = attributeData.ConstructorArguments; 2975Debug.Assert(attributeData.ConstructorArguments.Length == 1 && attributeData.ConstructorArguments[0].Value is null or ITypeSymbol); 2976var converterType = (ITypeSymbol?)attributeData.ConstructorArguments[0].Value;
System.Text.RegularExpressions.Generator (2)
RegexGenerator.Parser.cs (2)
69if (generatedRegexAttr.ConstructorArguments.Any(ca => ca.Kind == TypedConstantKind.Error)) 74ImmutableArray<TypedConstant> items = generatedRegexAttr.ConstructorArguments;