8 implementations of SetMethod
GenerateDocumentationAndConfigFiles (1)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationPropertySymbol.cs (1)
34public IMethodSymbol SetMethod { get; } = setMethod;
Microsoft.CodeAnalysis.Analyzers (1)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationPropertySymbol.cs (1)
34public IMethodSymbol SetMethod { get; } = setMethod;
Microsoft.CodeAnalysis.CodeStyle.Fixes (1)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationPropertySymbol.cs (1)
34public IMethodSymbol SetMethod { get; } = setMethod;
Microsoft.CodeAnalysis.CSharp (1)
Symbols\PublicModel\PropertySymbol.cs (1)
56IMethodSymbol IPropertySymbol.SetMethod
Microsoft.CodeAnalysis.Features (1)
MetadataAsSource\AbstractMetadataAsSourceService.WrappedPropertySymbol.cs (1)
50public IMethodSymbol SetMethod => _symbol.SetMethod;
Microsoft.CodeAnalysis.VisualBasic (1)
Symbols\PropertySymbol.vb (1)
585Private ReadOnly Property IPropertySymbol_SetMethod As IMethodSymbol Implements IPropertySymbol.SetMethod
Microsoft.CodeAnalysis.Workspaces (1)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationPropertySymbol.cs (1)
34public IMethodSymbol SetMethod { get; } = setMethod;
Roslyn.Diagnostics.Analyzers (1)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationPropertySymbol.cs (1)
34public IMethodSymbol SetMethod { get; } = setMethod;
326 references to SetMethod
ConfigurationSchemaGenerator (1)
RuntimeSource\Configuration.Binder\Specs\Members\PropertySpec.cs (1)
13IMethodSymbol? setMethod = property.SetMethod;
GenerateDocumentationAndConfigFiles (20)
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\IOperationExtensions.cs (1)
471if (operation.Property.SetMethod is null)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousTypeSymbolKey.cs (1)
24var propertyIsReadOnly = properties.SelectAsArray(p => p.SetMethod == null);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\INamedTypeSymbolExtensions.cs (7)
132return IsAccessorImplemented(propertySymbol.GetMethod, classOrStructType) && IsAccessorImplemented(propertySymbol.SetMethod, classOrStructType); 153if (propertySymbol.SetMethod != null) 155if (classOrStructType.FindImplementationForAbstractMember(propertySymbol.SetMethod) == null) 232return IsNonPublicImplementableAccessor(property.GetMethod) || IsNonPublicImplementableAccessor(property.SetMethod); 332return IsInaccessibleImplementableAccessor(property.GetMethod, within) || IsInaccessibleImplementableAccessor(property.SetMethod, within); 515propertySymbol.SetMethod != null && 517propertySymbol.SetMethod.IsAccessibleWithin(within))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SignatureComparer.cs (4)
189BadPropertyAccessor(property1.SetMethod, property2.SetMethod)) 199BadPropertyAccessor(property2.SetMethod, property1.SetMethod))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\IPropertySymbolExtensions.cs (3)
36property.SetMethod, 66property.SetMethod, 75=> property.SetMethod != null || ContainsBackingField(property);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions.cs (2)
253if (conflictingProperty is { SetMethod.Parameters.Length: 1 } && 254property is { SetMethod.Parameters: [var parameter] })
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\InitializeParameter\AbstractInitializerParameterService.cs (2)
200if (property.SetMethod != null) 201accessors.AddIfNotNull(GetAccessorBody(property.SetMethod, cancellationToken));
ILLink.RoslynAnalyzer (16)
DataFlow\DynamicallyAccessedMembersBinder.cs (10)
286(property.SetMethod == null || property.SetMethod.DeclaredAccessibility == Accessibility.Private)) 295if ((property.SetMethod != null) && !property.SetMethod.IsStatic) continue; 301if ((property.SetMethod != null) && property.SetMethod.IsStatic) continue; 307&& (property.SetMethod == null || (property.SetMethod.DeclaredAccessibility != Accessibility.Public))) 314if ((property.SetMethod != null) && (property.SetMethod.DeclaredAccessibility == Accessibility.Public)) continue;
IPropertySymbolExtensions.cs (2)
27while ((setMethod = declaringProperty.SetMethod) == null) 40return (property.GetMethod?.IsAutoAccessor() ?? false) || (property.SetMethod?.IsAutoAccessor() ?? false);
RequiresAnalyzerBase.cs (1)
369if (!propertySymbol.IsStatic || propertySymbol.Type.SpecialType != SpecialType.System_Boolean || propertySymbol.SetMethod != null)
TrimAnalysis\FeatureCheckReturnValuePattern.cs (1)
40if (!OwningSymbol.IsStatic || OwningSymbol.Type.SpecialType != SpecialType.System_Boolean || OwningSymbol.SetMethod != null)
TrimAnalysis\ReflectionAccessAnalyzer.cs (2)
189if (propertySymbol.SetMethod is not null) 190GetReflectionAccessDiagnosticsForMethod(location, propertySymbol.SetMethod);
Microsoft.AspNetCore.Components.Analyzers (1)
ComponentParameterAnalyzer.cs (1)
89else if (property.SetMethod?.DeclaredAccessibility != Accessibility.Public)
Microsoft.AspNetCore.Components.SdkAnalyzers (1)
ComponentParameterAnalyzer.cs (1)
83else if (property.SetMethod?.DeclaredAccessibility != Accessibility.Public)
Microsoft.CodeAnalysis.Analyzers (22)
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.PropertyMetricData.cs (2)
63if (property.SetMethod != null) 65yield return property.SetMethod;
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\IOperationExtensions.cs (1)
471if (operation.Property.SetMethod is null)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousTypeSymbolKey.cs (1)
24var propertyIsReadOnly = properties.SelectAsArray(p => p.SetMethod == null);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\INamedTypeSymbolExtensions.cs (7)
132return IsAccessorImplemented(propertySymbol.GetMethod, classOrStructType) && IsAccessorImplemented(propertySymbol.SetMethod, classOrStructType); 153if (propertySymbol.SetMethod != null) 155if (classOrStructType.FindImplementationForAbstractMember(propertySymbol.SetMethod) == null) 232return IsNonPublicImplementableAccessor(property.GetMethod) || IsNonPublicImplementableAccessor(property.SetMethod); 332return IsInaccessibleImplementableAccessor(property.GetMethod, within) || IsInaccessibleImplementableAccessor(property.SetMethod, within); 515propertySymbol.SetMethod != null && 517propertySymbol.SetMethod.IsAccessibleWithin(within))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SignatureComparer.cs (4)
189BadPropertyAccessor(property1.SetMethod, property2.SetMethod)) 199BadPropertyAccessor(property2.SetMethod, property1.SetMethod))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\IPropertySymbolExtensions.cs (3)
36property.SetMethod, 66property.SetMethod, 75=> property.SetMethod != null || ContainsBackingField(property);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions.cs (2)
253if (conflictingProperty is { SetMethod.Parameters.Length: 1 } && 254property is { SetMethod.Parameters: [var parameter] })
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\InitializeParameter\AbstractInitializerParameterService.cs (2)
200if (property.SetMethod != null) 201accessors.AddIfNotNull(GetAccessorBody(property.SetMethod, cancellationToken));
Microsoft.CodeAnalysis.AnalyzerUtilities (15)
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.PropertyMetricData.cs (2)
63if (property.SetMethod != null) 65yield return property.SetMethod;
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\IOperationExtensions.cs (1)
471if (operation.Property.SetMethod is null)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousTypeSymbolKey.cs (1)
24var propertyIsReadOnly = properties.SelectAsArray(p => p.SetMethod == null);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\INamedTypeSymbolExtensions.cs (7)
132return IsAccessorImplemented(propertySymbol.GetMethod, classOrStructType) && IsAccessorImplemented(propertySymbol.SetMethod, classOrStructType); 153if (propertySymbol.SetMethod != null) 155if (classOrStructType.FindImplementationForAbstractMember(propertySymbol.SetMethod) == null) 232return IsNonPublicImplementableAccessor(property.GetMethod) || IsNonPublicImplementableAccessor(property.SetMethod); 332return IsInaccessibleImplementableAccessor(property.GetMethod, within) || IsInaccessibleImplementableAccessor(property.SetMethod, within); 515propertySymbol.SetMethod != null && 517propertySymbol.SetMethod.IsAccessibleWithin(within))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SignatureComparer.cs (4)
189BadPropertyAccessor(property1.SetMethod, property2.SetMethod)) 199BadPropertyAccessor(property2.SetMethod, property1.SetMethod))
Microsoft.CodeAnalysis.CodeStyle (18)
src\roslyn\src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (1)
696member is IPropertySymbol { GetMethod: not null, SetMethod: not null } property &&
src\roslyn\src\Analyzers\Core\Analyzers\UseAutoProperty\AbstractUseAutoPropertyAnalyzer.cs (5)
451if (property.SetMethod != null) 454var setterFields = GetSetterFields(semanticModel, property.SetMethod, fieldNames, cancellationToken); 569result.Property.SetMethod is null && 582if (result.Property.SetMethod is { IsInitOnly: true } && 600if (result.Property.SetMethod != null &&
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousTypeSymbolKey.cs (1)
24var propertyIsReadOnly = properties.SelectAsArray(p => p.SetMethod == null);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\INamedTypeSymbolExtensions.cs (7)
132return IsAccessorImplemented(propertySymbol.GetMethod, classOrStructType) && IsAccessorImplemented(propertySymbol.SetMethod, classOrStructType); 153if (propertySymbol.SetMethod != null) 155if (classOrStructType.FindImplementationForAbstractMember(propertySymbol.SetMethod) == null) 232return IsNonPublicImplementableAccessor(property.GetMethod) || IsNonPublicImplementableAccessor(property.SetMethod); 332return IsInaccessibleImplementableAccessor(property.GetMethod, within) || IsInaccessibleImplementableAccessor(property.SetMethod, within); 515propertySymbol.SetMethod != null && 517propertySymbol.SetMethod.IsAccessibleWithin(within))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SignatureComparer.cs (4)
189BadPropertyAccessor(property1.SetMethod, property2.SetMethod)) 199BadPropertyAccessor(property2.SetMethod, property1.SetMethod))
Microsoft.CodeAnalysis.CodeStyle.Fixes (22)
src\roslyn\src\Analyzers\Core\CodeFixes\GenerateConstructor\AbstractGenerateConstructorService.cs (1)
132!IsSymbolAccessible(property.SetMethod, document))
src\roslyn\src\Analyzers\Core\CodeFixes\GenerateConstructor\GenerateConstructorHelpers.cs (2)
55if (symbol is IPropertySymbol { SetMethod: { } setMethod } && 319!IsSymbolAccessible(property.SetMethod, document))
src\roslyn\src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.State.cs (1)
230IsWrittenTo = propertySymbol.SetMethod != null;
src\roslyn\src\Analyzers\Core\CodeFixes\ImplementAbstractClass\ImplementAbstractClassData.cs (3)
219var setMethod = ShouldGenerateAccessor(property.SetMethod) 221property.SetMethod, 223accessibility: property.SetMethod.ComputeResultantAccessibility(ClassType),
src\roslyn\src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementHelpers.cs (1)
140if (ContainsTypeLessAccessibleThan(propertySymbol.SetMethod, second, supportsImplicitImplementationOfNonPublicInterfaceMembers))
src\roslyn\src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementInterfaceGenerator.cs (3)
431if (propertyToAdd.SetMethod != null && SignatureComparer.BadPropertyAccessor(propertyToAdd.SetMethod, existingProperty.SetMethod))
src\roslyn\src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementInterfaceGenerator_Property.cs (3)
97if (property.SetMethod == null) 108var setMethod = property.SetMethod.RemoveInaccessibleAttributesAndAttributesOfTypes( 116explicitInterfaceImplementations: useExplicitInterfaceSymbol ? [property.SetMethod] : default,
src\roslyn\src\Analyzers\Core\CodeFixes\UseAutoProperty\AbstractUseAutoPropertyCodeFixProvider.cs (1)
277(property.SetMethod != null && !isTrivialSetAccessor))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\IPropertySymbolExtensions.cs (3)
36property.SetMethod, 66property.SetMethod, 75=> property.SetMethod != null || ContainsBackingField(property);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions.cs (2)
253if (conflictingProperty is { SetMethod.Parameters.Length: 1 } && 254property is { SetMethod.Parameters: [var parameter] })
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\InitializeParameter\AbstractInitializerParameterService.cs (2)
200if (property.SetMethod != null) 201accessors.AddIfNotNull(GetAccessorBody(property.SetMethod, cancellationToken));
Microsoft.CodeAnalysis.CSharp (3)
SymbolDisplay\SymbolDisplayVisitor.Members.cs (3)
112var setMethod = property.SetMethod; 186var keywordForSetAccessor = IsInitOnly(symbol.SetMethod) ? SyntaxKind.InitKeyword : SyntaxKind.SetKeyword; 187AddAccessor(symbol, symbol.SetMethod, keywordForSetAccessor);
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (9)
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertToRecord\PositionalParameterInfo.cs (2)
56.Any(symbol => symbol.SetMethod is IMethodSymbol { IsInitOnly: true }); 160var setAccessor = propertySymbol.SetMethod;
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeMemberRequired\CSharpMakeMemberRequiredCodeFixProvider.cs (1)
66var setMethod = propertySymbol.SetMethod;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (2)
212if (property.SetMethod != null) 214var setMethod = property.SetMethod;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\PropertyGenerator.cs (4)
279var setAccessorKind = property.SetMethod?.IsInitOnly == true ? SyntaxKind.InitAccessorDeclaration : SyntaxKind.SetAccessorDeclaration; 283GenerateAccessorDeclaration(property, property.SetMethod, setAccessorKind, destination, info, cancellationToken), 353var hasNonReadOnlyAccessor = property.GetMethod?.IsReadOnly == false || property.SetMethod?.IsReadOnly == false; 394var hasAllReadOnlyAccessors = property.GetMethod?.IsReadOnly != false && property.SetMethod?.IsReadOnly != false;
Microsoft.CodeAnalysis.CSharp.Features (14)
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (10)
1107AddMemberUpdate(ref result, oldPropertySymbol.SetMethod, newPropertySymbol.SetMethod, matchingNewContainingMemberOrType); 1123result.Add((oldSynthesizedAutoProperty?.SetMethod, newSynthesizedAutoProperty?.SetMethod, editKind)); 1208if (oldPropertySymbol.SetMethod != null || newPropertySymbol.SetMethod != null) 1210if (DiffersInReadOnlyModifier(oldPropertySymbol.SetMethod, newPropertySymbol.SetMethod) || 1213result.Add((oldPropertySymbol.SetMethod, newPropertySymbol.SetMethod, editKind));
ReplacePropertyWithMethods\CSharpReplacePropertyWithMethodsService.cs (1)
88var setMethod = property.SetMethod;
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertToRecord\PositionalParameterInfo.cs (2)
56.Any(symbol => symbol.SetMethod is IMethodSymbol { IsInitOnly: true }); 160var setAccessor = propertySymbol.SetMethod;
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeMemberRequired\CSharpMakeMemberRequiredCodeFixProvider.cs (1)
66var setMethod = propertySymbol.SetMethod;
Microsoft.CodeAnalysis.CSharp.NetAnalyzers (5)
Microsoft.NetCore.Analyzers\InteropServices\CSharpDynamicInterfaceCastableImplementation.Fixer.cs (5)
94if (property.SetMethod is not null 95&& model.Compilation.IsSymbolAccessibleWithin(property.SetMethod, type)) 111if (!property.SetMethod!.IsInitOnly) 116var setAccessorAccessibility = includeAccessibility && property.DeclaredAccessibility != property.SetMethod!.DeclaredAccessibility 117? property.SetMethod.DeclaredAccessibility
Microsoft.CodeAnalysis.CSharp.Workspaces (6)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (2)
212if (property.SetMethod != null) 214var setMethod = property.SetMethod;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\PropertyGenerator.cs (4)
279var setAccessorKind = property.SetMethod?.IsInitOnly == true ? SyntaxKind.InitAccessorDeclaration : SyntaxKind.SetAccessorDeclaration; 283GenerateAccessorDeclaration(property, property.SetMethod, setAccessorKind, destination, info, cancellationToken), 353var hasNonReadOnlyAccessor = property.GetMethod?.IsReadOnly == false || property.SetMethod?.IsReadOnly == false; 394var hasAllReadOnlyAccessors = property.GetMethod?.IsReadOnly != false && property.SetMethod?.IsReadOnly != false;
Microsoft.CodeAnalysis.Extensions.Package (11)
Symbols\INamedTypeSymbolExtensions.cs (7)
132return IsAccessorImplemented(propertySymbol.GetMethod, classOrStructType) && IsAccessorImplemented(propertySymbol.SetMethod, classOrStructType); 153if (propertySymbol.SetMethod != null) 155if (classOrStructType.FindImplementationForAbstractMember(propertySymbol.SetMethod) == null) 232return IsNonPublicImplementableAccessor(property.GetMethod) || IsNonPublicImplementableAccessor(property.SetMethod); 332return IsInaccessibleImplementableAccessor(property.GetMethod, within) || IsInaccessibleImplementableAccessor(property.SetMethod, within); 515propertySymbol.SetMethod != null && 517propertySymbol.SetMethod.IsAccessibleWithin(within))
Symbols\SignatureComparer.cs (4)
189BadPropertyAccessor(property1.SetMethod, property2.SetMethod)) 199BadPropertyAccessor(property2.SetMethod, property1.SetMethod))
Microsoft.CodeAnalysis.Features (46)
ConvertAnonymousType\AbstractConvertAnonymousTypeToClassCodeRefactoringProvider.cs (2)
291properties.WhereAsArray(p => p.SetMethod == null)); 353var setMethod = prop.SetMethod != null ? CreateAccessorSymbol(prop, MethodKind.PropertySet) : null;
EditAndContinue\AbstractEditAndContinueAnalyzer.cs (10)
3074if (oldSymbol is IPropertySymbol { ContainingType.IsRecord: true, GetMethod.IsImplicitlyDeclared: true, SetMethod.IsImplicitlyDeclared: true } oldRecordProperty && 3263Debug.Assert(synthesizedProperty.SetMethod != null); 3277if (customProperty.SetMethod == null) 3282AddInsertEditsForMemberAndAccessors(semanticEdits, synthesizedProperty.SetMethod, cancellationToken); 3286AddDeleteEditsForMemberAndAccessors(semanticEdits, synthesizedProperty.SetMethod, symbolCache.GetKey(oldProperty.ContainingType, cancellationToken), cancellationToken); 3895AddUpdate(propertySymbol.SetMethod); 3933AddDelete(propertySymbol.SetMethod); 3992AddDelete(oldPropertySymbol.SetMethod); 7074.FirstOrDefault(static m => m is IPropertySymbol { IsImplicitlyDeclared: false, GetMethod.IsImplicitlyDeclared: true, SetMethod.IsImplicitlyDeclared: true }); 7081(IPropertySymbol { GetMethod.IsImplicitlyDeclared: false, SetMethod: null or { IsImplicitlyDeclared: false } } or
EditAndContinue\Utilities\Extensions.cs (1)
180=> property is { GetMethod.IsImplicitlyDeclared: true, SetMethod.IsImplicitlyDeclared: true };
ExtractInterface\AbstractExtractInterfaceService.cs (3)
415setMethod: property is { SetMethod.DeclaredAccessibility: Accessibility.Public } ? property.SetMethod : null, 442prop is { SetMethod.DeclaredAccessibility: Accessibility.Public });
GenerateType\AbstractGenerateTypeService.Editor.cs (2)
633property.SetMethod != null && 634IsSymbolAccessible(property.SetMethod) &&
MetadataAsSource\AbstractMetadataAsSourceService.WrappedPropertySymbol.cs (1)
50public IMethodSymbol SetMethod => _symbol.SetMethod;
PullMemberUp\MembersPuller.cs (3)
166setMethod: MakePublicAccessor(propertySymbol.SetMethod)); 175setMethod: FilterOutNonPublicAccessor(propertySymbol.SetMethod)); 456return CodeGenerationSymbolFactory.CreatePropertySymbol(propertySymbol, modifiers: modifier, getMethod: propertySymbol.GetMethod, setMethod: propertySymbol.SetMethod);
ReplacePropertyWithMethods\AbstractReplacePropertyWithMethodsService.cs (1)
429=> _propertyBackingField != null && _property.SetMethod == null;
ReplacePropertyWithMethods\ReplacePropertyWithMethodsCodeRefactoringProvider.cs (2)
57(propertySymbol.SetMethod == null ? 0 : 1); 145return property.SetMethod != null &&
src\roslyn\src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (1)
696member is IPropertySymbol { GetMethod: not null, SetMethod: not null } property &&
src\roslyn\src\Analyzers\Core\Analyzers\UseAutoProperty\AbstractUseAutoPropertyAnalyzer.cs (5)
451if (property.SetMethod != null) 454var setterFields = GetSetterFields(semanticModel, property.SetMethod, fieldNames, cancellationToken); 569result.Property.SetMethod is null && 582if (result.Property.SetMethod is { IsInitOnly: true } && 600if (result.Property.SetMethod != null &&
src\roslyn\src\Analyzers\Core\CodeFixes\GenerateConstructor\AbstractGenerateConstructorService.cs (1)
132!IsSymbolAccessible(property.SetMethod, document))
src\roslyn\src\Analyzers\Core\CodeFixes\GenerateConstructor\GenerateConstructorHelpers.cs (2)
55if (symbol is IPropertySymbol { SetMethod: { } setMethod } && 319!IsSymbolAccessible(property.SetMethod, document))
src\roslyn\src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.State.cs (1)
230IsWrittenTo = propertySymbol.SetMethod != null;
src\roslyn\src\Analyzers\Core\CodeFixes\ImplementAbstractClass\ImplementAbstractClassData.cs (3)
219var setMethod = ShouldGenerateAccessor(property.SetMethod) 221property.SetMethod, 223accessibility: property.SetMethod.ComputeResultantAccessibility(ClassType),
src\roslyn\src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementHelpers.cs (1)
140if (ContainsTypeLessAccessibleThan(propertySymbol.SetMethod, second, supportsImplicitImplementationOfNonPublicInterfaceMembers))
src\roslyn\src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementInterfaceGenerator.cs (3)
431if (propertyToAdd.SetMethod != null && SignatureComparer.BadPropertyAccessor(propertyToAdd.SetMethod, existingProperty.SetMethod))
src\roslyn\src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementInterfaceGenerator_Property.cs (3)
97if (property.SetMethod == null) 108var setMethod = property.SetMethod.RemoveInaccessibleAttributesAndAttributesOfTypes( 116explicitInterfaceImplementations: useExplicitInterfaceSymbol ? [property.SetMethod] : default,
src\roslyn\src\Analyzers\Core\CodeFixes\UseAutoProperty\AbstractUseAutoPropertyCodeFixProvider.cs (1)
277(property.SetMethod != null && !isTrivialSetAccessor))
Microsoft.CodeAnalysis.Razor.Compiler (6)
Analyzers\ComponentParameterNullableWarningSuppressor.cs (1)
50if (symbol is not IPropertySymbol { DeclaredAccessibility: Accessibility.Public, IsStatic: false, SetMethod.DeclaredAccessibility: Accessibility.Public })
CSharp\DefaultTagHelperDescriptorFactory.cs (2)
370=> property is { SetMethod.DeclaredAccessibility: Accessibility.Public }; 431property is { SetMethod.DeclaredAccessibility: Accessibility.Public } ||
Language\TagHelpers\Producers\ComponentTagHelperProducer.cs (3)
230if (property.SetMethod.AssumeNotNull().IsInitOnly) 650|| property.SetMethod == null // No setter 651|| property.SetMethod.DeclaredAccessibility != Accessibility.Public // No public setter
Microsoft.CodeAnalysis.ResxSourceGenerator (15)
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.PropertyMetricData.cs (2)
63if (property.SetMethod != null) 65yield return property.SetMethod;
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\IOperationExtensions.cs (1)
471if (operation.Property.SetMethod is null)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousTypeSymbolKey.cs (1)
24var propertyIsReadOnly = properties.SelectAsArray(p => p.SetMethod == null);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\INamedTypeSymbolExtensions.cs (7)
132return IsAccessorImplemented(propertySymbol.GetMethod, classOrStructType) && IsAccessorImplemented(propertySymbol.SetMethod, classOrStructType); 153if (propertySymbol.SetMethod != null) 155if (classOrStructType.FindImplementationForAbstractMember(propertySymbol.SetMethod) == null) 232return IsNonPublicImplementableAccessor(property.GetMethod) || IsNonPublicImplementableAccessor(property.SetMethod); 332return IsInaccessibleImplementableAccessor(property.GetMethod, within) || IsInaccessibleImplementableAccessor(property.SetMethod, within); 515propertySymbol.SetMethod != null && 517propertySymbol.SetMethod.IsAccessibleWithin(within))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SignatureComparer.cs (4)
189BadPropertyAccessor(property1.SetMethod, property2.SetMethod)) 199BadPropertyAccessor(property2.SetMethod, property1.SetMethod))
Microsoft.CodeAnalysis.VisualBasic (1)
Symbols\PropertySymbol.vb (1)
585Private ReadOnly Property IPropertySymbol_SetMethod As IMethodSymbol Implements IPropertySymbol.SetMethod
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (2)
src\roslyn\src\Analyzers\VisualBasic\Analyzers\UseAutoProperty\VisualBasicUseAutoPropertyAnalyzer.vb (2)
61If prop.SetMethod IsNot Nothing AndAlso 62prop.SetMethod.DeclaredAccessibility <> prop.DeclaredAccessibility Then
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (4)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\PropertyGenerator.vb (4)
79Dim setMethod = [property].SetMethod 113GenerateAccessor([property], [property].SetMethod, isGetter:=False, destination:=destination, options:=options) 217[property].SetMethod IsNot Nothing Then 221If [property].SetMethod Is Nothing AndAlso
Microsoft.CodeAnalysis.VisualBasic.Features (9)
EditAndContinue\VisualBasicEditAndContinueAnalyzer.vb (6)
762AddMemberUpdate(result, oldPropertySymbol.SetMethod, newPropertySymbol.SetMethod, matchingNewContainingMemberOrType) 814If oldPropertySymbol.SetMethod IsNot Nothing OrElse newPropertySymbol.SetMethod IsNot Nothing Then 816result.Add((oldPropertySymbol.SetMethod, newPropertySymbol.SetMethod, editKind))
ReplacePropertyWithMethods\VisualBasicReplacePropertyWithMethods.vb (1)
69Dim setMethod = [property].SetMethod
src\roslyn\src\Analyzers\VisualBasic\Analyzers\UseAutoProperty\VisualBasicUseAutoPropertyAnalyzer.vb (2)
61If prop.SetMethod IsNot Nothing AndAlso 62prop.SetMethod.DeclaredAccessibility <> prop.DeclaredAccessibility Then
Microsoft.CodeAnalysis.VisualBasic.Workspaces (4)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\PropertyGenerator.vb (4)
79Dim setMethod = [property].SetMethod 113GenerateAccessor([property], [property].SetMethod, isGetter:=False, destination:=destination, options:=options) 217[property].SetMethod IsNot Nothing Then 221If [property].SetMethod Is Nothing AndAlso
Microsoft.CodeAnalysis.Workspaces (33)
Editing\SyntaxGenerator.cs (1)
371var setMethodSymbol = property.SetMethod;
FindSymbols\FindReferences\Finders\AbstractMethodOrPropertyOrEventSymbolReferenceFinder.cs (1)
37result.AddIfNotNull(property.SetMethod);
FindSymbols\FindReferences\Finders\ParameterSymbolReferenceFinder.cs (3)
198if (containingProperty.SetMethod != null && ordinal < containingProperty.SetMethod.Parameters.Length) 199results.Add(containingProperty.SetMethod.Parameters[ordinal]);
FindSymbols\FindReferences\Finders\PropertySymbolReferenceFinder.cs (1)
67result.AddIfNotNull(symbol.SetMethod);
ReassignedVariable\AbstractReassignedVariableService.cs (2)
366var setParameter = property.SetMethod?.Parameters[parameter.Ordinal]; 389var setParameter = property.SetMethod?.Parameters[parameter.Ordinal];
Shared\Extensions\SyntaxGeneratorExtensions.cs (6)
46var setAccessibility = overriddenProperty.SetMethod.ComputeResultantAccessibility(containingType); 84var setName = overriddenProperty.SetMethod?.Name; 102codeFactory.CreateArguments(overriddenProperty.SetMethod.GetParameters()))); 153if (overriddenProperty.SetMethod is { DeclaredAccessibility: not Accessibility.Private } && 154overriddenProperty.SetMethod.IsAccessibleWithin(containingType)) 157overriddenProperty.SetMethod,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousTypeSymbolKey.cs (1)
24var propertyIsReadOnly = properties.SelectAsArray(p => p.SetMethod == null);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\INamedTypeSymbolExtensions.cs (7)
132return IsAccessorImplemented(propertySymbol.GetMethod, classOrStructType) && IsAccessorImplemented(propertySymbol.SetMethod, classOrStructType); 153if (propertySymbol.SetMethod != null) 155if (classOrStructType.FindImplementationForAbstractMember(propertySymbol.SetMethod) == null) 232return IsNonPublicImplementableAccessor(property.GetMethod) || IsNonPublicImplementableAccessor(property.SetMethod); 332return IsInaccessibleImplementableAccessor(property.GetMethod, within) || IsInaccessibleImplementableAccessor(property.SetMethod, within); 515propertySymbol.SetMethod != null && 517propertySymbol.SetMethod.IsAccessibleWithin(within))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SignatureComparer.cs (4)
189BadPropertyAccessor(property1.SetMethod, property2.SetMethod)) 199BadPropertyAccessor(property2.SetMethod, property1.SetMethod))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\IPropertySymbolExtensions.cs (3)
36property.SetMethod, 66property.SetMethod, 75=> property.SetMethod != null || ContainsBackingField(property);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions.cs (2)
253if (conflictingProperty is { SetMethod.Parameters.Length: 1 } && 254property is { SetMethod.Parameters: [var parameter] })
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\InitializeParameter\AbstractInitializerParameterService.cs (2)
200if (property.SetMethod != null) 201accessors.AddIfNotNull(GetAccessorBody(property.SetMethod, cancellationToken));
Microsoft.Maui.Controls.BindingSourceGen (2)
BindingSourceGenerator.cs (2)
265 IPropertySymbol { OriginalDefinition.SetMethod.IsInitOnly: true } => false, 266 IPropertySymbol propertySymbol => propertySymbol.SetMethod != null,
Roslyn.Diagnostics.Analyzers (24)
AbstractDoNotCopyValue.cs (2)
1035if (operation.Property.SetMethod is { IsReadOnly: false }) 1494CheckMethodSymbolInUnsupportedContext(operation, property.SetMethod);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.PropertyMetricData.cs (2)
63if (property.SetMethod != null) 65yield return property.SetMethod;
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\IOperationExtensions.cs (1)
471if (operation.Property.SetMethod is null)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousTypeSymbolKey.cs (1)
24var propertyIsReadOnly = properties.SelectAsArray(p => p.SetMethod == null);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\INamedTypeSymbolExtensions.cs (7)
132return IsAccessorImplemented(propertySymbol.GetMethod, classOrStructType) && IsAccessorImplemented(propertySymbol.SetMethod, classOrStructType); 153if (propertySymbol.SetMethod != null) 155if (classOrStructType.FindImplementationForAbstractMember(propertySymbol.SetMethod) == null) 232return IsNonPublicImplementableAccessor(property.GetMethod) || IsNonPublicImplementableAccessor(property.SetMethod); 332return IsInaccessibleImplementableAccessor(property.GetMethod, within) || IsInaccessibleImplementableAccessor(property.SetMethod, within); 515propertySymbol.SetMethod != null && 517propertySymbol.SetMethod.IsAccessibleWithin(within))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SignatureComparer.cs (4)
189BadPropertyAccessor(property1.SetMethod, property2.SetMethod)) 199BadPropertyAccessor(property2.SetMethod, property1.SetMethod))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\IPropertySymbolExtensions.cs (3)
36property.SetMethod, 66property.SetMethod, 75=> property.SetMethod != null || ContainsBackingField(property);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions.cs (2)
253if (conflictingProperty is { SetMethod.Parameters.Length: 1 } && 254property is { SetMethod.Parameters: [var parameter] })
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\InitializeParameter\AbstractInitializerParameterService.cs (2)
200if (property.SetMethod != null) 201accessors.AddIfNotNull(GetAccessorBody(property.SetMethod, cancellationToken));
Roslyn.Diagnostics.CSharp.Analyzers (6)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (2)
212if (property.SetMethod != null) 214var setMethod = property.SetMethod;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\PropertyGenerator.cs (4)
279var setAccessorKind = property.SetMethod?.IsInitOnly == true ? SyntaxKind.InitAccessorDeclaration : SyntaxKind.SetAccessorDeclaration; 283GenerateAccessorDeclaration(property, property.SetMethod, setAccessorKind, destination, info, cancellationToken), 353var hasNonReadOnlyAccessor = property.GetMethod?.IsReadOnly == false || property.SetMethod?.IsReadOnly == false; 394var hasAllReadOnlyAccessors = property.GetMethod?.IsReadOnly != false && property.SetMethod?.IsReadOnly != false;
Roslyn.Diagnostics.VisualBasic.Analyzers (4)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\PropertyGenerator.vb (4)
79Dim setMethod = [property].SetMethod 113GenerateAccessor([property], [property].SetMethod, isGetter:=False, destination:=destination, options:=options) 217[property].SetMethod IsNot Nothing Then 221If [property].SetMethod Is Nothing AndAlso
System.Text.Json.SourceGeneration (2)
Helpers\RoslynExtensions.cs (1)
312isSetterNonNullable = property.SetMethod != null && IsInputTypeNonNullable(property, property.Type);
JsonSourceGenerator.Parser.cs (1)
2151if (propertyInfo.SetMethod is { } setMethod)
System.Text.RegularExpressions.Generator (1)
RegexGenerator.Parser.cs (1)
132regexPropertySymbol.SetMethod is not null ||
System.Windows.Forms.Analyzers.CSharp (1)
System\Windows\Forms\CSharp\Analyzers\MissingPropertySerializationConfiguration\MissingPropertySerializationConfigurationAnalyzer.cs (1)
60if (propertySymbol.SetMethod is not IMethodSymbol propertySetter
System.Windows.Forms.Analyzers.VisualBasic (2)
Analyzers\MissingPropertySerializationConfiguration\MissingPropertySerializationConfigurationDiagnosticAnalyzer.vb (2)
61If propertySymbol.SetMethod Is Nothing OrElse 62propertySymbol.SetMethod.DeclaredAccessibility = Accessibility.Private OrElse