8 implementations of IPropertySymbol
GenerateDocumentationAndConfigFiles (1)
Microsoft.CodeAnalysis.Analyzers (1)
Microsoft.CodeAnalysis.CodeStyle.Fixes (1)
Microsoft.CodeAnalysis.CSharp (1)
Microsoft.CodeAnalysis.Features (1)
Microsoft.CodeAnalysis.VisualBasic (1)
Microsoft.CodeAnalysis.Workspaces (1)
Roslyn.Diagnostics.Analyzers (1)
2236 references to IPropertySymbol
ConfigurationSchemaGenerator (9)
GenerateDocumentationAndConfigFiles (134)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (14)
88IPropertySymbol property => property.OverriddenProperty,
146IPropertySymbol property => ImmutableArray<ISymbol>.CastUp(property.ExplicitInterfaceImplementations),
320=> symbol is IPropertySymbol && symbol.ContainingType.IsNormalAnonymousType();
326=> symbol is IPropertySymbol { IsIndexer: true };
332IPropertySymbol propertySymbol => !propertySymbol.IsReadOnly,
337=> symbol is IFieldSymbol { IsRequired: true } or IPropertySymbol { IsRequired: true };
343IPropertySymbol propertySymbol => propertySymbol.Type,
427IPropertySymbol nt => nt.Parameters,
602public static IEnumerable<IPropertySymbol> GetValidAnonymousTypeProperties(this ISymbol symbol)
605return ((INamedTypeSymbol)symbol).GetMembers().OfType<IPropertySymbol>().Where(p => p.CanBeReferencedByName);
672IPropertySymbol propertySymbol => propertySymbol.Type,
726if (!returnType.GetMembers().OfType<IPropertySymbol>().Any(p => p is { Name: WellKnownMemberNames.IsCompleted, Type.SpecialType: SpecialType.System_Boolean, GetMethod: not null }))
765if (!members.OfType<IPropertySymbol>().Any(p => p is { Name: WellKnownMemberNames.CurrentPropertyName, GetMethod: not null }))
805if (!members.OfType<IPropertySymbol>().Any(p => p is { Name: WellKnownMemberNames.CurrentPropertyName, GetMethod: not null }))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService.cs (7)
56public TDeclarationNode AddProperty<TDeclarationNode>(TDeclarationNode destination, IPropertySymbol property, CodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode
85public SyntaxNode CreatePropertyDeclaration(IPropertySymbol property, CodeGenerationDestination destination, CodeGenerationContextInfo info, CancellationToken cancellationToken)
126protected abstract TDeclarationNode AddProperty<TDeclarationNode>(TDeclarationNode destination, IPropertySymbol property, TCodeGenerationContextInfo info, IList<bool>? availableIndices, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode;
149public abstract SyntaxNode CreatePropertyDeclaration(IPropertySymbol property, CodeGenerationDestination destination, TCodeGenerationContextInfo info, CancellationToken cancellationToken);
347IPropertySymbol property => CreatePropertyDeclaration(property, codeGenerationDestination, info, cancellationToken),
365IPropertySymbol property => AddProperty(currentDestination, property, info, availableIndices, cancellationToken),
410public Task<Document> AddPropertyAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IPropertySymbol property, CancellationToken cancellationToken)
ILLink.RoslynAnalyzer (59)
Microsoft.Analyzers.Extra (4)
Microsoft.Analyzers.Local (8)
Microsoft.AspNetCore.Analyzers (2)
Microsoft.AspNetCore.App.Analyzers (13)
Microsoft.AspNetCore.App.CodeFixes (2)
Microsoft.AspNetCore.Components.Analyzers (18)
Microsoft.AspNetCore.Components.SdkAnalyzers (11)
Microsoft.AspNetCore.Http.RequestDelegateGenerator (12)
Microsoft.AspNetCore.Mvc.Analyzers (2)
Microsoft.AspNetCore.Mvc.Api.Analyzers (9)
Microsoft.AspNetCore.OpenApi.SourceGenerators (8)
Microsoft.CodeAnalysis (52)
Generated\Operations.Generated.cs (6)
998IPropertySymbol Property { get; }
2398ImmutableArray<IPropertySymbol> InitializedProperties { get; }
5496internal PropertyReferenceOperation(IPropertySymbol property, ITypeSymbol? constrainedToType, ImmutableArray<IArgumentOperation> arguments, IOperation? instance, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit)
5504public IPropertySymbol Property { get; }
7648internal PropertyInitializerOperation(ImmutableArray<IPropertySymbol> initializedProperties, ImmutableArray<ILocalSymbol> locals, IOperation value, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit)
7653public ImmutableArray<IPropertySymbol> InitializedProperties { get; }
Microsoft.CodeAnalysis.Analyzers (149)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (14)
88IPropertySymbol property => property.OverriddenProperty,
146IPropertySymbol property => ImmutableArray<ISymbol>.CastUp(property.ExplicitInterfaceImplementations),
320=> symbol is IPropertySymbol && symbol.ContainingType.IsNormalAnonymousType();
326=> symbol is IPropertySymbol { IsIndexer: true };
332IPropertySymbol propertySymbol => !propertySymbol.IsReadOnly,
337=> symbol is IFieldSymbol { IsRequired: true } or IPropertySymbol { IsRequired: true };
343IPropertySymbol propertySymbol => propertySymbol.Type,
427IPropertySymbol nt => nt.Parameters,
602public static IEnumerable<IPropertySymbol> GetValidAnonymousTypeProperties(this ISymbol symbol)
605return ((INamedTypeSymbol)symbol).GetMembers().OfType<IPropertySymbol>().Where(p => p.CanBeReferencedByName);
672IPropertySymbol propertySymbol => propertySymbol.Type,
726if (!returnType.GetMembers().OfType<IPropertySymbol>().Any(p => p is { Name: WellKnownMemberNames.IsCompleted, Type.SpecialType: SpecialType.System_Boolean, GetMethod: not null }))
765if (!members.OfType<IPropertySymbol>().Any(p => p is { Name: WellKnownMemberNames.CurrentPropertyName, GetMethod: not null }))
805if (!members.OfType<IPropertySymbol>().Any(p => p is { Name: WellKnownMemberNames.CurrentPropertyName, GetMethod: not null }))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService.cs (7)
56public TDeclarationNode AddProperty<TDeclarationNode>(TDeclarationNode destination, IPropertySymbol property, CodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode
85public SyntaxNode CreatePropertyDeclaration(IPropertySymbol property, CodeGenerationDestination destination, CodeGenerationContextInfo info, CancellationToken cancellationToken)
126protected abstract TDeclarationNode AddProperty<TDeclarationNode>(TDeclarationNode destination, IPropertySymbol property, TCodeGenerationContextInfo info, IList<bool>? availableIndices, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode;
149public abstract SyntaxNode CreatePropertyDeclaration(IPropertySymbol property, CodeGenerationDestination destination, TCodeGenerationContextInfo info, CancellationToken cancellationToken);
347IPropertySymbol property => CreatePropertyDeclaration(property, codeGenerationDestination, info, cancellationToken),
365IPropertySymbol property => AddProperty(currentDestination, property, info, availableIndices, cancellationToken),
410public Task<Document> AddPropertyAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IPropertySymbol property, CancellationToken cancellationToken)
Microsoft.CodeAnalysis.AnalyzerUtilities (93)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (14)
88IPropertySymbol property => property.OverriddenProperty,
146IPropertySymbol property => ImmutableArray<ISymbol>.CastUp(property.ExplicitInterfaceImplementations),
320=> symbol is IPropertySymbol && symbol.ContainingType.IsNormalAnonymousType();
326=> symbol is IPropertySymbol { IsIndexer: true };
332IPropertySymbol propertySymbol => !propertySymbol.IsReadOnly,
337=> symbol is IFieldSymbol { IsRequired: true } or IPropertySymbol { IsRequired: true };
343IPropertySymbol propertySymbol => propertySymbol.Type,
427IPropertySymbol nt => nt.Parameters,
602public static IEnumerable<IPropertySymbol> GetValidAnonymousTypeProperties(this ISymbol symbol)
605return ((INamedTypeSymbol)symbol).GetMembers().OfType<IPropertySymbol>().Where(p => p.CanBeReferencedByName);
672IPropertySymbol propertySymbol => propertySymbol.Type,
726if (!returnType.GetMembers().OfType<IPropertySymbol>().Any(p => p is { Name: WellKnownMemberNames.IsCompleted, Type.SpecialType: SpecialType.System_Boolean, GetMethod: not null }))
765if (!members.OfType<IPropertySymbol>().Any(p => p is { Name: WellKnownMemberNames.CurrentPropertyName, GetMethod: not null }))
805if (!members.OfType<IPropertySymbol>().Any(p => p is { Name: WellKnownMemberNames.CurrentPropertyName, GetMethod: not null }))
Microsoft.CodeAnalysis.CodeStyle (92)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (14)
88IPropertySymbol property => property.OverriddenProperty,
146IPropertySymbol property => ImmutableArray<ISymbol>.CastUp(property.ExplicitInterfaceImplementations),
320=> symbol is IPropertySymbol && symbol.ContainingType.IsNormalAnonymousType();
326=> symbol is IPropertySymbol { IsIndexer: true };
332IPropertySymbol propertySymbol => !propertySymbol.IsReadOnly,
337=> symbol is IFieldSymbol { IsRequired: true } or IPropertySymbol { IsRequired: true };
343IPropertySymbol propertySymbol => propertySymbol.Type,
427IPropertySymbol nt => nt.Parameters,
602public static IEnumerable<IPropertySymbol> GetValidAnonymousTypeProperties(this ISymbol symbol)
605return ((INamedTypeSymbol)symbol).GetMembers().OfType<IPropertySymbol>().Where(p => p.CanBeReferencedByName);
672IPropertySymbol propertySymbol => propertySymbol.Type,
726if (!returnType.GetMembers().OfType<IPropertySymbol>().Any(p => p is { Name: WellKnownMemberNames.IsCompleted, Type.SpecialType: SpecialType.System_Boolean, GetMethod: not null }))
765if (!members.OfType<IPropertySymbol>().Any(p => p is { Name: WellKnownMemberNames.CurrentPropertyName, GetMethod: not null }))
805if (!members.OfType<IPropertySymbol>().Any(p => p is { Name: WellKnownMemberNames.CurrentPropertyName, GetMethod: not null }))
Microsoft.CodeAnalysis.CodeStyle.Fixes (89)
src\roslyn\src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementInterfaceGenerator_Property.cs (11)
25IPropertySymbol property,
26IPropertySymbol? conflictingProperty,
61var updatedProperty = property.RenameParameters(parameterNames);
89IPropertySymbol property,
90IPropertySymbol? conflictingProperty,
123IPropertySymbol property,
124IPropertySymbol? conflictingProperty,
149IPropertySymbol property,
150IPropertySymbol? conflictingProperty,
164IPropertySymbol property,
165IPropertySymbol? conflictingProperty,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService.cs (7)
56public TDeclarationNode AddProperty<TDeclarationNode>(TDeclarationNode destination, IPropertySymbol property, CodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode
85public SyntaxNode CreatePropertyDeclaration(IPropertySymbol property, CodeGenerationDestination destination, CodeGenerationContextInfo info, CancellationToken cancellationToken)
126protected abstract TDeclarationNode AddProperty<TDeclarationNode>(TDeclarationNode destination, IPropertySymbol property, TCodeGenerationContextInfo info, IList<bool>? availableIndices, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode;
149public abstract SyntaxNode CreatePropertyDeclaration(IPropertySymbol property, CodeGenerationDestination destination, TCodeGenerationContextInfo info, CancellationToken cancellationToken);
347IPropertySymbol property => CreatePropertyDeclaration(property, codeGenerationDestination, info, cancellationToken),
365IPropertySymbol property => AddProperty(currentDestination, property, info, availableIndices, cancellationToken),
410public Task<Document> AddPropertyAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IPropertySymbol property, CancellationToken cancellationToken)
Microsoft.CodeAnalysis.CSharp (88)
Microsoft.CodeAnalysis.CSharp.CodeStyle (26)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (46)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\PropertyGenerator.cs (14)
26public static bool CanBeGenerated(IPropertySymbol property)
38IPropertySymbol property,
54IPropertySymbol property,
71IPropertySymbol property,
90IPropertySymbol property,
112IPropertySymbol property, CodeGenerationDestination destination,
142IPropertySymbol property, bool isExplicit, CSharpCodeGenerationContextInfo info)
158private static TypeSyntax GenerateTypeSyntax(IPropertySymbol property)
276IPropertySymbol property, CodeGenerationDestination destination,
292IPropertySymbol property,
306IPropertySymbol property,
330IPropertySymbol property,
341IPropertySymbol property,
361IPropertySymbol property, CodeGenerationDestination destination, CSharpCodeGenerationContextInfo info)
Microsoft.CodeAnalysis.CSharp.Features (96)
Microsoft.CodeAnalysis.CSharp.NetAnalyzers (4)
Microsoft.CodeAnalysis.CSharp.Workspaces (28)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\PropertyGenerator.cs (14)
26public static bool CanBeGenerated(IPropertySymbol property)
38IPropertySymbol property,
54IPropertySymbol property,
71IPropertySymbol property,
90IPropertySymbol property,
112IPropertySymbol property, CodeGenerationDestination destination,
142IPropertySymbol property, bool isExplicit, CSharpCodeGenerationContextInfo info)
158private static TypeSyntax GenerateTypeSyntax(IPropertySymbol property)
276IPropertySymbol property, CodeGenerationDestination destination,
292IPropertySymbol property,
306IPropertySymbol property,
330IPropertySymbol property,
341IPropertySymbol property,
361IPropertySymbol property, CodeGenerationDestination destination, CSharpCodeGenerationContextInfo info)
Microsoft.CodeAnalysis.Extensions.Package (55)
Symbols\ISymbolExtensions.cs (14)
88IPropertySymbol property => property.OverriddenProperty,
146IPropertySymbol property => ImmutableArray<ISymbol>.CastUp(property.ExplicitInterfaceImplementations),
320=> symbol is IPropertySymbol && symbol.ContainingType.IsNormalAnonymousType();
326=> symbol is IPropertySymbol { IsIndexer: true };
332IPropertySymbol propertySymbol => !propertySymbol.IsReadOnly,
337=> symbol is IFieldSymbol { IsRequired: true } or IPropertySymbol { IsRequired: true };
343IPropertySymbol propertySymbol => propertySymbol.Type,
427IPropertySymbol nt => nt.Parameters,
602public static IEnumerable<IPropertySymbol> GetValidAnonymousTypeProperties(this ISymbol symbol)
605return ((INamedTypeSymbol)symbol).GetMembers().OfType<IPropertySymbol>().Where(p => p.CanBeReferencedByName);
672IPropertySymbol propertySymbol => propertySymbol.Type,
726if (!returnType.GetMembers().OfType<IPropertySymbol>().Any(p => p is { Name: WellKnownMemberNames.IsCompleted, Type.SpecialType: SpecialType.System_Boolean, GetMethod: not null }))
765if (!members.OfType<IPropertySymbol>().Any(p => p is { Name: WellKnownMemberNames.CurrentPropertyName, GetMethod: not null }))
805if (!members.OfType<IPropertySymbol>().Any(p => p is { Name: WellKnownMemberNames.CurrentPropertyName, GetMethod: not null }))
Microsoft.CodeAnalysis.Features (249)
ConvertAnonymousType\AbstractConvertAnonymousTypeToClassCodeRefactoringProvider.cs (14)
55.OfType<IPropertySymbol>()
151ImmutableDictionary<IPropertySymbol, string> propertyMap, CancellationToken cancellationToken)
165if (semanticModel.GetSymbolInfo(identifier, cancellationToken).GetAnySymbol() is not IPropertySymbol symbol)
244ImmutableArray<IPropertySymbol> properties,
320private static (ImmutableArray<IPropertySymbol> properties, ImmutableDictionary<IPropertySymbol, string> propertyMap) GenerateProperties(
323var originalProperties = anonymousType.GetMembers().OfType<IPropertySymbol>().ToImmutableArray();
329var builder = ImmutableDictionary.CreateBuilder<IPropertySymbol, string>();
332var originalProperty = originalProperties[i];
333var newProperty = newProperties[i];
342private static IPropertySymbol GenerateProperty(Document document, IPropertySymbol prop)
370private static IMethodSymbol CreateAccessorSymbol(IPropertySymbol prop, MethodKind kind)
378ImmutableArray<IPropertySymbol> properties, SyntaxGenerator generator)
EditAndContinue\AbstractEditAndContinueAnalyzer.cs (40)
322SymbolKind.Property => GetDisplayName((IPropertySymbol)symbol),
330internal virtual string GetDisplayName(IPropertySymbol symbol)
2572protected static bool ReturnTypesEquivalent(IPropertySymbol oldProperty, IPropertySymbol newProperty, bool exact)
2648var oldProperty = (IPropertySymbol)oldMember;
2649var newProperty = (IPropertySymbol)newMember;
2925newSymbol is IPropertySymbol newProperty &&
2928AnalyzeRecordPropertyReplacement((IPropertySymbol)oldSymbol, newProperty, isDeleteEdit: true);
3025var newMatchingSymbol = newContainingType.GetMembers(oldSymbol.Name).FirstOrDefault(m => m is IPropertySymbol or IFieldSymbol);
3079if (oldSymbol is IPropertySymbol { ContainingType.IsRecord: true, GetMethod.IsImplicitlyDeclared: true, SetMethod.IsImplicitlyDeclared: true } oldRecordProperty &&
3082AnalyzeRecordPropertyReplacement(oldRecordProperty, (IPropertySymbol)newSymbol, isDeleteEdit: false);
3259void AnalyzeRecordPropertyReplacement(IPropertySymbol oldProperty, IPropertySymbol newProperty, bool isDeleteEdit)
3469IPropertySymbol { IsIndexer: false } or // changes in parameter attributes need indexer update
3759Debug.Assert(member is IPropertySymbol or IMethodSymbol);
3776var synthesizedProperty = GetPropertySynthesizedForRecordPrimaryConstructorParameter(parameterSymbol);
3780if (otherMembersOfParameterName.Any(static m => m is IPropertySymbol))
3882IPropertySymbol or
3897case IPropertySymbol propertySymbol:
3934case IPropertySymbol propertySymbol:
3991case IPropertySymbol oldPropertySymbol:
4142Contract.ThrowIfFalse(oldMember is IFieldSymbol or IPropertySymbol or IEventSymbol);
4378else if (oldSymbol is IPropertySymbol oldProperty && newSymbol is IPropertySymbol newProperty)
4465if (oldMethod is { MethodKind: MethodKind.PropertyGet or MethodKind.PropertySet, AssociatedSymbol: IPropertySymbol oldProperty } && !oldProperty.IsAutoProperty() &&
4466newMethod is { MethodKind: MethodKind.PropertyGet or MethodKind.PropertySet, AssociatedSymbol: IPropertySymbol newProperty } && newProperty.IsAutoProperty() &&
4565else if (oldSymbol is IPropertySymbol oldProperty && newSymbol is IPropertySymbol newProperty)
5058if (newSymbol is IMethodSymbol or IEventSymbol or IPropertySymbol)
7063=> symbol is { IsStatic: false } and (IPropertySymbol or IFieldSymbol) &&
7077private static IPropertySymbol? GetPropertySynthesizedForRecordPrimaryConstructorParameter(IParameterSymbol parameter)
7078=> (IPropertySymbol?)parameter.ContainingType.GetMembers(parameter.Name)
7079.FirstOrDefault(static m => m is IPropertySymbol { IsImplicitlyDeclared: false, GetMethod.IsImplicitlyDeclared: true, SetMethod.IsImplicitlyDeclared: true });
7086(IPropertySymbol { GetMethod.IsImplicitlyDeclared: false, SetMethod: null or { IsImplicitlyDeclared: false } } or
7122if (newSymbol is IPropertySymbol { IsStatic: false, ContainingType.IsRecord: true } &&
7127var oldProperty = (IPropertySymbol)oldSymbol;
7150if (newSymbol is IMethodSymbol { AssociatedSymbol: IPropertySymbol { } newProperty })
ReplacePropertyWithMethods\ReplacePropertyWithMethodsCodeRefactoringProvider.cs (35)
33IEqualityComparer<(IPropertySymbol property, ReferenceLocation location)>
50var propertySymbol = semanticModel.GetDeclaredSymbol(propertyDeclaration) as IPropertySymbol;
73IPropertySymbol propertySymbol,
92where r.Definition is IPropertySymbol
94select (property: (IPropertySymbol)r.Definition, location: loc);
115private static ImmutableDictionary<IPropertySymbol, IFieldSymbol?> CreateDefinitionToBackingFieldMap(IEnumerable<ReferencedSymbol> propertyReferences)
117var definitionToBackingField = ImmutableDictionary.CreateBuilder<IPropertySymbol, IFieldSymbol?>(SymbolEquivalenceComparer.Instance);
121if (reference.Definition is IPropertySymbol property)
128private static bool HasAnyMatchingGetOrSetMethods(IPropertySymbol property, string name)
134private static bool HasAnyMatchingGetMethods(IPropertySymbol property, string name)
142private static bool HasAnyMatchingSetMethods(IPropertySymbol property, string name)
153private static IFieldSymbol? GetBackingField(IPropertySymbol property)
193ILookup<Document, (IPropertySymbol property, ReferenceLocation location)> referencesByDocument,
194ImmutableDictionary<IPropertySymbol, IFieldSymbol?> propertyToBackingField,
213IEnumerable<(IPropertySymbol property, ReferenceLocation location)> references,
214ImmutableDictionary<IPropertySymbol, IFieldSymbol?> propertyToBackingField,
234IEnumerable<(IPropertySymbol property, ReferenceLocation location)> references,
235IDictionary<IPropertySymbol, IFieldSymbol?> propertyToBackingField,
297ImmutableDictionary<IPropertySymbol, IFieldSymbol?> definitionToBackingField,
315private static async Task<MultiDictionary<DocumentId, IPropertySymbol>> GetDefinitionsByDocumentIdAsync(
320var result = new MultiDictionary<DocumentId, IPropertySymbol>();
325var definition = referencedSymbol.Definition as IPropertySymbol;
346MultiDictionary<DocumentId, IPropertySymbol>.ValueSet originalDefinitions,
347IDictionary<IPropertySymbol, IFieldSymbol?> definitionToBackingField,
393private static async Task<ImmutableArray<(IPropertySymbol property, SyntaxNode declaration)>> GetCurrentPropertiesAsync(
397MultiDictionary<DocumentId, IPropertySymbol>.ValueSet originalDefinitions,
400using var _ = ArrayBuilder<(IPropertySymbol property, SyntaxNode declaration)>.GetInstance(out var result);
401foreach (var originalDefinition in originalDefinitions)
405var property = GetSymbolInCurrentCompilation(compilation, originalDefinition, cancellationToken);
416IPropertySymbol? property, CancellationToken cancellationToken)
432public bool Equals((IPropertySymbol property, ReferenceLocation location) x, (IPropertySymbol property, ReferenceLocation location) y)
438public int GetHashCode((IPropertySymbol property, ReferenceLocation location) obj)
src\roslyn\src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementInterfaceGenerator_Property.cs (11)
25IPropertySymbol property,
26IPropertySymbol? conflictingProperty,
61var updatedProperty = property.RenameParameters(parameterNames);
89IPropertySymbol property,
90IPropertySymbol? conflictingProperty,
123IPropertySymbol property,
124IPropertySymbol? conflictingProperty,
149IPropertySymbol property,
150IPropertySymbol? conflictingProperty,
164IPropertySymbol property,
165IPropertySymbol? conflictingProperty,
Microsoft.CodeAnalysis.NetAnalyzers (161)
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\DefineAccessorsForAttributeArguments.cs (9)
93IDictionary<string, IPropertySymbol> propertiesMap = GetAllPropertiesInTypeChain(symbol);
123private static IDictionary<string, IPropertySymbol> GetAllPropertiesInTypeChain(INamedTypeSymbol attributeType)
125var propertiesMap = new Dictionary<string, IPropertySymbol>(StringComparer.OrdinalIgnoreCase);
128foreach (IPropertySymbol property in currentType.GetMembers().Where(m => m.Kind == SymbolKind.Property).Cast<IPropertySymbol>())
140private static void AnalyzeParameters(Compilation compilation, IEnumerable<IParameterSymbol> parameters, IDictionary<string, IPropertySymbol> propertiesMap, INamedTypeSymbol attributeType, Action<Diagnostic> addDiagnostic)
146if (!propertiesMap.TryGetValue(parameter.Name, out IPropertySymbol property) ||
196private static Diagnostic GetIncreaseVisibilityDiagnostic(IParameterSymbol parameter, IPropertySymbol property)
202private static Diagnostic GetRemoveSetterDiagnostic(IParameterSymbol parameter, IPropertySymbol property)
Microsoft.NetFramework.Analyzers\Helpers\SecurityDiagnosticHelpers.cs (14)
28public static bool IsXmlDocumentXmlResolverProperty([NotNullWhen(returnValue: true)] IPropertySymbol? symbol, CompilationSecurityTypes xmlTypes)
40public static bool IsXmlTextReaderXmlResolverPropertyDerived([NotNullWhen(returnValue: true)] IPropertySymbol? symbol, CompilationSecurityTypes xmlTypes)
45public static bool IsXmlTextReaderDtdProcessingPropertyDerived([NotNullWhen(returnValue: true)] IPropertySymbol? symbol, CompilationSecurityTypes xmlTypes)
50public static bool IsXmlTextReaderXmlResolverProperty([NotNullWhen(returnValue: true)] IPropertySymbol? symbol, CompilationSecurityTypes xmlTypes)
55public static bool IsXmlTextReaderDtdProcessingProperty([NotNullWhen(returnValue: true)] IPropertySymbol? symbol, CompilationSecurityTypes xmlTypes)
67public static bool IsXmlReaderSettingsXmlResolverProperty([NotNullWhen(returnValue: true)] IPropertySymbol? symbol, CompilationSecurityTypes xmlTypes)
72public static bool IsXmlReaderSettingsDtdProcessingProperty([NotNullWhen(returnValue: true)] IPropertySymbol? symbol, CompilationSecurityTypes xmlTypes)
77public static bool IsXmlReaderSettingsMaxCharactersFromEntitiesProperty([NotNullWhen(returnValue: true)] IPropertySymbol? symbol, CompilationSecurityTypes xmlTypes)
87public static bool IsXsltSettingsTrustedXsltProperty([NotNullWhen(returnValue: true)] this IPropertySymbol? symbol, CompilationSecurityTypes xmlTypes)
90public static bool IsXsltSettingsDefaultProperty([NotNullWhen(returnValue: true)] this IPropertySymbol? symbol, CompilationSecurityTypes xmlTypes)
93public static bool IsXsltSettingsEnableDocumentFunctionProperty([NotNullWhen(returnValue: true)] this IPropertySymbol? symbol, CompilationSecurityTypes xmlTypes)
96public static bool IsXsltSettingsEnableScriptProperty([NotNullWhen(returnValue: true)] this IPropertySymbol? symbol, CompilationSecurityTypes xmlTypes)
162private static bool IsSpecifiedProperty([NotNullWhen(returnValue: true)] IPropertySymbol? symbol, [NotNullWhen(returnValue: true)] INamedTypeSymbol? namedType, string propertyName)
172private static bool IsSpecifiedPropertyDerived([NotNullWhen(returnValue: true)] IPropertySymbol? symbol, [NotNullWhen(returnValue: true)] INamedTypeSymbol? namedType, string propertyName)
Microsoft.CodeAnalysis.Razor.Compiler (25)
Language\TagHelpers\Producers\ComponentTagHelperProducer.cs (14)
87ImmutableArray<(IPropertySymbol property, PropertyKind kind)> properties)
93ImmutableArray<(IPropertySymbol property, PropertyKind kind)> properties)
99ImmutableArray<(IPropertySymbol property, PropertyKind kind)> properties,
196private static void CreateProperty(Compilation compilation, TagHelperDescriptorBuilder builder, INamedTypeSymbol containingSymbol, IPropertySymbol property, PropertyKind kind)
301private static bool IsAwaitable(IPropertySymbol prop)
342member is IPropertySymbol property &&
368static bool IsProperty_IsCompleted(IPropertySymbol property)
628private static ImmutableArray<(IPropertySymbol property, PropertyKind kind)> GetProperties(INamedTypeSymbol type)
631using var results = new PooledArrayBuilder<(IPropertySymbol, PropertyKind)>();
646if (member is not IPropertySymbol property)
716static bool IsEnum(IPropertySymbol property)
721static bool IsRenderFragment(IPropertySymbol property)
728static bool IsEventCallback(IPropertySymbol property)
735static bool IsDelegate(IPropertySymbol property)
Microsoft.CodeAnalysis.ResxSourceGenerator (92)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (14)
88IPropertySymbol property => property.OverriddenProperty,
146IPropertySymbol property => ImmutableArray<ISymbol>.CastUp(property.ExplicitInterfaceImplementations),
320=> symbol is IPropertySymbol && symbol.ContainingType.IsNormalAnonymousType();
326=> symbol is IPropertySymbol { IsIndexer: true };
332IPropertySymbol propertySymbol => !propertySymbol.IsReadOnly,
337=> symbol is IFieldSymbol { IsRequired: true } or IPropertySymbol { IsRequired: true };
343IPropertySymbol propertySymbol => propertySymbol.Type,
427IPropertySymbol nt => nt.Parameters,
602public static IEnumerable<IPropertySymbol> GetValidAnonymousTypeProperties(this ISymbol symbol)
605return ((INamedTypeSymbol)symbol).GetMembers().OfType<IPropertySymbol>().Where(p => p.CanBeReferencedByName);
672IPropertySymbol propertySymbol => propertySymbol.Type,
726if (!returnType.GetMembers().OfType<IPropertySymbol>().Any(p => p is { Name: WellKnownMemberNames.IsCompleted, Type.SpecialType: SpecialType.System_Boolean, GetMethod: not null }))
765if (!members.OfType<IPropertySymbol>().Any(p => p is { Name: WellKnownMemberNames.CurrentPropertyName, GetMethod: not null }))
805if (!members.OfType<IPropertySymbol>().Any(p => p is { Name: WellKnownMemberNames.CurrentPropertyName, GetMethod: not null }))
Microsoft.CodeAnalysis.VisualBasic (59)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (4)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (17)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\PropertyGenerator.vb (10)
21[property] As IPropertySymbol,
33[property] As IPropertySymbol,
46Public Function GeneratePropertyDeclaration([property] As IPropertySymbol,
61Private Function GeneratePropertyDeclarationWorker([property] As IPropertySymbol,
100Private Function GeneratePropertyParameterList([property] As IPropertySymbol, options As CodeGenerationContextInfo) As ParameterListSyntax
108Private Function GenerateAccessorList([property] As IPropertySymbol,
119Private Function GenerateAccessor([property] As IPropertySymbol,
156Private Function GenerateAccessorModifiers([property] As IPropertySymbol,
174[property] As IPropertySymbol,
236Private Function GenerateAsClause([property] As IPropertySymbol, options As CodeGenerationContextInfo) As AsClauseSyntax
Microsoft.CodeAnalysis.VisualBasic.Features (43)
Microsoft.CodeAnalysis.VisualBasic.NetAnalyzers (1)
Microsoft.CodeAnalysis.VisualBasic.Workspaces (26)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\PropertyGenerator.vb (10)
21[property] As IPropertySymbol,
33[property] As IPropertySymbol,
46Public Function GeneratePropertyDeclaration([property] As IPropertySymbol,
61Private Function GeneratePropertyDeclarationWorker([property] As IPropertySymbol,
100Private Function GeneratePropertyParameterList([property] As IPropertySymbol, options As CodeGenerationContextInfo) As ParameterListSyntax
108Private Function GenerateAccessorList([property] As IPropertySymbol,
119Private Function GenerateAccessor([property] As IPropertySymbol,
156Private Function GenerateAccessorModifiers([property] As IPropertySymbol,
174[property] As IPropertySymbol,
236Private Function GenerateAsClause([property] As IPropertySymbol, options As CodeGenerationContextInfo) As AsClauseSyntax
Microsoft.CodeAnalysis.Workspaces (172)
FindSymbols\FindReferences\Finders\PropertySymbolReferenceFinder.cs (16)
19internal sealed class PropertySymbolReferenceFinder : AbstractMethodOrPropertyOrEventSymbolReferenceFinder<IPropertySymbol>
27protected override bool CanFind(IPropertySymbol symbol)
31IPropertySymbol symbol,
46private static void CascadeToOtherPartOfPartial(IPropertySymbol symbol, ArrayBuilder<ISymbol> result)
52private static void CascadeToBackingFields(IPropertySymbol symbol, ArrayBuilder<ISymbol> result)
64private static void CascadeToAccessors(IPropertySymbol symbol, ArrayBuilder<ISymbol> result)
70private static void CascadeToPrimaryConstructorParameters(IPropertySymbol property, ArrayBuilder<ISymbol> result, CancellationToken cancellationToken)
108IPropertySymbol symbol,
131private static bool IsForEachProperty(IPropertySymbol symbol)
135IPropertySymbol symbol,
189IPropertySymbol symbol,
233IPropertySymbol symbol,
261IPropertySymbol symbol, FindReferencesDocumentState state, SyntaxNode node, CancellationToken cancellationToken)
270IPropertySymbol symbol, SyntaxNode node, FindReferencesDocumentState state, CancellationToken cancellationToken)
289IPropertySymbol symbol, SyntaxNode node, FindReferencesDocumentState state, CancellationToken cancellationToken)
306IPropertySymbol symbol, SyntaxNode node, FindReferencesDocumentState state, CancellationToken cancellationToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (14)
88IPropertySymbol property => property.OverriddenProperty,
146IPropertySymbol property => ImmutableArray<ISymbol>.CastUp(property.ExplicitInterfaceImplementations),
320=> symbol is IPropertySymbol && symbol.ContainingType.IsNormalAnonymousType();
326=> symbol is IPropertySymbol { IsIndexer: true };
332IPropertySymbol propertySymbol => !propertySymbol.IsReadOnly,
337=> symbol is IFieldSymbol { IsRequired: true } or IPropertySymbol { IsRequired: true };
343IPropertySymbol propertySymbol => propertySymbol.Type,
427IPropertySymbol nt => nt.Parameters,
602public static IEnumerable<IPropertySymbol> GetValidAnonymousTypeProperties(this ISymbol symbol)
605return ((INamedTypeSymbol)symbol).GetMembers().OfType<IPropertySymbol>().Where(p => p.CanBeReferencedByName);
672IPropertySymbol propertySymbol => propertySymbol.Type,
726if (!returnType.GetMembers().OfType<IPropertySymbol>().Any(p => p is { Name: WellKnownMemberNames.IsCompleted, Type.SpecialType: SpecialType.System_Boolean, GetMethod: not null }))
765if (!members.OfType<IPropertySymbol>().Any(p => p is { Name: WellKnownMemberNames.CurrentPropertyName, GetMethod: not null }))
805if (!members.OfType<IPropertySymbol>().Any(p => p is { Name: WellKnownMemberNames.CurrentPropertyName, GetMethod: not null }))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService.cs (7)
56public TDeclarationNode AddProperty<TDeclarationNode>(TDeclarationNode destination, IPropertySymbol property, CodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode
85public SyntaxNode CreatePropertyDeclaration(IPropertySymbol property, CodeGenerationDestination destination, CodeGenerationContextInfo info, CancellationToken cancellationToken)
126protected abstract TDeclarationNode AddProperty<TDeclarationNode>(TDeclarationNode destination, IPropertySymbol property, TCodeGenerationContextInfo info, IList<bool>? availableIndices, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode;
149public abstract SyntaxNode CreatePropertyDeclaration(IPropertySymbol property, CodeGenerationDestination destination, TCodeGenerationContextInfo info, CancellationToken cancellationToken);
347IPropertySymbol property => CreatePropertyDeclaration(property, codeGenerationDestination, info, cancellationToken),
365IPropertySymbol property => AddProperty(currentDestination, property, info, availableIndices, cancellationToken),
410public Task<Document> AddPropertyAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IPropertySymbol property, CancellationToken cancellationToken)
Microsoft.Diagnostics.DataContractReader.DataGenerator (3)
Microsoft.DotNet.ApiSymbolExtensions (2)
Microsoft.Extensions.Configuration.Binder.SourceGeneration (3)
Microsoft.Extensions.Options.SourceGeneration (3)
Microsoft.Extensions.Validation.ValidationsGenerator (15)
Microsoft.Gen.ComplianceReports (2)
Microsoft.Gen.ContextualOptions (2)
Microsoft.Gen.Logging (8)
Microsoft.Gen.MetadataExtractor (4)
Microsoft.Gen.Metrics (2)
Microsoft.Gen.MetricsReports (2)
Microsoft.Interop.ComInterfaceGenerator (9)
Microsoft.Interop.LibraryImportGenerator (1)
Microsoft.Interop.SourceGeneration (3)
Microsoft.Maui.Controls.BindingSourceGen (5)
Microsoft.ML.InternalCodeAnalyzer (2)
Roslyn.Diagnostics.Analyzers (148)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (14)
88IPropertySymbol property => property.OverriddenProperty,
146IPropertySymbol property => ImmutableArray<ISymbol>.CastUp(property.ExplicitInterfaceImplementations),
320=> symbol is IPropertySymbol && symbol.ContainingType.IsNormalAnonymousType();
326=> symbol is IPropertySymbol { IsIndexer: true };
332IPropertySymbol propertySymbol => !propertySymbol.IsReadOnly,
337=> symbol is IFieldSymbol { IsRequired: true } or IPropertySymbol { IsRequired: true };
343IPropertySymbol propertySymbol => propertySymbol.Type,
427IPropertySymbol nt => nt.Parameters,
602public static IEnumerable<IPropertySymbol> GetValidAnonymousTypeProperties(this ISymbol symbol)
605return ((INamedTypeSymbol)symbol).GetMembers().OfType<IPropertySymbol>().Where(p => p.CanBeReferencedByName);
672IPropertySymbol propertySymbol => propertySymbol.Type,
726if (!returnType.GetMembers().OfType<IPropertySymbol>().Any(p => p is { Name: WellKnownMemberNames.IsCompleted, Type.SpecialType: SpecialType.System_Boolean, GetMethod: not null }))
765if (!members.OfType<IPropertySymbol>().Any(p => p is { Name: WellKnownMemberNames.CurrentPropertyName, GetMethod: not null }))
805if (!members.OfType<IPropertySymbol>().Any(p => p is { Name: WellKnownMemberNames.CurrentPropertyName, GetMethod: not null }))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService.cs (7)
56public TDeclarationNode AddProperty<TDeclarationNode>(TDeclarationNode destination, IPropertySymbol property, CodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode
85public SyntaxNode CreatePropertyDeclaration(IPropertySymbol property, CodeGenerationDestination destination, CodeGenerationContextInfo info, CancellationToken cancellationToken)
126protected abstract TDeclarationNode AddProperty<TDeclarationNode>(TDeclarationNode destination, IPropertySymbol property, TCodeGenerationContextInfo info, IList<bool>? availableIndices, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode;
149public abstract SyntaxNode CreatePropertyDeclaration(IPropertySymbol property, CodeGenerationDestination destination, TCodeGenerationContextInfo info, CancellationToken cancellationToken);
347IPropertySymbol property => CreatePropertyDeclaration(property, codeGenerationDestination, info, cancellationToken),
365IPropertySymbol property => AddProperty(currentDestination, property, info, availableIndices, cancellationToken),
410public Task<Document> AddPropertyAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IPropertySymbol property, CancellationToken cancellationToken)
Roslyn.Diagnostics.CSharp.Analyzers (24)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\PropertyGenerator.cs (14)
26public static bool CanBeGenerated(IPropertySymbol property)
38IPropertySymbol property,
54IPropertySymbol property,
71IPropertySymbol property,
90IPropertySymbol property,
112IPropertySymbol property, CodeGenerationDestination destination,
142IPropertySymbol property, bool isExplicit, CSharpCodeGenerationContextInfo info)
158private static TypeSyntax GenerateTypeSyntax(IPropertySymbol property)
276IPropertySymbol property, CodeGenerationDestination destination,
292IPropertySymbol property,
306IPropertySymbol property,
330IPropertySymbol property,
341IPropertySymbol property,
361IPropertySymbol property, CodeGenerationDestination destination, CSharpCodeGenerationContextInfo info)
Roslyn.Diagnostics.VisualBasic.Analyzers (17)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\PropertyGenerator.vb (10)
21[property] As IPropertySymbol,
33[property] As IPropertySymbol,
46Public Function GeneratePropertyDeclaration([property] As IPropertySymbol,
61Private Function GeneratePropertyDeclarationWorker([property] As IPropertySymbol,
100Private Function GeneratePropertyParameterList([property] As IPropertySymbol, options As CodeGenerationContextInfo) As ParameterListSyntax
108Private Function GenerateAccessorList([property] As IPropertySymbol,
119Private Function GenerateAccessor([property] As IPropertySymbol,
156Private Function GenerateAccessorModifiers([property] As IPropertySymbol,
174[property] As IPropertySymbol,
236Private Function GenerateAsClause([property] As IPropertySymbol, options As CodeGenerationContextInfo) As AsClauseSyntax
System.Private.CoreLib.Generators (1)
System.Text.Json.SourceGeneration (14)
System.Text.RegularExpressions.Generator (5)
System.Windows.Forms.Analyzers.CSharp (1)
System.Windows.Forms.Analyzers.VisualBasic (2)