80 references to ContainingSymbol
ILLink.RoslynAnalyzer (3)
COMAnalyzer.cs (1)
45 if (operationContext.ContainingSymbol.IsInRequiresUnreferencedCodeAttributeScope (out _))
RequiresAnalyzerBase.cs (2)
217 return operationContext.ContainingSymbol; 225 return operationContext.ContainingSymbol;
Microsoft.AspNetCore.Mvc.Api.Analyzers (2)
ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzer.cs (1)
77if (context.ContainingSymbol is not IMethodSymbol methodSymbol)
ApiConventionAnalyzer.cs (1)
41var method = (IMethodSymbol)context.ContainingSymbol;
Microsoft.CodeAnalysis.CodeStyle (5)
src\Analyzers\Core\Analyzers\MakeFieldReadonly\AbstractMakeFieldReadonlyDiagnosticAnalyzer.cs (1)
105if (!IsFieldWrite(fieldReference, operationContext.ContainingSymbol))
src\Analyzers\Core\Analyzers\QualifyMemberAccess\AbstractQualifyMemberAccessDiagnosticAnalyzer.cs (2)
59if (context.ContainingSymbol.IsStatic) 98if (!CanMemberAccessBeQualified(context.ContainingSymbol, instanceOperation.Syntax))
src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (1)
360var valueUsageInfo = memberReference.GetValueUsageInfo(operationContext.ContainingSymbol);
src\Analyzers\Core\Analyzers\UseConditionalExpression\AbstractUseConditionalExpressionDiagnosticAnalyzer.cs (1)
51var (matched, canSimplify) = TryMatchPattern(ifOperation, context.ContainingSymbol);
Microsoft.CodeAnalysis.CSharp.CodeStyle (1)
src\Analyzers\CSharp\Analyzers\UseSystemThreadingLock\CSharpUseSystemThreadingLockDiagnosticAnalyzer.cs (1)
152if (context.ContainingSymbol is not IFieldSymbol fieldSymbol)
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (35)
Diagnostics\DiagnosticAnalyzerTests.cs (2)
2329sortedCallbackEntityNames.Add($"Operation: {operationContext.ContainingSymbol.Name}"); 2330ReportOperationDiagnostics(operationContext.Operation, operationContext.ContainingSymbol.Name, operationContext.ReportDiagnostic);
Diagnostics\GetDiagnosticsTests.cs (1)
983context => analyzeNode(context.Operation.Syntax, context.ContainingSymbol, context.ReportDiagnostic),
Semantics\PrimaryConstructorTests.cs (18)
4324switch (context.ContainingSymbol.ToTestDisplayString()) 4346switch (context.ContainingSymbol.ToTestDisplayString()) 4389Assert.Equal("A..ctor([System.Int32 X = 0])", context.ContainingSymbol.ToTestDisplayString()); 4393Assert.Equal("A..ctor([System.Int32 X = 0])", context.ContainingSymbol.ToTestDisplayString()); 4397Assert.Equal("B..ctor([System.Int32 Y = 1])", context.ContainingSymbol.ToTestDisplayString()); 4401Assert.Equal("B..ctor([System.Int32 Y = 1])", context.ContainingSymbol.ToTestDisplayString()); 4405Assert.Equal("B..ctor([System.Int32 Y = 1])", context.ContainingSymbol.ToTestDisplayString()); 4409Assert.Equal("C..ctor([System.Int32 Z = 4])", context.ContainingSymbol.ToTestDisplayString()); 4413Assert.Equal("C..ctor([System.Int32 Z = 4])", context.ContainingSymbol.ToTestDisplayString()); 4417Assert.Equal("C..ctor([System.Int32 Z = 4])", context.ContainingSymbol.ToTestDisplayString()); 4421Assert.Equal("System.Int32 B.M()", context.ContainingSymbol.ToTestDisplayString()); 4435Assert.Equal("A..ctor([System.Int32 X = 0])", context.ContainingSymbol.ToTestDisplayString()); 4439Assert.Equal("B..ctor([System.Int32 Y = 1])", context.ContainingSymbol.ToTestDisplayString()); 4443Assert.Equal("C..ctor([System.Int32 Z = 4])", context.ContainingSymbol.ToTestDisplayString()); 5692switch (context.ContainingSymbol.ToTestDisplayString()) 5716Assert.Equal("A..ctor([System.Int32 X = 0])", context.ContainingSymbol.ToTestDisplayString()); 5720Assert.Equal("A..ctor([System.Int32 X = 0])", context.ContainingSymbol.ToTestDisplayString()); 5734Assert.Equal("A..ctor([System.Int32 X = 0])", context.ContainingSymbol.ToTestDisplayString());
Semantics\RecordTests.cs (14)
26832switch (context.ContainingSymbol.ToTestDisplayString()) 26854switch (context.ContainingSymbol.ToTestDisplayString()) 26897Assert.Equal("A..ctor([System.Int32 X = 0])", context.ContainingSymbol.ToTestDisplayString()); 26901Assert.Equal("A..ctor([System.Int32 X = 0])", context.ContainingSymbol.ToTestDisplayString()); 26905Assert.Equal("B..ctor([System.Int32 Y = 1])", context.ContainingSymbol.ToTestDisplayString()); 26909Assert.Equal("B..ctor([System.Int32 Y = 1])", context.ContainingSymbol.ToTestDisplayString()); 26913Assert.Equal("B..ctor([System.Int32 Y = 1])", context.ContainingSymbol.ToTestDisplayString()); 26917Assert.Equal("C..ctor([System.Int32 Z = 4])", context.ContainingSymbol.ToTestDisplayString()); 26921Assert.Equal("C..ctor([System.Int32 Z = 4])", context.ContainingSymbol.ToTestDisplayString()); 26925Assert.Equal("C..ctor([System.Int32 Z = 4])", context.ContainingSymbol.ToTestDisplayString()); 26929Assert.Equal("System.Int32 B.M()", context.ContainingSymbol.ToTestDisplayString()); 26943Assert.Equal("A..ctor([System.Int32 X = 0])", context.ContainingSymbol.ToTestDisplayString()); 26947Assert.Equal("B..ctor([System.Int32 Y = 1])", context.ContainingSymbol.ToTestDisplayString()); 26951Assert.Equal("C..ctor([System.Int32 Z = 4])", context.ContainingSymbol.ToTestDisplayString());
Microsoft.CodeAnalysis.CSharp.Features (1)
src\Analyzers\CSharp\Analyzers\UseSystemThreadingLock\CSharpUseSystemThreadingLockDiagnosticAnalyzer.cs (1)
152if (context.ContainingSymbol is not IFieldSymbol fieldSymbol)
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (10)
Semantics\RecordStructTests.cs (4)
6418switch (context.ContainingSymbol.ToTestDisplayString()) 6442Assert.Equal("A..ctor([System.Int32 X = 0])", context.ContainingSymbol.ToTestDisplayString()); 6446Assert.Equal("A..ctor([System.Int32 X = 0])", context.ContainingSymbol.ToTestDisplayString()); 6460Assert.Equal("A..ctor([System.Int32 X = 0])", context.ContainingSymbol.ToTestDisplayString());
Semantics\TopLevelStatementsTests.cs (6)
6720Assert.Equal("<top-level-statements-entry-point>", context.ContainingSymbol.ToTestDisplayString()); 6721Assert.Same(context.ContainingSymbol.DeclaringSyntaxReferences.Single().SyntaxTree, context.Operation.Syntax.SyntaxTree); 6741Assert.Equal("<top-level-statements-entry-point>", context.ContainingSymbol.ToTestDisplayString()); 6742Assert.Same(context.ContainingSymbol.DeclaringSyntaxReferences.Single().GetSyntax(), context.Operation.Syntax); 7419Assert.Equal("<top-level-statements-entry-point>", context.ContainingSymbol.ToTestDisplayString()); 7420Assert.Same(context.ContainingSymbol.DeclaringSyntaxReferences.Single().GetSyntax(), context.Operation.Syntax);
Microsoft.CodeAnalysis.Features (5)
src\Analyzers\Core\Analyzers\MakeFieldReadonly\AbstractMakeFieldReadonlyDiagnosticAnalyzer.cs (1)
105if (!IsFieldWrite(fieldReference, operationContext.ContainingSymbol))
src\Analyzers\Core\Analyzers\QualifyMemberAccess\AbstractQualifyMemberAccessDiagnosticAnalyzer.cs (2)
59if (context.ContainingSymbol.IsStatic) 98if (!CanMemberAccessBeQualified(context.ContainingSymbol, instanceOperation.Syntax))
src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (1)
360var valueUsageInfo = memberReference.GetValueUsageInfo(operationContext.ContainingSymbol);
src\Analyzers\Core\Analyzers\UseConditionalExpression\AbstractUseConditionalExpressionDiagnosticAnalyzer.cs (1)
51var (matched, canSimplify) = TryMatchPattern(ifOperation, context.ContainingSymbol);
Microsoft.CodeAnalysis.Test.Utilities (9)
Diagnostics\CommonDiagnosticAnalyzers.cs (8)
1322_controlFlowGraphMapOpt[rootOperation] = (controlFlowGraph, operationContext.ContainingSymbol); 1466var diagnostic = Diagnostic.Create(Descriptor, operationContext.Operation.Syntax.GetLocation(), operationContext.ContainingSymbol.Name); 1582sortedCallbackOperationNames.Add($"{context.ContainingSymbol.ContainingType.Name}(IsGeneratedCode:{context.IsGeneratedCode})"), 2069var containingSymbols = GetContainingSymbolsAndThis(operationContext.ContainingSymbol).ToSet(); 2074operationContext.ReportDiagnostic(Diagnostic.Create(OperationRule, Location.None, symbolStartContext.Symbol.Name, operationContext.ContainingSymbol.Name, operationContext.Operation.Syntax.ToString(), _analyzerId)); 2758ReportDiagnostics($"RegisterOperationAction({operationContext.Operation.Syntax}) in RegisterSymbolStartAction", operationContext.Operation.Syntax.SyntaxTree, operationContext.ContainingSymbol, operationContext.ReportDiagnostic), 2772ReportDiagnostics($"RegisterOperationAction({operationContext.Operation.Syntax})", operationContext.Operation.Syntax.SyntaxTree, operationContext.ContainingSymbol, operationContext.ReportDiagnostic), 2785ReportDiagnostics($"RegisterOperationAction({operationContext.Operation.Syntax}) in RegisterOperationBlockStartAction", operationContext.Operation.Syntax.SyntaxTree, operationContext.ContainingSymbol, operationContext.ReportDiagnostic),
Diagnostics\OperationTestAnalyzer.cs (1)
107if (operationContext.ContainingSymbol.Name.StartsWith("Funky") && operationContext.Compilation.Language != "Mumble")
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (1)
Diagnostics\GetDiagnosticsTests.vb (1)
641AnalyzeNode(context.Operation.Syntax, context.ContainingSymbol, AddressOf context.ReportDiagnostic)
Microsoft.Interop.ComInterfaceGenerator (5)
Analyzers\ComHostingDoesNotSupportGeneratedComInterfaceAnalyzer.cs (5)
51INamedTypeSymbol containingType = (INamedTypeSymbol)context.ContainingSymbol; 55context.ReportDiagnostic(context.ContainingSymbol.CreateDiagnostic(ComHostingDoesNotSupportGeneratedComInterface, context.ContainingSymbol.Name)); 63context.ReportDiagnostic(context.ContainingSymbol.CreateDiagnostic(ComHostingDoesNotSupportGeneratedComInterface, context.ContainingSymbol.Name));
Microsoft.Interop.LibraryImportGenerator (3)
Analyzers\CustomMarshallerAttributeAnalyzer.cs (1)
648INamedTypeSymbol entryType = (INamedTypeSymbol)context.ContainingSymbol!;
Analyzers\NativeMarshallingAttributeAnalyzer.cs (2)
96GetSymbolType(context.ContainingSymbol!).ToDisplayString()); 101GetSymbolType(context.ContainingSymbol!),