13 implementations of ContainingType
Analyzer.Utilities.UnitTests (1)
GenerateDocumentationAndConfigFiles (1)
Microsoft.CodeAnalysis.Analyzers (1)
Microsoft.CodeAnalysis.BannedApiAnalyzers (1)
Microsoft.CodeAnalysis.CodeStyle.Fixes (1)
Microsoft.CodeAnalysis.CSharp (2)
Microsoft.CodeAnalysis.Features (1)
Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzers (1)
Microsoft.CodeAnalysis.VisualBasic (1)
Microsoft.CodeAnalysis.Workspaces (1)
Roslyn.Diagnostics.Analyzers (1)
Text.Analyzers (1)
2694 references to ContainingType
Analyzer.Utilities.UnitTests (1)
ConfigurationSchemaGenerator (5)
GenerateDocumentationAndConfigFiles (112)
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (16)
43method.ContainingType.SpecialType == SpecialType.System_Object &&
58method.ContainingType.SpecialType == SpecialType.System_Object &&
74if (overriddenMethod.ContainingType.SpecialType == SpecialType.System_Object)
94SymbolEqualityComparer.Default.Equals(method, method.ContainingType.FindImplementationForInterfaceMember(interfaceMethod));
279if (method.ContainingType.IsDisposable(iDisposable, iAsyncDisposable, configuredAsyncDisposable))
282(SymbolEqualityComparer.Default.Equals(method.ContainingType, iDisposable) &&
285|| (method.ContainingType.IsRefLikeType &&
341var methods = method?.ContainingType?.GetMembers(method.Name).OfType<IMethodSymbol>();
387return method.ContainingType.AllInterfaces.Any(i => iCollectionTypes.Contains(i.OriginalDefinition));
397SymbolEqualityComparer.Default.Equals(method.ContainingType, taskType);
408SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, genericTaskType);
422SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, taskAsyncEnumerableExtensions) &&
497SymbolEqualityComparer.Default.Equals(method.ContainingType, systemThreadingMonitor) &&
505Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked));
517Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked));
571var typeSymbol = methodSymbol.ContainingType;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\INamedTypeSymbolExtensions.cs (1)
20namedType.ContainingType,
ILLink.CodeFixProvider (2)
ILLink.RoslynAnalyzer (31)
Metrics (100)
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (16)
43method.ContainingType.SpecialType == SpecialType.System_Object &&
58method.ContainingType.SpecialType == SpecialType.System_Object &&
74if (overriddenMethod.ContainingType.SpecialType == SpecialType.System_Object)
94SymbolEqualityComparer.Default.Equals(method, method.ContainingType.FindImplementationForInterfaceMember(interfaceMethod));
279if (method.ContainingType.IsDisposable(iDisposable, iAsyncDisposable, configuredAsyncDisposable))
282(SymbolEqualityComparer.Default.Equals(method.ContainingType, iDisposable) &&
285|| (method.ContainingType.IsRefLikeType &&
341var methods = method?.ContainingType?.GetMembers(method.Name).OfType<IMethodSymbol>();
387return method.ContainingType.AllInterfaces.Any(i => iCollectionTypes.Contains(i.OriginalDefinition));
397SymbolEqualityComparer.Default.Equals(method.ContainingType, taskType);
408SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, genericTaskType);
422SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, taskAsyncEnumerableExtensions) &&
497SymbolEqualityComparer.Default.Equals(method.ContainingType, systemThreadingMonitor) &&
505Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked));
517Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked));
571var typeSymbol = methodSymbol.ContainingType;
Metrics.Legacy (100)
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (16)
43method.ContainingType.SpecialType == SpecialType.System_Object &&
58method.ContainingType.SpecialType == SpecialType.System_Object &&
74if (overriddenMethod.ContainingType.SpecialType == SpecialType.System_Object)
94SymbolEqualityComparer.Default.Equals(method, method.ContainingType.FindImplementationForInterfaceMember(interfaceMethod));
279if (method.ContainingType.IsDisposable(iDisposable, iAsyncDisposable, configuredAsyncDisposable))
282(SymbolEqualityComparer.Default.Equals(method.ContainingType, iDisposable) &&
285|| (method.ContainingType.IsRefLikeType &&
341var methods = method?.ContainingType?.GetMembers(method.Name).OfType<IMethodSymbol>();
387return method.ContainingType.AllInterfaces.Any(i => iCollectionTypes.Contains(i.OriginalDefinition));
397SymbolEqualityComparer.Default.Equals(method.ContainingType, taskType);
408SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, genericTaskType);
422SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, taskAsyncEnumerableExtensions) &&
497SymbolEqualityComparer.Default.Equals(method.ContainingType, systemThreadingMonitor) &&
505Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked));
517Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked));
571var typeSymbol = methodSymbol.ContainingType;
Microsoft.Analyzers.Extra (8)
Microsoft.Analyzers.Local (7)
Microsoft.AspNetCore.Analyzers (7)
Microsoft.AspNetCore.Analyzers.Test (1)
Microsoft.AspNetCore.App.Analyzers (27)
Microsoft.AspNetCore.Components.Analyzers (5)
Microsoft.AspNetCore.Components.SdkAnalyzers (4)
Microsoft.AspNetCore.Http.RequestDelegateGenerator (2)
Microsoft.AspNetCore.Mvc.Analyzers (8)
Microsoft.AspNetCore.Mvc.Api.Analyzers (10)
Microsoft.AspNetCore.OpenApi.SourceGenerators (12)
Microsoft.CodeAnalysis (21)
Microsoft.CodeAnalysis.Analyzers (151)
src\RoslynAnalyzers\Microsoft.CodeAnalysis.BannedApiAnalyzers\Core\SymbolIsBannedAnalyzerBase.cs (8)
84VerifyType(context.ReportDiagnostic, invocation.TargetMethod.ContainingType, context.Operation.Syntax);
89VerifyType(context.ReportDiagnostic, memberReference.Member.ContainingType, context.Operation.Syntax);
104VerifyType(context.ReportDiagnostic, conversion.OperatorMethod.ContainingType, context.Operation.Syntax);
113VerifyType(context.ReportDiagnostic, unary.OperatorMethod.ContainingType, context.Operation.Syntax);
122VerifyType(context.ReportDiagnostic, binary.OperatorMethod.ContainingType, context.Operation.Syntax);
131VerifyType(context.ReportDiagnostic, incrementOrDecrement.OperatorMethod.ContainingType, context.Operation.Syntax);
217IMethodSymbol method => method.ContainingType.IsAttribute() && method.IsConstructor(),
290type = type.ContainingType;
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (16)
43method.ContainingType.SpecialType == SpecialType.System_Object &&
58method.ContainingType.SpecialType == SpecialType.System_Object &&
74if (overriddenMethod.ContainingType.SpecialType == SpecialType.System_Object)
94SymbolEqualityComparer.Default.Equals(method, method.ContainingType.FindImplementationForInterfaceMember(interfaceMethod));
279if (method.ContainingType.IsDisposable(iDisposable, iAsyncDisposable, configuredAsyncDisposable))
282(SymbolEqualityComparer.Default.Equals(method.ContainingType, iDisposable) &&
285|| (method.ContainingType.IsRefLikeType &&
341var methods = method?.ContainingType?.GetMembers(method.Name).OfType<IMethodSymbol>();
387return method.ContainingType.AllInterfaces.Any(i => iCollectionTypes.Contains(i.OriginalDefinition));
397SymbolEqualityComparer.Default.Equals(method.ContainingType, taskType);
408SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, genericTaskType);
422SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, taskAsyncEnumerableExtensions) &&
497SymbolEqualityComparer.Default.Equals(method.ContainingType, systemThreadingMonitor) &&
505Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked));
517Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked));
571var typeSymbol = methodSymbol.ContainingType;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\INamedTypeSymbolExtensions.cs (1)
20namedType.ContainingType,
Microsoft.CodeAnalysis.AnalyzerUtilities (123)
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (16)
43method.ContainingType.SpecialType == SpecialType.System_Object &&
58method.ContainingType.SpecialType == SpecialType.System_Object &&
74if (overriddenMethod.ContainingType.SpecialType == SpecialType.System_Object)
94SymbolEqualityComparer.Default.Equals(method, method.ContainingType.FindImplementationForInterfaceMember(interfaceMethod));
279if (method.ContainingType.IsDisposable(iDisposable, iAsyncDisposable, configuredAsyncDisposable))
282(SymbolEqualityComparer.Default.Equals(method.ContainingType, iDisposable) &&
285|| (method.ContainingType.IsRefLikeType &&
341var methods = method?.ContainingType?.GetMembers(method.Name).OfType<IMethodSymbol>();
387return method.ContainingType.AllInterfaces.Any(i => iCollectionTypes.Contains(i.OriginalDefinition));
397SymbolEqualityComparer.Default.Equals(method.ContainingType, taskType);
408SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, genericTaskType);
422SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, taskAsyncEnumerableExtensions) &&
497SymbolEqualityComparer.Default.Equals(method.ContainingType, systemThreadingMonitor) &&
505Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked));
517Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked));
571var typeSymbol = methodSymbol.ContainingType;
Microsoft.CodeAnalysis.BannedApiAnalyzers (125)
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (16)
43method.ContainingType.SpecialType == SpecialType.System_Object &&
58method.ContainingType.SpecialType == SpecialType.System_Object &&
74if (overriddenMethod.ContainingType.SpecialType == SpecialType.System_Object)
94SymbolEqualityComparer.Default.Equals(method, method.ContainingType.FindImplementationForInterfaceMember(interfaceMethod));
279if (method.ContainingType.IsDisposable(iDisposable, iAsyncDisposable, configuredAsyncDisposable))
282(SymbolEqualityComparer.Default.Equals(method.ContainingType, iDisposable) &&
285|| (method.ContainingType.IsRefLikeType &&
341var methods = method?.ContainingType?.GetMembers(method.Name).OfType<IMethodSymbol>();
387return method.ContainingType.AllInterfaces.Any(i => iCollectionTypes.Contains(i.OriginalDefinition));
397SymbolEqualityComparer.Default.Equals(method.ContainingType, taskType);
408SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, genericTaskType);
422SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, taskAsyncEnumerableExtensions) &&
497SymbolEqualityComparer.Default.Equals(method.ContainingType, systemThreadingMonitor) &&
505Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked));
517Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked));
571var typeSymbol = methodSymbol.ContainingType;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\INamedTypeSymbolExtensions.cs (1)
20namedType.ContainingType,
SymbolIsBannedAnalyzerBase.cs (8)
84VerifyType(context.ReportDiagnostic, invocation.TargetMethod.ContainingType, context.Operation.Syntax);
89VerifyType(context.ReportDiagnostic, memberReference.Member.ContainingType, context.Operation.Syntax);
104VerifyType(context.ReportDiagnostic, conversion.OperatorMethod.ContainingType, context.Operation.Syntax);
113VerifyType(context.ReportDiagnostic, unary.OperatorMethod.ContainingType, context.Operation.Syntax);
122VerifyType(context.ReportDiagnostic, binary.OperatorMethod.ContainingType, context.Operation.Syntax);
131VerifyType(context.ReportDiagnostic, incrementOrDecrement.OperatorMethod.ContainingType, context.Operation.Syntax);
217IMethodSymbol method => method.ContainingType.IsAttribute() && method.IsConstructor(),
290type = type.ContainingType;
Microsoft.CodeAnalysis.CodeStyle (109)
Microsoft.CodeAnalysis.CodeStyle.Fixes (37)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\INamedTypeSymbolExtensions.cs (1)
20namedType.ContainingType,
Microsoft.CodeAnalysis.CSharp (31)
Microsoft.CodeAnalysis.CSharp.CodeStyle (29)
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForNewDiagnosticAnalyzer.cs (1)
81if (!symbol.ContainingType
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (25)
Microsoft.CodeAnalysis.CSharp.EditorFeatures (1)
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (17)
CodeGen\CodeGenLocalFunctionTests.cs (15)
2595Assert.Equal(verify.Compilation.GetTypeByMetadataName("Program"), goo.ContainingType);
2613Assert.Equal(program, goo.ContainingType);
2719Assert.Equal(outer.ContainingType, inner.ContainingType);
3134Assert.Equal(program, goo.ContainingType);
3205Assert.Equal(program, inner.ContainingType);
3206Assert.Equal(program, middle.ContainingType);
3207Assert.Equal(program, outer.ContainingType);
3251Assert.Equal(program, verify.FindLocalFunction("First").ContainingType);
3252Assert.Equal(program, verify.FindLocalFunction("Second").ContainingType);
3277Assert.Equal(program, goo.ContainingType);
3312Assert.Equal(program, goo.ContainingType);
3313Assert.Equal(program, bar.ContainingType);
3398Assert.Equal(program, verify.FindLocalFunction("Inner").ContainingType);
4241Assert.Equal(verify.Compilation.GetTypeByMetadataName("Program"), goo.ContainingType);
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (15)
Semantics\ExtensionTests.cs (13)
167Assert.Equal("Extensions", symbol.ContainingType.Name);
170var member = symbol.ContainingType.GetMembers().Single();
252Assert.Equal("Extensions", symbol.ContainingType.Name);
255var member = symbol.ContainingType.GetMembers().Single();
476var container = symbol.ContainingType;
622var members = symbol.ContainingType.GetMembers();
649Assert.Null(symbol.ContainingType);
690Assert.Equal("Extensions.Extensions2", nestedExtensionSymbol.ContainingType.ToTestDisplayString());
691var members = nestedExtensionSymbol.ContainingType.GetMembers();
740Assert.Equal("Extensions.<>E__0", nestedExtensionSymbol.ContainingType.ToTestDisplayString());
741Assert.Equal(["void Extensions.<>E__0.<Extension>$(System.Object)", "void Extensions.<>E__0.Method()", "Extensions.<>E__0.<>E__0"], nestedExtensionSymbol.ContainingType.GetMembers().ToTestDisplayStrings());
1782Assert.Equal(["", "M"], symbol.ContainingType.MemberNames);
2796Assert.Same(extensionParameter.Type, symbol.ContainingType.TypeParameters[0]);
Microsoft.CodeAnalysis.CSharp.Features (87)
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForNewDiagnosticAnalyzer.cs (1)
81if (!symbol.ContainingType
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (15)
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (53)
Symbols\Source\NullablePublicAPITests.cs (20)
2742Assert.Equal(PublicNullableAnnotation.Annotated, symInfo.Symbol.ContainingType.TypeArgumentNullableAnnotations[0]);
2743Assert.Equal(PublicNullableAnnotation.Annotated, symInfo.Symbol.ContainingType.TypeArgumentNullableAnnotations().First());
2747Assert.Equal(PublicNullableAnnotation.NotAnnotated, symInfo.Symbol.ContainingType.TypeArgumentNullableAnnotations[0]);
2748Assert.Equal(PublicNullableAnnotation.NotAnnotated, symInfo.Symbol.ContainingType.TypeArgumentNullableAnnotations().First());
2788Assert.Equal(PublicNullableAnnotation.Annotated, symInfo.Symbol.ContainingType.TypeArgumentNullableAnnotations[0]);
2789Assert.Equal(PublicNullableAnnotation.Annotated, symInfo.Symbol.ContainingType.TypeArgumentNullableAnnotations().First());
2793Assert.Equal(PublicNullableAnnotation.NotAnnotated, symInfo.Symbol.ContainingType.TypeArgumentNullableAnnotations[0]);
2794Assert.Equal(PublicNullableAnnotation.NotAnnotated, symInfo.Symbol.ContainingType.TypeArgumentNullableAnnotations().First());
2831Assert.Equal(PublicNullableAnnotation.Annotated, symInfo.Symbol.ContainingType.TypeArgumentNullableAnnotations[0]);
2832Assert.Equal(PublicNullableAnnotation.Annotated, symInfo.Symbol.ContainingType.TypeArgumentNullableAnnotations().First());
2836Assert.Equal(PublicNullableAnnotation.NotAnnotated, symInfo.Symbol.ContainingType.TypeArgumentNullableAnnotations[0]);
2837Assert.Equal(PublicNullableAnnotation.NotAnnotated, symInfo.Symbol.ContainingType.TypeArgumentNullableAnnotations().First());
2880Assert.Equal(PublicNullableAnnotation.Annotated, symInfo.Symbol.ContainingType.TypeArgumentNullableAnnotations[0]);
2881Assert.Equal(PublicNullableAnnotation.Annotated, symInfo.Symbol.ContainingType.TypeArgumentNullableAnnotations().First());
2885Assert.Equal(PublicNullableAnnotation.NotAnnotated, symInfo.Symbol.ContainingType.TypeArgumentNullableAnnotations[0]);
2886Assert.Equal(PublicNullableAnnotation.NotAnnotated, symInfo.Symbol.ContainingType.TypeArgumentNullableAnnotations().First());
3413Assert.Equal(annotation, method.ContainingType.TypeArgumentNullableAnnotations[0]);
3414Assert.Equal(annotation, method.ContainingType.TypeArgumentNullableAnnotations().First());
3458Assert.Equal(annotation, method.ContainingType.TypeArgumentNullableAnnotations[0]);
3459Assert.Equal(annotation, method.ContainingType.TypeArgumentNullableAnnotations().First());
Microsoft.CodeAnalysis.CSharp.Test.Utilities (2)
Microsoft.CodeAnalysis.CSharp.Workspaces (45)
Microsoft.CodeAnalysis.EditorFeatures (3)
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (1)
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (2)
Microsoft.CodeAnalysis.Extensions.Package (50)
Microsoft.CodeAnalysis.Features (228)
EditAndContinue\AbstractEditAndContinueAnalyzer.cs (59)
292return (symbol is IParameterSymbol { ContainingType: not { TypeKind: TypeKind.Delegate } })
340=> symbol.IsConst ? ((symbol.ContainingType.TypeKind == TypeKind.Enum) ? FeaturesResources.enum_value : FeaturesResources.const_field) :
2623if (TypesEquivalent(oldSymbol.ContainingType, newSymbol.ContainingType, exact: false) &&
2680var oldContainingType = oldSymbol?.ContainingType;
2681var newContainingType = newSymbol?.ContainingType;
2768if (oldSymbol.ContainingType.IsRecord &&
2769newSymbol.ContainingType.IsRecord &&
2802if (oldSymbol.ContainingType == null)
2818var oldContainingType = oldSymbol.ContainingType;
2903var newContainingType = newSymbol.ContainingType;
2911oldContainingType = oldSymbol.ContainingType;
2913if (oldSymbol is IPropertySymbol { ContainingType.IsRecord: true, GetMethod.IsImplicitlyDeclared: true, SetMethod.IsImplicitlyDeclared: true } oldRecordProperty &&
3008if (!capabilities.GrantNewTypeDefinition((newSymbol as INamedTypeSymbol) ?? newSymbol.ContainingType))
3084Debug.Assert(oldProperty.ContainingType.IsRecord);
3085Debug.Assert(newProperty.ContainingType.IsRecord);
3102DeferConstructorEdit(oldProperty.ContainingType, newProperty.ContainingType, newDeclaration: null, syntaxMaps: default, oldProperty.IsStatic, isMemberWithDeletedInitializer: true);
3113AddDeleteEditsForMemberAndAccessors(semanticEdits, synthesizedProperty.SetMethod, symbolCache.GetKey(oldProperty.ContainingType, cancellationToken), cancellationToken);
3119AddSynthesizedRecordMethodUpdatesForPropertyChange(semanticEdits, newModel.Compilation, newProperty.ContainingType, cancellationToken);
3258DeferConstructorEdit(oldSymbol.ContainingType, newSymbol.ContainingType, newDeclaration, syntaxMaps, newSymbol.IsStatic,
3280var containingSymbolKey = symbolCache.GetKey(oldSymbol.ContainingType, cancellationToken);
3310? symbolCache.GetKey(symbol.ContainingType, cancellationToken)
3346var oldContainingType = oldSymbol.ContainingType;
3347var newContainingType = newSymbol.ContainingType;
3682if (symbol.ContainingType is { TypeKind: TypeKind.Interface })
3976return memberWithInitializer.ContainingType.Constructors.Any(
4220TypesEquivalent(oldField.ContainingType.EnumUnderlyingType, newField.ContainingType.EnumUnderlyingType, exact: false))
4525newParameter.ContainingType is INamedTypeSymbol { TypeKind: TypeKind.Delegate } newContainingDelegateType)
4557if (oldContainingMember.ContainingType.IsRecord &&
4558newContainingMember.ContainingType.IsRecord &&
4580AddSynthesizedRecordMethodUpdatesForPropertyChange(semanticEdits, newCompilation, newContainingMember.ContainingType, cancellationToken);
5108(newSymbol.ContainingType.TypeKind == TypeKind.Struct) ? RudeEditKind.InsertOrMoveStructMember : RudeEditKind.InsertOrMoveTypeWithLayoutMember,
5113analyzer.GetDisplayKind(newSymbol.ContainingType)
5136if (newSymbol.ContainingType is INamedTypeSymbol { IsComImport: true })
5147if (HasExplicitOrSequentialLayout(newSymbol.ContainingType, diagnosticContext.NewModel))
5156HasExplicitOrSequentialLayout(newSymbol.ContainingType, diagnosticContext.NewModel))
5165HasExplicitOrSequentialLayout(newSymbol.ContainingType, diagnosticContext.NewModel))
5175HasExplicitOrSequentialLayout(newSymbol.ContainingType, diagnosticContext.NewModel))
5186parameter.ContainingType.GetMembers($"<{parameter.Name}>P").Any(m => m.Kind == SymbolKind.Field);
5508AddSynthesizedRecordMethodUpdatesForPropertyChange(semanticEdits, newModel.Compilation, newCtor.ContainingType, cancellationToken);
5739: GetPrimaryConstructor(oldMember.ContainingType, cancellationToken);
5743: GetPrimaryConstructor(newMember.ContainingType, cancellationToken);
5748(newPrimaryConstructor != null || oldPrimaryConstructor != null) && HasExplicitOrSequentialLayout(newMember.ContainingType, newModel);
5835var isInInterface = newMember.ContainingType.TypeKind == TypeKind.Interface;
6083if (oldLiftingPrimaryConstructor == null || !IsCapturedPrimaryParameterCapturedInType(newCapture, oldLiftingPrimaryConstructor.ContainingType))
6098if (newLiftingPrimaryConstructor == null || !IsCapturedPrimaryParameterCapturedInType(oldCapture, newLiftingPrimaryConstructor.ContainingType))
6120=> (parameter.ContainingType.TypeKind == TypeKind.Struct) ? FeaturesResources.struct_ : FeaturesResources.class_with_explicit_or_sequential_layout;
6818GetPrimaryConstructor(symbol.ContainingType, cancellationToken) is { } primaryCtor &&
6828IsDeclarationWithInitializer(declaration) ? symbol.ContainingType.InstanceConstructors.FirstOrDefault(IsPrimaryConstructor, cancellationToken) :
6832=> (IPropertySymbol?)parameter.ContainingType.GetMembers(parameter.Name)
6839=> symbol is { IsStatic: false, ContainingType.IsRecord: true } and
6863if (newSymbol is IMethodSymbol { IsStatic: false, ContainingType.IsRecord: true, ReturnsVoid: true, Name: WellKnownMemberNames.DeconstructMethodName } method &&
6864GetPrimaryConstructor(newSymbol.ContainingType, cancellationToken) is { } newPrimaryConstructor &&
6876if (newSymbol is IPropertySymbol { IsStatic: false, ContainingType.IsRecord: true } &&
6877GetPrimaryConstructor(newSymbol.ContainingType, cancellationToken)?.Parameters.FirstOrDefault(
6920=> method.Parameters is [var parameter] && SymbolEqualityComparer.Default.Equals(parameter.Type, method.ContainingType);
Microsoft.CodeAnalysis.Features.UnitTests (8)
Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzers (117)
Microsoft.CodeAnalysis.PublicApiAnalyzers (110)
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (16)
43method.ContainingType.SpecialType == SpecialType.System_Object &&
58method.ContainingType.SpecialType == SpecialType.System_Object &&
74if (overriddenMethod.ContainingType.SpecialType == SpecialType.System_Object)
94SymbolEqualityComparer.Default.Equals(method, method.ContainingType.FindImplementationForInterfaceMember(interfaceMethod));
279if (method.ContainingType.IsDisposable(iDisposable, iAsyncDisposable, configuredAsyncDisposable))
282(SymbolEqualityComparer.Default.Equals(method.ContainingType, iDisposable) &&
285|| (method.ContainingType.IsRefLikeType &&
341var methods = method?.ContainingType?.GetMembers(method.Name).OfType<IMethodSymbol>();
387return method.ContainingType.AllInterfaces.Any(i => iCollectionTypes.Contains(i.OriginalDefinition));
397SymbolEqualityComparer.Default.Equals(method.ContainingType, taskType);
408SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, genericTaskType);
422SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, taskAsyncEnumerableExtensions) &&
497SymbolEqualityComparer.Default.Equals(method.ContainingType, systemThreadingMonitor) &&
505Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked));
517Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked));
571var typeSymbol = methodSymbol.ContainingType;
Microsoft.CodeAnalysis.ResxSourceGenerator (98)
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (16)
43method.ContainingType.SpecialType == SpecialType.System_Object &&
58method.ContainingType.SpecialType == SpecialType.System_Object &&
74if (overriddenMethod.ContainingType.SpecialType == SpecialType.System_Object)
94SymbolEqualityComparer.Default.Equals(method, method.ContainingType.FindImplementationForInterfaceMember(interfaceMethod));
279if (method.ContainingType.IsDisposable(iDisposable, iAsyncDisposable, configuredAsyncDisposable))
282(SymbolEqualityComparer.Default.Equals(method.ContainingType, iDisposable) &&
285|| (method.ContainingType.IsRefLikeType &&
341var methods = method?.ContainingType?.GetMembers(method.Name).OfType<IMethodSymbol>();
387return method.ContainingType.AllInterfaces.Any(i => iCollectionTypes.Contains(i.OriginalDefinition));
397SymbolEqualityComparer.Default.Equals(method.ContainingType, taskType);
408SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, genericTaskType);
422SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, taskAsyncEnumerableExtensions) &&
497SymbolEqualityComparer.Default.Equals(method.ContainingType, systemThreadingMonitor) &&
505Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked));
517Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked));
571var typeSymbol = methodSymbol.ContainingType;
Microsoft.CodeAnalysis.Scripting (1)
Microsoft.CodeAnalysis.Test.Utilities (16)
Microsoft.CodeAnalysis.VisualBasic (13)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (15)
Microsoft.CodeAnalysis.VisualBasic.EditorFeatures (1)
Microsoft.CodeAnalysis.VisualBasic.Features (27)
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (1)
Microsoft.CodeAnalysis.VisualBasic.Workspaces (38)
Microsoft.CodeAnalysis.Workspaces (147)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\INamedTypeSymbolExtensions.cs (1)
20namedType.ContainingType,
Microsoft.CodeAnalysis.Workspaces.UnitTests (2)
Microsoft.DotNet.CodeAnalysis (3)
Microsoft.Extensions.Logging.Generators (2)
Microsoft.Extensions.Validation.ValidationsGenerator (4)
Microsoft.Gen.ComplianceReports (1)
Microsoft.Gen.ContextualOptions (1)
Microsoft.Gen.Logging (8)
Microsoft.Gen.MetadataExtractor (4)
Microsoft.Gen.Metrics (4)
Microsoft.Gen.MetricsReports (4)
Microsoft.Interop.ComInterfaceGenerator (6)
Microsoft.Interop.JavaScript.JSImportGenerator (5)
Microsoft.Interop.LibraryImportGenerator (4)
Microsoft.Interop.SourceGeneration (6)
Microsoft.Maui.Controls.BindingSourceGen (7)
Microsoft.VisualStudio.LanguageServices (8)
Microsoft.VisualStudio.LanguageServices.CSharp (5)
Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests (1)
Microsoft.VisualStudio.LanguageServices.UnitTests (3)
Microsoft.VisualStudio.LanguageServices.VisualBasic (9)
Roslyn.Diagnostics.Analyzers (128)
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (16)
43method.ContainingType.SpecialType == SpecialType.System_Object &&
58method.ContainingType.SpecialType == SpecialType.System_Object &&
74if (overriddenMethod.ContainingType.SpecialType == SpecialType.System_Object)
94SymbolEqualityComparer.Default.Equals(method, method.ContainingType.FindImplementationForInterfaceMember(interfaceMethod));
279if (method.ContainingType.IsDisposable(iDisposable, iAsyncDisposable, configuredAsyncDisposable))
282(SymbolEqualityComparer.Default.Equals(method.ContainingType, iDisposable) &&
285|| (method.ContainingType.IsRefLikeType &&
341var methods = method?.ContainingType?.GetMembers(method.Name).OfType<IMethodSymbol>();
387return method.ContainingType.AllInterfaces.Any(i => iCollectionTypes.Contains(i.OriginalDefinition));
397SymbolEqualityComparer.Default.Equals(method.ContainingType, taskType);
408SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, genericTaskType);
422SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, taskAsyncEnumerableExtensions) &&
497SymbolEqualityComparer.Default.Equals(method.ContainingType, systemThreadingMonitor) &&
505Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked));
517Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked));
571var typeSymbol = methodSymbol.ContainingType;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\INamedTypeSymbolExtensions.cs (1)
20namedType.ContainingType,
Roslyn.Diagnostics.CSharp.Analyzers (19)
Roslyn.Diagnostics.VisualBasic.Analyzers (11)
System.Private.CoreLib.Generators (13)
System.Text.Json.SourceGeneration (4)
System.Text.RegularExpressions.Generator (3)
System.Windows.Forms.Analyzers.CSharp (5)
System.Windows.Forms.Analyzers.VisualBasic (5)
Test.Utilities (93)
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (16)
43method.ContainingType.SpecialType == SpecialType.System_Object &&
58method.ContainingType.SpecialType == SpecialType.System_Object &&
74if (overriddenMethod.ContainingType.SpecialType == SpecialType.System_Object)
94SymbolEqualityComparer.Default.Equals(method, method.ContainingType.FindImplementationForInterfaceMember(interfaceMethod));
279if (method.ContainingType.IsDisposable(iDisposable, iAsyncDisposable, configuredAsyncDisposable))
282(SymbolEqualityComparer.Default.Equals(method.ContainingType, iDisposable) &&
285|| (method.ContainingType.IsRefLikeType &&
341var methods = method?.ContainingType?.GetMembers(method.Name).OfType<IMethodSymbol>();
387return method.ContainingType.AllInterfaces.Any(i => iCollectionTypes.Contains(i.OriginalDefinition));
397SymbolEqualityComparer.Default.Equals(method.ContainingType, taskType);
408SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, genericTaskType);
422SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, taskAsyncEnumerableExtensions) &&
497SymbolEqualityComparer.Default.Equals(method.ContainingType, systemThreadingMonitor) &&
505Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked));
517Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked));
571var typeSymbol = methodSymbol.ContainingType;
Text.Analyzers (122)
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (16)
43method.ContainingType.SpecialType == SpecialType.System_Object &&
58method.ContainingType.SpecialType == SpecialType.System_Object &&
74if (overriddenMethod.ContainingType.SpecialType == SpecialType.System_Object)
94SymbolEqualityComparer.Default.Equals(method, method.ContainingType.FindImplementationForInterfaceMember(interfaceMethod));
279if (method.ContainingType.IsDisposable(iDisposable, iAsyncDisposable, configuredAsyncDisposable))
282(SymbolEqualityComparer.Default.Equals(method.ContainingType, iDisposable) &&
285|| (method.ContainingType.IsRefLikeType &&
341var methods = method?.ContainingType?.GetMembers(method.Name).OfType<IMethodSymbol>();
387return method.ContainingType.AllInterfaces.Any(i => iCollectionTypes.Contains(i.OriginalDefinition));
397SymbolEqualityComparer.Default.Equals(method.ContainingType, taskType);
408SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, genericTaskType);
422SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, taskAsyncEnumerableExtensions) &&
497SymbolEqualityComparer.Default.Equals(method.ContainingType, systemThreadingMonitor) &&
505Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked));
517Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked));
571var typeSymbol = methodSymbol.ContainingType;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\INamedTypeSymbolExtensions.cs (1)
20namedType.ContainingType,