170 references to Symbol
ILLink.RoslynAnalyzer (11)
DynamicallyAccessedMembersAnalyzer.cs (8)
116 var type = (INamedTypeSymbol) context.Symbol; 134 VerifyMemberOnlyApplyToTypesOrStrings (context, context.Symbol); 135 VerifyDamOnPropertyAndAccessorMatch (context, (IMethodSymbol) context.Symbol); 136 VerifyDamOnDerivedAndBaseMethodsMatch (context, (IMethodSymbol) context.Symbol); 139 VerifyDamOnInterfaceAndImplementationMethodsMatch (context, (INamedTypeSymbol) context.Symbol); 142 VerifyMemberOnlyApplyToTypesOrStrings (context, context.Symbol); 145 VerifyMemberOnlyApplyToTypesOrStrings (context, context.Symbol); 172 && context.Symbol is IMethodSymbol method) {
RequiresAnalyzerBase.cs (2)
54 var methodSymbol = (IMethodSymbol) symbolAnalysisContext.Symbol; 68 var typeSymbol = (INamedTypeSymbol) symbolAnalysisContext.Symbol;
RequiresUnreferencedCodeAnalyzer.cs (1)
33 if (symbolAnalysisContext.Symbol is INamedTypeSymbol typeSymbol && !typeSymbol.HasAttribute (RequiresUnreferencedCodeAttribute)
Microsoft.Analyzers.Extra (1)
MakeExeTypesInternalAnalyzer.cs (1)
93var type = (ITypeSymbol)symbolActionContext.Symbol;
Microsoft.AspNetCore.Analyzers (6)
BuildServiceProviderAnalyzer.cs (2)
21Debug.Assert(context.Symbol.Kind == SymbolKind.NamedType); 23var type = (INamedTypeSymbol)context.Symbol;
UseAuthorizationAnalyzer.cs (2)
22Debug.Assert(context.Symbol.Kind == SymbolKind.NamedType); 24var type = (INamedTypeSymbol)context.Symbol;
UseMvcAnalyzer.cs (2)
21Debug.Assert(context.Symbol.Kind == SymbolKind.NamedType); 23var type = (INamedTypeSymbol)context.Symbol;
Microsoft.AspNetCore.App.Analyzers (1)
Mvc\MvcAnalyzer.cs (1)
44var namedTypeSymbol = (INamedTypeSymbol)context.Symbol;
Microsoft.AspNetCore.Components.Analyzers (2)
ComponentParameterAnalyzer.cs (1)
128context.Symbol.Locations[0],
InternalUsageAnalyzer.cs (1)
82switch (context.Symbol)
Microsoft.AspNetCore.Components.SdkAnalyzers (2)
ComponentParameterAnalyzer.cs (1)
115context.Symbol.Locations[0],
InternalUsageAnalyzer.cs (1)
82switch (context.Symbol)
Microsoft.AspNetCore.Mvc.Analyzers (3)
AttributesShouldNotBeAppliedToPageModelAnalyzer.cs (2)
40var method = (IMethodSymbol)context.Symbol; 57var type = (INamedTypeSymbol)context.Symbol;
TopLevelParameterNameAnalyzer.cs (1)
40var method = (IMethodSymbol)context.Symbol;
Microsoft.CodeAnalysis (1)
DiagnosticAnalyzer\DiagnosticAnalysisContext.cs (1)
810/// Indicates if the <see cref="Symbol"/> is generated code.
Microsoft.CodeAnalysis.CodeStyle (6)
src\Analyzers\Core\Analyzers\MakeFieldReadonly\AbstractMakeFieldReadonlyDiagnosticAnalyzer.cs (2)
88var field = (IFieldSymbol)symbolContext.Symbol; 114var members = ((INamedTypeSymbol)symbolEndContext.Symbol).GetMembers();
src\Analyzers\Core\Analyzers\NamingStyle\NamingStyleDiagnosticAnalyzerBase.cs (2)
60var sourceTree = symbolContext.Symbol.Locations.FirstOrDefault()?.SourceTree; 69symbolContext.Symbol,
src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (2)
278var symbol = symbolContext.Symbol.OriginalDefinition; 474var namedType = (INamedTypeSymbol)symbolEndContext.Symbol;
Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests (2)
CommandLineTests.cs (2)
16000symbolContext.ReportDiagnostic(Diagnostic.Create(Warning01, symbolContext.Symbol.Locations.First())); 16017symbolContext.ReportDiagnostic(Diagnostic.Create(Warning02, symbolContext.Symbol.Locations.First()));
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (1)
Diagnostics\DiagnosticAnalyzerDriver\DiagnosticAnalyzerDriverTests.cs (1)
879var diagnostic = Diagnostic.Create(descriptor, context.Symbol.Locations[0]);
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (26)
Diagnostics\DiagnosticAnalyzerTests.cs (3)
272var diag1 = CodeAnalysis.Diagnostic.Create(s_descriptor, context.Symbol.Locations[0], "NamedType"); 514Assert.False(c.Symbol.IsImplicitlyDeclared); 840var method = ((IMethodSymbol)ctxt.Symbol);
Diagnostics\GetDiagnosticsTests.cs (1)
1720var namedType = (INamedTypeSymbol)symbolContext.Symbol;
Semantics\PrimaryConstructorTests.cs (13)
4087switch (context.Symbol.ToTestDisplayString()) 4213Assert.Equal("A..ctor([System.Int32 X = 0])", context.Symbol.ToTestDisplayString()); 4219Assert.Equal("C..ctor([System.Int32 Z = 4])", context.Symbol.ToTestDisplayString()); 4225Assert.Equal("A", context.Symbol.ToTestDisplayString()); 4234Assert.Equal("C", context.Symbol.ToTestDisplayString()); 5149switch (context.Symbol.ToTestDisplayString()) 5171switch (context.Symbol.ToTestDisplayString()) 5181switch (context.Symbol.ToTestDisplayString()) 5490switch (context.Symbol.ToTestDisplayString()) 5617Assert.Equal("A..ctor([System.Int32 X = 0])", context.Symbol.ToTestDisplayString()); 5623Assert.Equal("C..ctor([System.Int32 Z = 4])", context.Symbol.ToTestDisplayString()); 5629Assert.Equal("A", context.Symbol.ToTestDisplayString()); 5638Assert.Equal("C", context.Symbol.ToTestDisplayString());
Semantics\RecordTests.cs (9)
26570switch (context.Symbol.ToTestDisplayString()) 26713Assert.Equal("A..ctor([System.Int32 X = 0])", context.Symbol.ToTestDisplayString()); 26719Assert.Equal("System.Int32 A.X { get; init; }", context.Symbol.ToTestDisplayString()); 26725Assert.Equal("C..ctor([System.Int32 Z = 4])", context.Symbol.ToTestDisplayString()); 26731Assert.Equal("A", context.Symbol.ToTestDisplayString()); 26742Assert.Equal("C", context.Symbol.ToTestDisplayString()); 27661switch (context.Symbol.ToTestDisplayString()) 27683switch (context.Symbol.ToTestDisplayString()) 27699switch (context.Symbol.ToTestDisplayString())
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (2)
Diagnostics\Suppression\RemoveUnnecessaryPragmaSuppressionsTests.cs (2)
1306if (!context.Symbol.ContainingNamespace.IsGlobalNamespace) 1308var diagnostic = Diagnostic.Create(Descriptor, context.Symbol.ContainingNamespace.Locations[0]);
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (20)
Semantics\RecordStructTests.cs (9)
6191switch (context.Symbol.ToTestDisplayString()) 6335Assert.Equal("A..ctor([System.Int32 X = 0])", context.Symbol.ToTestDisplayString()); 6341Assert.Equal("System.Int32 A.X { get; init; }", context.Symbol.ToTestDisplayString()); 6347Assert.Equal("C..ctor([System.Int32 Z = 4])", context.Symbol.ToTestDisplayString()); 6353Assert.Equal("A", context.Symbol.ToTestDisplayString()); 6364Assert.Equal("C", context.Symbol.ToTestDisplayString()); 6824switch (context.Symbol.ToTestDisplayString()) 6846switch (context.Symbol.ToTestDisplayString()) 6862switch (context.Symbol.ToTestDisplayString())
Semantics\TopLevelStatementsTests.cs (10)
6535Assert.Equal("<top-level-statements-entry-point>", context.Symbol.ToTestDisplayString()); 6537switch (context.Symbol.DeclaringSyntaxReferences.Single().GetSyntax().ToString()) 6654Assert.Equal("<top-level-statements-entry-point>", context.Symbol.ToTestDisplayString()); 6656Assert.Equal("System.Console.WriteLine(1);", context.Symbol.DeclaringSyntaxReferences.Single().GetSyntax().ToString()); 6661Assert.Equal("<top-level-statements-entry-point>", context.Symbol.ToTestDisplayString()); 6663Assert.Equal("System.Console.WriteLine(2);", context.Symbol.DeclaringSyntaxReferences.Single().GetSyntax().ToString()); 6668Assert.Equal(WellKnownMemberNames.TopLevelStatementsEntryPointTypeName, context.Symbol.ToTestDisplayString()); 7277Assert.Equal("<top-level-statements-entry-point>", context.Symbol.ToTestDisplayString()); 7283Assert.Equal("N1", context.Symbol.ToTestDisplayString()); 7288switch (context.Symbol.ToTestDisplayString())
SourceGeneration\GeneratorDriverTests.cs (1)
190switch (context.Symbol.ToTestDisplayString())
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (1)
Diagnostics\DiagnosticAnalyzerServiceTests.cs (1)
1047c.ReportDiagnostic(Diagnostic.Create(_supportedDiagnostics[0], c.Symbol.Locations[0]));
Microsoft.CodeAnalysis.EditorFeatures2.UnitTests (15)
CodeFixes\CodeFixServiceTests.vb (2)
205context.ReportDiagnostic(Diagnostic.Create(DiagDescriptor, context.Symbol.Locations.First(), context.Symbol.Locations.Skip(1)))
Diagnostics\AdditionalFileDiagnosticsTests.vb (2)
93Dim namedType = DirectCast(context.Symbol, INamedTypeSymbol) 97context.ReportDiagnostic(Diagnostic.Create(Rule, context.Symbol.Locations.First()))
Diagnostics\DiagnosticServiceTests.vb (11)
1261Dim method = DirectCast(context.Symbol, IMethodSymbol) 1263Dim sourceLoc = context.Symbol.Locations.First(Function(l) l.IsInSource) 1461Dim diag = Diagnostic.Create(Descriptor, symbolContext.Symbol.Locations(0), additionalFileText) 1548context.ReportDiagnostic(Diagnostic.Create(DiagDescriptor, context.Symbol.Locations.First(), context.Symbol.Locations.Skip(1))) 1574For Each location In context.Symbol.Locations 1599If (symbols.Contains(sc.Symbol)) Then 1603sc.ReportDiagnostic(Diagnostic.Create(DiagDescriptor, sc.Symbol.Locations.First())) 1785_symbolNames.Add(context.Symbol.Name) 1886Dim method = (DirectCast(ctxt.Symbol, IMethodSymbol)) 2522context.RegisterSymbolAction(Sub(symbolContext) AnalyzedMethodSymbols.Add(symbolContext.Symbol), SymbolKind.Method)
Microsoft.CodeAnalysis.Features (6)
src\Analyzers\Core\Analyzers\MakeFieldReadonly\AbstractMakeFieldReadonlyDiagnosticAnalyzer.cs (2)
88var field = (IFieldSymbol)symbolContext.Symbol; 114var members = ((INamedTypeSymbol)symbolEndContext.Symbol).GetMembers();
src\Analyzers\Core\Analyzers\NamingStyle\NamingStyleDiagnosticAnalyzerBase.cs (2)
60var sourceTree = symbolContext.Symbol.Locations.FirstOrDefault()?.SourceTree; 69symbolContext.Symbol,
src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (2)
278var symbol = symbolContext.Symbol.OriginalDefinition; 474var namedType = (INamedTypeSymbol)symbolEndContext.Symbol;
Microsoft.CodeAnalysis.Test.Utilities (42)
Diagnostics\CommonDiagnosticAnalyzers.cs (35)
765CallbackSymbols.Add(context.Symbol); 766context.ReportDiagnostic(Diagnostic.Create(Rule, context.Symbol.Locations[0])); 795var ns = (INamespaceSymbol)context.Symbol; 1003symbolContext.ReportDiagnostic(Diagnostic.Create(Rule, symbolContext.Symbol.Locations[0])); 1043symbolContext.ReportDiagnostic(Diagnostic.Create(Rule, symbolContext.Symbol.Locations[0], symbolContext.Symbol.Name)); 1160if (!pendingSymbols.Remove((INamedTypeSymbol)symbolContext.Symbol)) 1177var diagnostic = Diagnostic.Create(Descriptor, symbolContext.Symbol.Locations[0], symbolContext.Symbol.Name); 1219var diagnostic = Diagnostic.Create(Descriptor, symbolContext.Symbol.Locations[0]); 1536sortedCallbackSymbolNames.Add($"{symbolContext.Symbol.Name}(IsGeneratedCode:{symbolContext.IsGeneratedCode})"); 1537ReportSymbolDiagnostics(symbolContext.Symbol, symbolContext.ReportDiagnostic); 1601sortedCallbackSymbolEndNames.Add($"{context.Symbol.Name}(IsGeneratedCode:{context.IsGeneratedCode})")); 1700compilationStartContext.RegisterSymbolAction(symbolContext => namedTypes.Add(symbolContext.Symbol), SymbolKind.NamedType); 1804foreach (var location in symbolContext.Symbol.Locations) 1814var diagnostic = Diagnostic.Create(descriptor, symbolContext.Symbol.Locations[0], symbolContext.Symbol.Name); 1864context.ReportDiagnostic(Diagnostic.Create(ParameterDescriptor, context.Symbol.Locations[0])); 2055Assert.Equal(symbolStartContext.Symbol, symbolEndContext.Symbol); 2057if (!symbolsEnded.Add(symbolEndContext.Symbol)) 2059diagnostics.Add(Diagnostic.Create(DuplicateEndActionRule, Location.None, symbolEndContext.Symbol.Name, _analyzerId)); 2062Assert.False(symbolEndContext.Symbol.IsImplicitlyDeclared); 2117ISymbol symbolEnded = symbolEndContext.Symbol; 2428_symbolCallbacks.Add(c.Symbol); 2429ReportDiagnostic(c.Symbol, c.ReportDiagnostic); 2438_symbolCallbacks.Add(symbolEndContext.Symbol); 2439ReportDiagnostic(symbolEndContext.Symbol, symbolEndContext.ReportDiagnostic); 2450_symbolCallbacks.Add(c.Symbol); 2542var diagnostic = Diagnostic.Create(Descriptor, context.Symbol.Locations[0], _reportedSeverity, additionalLocations: null, properties: null, messageArgs: null); 2610context => context.ReportDiagnostic(Diagnostic.Create(Descriptor, context.Symbol.Locations[0])), 2750ReportSymbolDiagnostics("RegisterSymbolAction", symbolContext.Symbol, symbolContext.Compilation, symbolContext.ReportDiagnostic), 2766ReportSymbolDiagnostics("RegisterSymbolEndAction", symbolEndContext.Symbol, symbolEndContext.Compilation, symbolEndContext.ReportDiagnostic)); 2940context.RegisterSymbolAction(context => HandleCallback(context.Symbol.Locations[0], context.Compilation, context.ReportDiagnostic, context.CancellationToken), SymbolKind.NamedType); 3016context.RegisterSymbolAction(symbolContext => AnalyzedSymbols.Add(symbolContext.Symbol), SymbolKind.NamedType, SymbolKind.Method); 3035symbolStartContext.RegisterSymbolEndAction(symbolEndContext => AnalyzedSymbolEndSymbols.Add(symbolEndContext.Symbol));
Diagnostics\FieldCouldBeReadOnlyAnalyzer.cs (1)
91IFieldSymbol field = (IFieldSymbol)symbolContext.Symbol;
Diagnostics\SuppressMessageAttributeTests.DiagnosticAnalyzers.cs (5)
67if (context.Symbol.Name.StartsWith(_errorSymbolPrefix, StringComparison.Ordinal)) 69context.ReportDiagnostic(CodeAnalysis.Diagnostic.Create(s_rule, context.Symbol.Locations.First(), messageArgs: context.Symbol.Name)); 100context.ReportDiagnostic(CodeAnalysis.Diagnostic.Create(s_rule, context.Symbol.Locations.First(), messageArgs: context.Symbol.Name));
Diagnostics\TestDiagnosticAnalyzer.cs (1)
82OnAbstractMember("Symbol", symbol: context.Symbol);
Microsoft.CodeAnalysis.UnitTests (1)
Diagnostics\AnalysisContextInfoTests.cs (1)
79c.RegisterSymbolAction(b => ThrowIfMatch(nameof(c.RegisterSymbolAction), new AnalysisContextInfo(b.Compilation, b.Symbol)), SymbolKind.NamedType);
Microsoft.CodeAnalysis.VisualBasic.CommandLine.UnitTests (3)
CommandLineTests.vb (3)
11042context.ReportDiagnostic(Diagnostic.Create(Warning01, context.Symbol.Locations.First())) 11043context.ReportDiagnostic(Diagnostic.Create(Warning03, context.Symbol.Locations.First())) 11066context.ReportDiagnostic(Diagnostic.Create(Warning04, context.Symbol.Locations.First()))
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (3)
Diagnostics\DiagnosticAnalyzerTests.vb (2)
316Dim sourceLoc = context.Symbol.Locations.First(Function(l) l.IsInSource) 510Dim sourceLoc = context.Symbol.Locations.First(Function(l) l.IsInSource)
Diagnostics\GetDiagnosticsTests.vb (1)
721Dim namedType = DirectCast(symbolContext.Symbol, INamedTypeSymbol)
Microsoft.DotNet.CodeAnalysis (2)
Analyzers\MembersMustExistAnalyzer.cs (1)
85string apiDef = Helpers.GetMemberName(context.Symbol);
Analyzers\PinvokeAnalyzer.cs (1)
135var methodSymbol = context.Symbol as IMethodSymbol;
Microsoft.Interop.ComInterfaceGenerator (3)
Analyzers\AddGeneratedComClassAnalyzer.cs (1)
35INamedTypeSymbol type = (INamedTypeSymbol)context.Symbol;
Analyzers\ConvertComImportToGeneratedComInterfaceAnalyzer.cs (1)
50INamedTypeSymbol type = (INamedTypeSymbol)context.Symbol;
Analyzers\GeneratedComInterfaceAttributeAnalyzer.cs (1)
31INamedTypeSymbol typeSymbol = (INamedTypeSymbol)context.Symbol;
Microsoft.Interop.LibraryImportGenerator (1)
Analyzers\ConvertToLibraryImportAnalyzer.cs (1)
69var method = (IMethodSymbol)context.Symbol;
Microsoft.ML.CodeAnalyzer.Tests (1)
Code\RelaxTestNamingTest.cs (1)
121var method = (IMethodSymbol)context.Symbol;
Microsoft.ML.InternalCodeAnalyzer (6)
BaseTestClassAnalyzer.cs (1)
67var namedType = (INamedTypeSymbol)context.Symbol;
BestFriendOnPublicDeclarationsAnalyzer.cs (3)
59if (context.Symbol.DeclaredAccessibility != Accessibility.Public) 62var attribute = context.Symbol.GetAttributes().FirstOrDefault(a => Equals(a.AttributeClass, attributeType)); 66var diagnostic = Diagnostic.Create(Rule, attribute.ApplicationSyntaxReference.GetSyntax().GetLocation(), context.Symbol.Name);
InstanceInitializerAnalyzer.cs (2)
42var symbol = (IFieldSymbol)context.Symbol; 65var symbol = (IPropertySymbol)context.Symbol;
System.Windows.Forms.Analyzers.CSharp (1)
System\Windows\Forms\CSharp\Analyzers\MissingPropertySerializationConfiguration\MissingPropertySerializationConfigurationAnalyzer.cs (1)
28var propertySymbol = (IPropertySymbol)context.Symbol;
System.Windows.Forms.Analyzers.VisualBasic (1)
Analyzers\MissingPropertySerializationConfiguration\MissingPropertySerializationConfigurationDiagnosticAnalyzer.vb (1)
30Dim propertySymbol As IPropertySymbol = TryCast(context.Symbol, IPropertySymbol)