367 references to Value
Aspire.Hosting.Integration.Analyzers (5)
AspireExportAnalyzer.cs (5)
746if (typeConstant.Value is INamedTypeSymbol typeSymbol) 785attribute.ConstructorArguments[0].Value is string id) 844namedArgument.Value.Value is bool enabled) 1150attribute.ConstructorArguments[0].Value is ITypeSymbol constructorType) 1159namedArgument.Value.Value is ITypeSymbol namedType)
ConfigurationSchemaGenerator (6)
ConfigSchemaEmitter.cs (1)
423attribute.ConstructorArguments[0].Value is int value &&
ConfigSchemaGenerator.cs (4)
70var path = (string)args[0].Value; 77(types ??= new()).Add((INamedTypeSymbol)args[1].Value); 82(exclusionPaths ??= new()).AddRange(exclusionPathsArg.Values.Select(v => $"{path}:{(string)v.Value}")); 93(logCategories ??= new()).AddRange(args[0].Values.Select(v => (string)v.Value));
RuntimeSource\Configuration.Binder\ConfigurationBindingGenerator.Parser.cs (1)
675string configKeyName = attributeData?.ConstructorArguments.FirstOrDefault().Value as string ?? propertyName;
EventSourceGenerator (1)
EventSourceGenerator.Parser.cs (1)
111string value = arg.Value.Value?.ToString();
GenerateDocumentationAndConfigFiles (6)
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\ITypeSymbolExtensions.cs (1)
202return !Equals(false, typedConstant.Value);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\CollectionExpressionUtilities.cs (2)
155if (attribute is not { ConstructorArguments: [{ Value: INamedTypeSymbol builderType }, { Value: string builderMethodName }] })
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\InterceptsLocationUtilities.cs (2)
49ConstructorArguments: [{ Value: int version }, { Value: string attributeData }]
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (1)
581if (attributeUsageAttribute.ConstructorArguments is [{ Value: int targetsValue }, ..])
ILLink.RoslynAnalyzer (13)
COMAnalyzer.cs (2)
70var unmanagedType = typedConstant.Value; 133(LayoutKind)structLayoutAttribute.ConstructorArguments[0].Value! == LayoutKind.Auto)
DataFlow\LocalDataFlowVisitor.cs (1)
886if (attributeArgument.Value is not bool doesNotReturnIfConditionValue)
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)
317var url = requiresAttribute?.NamedArguments.FirstOrDefault(na => na.Key == "Url").Value.Value?.ToString(); 435attr.ConstructorArguments[0].Value?.ToString() == assemblyMetadataName && 436string.Equals(attr.ConstructorArguments[1].Value?.ToString(), "True", StringComparison.OrdinalIgnoreCase));
RequiresAssemblyFilesAnalyzer.cs (1)
143message = requiresAttribute.ConstructorArguments[0].Value?.ToString() ?? "";
RequiresDynamicCodeAnalyzer.cs (1)
194var message = (string)requiresAttribute!.ConstructorArguments[0].Value!;
RequiresISymbolExtensions.cs (1)
46if (namedArg.Key == "ExcludeStatics" && namedArg.Value.Value is bool b)
RequiresUnreferencedCodeUtils.cs (1)
41var message = (string)requiresAttribute!.ConstructorArguments[0].Value!;
Microsoft.Analyzers.Extra (3)
CallAnalysis\Fixers\LegacyLoggingFixer.cs (3)
209var level = (LogLevel)argLevel.Value.Value!; 217var message = argMessage.Value.Value!.ToString(); 648var eventId = (int)arg.Value.Value!;
Microsoft.AspNetCore.App.Analyzers (5)
Mvc\DetectAmbiguousActionRoutes.cs (1)
123if (actionNameAttribute != null && actionNameAttribute.ConstructorArguments.Length > 0 && actionNameAttribute.ConstructorArguments[0].Value is string name)
Mvc\DetectOverriddenAuthorizeAttribute.cs (1)
126return (bool)arg.Value.Value!;
RouteEmbeddedLanguage\Infrastructure\RoutePatternParametersDetector.cs (1)
56var routeParameterName = (string)routeParameterNameConstant.Value!;
RouteEmbeddedLanguage\Infrastructure\RouteStringSyntaxDetector.cs (1)
358if (argument.Kind != TypedConstantKind.Primitive || argument.Value is not string argString)
src\aspnetcore\src\Shared\RoslynUtils\SymbolExtensions.cs (1)
288argumentValue = (T?)routeParameterNameConstant.Value;
Microsoft.AspNetCore.Components.Analyzers (1)
ComponentFacts.cs (1)
68return kvp.Value.Value as bool? ?? false;
Microsoft.AspNetCore.Components.SdkAnalyzers (1)
ComponentFacts.cs (1)
68return kvp.Value.Value as bool? ?? false;
Microsoft.AspNetCore.Mvc.Analyzers (1)
TopLevelParameterNameAnalyzer.cs (1)
166namedArgumentValue.Value is string name)
Microsoft.AspNetCore.Mvc.Api.Analyzers (9)
ActualApiResponseMetadataFactory.cs (1)
251attribute.ConstructorArguments[0].Value is int statusCode)
SymbolApiConventionMatcher.cs (2)
71var argEnum = attribute.ConstructorArguments[0].Value; 93var argEnum = attribute.ConstructorArguments[0].Value;
SymbolApiResponseMetadataProvider.cs (6)
56errorTypeAttribute.ConstructorArguments[0].Value is ITypeSymbol typeSymbol) 99!(attribute.ConstructorArguments[0].Value is ITypeSymbol conventionType)) 105!(attribute.ConstructorArguments[1].Value is string conventionMethodName)) 175!(attribute.ConstructorArguments[0].Value is ITypeSymbol conventionType)) 196namedArgumentValue.Value is int statusCode) 220if (argument.Kind == TypedConstantKind.Primitive && argument.Value is int statusCode)
Microsoft.CodeAnalysis (1)
Symbols\TypedConstant.cs (1)
91/// Unlike <see cref="Value"/> returns <see cref="ISymbolInternal"/> when the value is a symbol.
Microsoft.CodeAnalysis.Analyzers (13)
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)
205var supportedLanguage = (string?)argument.Value;
MetaAnalyzers\CompilerExtensionTargetFrameworkAnalyzer.cs (3)
65switch (appliedTargetFrameworkAttribute.ConstructorArguments[0].Value as string) 79displayName = appliedTargetFrameworkAttribute.NamedArguments.FirstOrDefault(arg => arg.Key == nameof(TargetFrameworkAttribute.FrameworkDisplayName)).Value.Value as string 80?? appliedTargetFrameworkAttribute.ConstructorArguments[0].Value as string
MetaAnalyzers\DiagnosticAnalyzerAttributeAnalyzer.cs (1)
153var supportedLanguage = (string?)argument.Value;
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\ITypeSymbolExtensions.cs (1)
202return !Equals(false, typedConstant.Value);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\CollectionExpressionUtilities.cs (2)
155if (attribute is not { ConstructorArguments: [{ Value: INamedTypeSymbol builderType }, { Value: string builderMethodName }] })
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\InterceptsLocationUtilities.cs (2)
49ConstructorArguments: [{ Value: int version }, { Value: string attributeData }]
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (1)
581if (attributeUsageAttribute.ConstructorArguments is [{ Value: int targetsValue }, ..])
Microsoft.CodeAnalysis.AnalyzerUtilities (6)
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\ITypeSymbolExtensions.cs (1)
202return !Equals(false, typedConstant.Value);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\CollectionExpressionUtilities.cs (2)
155if (attribute is not { ConstructorArguments: [{ Value: INamedTypeSymbol builderType }, { Value: string builderMethodName }] })
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\InterceptsLocationUtilities.cs (2)
49ConstructorArguments: [{ Value: int version }, { Value: string attributeData }]
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (1)
581if (attributeUsageAttribute.ConstructorArguments is [{ Value: int targetsValue }, ..])
Microsoft.CodeAnalysis.CodeStyle (9)
src\roslyn\src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (2)
850attribute.ConstructorArguments is [_, { Kind: TypedConstantKind.Primitive, Value: string checkId }, ..]) 862Value: string categoryArg
src\roslyn\src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (2)
902if (attribute.ConstructorArguments is [{ Kind: TypedConstantKind.Primitive, Type.SpecialType: SpecialType.System_String, Value: string value }]) 913Value: { Kind: TypedConstantKind.Primitive, Type.SpecialType: SpecialType.System_String, Value: string namedValue },
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\CollectionExpressionUtilities.cs (2)
155if (attribute is not { ConstructorArguments: [{ Value: INamedTypeSymbol builderType }, { Value: string builderMethodName }] })
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\InterceptsLocationUtilities.cs (2)
49ConstructorArguments: [{ Value: int version }, { Value: string attributeData }]
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (1)
581if (attributeUsageAttribute.ConstructorArguments is [{ Value: int targetsValue }, ..])
Microsoft.CodeAnalysis.CSharp (9)
Symbols\Source\SourceMethodSymbolWithAttributes.cs (5)
1012{ Kind: not TypedConstantKind.Array, Value: int lineNumberOneBased }, 1013{ Kind: not TypedConstantKind.Array, Value: int characterNumberOneBased }]) 1015DecodeInterceptsLocationAttributeExperimentalCompat(arguments, attributeFilePath: (string?)constructorArguments[0].Value, lineNumberOneBased, characterNumberOneBased); 1020DecodeInterceptsLocationChecksumBased(arguments, version: (int)constructorArguments[0].Value!, data: (string?)constructorArguments[1].Value);
Symbols\Source\SourceNamedTypeSymbol_Extension.cs (2)
891appendPrimitive(argument.Value, builder); 897appendPrimitive(argument.Value, builder);
Symbols\TypedConstantExtensions.cs (2)
32Debug.Assert(constant.Value is object); 33return "typeof(" + constant.Value.ToString() + ")";
Microsoft.CodeAnalysis.CSharp.CodeStyle (4)
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (4)
329{ Kind: TypedConstantKind.Type, Value: INamedTypeSymbol builderType }, 330{ Kind: TypedConstantKind.Primitive, Value: string methodName } 908if (collectionBuilderAttributeData?.ConstructorArguments is not [{ Value: ITypeSymbol collectionBuilderType }, { Value: CreateName }])
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (3)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\AttributeGenerator.cs (1)
103if (existingSyntax?.ArgumentList != null && constant is { Kind: not TypedConstantKind.Array, Value: string stringValue })
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ExpressionGenerator.cs (2)
31return GenerateExpression(typedConstant.Type, typedConstant.Value, canUseFieldReference: true); 34return typedConstant.Value is ITypeSymbol typeSymbol
Microsoft.CodeAnalysis.CSharp.Features (4)
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (4)
329{ Kind: TypedConstantKind.Type, Value: INamedTypeSymbol builderType }, 330{ Kind: TypedConstantKind.Primitive, Value: string methodName } 908if (collectionBuilderAttributeData?.ConstructorArguments is not [{ Value: ITypeSymbol collectionBuilderType }, { Value: CreateName }])
Microsoft.CodeAnalysis.CSharp.Workspaces (3)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\AttributeGenerator.cs (1)
103if (existingSyntax?.ArgumentList != null && constant is { Kind: not TypedConstantKind.Array, Value: string stringValue })
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ExpressionGenerator.cs (2)
31return GenerateExpression(typedConstant.Type, typedConstant.Value, canUseFieldReference: true); 34return typedConstant.Value is ITypeSymbol typeSymbol
Microsoft.CodeAnalysis.Extensions.Package (1)
Symbols\ISymbolExtensions.cs (1)
581if (attributeUsageAttribute.ConstructorArguments is [{ Value: int targetsValue }, ..])
Microsoft.CodeAnalysis.Features (11)
DesignerAttribute\DesignerAttributeDiscoveryService.cs (1)
321if (attribute is { ConstructorArguments: [{ Type.SpecialType: SpecialType.System_String, Value: string stringValue }] })
EditAndContinue\AbstractEditAndContinueAnalyzer.cs (5)
5463return attribute.ConstructorArguments.Single().Value switch 6976TypedConstantKind.Type => TypesEquivalent((ITypeSymbol?)x.Value, (ITypeSymbol?)y.Value, exact: false), 6977_ => Equals(x.Value, y.Value)
EmbeddedLanguages\EmbeddedLanguageDetector.cs (1)
533if (argument.Kind != TypedConstantKind.Primitive || argument.Value is not string argString)
src\roslyn\src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (2)
850attribute.ConstructorArguments is [_, { Kind: TypedConstantKind.Primitive, Value: string checkId }, ..]) 862Value: string categoryArg
src\roslyn\src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (2)
902if (attribute.ConstructorArguments is [{ Kind: TypedConstantKind.Primitive, Type.SpecialType: SpecialType.System_String, Value: string value }]) 913Value: { Kind: TypedConstantKind.Primitive, Type.SpecialType: SpecialType.System_String, Value: string namedValue },
Microsoft.CodeAnalysis.Razor.Compiler (35)
CSharp\DefaultTagHelperDescriptorFactory.cs (10)
65return editorBrowsableAttribute?.ConstructorArguments is [{ Value: object value }, ..] && 156childTagBuilder.Name = (string?)arg0.Value; 163builder.AllowChildTag(childTagBuilder => childTagBuilder.Name = (string?)value.Value); 187attribute.ConstructorArguments is [{ Value: string value }, ..]) 200var (hasExplicitName, attributeName) = attributeNameAttribute?.ConstructorArguments is [{ Value: string { Length: > 0 } value }, ..] 255dictionaryAttributePrefix = (string?)argument.Value; 325return (string?)argument.Value; 338return (string?)value.Value; 347if (attribute.ConstructorArguments is [{ Value: string value }, ..]) 360argument is { Value: object value })
Language\TagHelpers\Producers\BindTagHelperProducer.cs (14)
144element: (string?)constructorArguments[0].Value, 146suffix: (string?)constructorArguments[1].Value, 147valueAttribute: (string?)constructorArguments[2].Value, 148changeAttribute: (string?)constructorArguments[3].Value); 157typeAttribute: (string?)constructorArguments[0].Value, 158suffix: (string?)constructorArguments[1].Value, 159valueAttribute: (string?)constructorArguments[2].Value, 160changeAttribute: (string?)constructorArguments[3].Value); 169typeAttribute: (string?)constructorArguments[0].Value, 170suffix: (string?)constructorArguments[1].Value, 171valueAttribute: (string?)constructorArguments[2].Value, 172changeAttribute: (string?)constructorArguments[3].Value, 173isInvariantCulture: (bool?)constructorArguments[4].Value ?? false, 174format: (string?)constructorArguments[5].Value);
Language\TagHelpers\Producers\ComponentTagHelperProducer.cs (2)
139attribute.ConstructorArguments.FirstOrDefault() is { Value: string value }) 483withAttributes.Append(SymbolDisplay.FormatPrimitive(arg.Value!, quoteStrings: true, useHexadecimalNumbers: true));
Language\TagHelpers\Producers\EventHandlerTagHelperProducer.cs (6)
78{ Value: string attributeName }, 79{ Value: INamedTypeSymbol eventArgsType }]) 99{ Value: string attributeName }, 100{ Value: INamedTypeSymbol eventArgsType }, 101{ Value: bool enablePreventDefault }, 102{ Value: bool enableStopPropagation }])
Mvc.Version1_X\ViewComponentTagHelperDescriptorFactory.cs (1)
247.Value as string;
Mvc.Version2_X\ViewComponentTagHelperDescriptorFactory.cs (1)
262.Value as string;
Mvc\ViewComponentTagHelperDescriptorFactory.cs (1)
265.Value as string;
Microsoft.CodeAnalysis.ResxSourceGenerator (6)
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\ITypeSymbolExtensions.cs (1)
202return !Equals(false, typedConstant.Value);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\CollectionExpressionUtilities.cs (2)
155if (attribute is not { ConstructorArguments: [{ Value: INamedTypeSymbol builderType }, { Value: string builderMethodName }] })
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\InterceptsLocationUtilities.cs (2)
49ConstructorArguments: [{ Value: int version }, { Value: string attributeData }]
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (1)
581if (attributeUsageAttribute.ConstructorArguments is [{ Value: int targetsValue }, ..])
Microsoft.CodeAnalysis.VisualBasic (1)
Symbols\TypedConstant.vb (1)
38Return "GetType(" & constant.Value.ToString() & ")"
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (3)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\ExpressionGenerator.vb (3)
21Return GenerateExpression(generator, typedConstant.Type, typedConstant.Value, canUseFieldReference:=True) 31If TypeOf typedConstant.Value IsNot ITypeSymbol Then 35Return SyntaxFactory.GetTypeExpression(DirectCast(typedConstant.Value, ITypeSymbol).GenerateTypeSyntax())
Microsoft.CodeAnalysis.VisualBasic.Workspaces (3)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\ExpressionGenerator.vb (3)
21Return GenerateExpression(generator, typedConstant.Type, typedConstant.Value, canUseFieldReference:=True) 31If TypeOf typedConstant.Value IsNot ITypeSymbol Then 35Return SyntaxFactory.GetTypeExpression(DirectCast(typedConstant.Value, ITypeSymbol).GenerateTypeSyntax())
Microsoft.CodeAnalysis.Workspaces (10)
FindSymbols\FindReferences\DependentProjectsFinder.cs (1)
302typeNameConstant.Value is not string value)
FindSymbols\FindReferences\Finders\OrdinaryMethodReferenceFinder.cs (2)
150attribute.ConstructorArguments is [{ Value: INamedTypeSymbol builderType }, { Value: string factoryName }] &&
Shared\Extensions\ISymbolExtensions.cs (2)
136attribute.ConstructorArguments is [{ Value: int value }]) 193var argumentValue = attribute.ConstructorArguments.First().Value;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\CollectionExpressionUtilities.cs (2)
155if (attribute is not { ConstructorArguments: [{ Value: INamedTypeSymbol builderType }, { Value: string builderMethodName }] })
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\InterceptsLocationUtilities.cs (2)
49ConstructorArguments: [{ Value: int version }, { Value: string attributeData }]
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (1)
581if (attributeUsageAttribute.ConstructorArguments is [{ Value: int targetsValue }, ..])
Microsoft.DotNet.ApiCompatibility (4)
Comparing\TypedConstantEqualityComparer.cs (4)
30if (!symbolEqualityComparer.Equals((x.Value as INamedTypeSymbol)!, (y.Value as INamedTypeSymbol)!)) 34if (!Equals(x.Value, y.Value))
Microsoft.DotNet.ApiSymbolExtensions (1)
AttributeDataExtensions.cs (1)
39&& typedConstant.Value is INamedTypeSymbol namedTypeSymbol
Microsoft.Extensions.Logging.Generators (1)
LoggerMessageGenerator.Parser.cs (1)
952private static object GetItem(TypedConstant arg) => arg.Kind == TypedConstantKind.Array ? arg.Values : arg.Value;
Microsoft.Extensions.Options.SourceGeneration (7)
Parser.cs (7)
368var transValidatorType = attribute.ConstructorArguments[0].Value as INamedTypeSymbol; 431var enumerationValidatorType = attribute.ConstructorArguments[0].Value as INamedTypeSymbol; 516validationAttr.ConstructorArguments.Add(GetArgumentExpression(argument.Type!, argument.Value)); 529validationAttr.Properties.Add(namedArgument.Key, GetArgumentExpression(namedArgument.Value.Type!, namedArgument.Value.Value)); 625trackedTypeList!.Add((modelType.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat), (string)attribute.ConstructorArguments[0].Value!)); 656argumentValue = attribute.ConstructorArguments[i].Value; 788sb.Append(GetArgumentExpression(value[i].Type!, value[i].Value));
Microsoft.Gen.ComplianceReports (1)
Parser.cs (1)
268notes = namedArg.Value.Value?.ToString();
Microsoft.Gen.Logging (9)
Parsing\AttributeProcessors.cs (9)
44var v = a.Value; 52var v = a.Value; 60message = a.Value as string ?? string.Empty; 66var v = a.Value.Value; 135var v = a.Value.Value; 173var v = a.Value.Value; 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 (9)
src\Generators\Microsoft.Gen.ComplianceReports\Parser.cs (1)
268notes = namedArg.Value.Value?.ToString();
src\Generators\Microsoft.Gen.Metrics\Parser.cs (8)
268var ctorArg0 = attributeData.ConstructorArguments[0].Value as string; 296metricNameFromAttribute = (arg.Value.Value ?? string.Empty).ToString().Replace("\\\\", "\\"); 301metricUnitFromAttribute = (arg.Value.Value ?? string.Empty).ToString(); 322var value = item.Value?.ToString(); 621if (namedArgument.Key == "Name" && namedArgument.Value.Value is { } nameValue) 625else if (namedArgument.Key == "Unit" && namedArgument.Value.Value is { } unitValue) 632constructorArg.Value is not INamedTypeSymbol strongTypeSymbol) 675strongTypeAttributeParameters.StrongTypeObjectName = constructorArg.Value.ToString();
Microsoft.Gen.Metrics (8)
Parser.cs (8)
268var ctorArg0 = attributeData.ConstructorArguments[0].Value as string; 296metricNameFromAttribute = (arg.Value.Value ?? string.Empty).ToString().Replace("\\\\", "\\"); 301metricUnitFromAttribute = (arg.Value.Value ?? string.Empty).ToString(); 322var value = item.Value?.ToString(); 621if (namedArgument.Key == "Name" && namedArgument.Value.Value is { } nameValue) 625else if (namedArgument.Key == "Unit" && namedArgument.Value.Value is { } unitValue) 632constructorArg.Value is not INamedTypeSymbol strongTypeSymbol) 675strongTypeAttributeParameters.StrongTypeObjectName = constructorArg.Value.ToString();
Microsoft.Gen.MetricsReports (8)
src\Generators\Microsoft.Gen.Metrics\Parser.cs (8)
268var ctorArg0 = attributeData.ConstructorArguments[0].Value as string; 296metricNameFromAttribute = (arg.Value.Value ?? string.Empty).ToString().Replace("\\\\", "\\"); 301metricUnitFromAttribute = (arg.Value.Value ?? string.Empty).ToString(); 322var value = item.Value?.ToString(); 621if (namedArgument.Key == "Name" && namedArgument.Value.Value is { } nameValue) 625else if (namedArgument.Key == "Unit" && namedArgument.Value.Value is { } unitValue) 632constructorArg.Value is not INamedTypeSymbol strongTypeSymbol) 675strongTypeAttributeParameters.StrongTypeObjectName = constructorArg.Value.ToString();
Microsoft.Interop.ComInterfaceGenerator (18)
Analyzers\AddGeneratedComClassFixer.cs (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)
63interfaceType = (ComInterfaceType)ctorArg0.Value; 67interfaceType = (ComInterfaceType)(short)ctorArg0.Value;
ComInterfaceInfo.cs (1)
381&& guidAttr.ConstructorArguments[0].Value is string guidStr
GeneratedComInterfaceAttributeData.cs (2)
71Options = (ComInterfaceOptions)options.Value 78ExceptionToUnmanagedMarshaller = (ITypeSymbol)exceptionToUnmanagedMarshaller.Value
VirtualMethodPointerStubGenerator.cs (1)
279ITypeSymbol callConvSymbol = (ITypeSymbol)callConv.Value!;
VtableIndexStubGenerator.cs (10)
201if (attrData.ConstructorArguments.Length == 0 || attrData.ConstructorArguments[0].Value is not int) 214if (directionValue.Value is not int) 219direction = (MarshalDirection)directionValue.Value!; 223if (implicitThisValue.Value is not bool) 227implicitThis = (bool)implicitThisValue.Value!; 233if (exceptionMarshallingValue.Value is not int) 238exceptionMarshalling = (ExceptionMarshalling)exceptionMarshallingValue.Value!; 242if (exceptionMarshallingCustomTypeValue.Value is not INamedTypeSymbol) 246exceptionMarshallingCustomType = (INamedTypeSymbol)exceptionMarshallingCustomTypeValue.Value; 249return new VirtualMethodIndexCompilationData((int)attrData.ConstructorArguments[0].Value).WithValuesFromNamedArguments(namedArguments) with
Microsoft.Interop.JavaScript.JSImportGenerator (3)
JSImportGenerator.cs (3)
119return new JSImportData(attrData.ConstructorArguments[0].Value!.ToString(), null); 123return new JSImportData(attrData.ConstructorArguments[0].Value!.ToString(), attrData.ConstructorArguments[1].Value!.ToString());
Microsoft.Interop.LibraryImportGenerator (14)
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[0].Value is string toolName 301if (entryPointValue.Value is not string) 305entryPoint = (string)entryPointValue.Value!; 308return new LibraryImportCompilationData(attrData.ConstructorArguments[0].Value!.ToString())
Analyzers\ShapeBreakingDiagnosticSuppressor.cs (2)
64&& attr.ConstructorArguments[2].Value is INamedTypeSymbol marshallerTypeInAttribute 69return (containingType, (INamedTypeSymbol)attrData.ConstructorArguments[0].Value);
LibraryImportGenerator.cs (5)
111TypeOfExpression(((ITypeSymbol)callConv.Value!).AsTypeSyntax())); 132Literal((int)defaultDllImportSearchPathsAttribute.ConstructorArguments[0].Value!)))))); 183if (entryPointValue.Value is not string) 187entryPoint = (string)entryPointValue.Value!; 190return new LibraryImportCompilationData(attrData.ConstructorArguments[0].Value!.ToString())
Microsoft.Interop.LibraryImportGenerator.Downlevel (8)
DownlevelLibraryImportDiagnosticsAnalyzer.cs (4)
147&& attr.ConstructorArguments[0].Value is string toolName 305if (entryPointValue.Value is not string) 309entryPoint = (string)entryPointValue.Value!; 312return new LibraryImportCompilationData(attrData.ConstructorArguments[0].Value!.ToString())
DownlevelLibraryImportGenerator.cs (4)
122Literal((int)defaultDllImportSearchPathsAttribute.ConstructorArguments[0].Value!)))))); 169if (entryPointValue.Value is not string) 173entryPoint = (string)entryPointValue.Value!; 176return new LibraryImportCompilationData(attrData.ConstructorArguments[0].Value!.ToString())
Microsoft.Interop.SourceGeneration (22)
InteropAttributeData.cs (6)
65if (setLastErrorValue.Value is not bool) 69setLastError = (bool)setLastErrorValue.Value!; 75if (stringMarshallingValue.Value is not int) 80stringMarshalling = (StringMarshalling)stringMarshallingValue.Value!; 85if (stringMarshallingCustomTypeValue.Value is not INamedTypeSymbol) 89stringMarshallingCustomType = (INamedTypeSymbol)stringMarshallingCustomTypeValue.Value;
ManualTypeMarshallingHelper.cs (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 (6)
178arraySizeInfo = arraySizeInfo with { ConstSize = (int)sizeConstArg.Value! }; 182if (!elementInfoProvider.TryGetInfoForParamIndex(attributeData, (short)sizeParamIndexArg.Value!, marshallingInfoCallback, out TypePositionInfo paramIndexInfo)) 184_diagnostics.ReportConfigurationNotSupported(attributeData, nameof(MarshalAsAttribute.SizeParamIndex), sizeParamIndexArg.Value.ToString()); 190if (!elementInfoProvider.TryGetInfoForParamIndex(attributeData, (int)iidParameterIndexArg.Value!, marshallingInfoCallback, out iidParameterIndexInfo) 202object unmanagedTypeObj = attributeData.ConstructorArguments[0].Value!; 244elementUnmanagedType = (UnmanagedType)namedArg.Value.Value!;
MarshalUsingAttributeParser.cs (5)
46if (attributeData.ConstructorArguments[0].Value is not INamedTypeSymbol namedType) 68int elementIndirectionDepth = namedArgs.TryGetValue(ManualTypeMarshallingHelper.MarshalUsingProperties.ElementIndirectionDepth, out TypedConstant value) ? (int)value.Value! : 0; 80constSize = (int)arg.Value.Value!; 84if (arg.Value.Value is null) 89elementName = (string)arg.Value.Value!;
NativeMarshallingAttributeParser.cs (1)
31if (attributeData.ConstructorArguments[0].Value is not INamedTypeSymbol entryPointType)
TypeSymbolExtensions.cs (1)
141return attr.ConstructorArguments.Length == 1 && (LayoutKind)(int)attr.ConstructorArguments[0].Value! == LayoutKind.Auto;
Microsoft.Maui.Controls.BindingSourceGen (1)
ISymbolExtensions.cs (1)
58 return (attribute.ConstructorArguments.Length > 0 ? attribute.ConstructorArguments[0].Value as string : null) ?? defaultName;
Microsoft.Maui.Controls.SourceGen (4)
CodeBehindGenerator.cs (4)
217 var xmlnsDef = new XmlnsDefinitionAttribute(attr.ConstructorArguments[0].Value as string, attr.ConstructorArguments[1].Value as string); 220 xmlnsDef.AssemblyName = attr.NamedArguments[0].Value.Value as string; 232 if (attr.ConstructorArguments[0].Value is string assemblyName && new AssemblyName(assemblyName).Name == compilation.Assembly.Identity.Name)
Microsoft.ML.InternalCodeAnalyzer (1)
ContractsCheckNameofFixProvider.cs (1)
153var shortName = shortPair.Value.Value as string;
Roslyn.Diagnostics.Analyzers (8)
ImportingConstructorShouldBeObsolete.cs (2)
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\RoslynAnalyzers\Utilities\Compiler\Extensions\ITypeSymbolExtensions.cs (1)
202return !Equals(false, typedConstant.Value);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\CollectionExpressionUtilities.cs (2)
155if (attribute is not { ConstructorArguments: [{ Value: INamedTypeSymbol builderType }, { Value: string builderMethodName }] })
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\InterceptsLocationUtilities.cs (2)
49ConstructorArguments: [{ Value: int version }, { Value: string attributeData }]
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (1)
581if (attributeUsageAttribute.ConstructorArguments is [{ Value: int targetsValue }, ..])
Roslyn.Diagnostics.CSharp.Analyzers (3)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\AttributeGenerator.cs (1)
103if (existingSyntax?.ArgumentList != null && constant is { Kind: not TypedConstantKind.Array, Value: string stringValue })
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ExpressionGenerator.cs (2)
31return GenerateExpression(typedConstant.Type, typedConstant.Value, canUseFieldReference: true); 34return typedConstant.Value is ITypeSymbol typeSymbol
Roslyn.Diagnostics.VisualBasic.Analyzers (3)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\ExpressionGenerator.vb (3)
21Return GenerateExpression(generator, typedConstant.Type, typedConstant.Value, canUseFieldReference:=True) 31If TypeOf typedConstant.Value IsNot ITypeSymbol Then 35Return SyntaxFactory.GetTypeExpression(DirectCast(typedConstant.Value, ITypeSymbol).GenerateTypeSyntax())
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 (53)
JsonSourceGenerator.Parser.cs (53)
364defaults = (JsonSerializerDefaults)attributeData.ConstructorArguments[0].Value!; 372allowOutOfOrderMetadataProperties = (bool)namedArg.Value.Value!; 376allowTrailingCommas = (bool)namedArg.Value.Value!; 383var converterType = (ITypeSymbol?)element.Value; 394defaultBufferSize = (int)namedArg.Value.Value!; 398defaultIgnoreCondition = (JsonIgnoreCondition)namedArg.Value.Value!; 402dictionaryKeyPolicy = (JsonKnownNamingPolicy)namedArg.Value.Value!; 406respectNullableAnnotations = (bool)namedArg.Value.Value!; 410respectRequiredConstructorParameters = (bool)namedArg.Value.Value!; 414ignoreReadOnlyFields = (bool)namedArg.Value.Value!; 418ignoreReadOnlyProperties = (bool)namedArg.Value.Value!; 422includeFields = (bool)namedArg.Value.Value!; 426maxDepth = (int)namedArg.Value.Value!; 430newLine = (string)namedArg.Value.Value!; 434numberHandling = (JsonNumberHandling)namedArg.Value.Value!; 438preferredObjectCreationHandling = (JsonObjectCreationHandling)namedArg.Value.Value!; 442propertyNameCaseInsensitive = (bool)namedArg.Value.Value!; 446propertyNamingPolicy = (JsonKnownNamingPolicy)namedArg.Value.Value!; 450readCommentHandling = (JsonCommentHandling)namedArg.Value.Value!; 454referenceHandler = (JsonKnownReferenceHandler)namedArg.Value.Value!; 458unknownTypeHandling = (JsonUnknownTypeHandling)namedArg.Value.Value!; 462unmappedMemberHandling = (JsonUnmappedMemberHandling)namedArg.Value.Value!; 466useStringEnumConverter = (bool)namedArg.Value.Value!; 470writeIndented = (bool)namedArg.Value.Value!; 474indentCharacter = (char)namedArg.Value.Value!; 478indentSize = (int)namedArg.Value.Value!; 482generationMode = (JsonSourceGenerationMode)namedArg.Value.Value!; 486allowDuplicateProperties = (bool)namedArg.Value.Value!; 493var classifierType = (ITypeSymbol?)element.Value; 545var typeSymbol = (ITypeSymbol?)attributeData.ConstructorArguments[0].Value; 559typeInfoPropertyName = (string)namedArg.Value.Value!; 562generationMode = (JsonSourceGenerationMode)namedArg.Value.Value!; 865numberHandling = (JsonNumberHandling)attributeData.ConstructorArguments[0].Value!; 870unmappedMemberHandling = (JsonUnmappedMemberHandling)attributeData.ConstructorArguments[0].Value!; 875objectCreationHandling = (JsonObjectCreationHandling)attributeData.ConstructorArguments[0].Value!; 881attributeData.ConstructorArguments[0].Value is int knownPolicyValue) 911typeIgnoreCondition = (JsonIgnoreCondition)namedArgs[0].Value.Value!; 924var derivedType = (ITypeSymbol)attributeData.ConstructorArguments[0].Value!; 930typeDiscriminator = attributeData.ConstructorArguments[1].Value; 954ignoreUnrecognizedTypeDiscriminators = (bool)namedArg.Value.Value!; 957typeDiscriminatorPropertyName = (string?)namedArg.Value.Value; 960if (namedArg.Value.Value is ITypeSymbol classifierType) 966unknownDerivedTypeHandling = (JsonUnknownDerivedTypeHandling)namedArg.Value.Value!; 978namedArg.Value.Value is ITypeSymbol classifierType) 1416attr.ConstructorArguments[0].Value is int handlingValue && 2028attributeData.ConstructorArguments[0].Value is int knownPolicyValue) 2054ignoreCondition = (JsonIgnoreCondition)namedArgs[0].Value.Value!; 2066numberHandling = (JsonNumberHandling)ctorArgs[0].Value!; 2072objectCreationHandling = (JsonObjectCreationHandling)ctorArgs[0].Value!; 2078jsonPropertyName = (string)ctorArgs[0].Value!; 2085order = (int)ctorArgs[0].Value!; 2368Debug.Assert(attributeData.ConstructorArguments.Length == 1 && attributeData.ConstructorArguments[0].Value is null or ITypeSymbol); 2369var converterType = (ITypeSymbol?)attributeData.ConstructorArguments[0].Value;
System.Text.RegularExpressions.Generator (6)
RegexGenerator.Parser.cs (6)
80string? pattern = items[0].Value as string; 86options = items[1].Value as int?; 89matchTimeout = items[2].Value as int?; 90cultureName = items[3].Value as string; 98matchTimeout = items[2].Value as int?; 102cultureName = items[2].Value as string;