205 references to ConstructorArguments
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;
ILLink.RoslynAnalyzer (20)
COMAnalyzer.cs (3)
63 marshalAsAttribute.ConstructorArguments.Length >= 1 && marshalAsAttribute.ConstructorArguments[0] is TypedConstant typedConstant && 116 (LayoutKind) structLayoutAttribute.ConstructorArguments[0].Value! == LayoutKind.Auto) {
DataFlow\LocalDataFlowVisitor.cs (2)
758 if (attributeData.ConstructorArguments.Length != 1) 761 var attributeArgument = attributeData.ConstructorArguments[0];
ISymbolExtensions.cs (3)
61 return (DynamicallyAccessedMemberTypes) dynamicallyAccessedMembers!.ConstructorArguments[0].Value!; 77 return (DynamicallyAccessedMemberTypes) dynamicallyAccessedMembers.ConstructorArguments[0].Value!; 84 if (featureGuardAttribute.ConstructorArguments is [TypedConstant { Value: INamedTypeSymbol featureType }])
RequiresAnalyzerBase.cs (1)
111 (string) requiresAttribute.ConstructorArguments[0].Value!,
RequiresAssemblyFilesAnalyzer.cs (5)
130 protected override bool VerifyAttributeArguments (AttributeData attribute) => attribute.ConstructorArguments.Length == 0 || 131 attribute.ConstructorArguments.Length >= 1 && attribute.ConstructorArguments is [ { Type.SpecialType: SpecialType.System_String }, ..]; 136 if (requiresAttribute.ConstructorArguments.Length >= 1) { 137 message = requiresAttribute.ConstructorArguments[0].Value?.ToString () ?? "";
RequiresDynamicCodeAnalyzer.cs (3)
143 attribute.ConstructorArguments.Length >= 1 && attribute.ConstructorArguments is [ { Type.SpecialType: SpecialType.System_String }, ..]; 147 var message = (string) requiresAttribute!.ConstructorArguments[0].Value!;
RequiresUnreferencedCodeUtils.cs (3)
37 => attribute.ConstructorArguments.Length >= 1 && attribute.ConstructorArguments is [ { Type.SpecialType: SpecialType.System_String }, ..]; 41 var message = (string) requiresAttribute!.ConstructorArguments[0].Value!;
Microsoft.Analyzers.Extra (3)
CallAnalysis\Fixers\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)
158var constructorArgument = keyedServicesAttribute.ConstructorArguments.FirstOrDefault();
Microsoft.AspNetCore.Mvc.Api.Analyzers (22)
ActualApiResponseMetadataFactory.cs (3)
249attribute.ConstructorArguments.Length == 1 && 250attribute.ConstructorArguments[0].Kind == TypedConstantKind.Primitive && 251attribute.ConstructorArguments[0].Value is int statusCode)
SymbolApiConventionMatcher.cs (6)
65attribute.ConstructorArguments.Length != 1 || 66attribute.ConstructorArguments[0].Kind != TypedConstantKind.Enum) 71var argEnum = attribute.ConstructorArguments[0].Value; 87attribute.ConstructorArguments.Length != 1 || 88attribute.ConstructorArguments[0].Kind != TypedConstantKind.Enum) 93var argEnum = attribute.ConstructorArguments[0].Value;
SymbolApiResponseMetadataProvider.cs (13)
54errorTypeAttribute.ConstructorArguments.Length == 1 && 55errorTypeAttribute.ConstructorArguments[0].Kind == TypedConstantKind.Type && 56errorTypeAttribute.ConstructorArguments[0].Value is ITypeSymbol typeSymbol) 93if (attribute.ConstructorArguments.Length != 2) 98if (attribute.ConstructorArguments[0].Kind != TypedConstantKind.Type || 99!(attribute.ConstructorArguments[0].Value is ITypeSymbol conventionType)) 104if (attribute.ConstructorArguments[1].Kind != TypedConstantKind.Primitive || 105!(attribute.ConstructorArguments[1].Value is string conventionMethodName)) 173if (attribute.ConstructorArguments.Length != 1 || 174attribute.ConstructorArguments[0].Kind != TypedConstantKind.Type || 175!(attribute.ConstructorArguments[0].Value is ITypeSymbol conventionType)) 214if (attribute.ConstructorArguments.Length < i) 219var argument = attribute.ConstructorArguments[i];
Microsoft.CodeAnalysis.CodeStyle (4)
src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (2)
833attribute.ConstructorArguments is [_, { Kind: TypedConstantKind.Primitive, Value: string checkId }, ..]) 842attribute.ConstructorArguments[0] is
src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (1)
734attribute.ConstructorArguments is [{ Kind: TypedConstantKind.Primitive, Type.SpecialType: SpecialType.System_String, Value: string value }])
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\InterceptsLocationUtilities.cs (1)
48ConstructorArguments: [{ Value: int version }, { Value: string attributeData }]
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (2)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\AttributeGenerator.cs (2)
84if (attribute.ConstructorArguments.Length == 0 && attribute.NamedArguments.Length == 0) 89foreach (var argument in attribute.ConstructorArguments)
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (11)
Attributes\AttributeTests.cs (4)
654Assert.Equal(TypedConstantKind.Array, attributeData.ConstructorArguments.Single().Kind); 655Assert.Equal(new object[] { 1, 2, 3 }, attributeData.ConstructorArguments.Single().Values.Select(arg => arg.Value)); 712Assert.Equal("M0", attrs.Single().ConstructorArguments.Single().Value); 8855Assert.Equal(0, type.GetAttributes()[0].ConstructorArguments.Count());
Semantics\ParamsCollectionTests.cs (7)
242Assert.Empty(attributeData1.ConstructorArguments); 358Assert.Empty(attributeData1.ConstructorArguments); 540Assert.Empty(attributeData1.ConstructorArguments); 686Assert.Empty(attributeData1.ConstructorArguments); 1430Assert.Empty(attributeData1.ConstructorArguments); 2554Assert.Empty(attributeData1.ConstructorArguments); 2690Assert.Empty(attributeData1.ConstructorArguments);
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (1)
Semantics\LocalFunctionTests.cs (1)
559Assert.Equal(42, attributeData.ConstructorArguments.Single().Value);
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (1)
Compilation\SemanticModelAPITests.cs (1)
4454Assert.Equal("DEBUG", attribute.ConstructorArguments[0].Value);
Microsoft.CodeAnalysis.CSharp.Test.Utilities (1)
TestAttributesVisitor.cs (1)
164var arguments = attribute.ConstructorArguments.ToImmutableArray();
Microsoft.CodeAnalysis.CSharp.Workspaces (2)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\AttributeGenerator.cs (2)
84if (attribute.ConstructorArguments.Length == 0 && attribute.NamedArguments.Length == 0) 89foreach (var argument in attribute.ConstructorArguments)
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (1)
CodeGeneration\SyntaxGeneratorTests.cs (1)
4975var type = (ITypeSymbol)attribute.ConstructorArguments[0].Values[2].Value;
Microsoft.CodeAnalysis.Features (6)
DesignerAttribute\DesignerAttributeDiscoveryService.cs (1)
321if (attribute is { ConstructorArguments: [{ Type.SpecialType: SpecialType.System_String, Value: string stringValue }] })
EmbeddedLanguages\EmbeddedLanguageDetector.cs (2)
464if (attribute.ConstructorArguments.Length == 0) 488var argument = attribute.ConstructorArguments[0];
src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (2)
833attribute.ConstructorArguments is [_, { Kind: TypedConstantKind.Primitive, Value: string checkId }, ..]) 842attribute.ConstructorArguments[0] is
src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (1)
734attribute.ConstructorArguments is [{ Kind: TypedConstantKind.Primitive, Type.SpecialType: SpecialType.System_String, Value: string value }])
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (2)
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\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 (6)
Editing\SyntaxGenerator.cs (1)
1024var args = attribute.ConstructorArguments.Select(a => this.AttributeArgument(this.TypedConstantExpression(a)))
FindSymbols\FindReferences\DependentProjectsFinder.cs (1)
289var typeNameConstant = attr.ConstructorArguments.FirstOrDefault();
Shared\Extensions\ISymbolExtensions.cs (3)
136attribute.ConstructorArguments is [{ Value: int value }]) 186if (attribute.ConstructorArguments.Length == 1) 193var argumentValue = attribute.ConstructorArguments.First().Value;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\InterceptsLocationUtilities.cs (1)
48ConstructorArguments: [{ Value: int version }, { Value: string attributeData }]
Microsoft.Extensions.Logging.Generators (3)
LoggerMessageGenerator.Parser.cs (3)
136if (attributeData.ConstructorArguments.Any()) 138foreach (TypedConstant typedConstant in attributeData.ConstructorArguments) 147ImmutableArray<TypedConstant> items = attributeData.ConstructorArguments;
Microsoft.Extensions.Options.SourceGeneration (7)
Parser.cs (7)
366if (attribute.ConstructorArguments.Length == 1) 368var transValidatorType = attribute.ConstructorArguments[0].Value as INamedTypeSymbol; 429if (attribute.ConstructorArguments.Length == 1) 431var enumerationValidatorType = attribute.ConstructorArguments[0].Value as INamedTypeSymbol; 504ImmutableArray<TypedConstant> arguments = attribute.ConstructorArguments; 625trackedTypeList!.Add((modelType.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat), (string)attribute.ConstructorArguments[0].Value!)); 656argumentValue = attribute.ConstructorArguments[i].Value;
Microsoft.Gen.Logging (4)
Parsing\AttributeProcessors.cs (4)
41foreach (var a in attr.ConstructorArguments) 187providerType = attr.ConstructorArguments[0].Value as ITypeSymbol; 188providerMethodName = attr.ConstructorArguments[1].Value as string; 194=> attr.ConstructorArguments[0].Value as string ?? string.Empty;
Microsoft.Gen.Metrics (8)
Parser.cs (8)
260&& !attributeData.ConstructorArguments.IsDefaultOrEmpty 261&& attributeData.ConstructorArguments[0].Kind == TypedConstantKind.Primitive) 263var ctorArg0 = attributeData.ConstructorArguments[0].Value as string; 296if (!attribute.ConstructorArguments.IsDefaultOrEmpty) 298foreach (var arg in attribute.ConstructorArguments) 422if (!methodAttribute.ConstructorArguments.IsDefaultOrEmpty 423&& methodAttribute.ConstructorArguments[0].Kind == TypedConstantKind.Type) 426var ctorArg = methodAttribute.ConstructorArguments[0];
Microsoft.Gen.MetricsReports (8)
src\Generators\Microsoft.Gen.Metrics\Parser.cs (8)
260&& !attributeData.ConstructorArguments.IsDefaultOrEmpty 261&& attributeData.ConstructorArguments[0].Kind == TypedConstantKind.Primitive) 263var ctorArg0 = attributeData.ConstructorArguments[0].Value as string; 296if (!attribute.ConstructorArguments.IsDefaultOrEmpty) 298foreach (var arg in attribute.ConstructorArguments) 422if (!methodAttribute.ConstructorArguments.IsDefaultOrEmpty 423&& methodAttribute.ConstructorArguments[0].Kind == TypedConstantKind.Type) 426var ctorArg = methodAttribute.ConstructorArguments[0];
Microsoft.Interop.ComInterfaceGenerator (9)
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)
28var args = attribute.ConstructorArguments.Select(ca => ca.ToCSharpString());
ComInterfaceInfo.cs (2)
341&& guidAttr.ConstructorArguments.Length == 1 342&& guidAttr.ConstructorArguments[0].Value is string guidStr
VtableIndexStubGenerator.cs (3)
140if (attrData.ConstructorArguments.Length == 0 || attrData.ConstructorArguments[0].Value is not int) 188return new VirtualMethodIndexCompilationData((int)attrData.ConstructorArguments[0].Value).WithValuesFromNamedArguments(namedArguments) with
Microsoft.Interop.JavaScript.JSImportGenerator (5)
JSImportGenerator.cs (5)
138if (attrData.ConstructorArguments.Length == 1) 140return new JSImportData(attrData.ConstructorArguments[0].Value!.ToString(), null); 142if (attrData.ConstructorArguments.Length == 2) 144return new JSImportData(attrData.ConstructorArguments[0].Value!.ToString(), attrData.ConstructorArguments[1].Value!.ToString());
Microsoft.Interop.LibraryImportGenerator (9)
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\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)
154Literal((int)defaultDllImportSearchPathsAttribute.ConstructorArguments[0].Value!)))))); 195if (attrData.ConstructorArguments.Length == 0) 212return new LibraryImportCompilationData(attrData.ConstructorArguments[0].Value!.ToString())
Microsoft.Interop.LibraryImportGenerator.Downlevel (3)
DownlevelLibraryImportGenerator.cs (3)
100Literal((int)defaultDllImportSearchPathsAttribute.ConstructorArguments[0].Value!)))))); 137if (attrData.ConstructorArguments.Length == 0) 154return new LibraryImportCompilationData(attrData.ConstructorArguments[0].Value!.ToString())
Microsoft.Interop.SourceGeneration (11)
ManualTypeMarshallingHelper.cs (5)
175if (attr.ConstructorArguments.Length != 3) 177Debug.WriteLine($"{attr} has {attr.ConstructorArguments.Length} constructor arguments - expected 3"); 182ITypeSymbol? managedTypeOnAttr = attr.ConstructorArguments[0].Value as ITypeSymbol; 204var marshalMode = (MarshalMode)attr.ConstructorArguments[1].Value!; 206ITypeSymbol? marshallerTypeOnAttr = attr.ConstructorArguments[2].Value as ITypeSymbol;
MarshalAsParser.cs (1)
154object 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)
Mvc.Analyzers.Test (15)
CodeAnalysisExtensionsTest.cs (15)
63attributeData => Assert.Equal(201, attributeData.ConstructorArguments[0].Value)); 100attributeData => Assert.Equal(400, attributeData.ConstructorArguments[0].Value)); 137attributeData => Assert.Equal(400, attributeData.ConstructorArguments[0].Value)); 174attributeData => Assert.Equal(400, attributeData.ConstructorArguments[0].Value), 175attributeData => Assert.Equal(200, attributeData.ConstructorArguments[0].Value), 176attributeData => Assert.Equal(404, attributeData.ConstructorArguments[0].Value)); 219attributeData => Assert.Equal(400, attributeData.ConstructorArguments[0].Value)); 262attributeData => Assert.Equal(401, attributeData.ConstructorArguments[0].Value)); 318Assert.Equal(attributeData.ConstructorArguments[0].Value, compilation.GetSpecialType(SpecialType.System_Object)); 323Assert.Equal(attributeData.ConstructorArguments[0].Value, compilation.GetSpecialType(SpecialType.System_String)); 361Assert.Equal(attributeData.ConstructorArguments[0].Value, compilation.GetSpecialType(SpecialType.System_Int32)); 366Assert.Equal(attributeData.ConstructorArguments[0].Value, compilation.GetSpecialType(SpecialType.System_Object)); 371Assert.Equal(attributeData.ConstructorArguments[0].Value, compilation.GetSpecialType(SpecialType.System_String)); 409Assert.Equal(attributeData.ConstructorArguments[0].Value, compilation.GetSpecialType(SpecialType.System_Int32)); 447Assert.Equal(attributeData.ConstructorArguments[0].Value, compilation.GetSpecialType(SpecialType.System_Int32));
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 (18)
JsonSourceGenerator.Parser.cs (18)
291if (attributeData.ConstructorArguments.Length > 0) 293Debug.Assert(attributeData.ConstructorArguments.Length == 1 & attributeData.ConstructorArguments[0].Type?.Name is nameof(JsonSerializerDefaults)); 294defaults = (JsonSerializerDefaults)attributeData.ConstructorArguments[0].Value!; 454Debug.Assert(attributeData.ConstructorArguments.Length == 1); 455var typeSymbol = (ITypeSymbol?)attributeData.ConstructorArguments[0].Value; 705numberHandling = (JsonNumberHandling)attributeData.ConstructorArguments[0].Value!; 710unmappedMemberHandling = (JsonUnmappedMemberHandling)attributeData.ConstructorArguments[0].Value!; 715objectCreationHandling = (JsonObjectCreationHandling)attributeData.ConstructorArguments[0].Value!; 726Debug.Assert(attributeData.ConstructorArguments.Length > 0); 727var derivedType = (ITypeSymbol)attributeData.ConstructorArguments[0].Value!; 1293ImmutableArray<TypedConstant> ctorArgs = attributeData.ConstructorArguments; 1299ImmutableArray<TypedConstant> ctorArgs = attributeData.ConstructorArguments; 1305ImmutableArray<TypedConstant> ctorArgs = attributeData.ConstructorArguments; 1312ImmutableArray<TypedConstant> ctorArgs = attributeData.ConstructorArguments; 1572Debug.Assert(attributeData.ConstructorArguments.Length == 1 && attributeData.ConstructorArguments[0].Value is null or ITypeSymbol); 1573var 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;