13 implementations of Locations
Analyzer.Utilities.UnitTests (1)
Lightup\LightupHelpersTests.cs (1)
118ImmutableArray<Location> ISymbol.Locations => throw new NotImplementedException();
GenerateDocumentationAndConfigFiles (1)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationSymbol.cs (1)
135public ImmutableArray<Location> Locations
Microsoft.CodeAnalysis.Analyzers (1)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationSymbol.cs (1)
135public ImmutableArray<Location> Locations
Microsoft.CodeAnalysis.BannedApiAnalyzers (1)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationSymbol.cs (1)
135public ImmutableArray<Location> Locations
Microsoft.CodeAnalysis.CodeStyle.Fixes (1)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationSymbol.cs (1)
135public ImmutableArray<Location> Locations
Microsoft.CodeAnalysis.CSharp (2)
Symbols\PublicModel\PreprocessingSymbol.cs (1)
60ImmutableArray<Location> ISymbol.Locations => ImmutableArray<Location>.Empty;
Symbols\PublicModel\Symbol.cs (1)
104ImmutableArray<Location> ISymbol.Locations
Microsoft.CodeAnalysis.Features (1)
MetadataAsSource\AbstractMetadataAsSourceService.AbstractWrappedSymbol.cs (1)
65public ImmutableArray<Location> Locations => _symbol.Locations;
Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzers (1)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationSymbol.cs (1)
135public ImmutableArray<Location> Locations
Microsoft.CodeAnalysis.VisualBasic (1)
Symbols\Symbol.vb (1)
1295Private ReadOnly Property ISymbol_Locations As ImmutableArray(Of Location) Implements ISymbol.Locations, ISymbolInternal.Locations
Microsoft.CodeAnalysis.Workspaces (1)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationSymbol.cs (1)
135public ImmutableArray<Location> Locations
Roslyn.Diagnostics.Analyzers (1)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationSymbol.cs (1)
135public ImmutableArray<Location> Locations
Text.Analyzers (1)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationSymbol.cs (1)
135public ImmutableArray<Location> Locations
902 references to Locations
GenerateDocumentationAndConfigFiles (26)
src\RoslynAnalyzers\Utilities\Compiler\Extensions\DiagnosticExtensions.cs (2)
84return symbol.Locations.CreateDiagnostic(rule, args); 93return symbol.Locations.CreateDiagnostic(rule, properties, args);
src\RoslynAnalyzers\Utilities\Compiler\Options\AnalyzerOptionsExtensions.cs (4)
42tree = symbol.Locations[0].SourceTree; 321=> options.GetDisallowedSymbolNamesWithValueOption(rule, symbol.Locations[0].SourceTree, compilation); 335=> options.GetAdditionalRequiredSuffixesOption(rule, symbol.Locations[0].SourceTree, compilation); 384=> options.GetAdditionalRequiredGenericInterfaces(rule, symbol.Locations[0].SourceTree, compilation);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs (1)
32visitor.WriteLocation(symbol.Locations.First());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousTypeSymbolKey.cs (1)
25var propertyLocations = properties.SelectAsArray(p => p.Locations.FirstOrDefault());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.BodyLevelSymbolKey.cs (3)
22Contract.ThrowIfTrue(symbol.DeclaringSyntaxReferences.IsEmpty && symbol.Locations.IsEmpty); 26foreach (var location in symbol.Locations) 61Contract.ThrowIfTrue(symbol.DeclaringSyntaxReferences.IsEmpty && symbol.Locations.IsEmpty);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (1)
705var location = module.Locations.FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TupleTypeSymbolKey.cs (1)
30locations.Add(element.Locations.FirstOrDefault() ?? Location.None);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TypeParameterSymbolKey.cs (1)
20visitor.WriteLocation(symbol.Locations[0]);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (2)
616=> symbol.Locations.Any() && symbol.Locations.All(location => location.IsInSource);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.EquivalenceVisitor.cs (4)
274return x.Locations.Length == 1 && y.Locations.Length == 1 && 275x.Locations.First().Equals(y.Locations.First());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (4)
103Hash.Combine(x.Locations.FirstOrDefault(), currentHash)); 107=> Hash.Combine(x.Locations.FirstOrDefault(), currentHash); 117return Hash.Combine(x.Locations.FirstOrDefault(), currentHash); 297=> Hash.Combine(x.Locations.FirstOrDefault(), currentHash);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\SymbolFinder\SymbolFinderInternal.cs (2)
71else if (!symbol.Locations.Any(static loc => loc.IsInMetadata)) 91=> symbol != null && symbol.Locations.Any(static loc => loc.IsInSource);
ILLink.RoslynAnalyzer (15)
DynamicallyAccessedMembersAnalyzer.cs (9)
131var location = GetPrimaryLocation(type.Locations); 164var location = GetPrimaryLocation(member.Locations); 204Location attributableSymbolLocation = GetPrimaryLocation(attributableMethod.Locations); 215GetPrimaryLocation(returnOrigin.Locations), sourceLocation, DAMArgs?.ToImmutableDictionary(), overrideMethod.GetDisplayName(), baseMethod.GetDisplayName())); 239GetPrimaryLocation(parameterOrigin?.Locations), sourceLocation, DAMArgs?.ToImmutableDictionary(), 254Location attributableSymbolLocation = GetPrimaryLocation(attributableSymbol.Locations); 265GetPrimaryLocation(typeParameterOrigin.Locations), sourceLocation, DAMArgs?.ToImmutableDictionary(), 280GetPrimaryLocation(methodOrigin.Locations), 322GetPrimaryLocation(propertySymbol.Locations),
RequiresAnalyzerBase.cs (3)
259ctor.Locations[0], 267entryPoint.Locations[0], 277origin.Locations[0],
RequiresUnreferencedCodeAnalyzer.cs (1)
41typeSymbol.Locations[0],
TrimAnalysis\ParameterProxy.cs (1)
45public Location? Location => ParameterSymbol?.Locations[0];
TrimAnalysis\ReflectionAccessAnalyzer.cs (1)
140location = DynamicallyAccessedMembersAnalyzer.GetPrimaryLocation(member.Locations);
Metrics (25)
MetricsOutputWriter.cs (1)
84var location = data.Symbol.Locations.First();
src\RoslynAnalyzers\Utilities\Compiler\Extensions\DiagnosticExtensions.cs (2)
84return symbol.Locations.CreateDiagnostic(rule, args); 93return symbol.Locations.CreateDiagnostic(rule, properties, args);
src\RoslynAnalyzers\Utilities\Compiler\Options\AnalyzerOptionsExtensions.cs (4)
42tree = symbol.Locations[0].SourceTree; 321=> options.GetDisallowedSymbolNamesWithValueOption(rule, symbol.Locations[0].SourceTree, compilation); 335=> options.GetAdditionalRequiredSuffixesOption(rule, symbol.Locations[0].SourceTree, compilation); 384=> options.GetAdditionalRequiredGenericInterfaces(rule, symbol.Locations[0].SourceTree, compilation);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs (1)
32visitor.WriteLocation(symbol.Locations.First());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousTypeSymbolKey.cs (1)
25var propertyLocations = properties.SelectAsArray(p => p.Locations.FirstOrDefault());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.BodyLevelSymbolKey.cs (3)
22Contract.ThrowIfTrue(symbol.DeclaringSyntaxReferences.IsEmpty && symbol.Locations.IsEmpty); 26foreach (var location in symbol.Locations) 61Contract.ThrowIfTrue(symbol.DeclaringSyntaxReferences.IsEmpty && symbol.Locations.IsEmpty);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (1)
705var location = module.Locations.FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TupleTypeSymbolKey.cs (1)
30locations.Add(element.Locations.FirstOrDefault() ?? Location.None);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TypeParameterSymbolKey.cs (1)
20visitor.WriteLocation(symbol.Locations[0]);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (2)
616=> symbol.Locations.Any() && symbol.Locations.All(location => location.IsInSource);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.EquivalenceVisitor.cs (4)
274return x.Locations.Length == 1 && y.Locations.Length == 1 && 275x.Locations.First().Equals(y.Locations.First());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (4)
103Hash.Combine(x.Locations.FirstOrDefault(), currentHash)); 107=> Hash.Combine(x.Locations.FirstOrDefault(), currentHash); 117return Hash.Combine(x.Locations.FirstOrDefault(), currentHash); 297=> Hash.Combine(x.Locations.FirstOrDefault(), currentHash);
Metrics.Legacy (25)
src\RoslynAnalyzers\Tools\Metrics\MetricsOutputWriter.cs (1)
84var location = data.Symbol.Locations.First();
src\RoslynAnalyzers\Utilities\Compiler\Extensions\DiagnosticExtensions.cs (2)
84return symbol.Locations.CreateDiagnostic(rule, args); 93return symbol.Locations.CreateDiagnostic(rule, properties, args);
src\RoslynAnalyzers\Utilities\Compiler\Options\AnalyzerOptionsExtensions.cs (4)
42tree = symbol.Locations[0].SourceTree; 321=> options.GetDisallowedSymbolNamesWithValueOption(rule, symbol.Locations[0].SourceTree, compilation); 335=> options.GetAdditionalRequiredSuffixesOption(rule, symbol.Locations[0].SourceTree, compilation); 384=> options.GetAdditionalRequiredGenericInterfaces(rule, symbol.Locations[0].SourceTree, compilation);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs (1)
32visitor.WriteLocation(symbol.Locations.First());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousTypeSymbolKey.cs (1)
25var propertyLocations = properties.SelectAsArray(p => p.Locations.FirstOrDefault());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.BodyLevelSymbolKey.cs (3)
22Contract.ThrowIfTrue(symbol.DeclaringSyntaxReferences.IsEmpty && symbol.Locations.IsEmpty); 26foreach (var location in symbol.Locations) 61Contract.ThrowIfTrue(symbol.DeclaringSyntaxReferences.IsEmpty && symbol.Locations.IsEmpty);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (1)
705var location = module.Locations.FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TupleTypeSymbolKey.cs (1)
30locations.Add(element.Locations.FirstOrDefault() ?? Location.None);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TypeParameterSymbolKey.cs (1)
20visitor.WriteLocation(symbol.Locations[0]);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (2)
616=> symbol.Locations.Any() && symbol.Locations.All(location => location.IsInSource);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.EquivalenceVisitor.cs (4)
274return x.Locations.Length == 1 && y.Locations.Length == 1 && 275x.Locations.First().Equals(y.Locations.First());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (4)
103Hash.Combine(x.Locations.FirstOrDefault(), currentHash)); 107=> Hash.Combine(x.Locations.FirstOrDefault(), currentHash); 117return Hash.Combine(x.Locations.FirstOrDefault(), currentHash); 297=> Hash.Combine(x.Locations.FirstOrDefault(), currentHash);
Microsoft.Analyzers.Extra (1)
MakeExeTypesInternalAnalyzer.cs (1)
134var diagnostic = Diagnostic.Create(DiagDescriptors.MakeExeTypesInternal, type.Locations[0], type.Name);
Microsoft.Analyzers.Local (7)
ApiLifecycle\ApiLifecycleAnalyzer.cs (7)
76context.ReportDiagnostic(Diagnostic.Create(DiagDescriptors.NewSymbolsMustBeMarkedExperimental, symbol.Locations.FirstOrDefault(), symbol)); 113context.ReportDiagnostic(Diagnostic.Create(DiagDescriptors.ExperimentalSymbolsCantBeMarkedObsolete, symbol.Locations.FirstOrDefault(), symbol)); 120context.ReportDiagnostic(Diagnostic.Create(DiagDescriptors.PublishedSymbolsCantBeMarkedExperimental, symbol.Locations.FirstOrDefault(), symbol)); 127context.ReportDiagnostic(Diagnostic.Create(DiagDescriptors.PublishedSymbolsCantChange, symbol.Locations.FirstOrDefault(), symbol)); 135context.ReportDiagnostic(Diagnostic.Create(DiagDescriptors.PublishedSymbolsCantChange, symbol.Locations.FirstOrDefault(), symbol)); 156context.ReportDiagnostic(Diagnostic.Create(DiagDescriptors.NewSymbolsMustBeMarkedExperimental, type.Locations.FirstOrDefault(), type)); 160context.ReportDiagnostic(Diagnostic.Create(DiagDescriptors.ExperimentalSymbolsCantBeMarkedObsolete, type.Locations.FirstOrDefault(), type));
Microsoft.AspNetCore.Components.Analyzers (2)
ComponentParameterAnalyzer.cs (2)
76var propertyLocation = property.Locations.FirstOrDefault(); 128context.Symbol.Locations[0],
Microsoft.AspNetCore.Components.SdkAnalyzers (2)
ComponentParameterAnalyzer.cs (2)
70var propertyLocation = property.Locations.FirstOrDefault(); 115context.Symbol.Locations[0],
Microsoft.AspNetCore.Mvc.Analyzers (2)
TopLevelParameterNameAnalyzer.cs (2)
69var location = parameter.Locations.Length != 0 ? 70parameter.Locations[0] :
Microsoft.AspNetCore.Mvc.Api.Analyzers (1)
ApiConventionAnalyzer.cs (1)
88method.Locations[0],
Microsoft.AspNetCore.SignalR.Client.SourceGenerator (13)
HubClientProxyGenerator.Parser.cs (7)
57symbol.Locations[0])); 66symbol.Locations[0])); 75symbol.Locations[0])); 84symbol.Locations[0])); 93symbol.Locations[0])); 102symbol.Locations[0])); 111symbol.Locations[0]));
HubServerProxyGenerator.Parser.cs (6)
57symbol.Locations[0])); 66symbol.Locations[0])); 75symbol.Locations[0])); 84symbol.Locations[0])); 93symbol.Locations[0])); 101symbol.Locations[0]));
Microsoft.CodeAnalysis (5)
Compilation\IImportScope.cs (1)
13/// location can be found using either <see cref="ISymbol.Locations"/> or <see
DiagnosticAnalyzer\AnalyzerExecutor.cs (1)
1560foreach (var location in symbol.Locations)
DiagnosticAnalyzer\CompilationWithAnalyzers.cs (1)
908foreach (var location in symbolDeclaredEvent.Symbol.Locations)
Symbols\ISymbolExtensions.cs (1)
111foreach (var location in symbol.Locations)
Symbols\ISymbolInternal.cs (1)
170/// cref="ISymbol.Locations"/> as it will avoid an unnecessary array allocation.
Microsoft.CodeAnalysis.Analyzers (33)
MetaAnalyzers\ClassIsNotDiagnosticAnalyzer.cs (1)
55sac.ReportDiagnostic(namedType.Locations[0].CreateDiagnostic(Rule, namedType.Name));
MetaAnalyzers\DiagnosticDescriptorCreationAnalyzer.cs (3)
440!field.Locations.IsEmpty && 441field.Locations[0].IsInSource) 443context.ReportDiagnostic(Diagnostic.Create(AddCompilationEndCustomTagRule, field.Locations[0], field.Name));
MetaAnalyzers\DoNotUseFileTypesForAnalyzersOrGenerators.cs (1)
64var diagnostic = Diagnostic.Create(Rule, namedTypeSymbol.Locations[0], namedTypeSymbol.Name);
MetaAnalyzers\RegisterActionAnalyzer.cs (1)
405Location location = typeArgument.Locations[0];
MetaAnalyzers\SymbolIsBannedInAnalyzersAnalyzer.cs (1)
77symbolAnalysisContext.ReportDiagnostic(symbol.Locations.CreateDiagnostic(SymbolIsBannedInAnalyzersAnalyzer.NoSettingSpecifiedSymbolIsBannedRule, symbol));
src\RoslynAnalyzers\Utilities\Compiler\Extensions\DiagnosticExtensions.cs (2)
84return symbol.Locations.CreateDiagnostic(rule, args); 93return symbol.Locations.CreateDiagnostic(rule, properties, args);
src\RoslynAnalyzers\Utilities\Compiler\Options\AnalyzerOptionsExtensions.cs (4)
42tree = symbol.Locations[0].SourceTree; 321=> options.GetDisallowedSymbolNamesWithValueOption(rule, symbol.Locations[0].SourceTree, compilation); 335=> options.GetAdditionalRequiredSuffixesOption(rule, symbol.Locations[0].SourceTree, compilation); 384=> options.GetAdditionalRequiredGenericInterfaces(rule, symbol.Locations[0].SourceTree, compilation);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs (1)
32visitor.WriteLocation(symbol.Locations.First());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousTypeSymbolKey.cs (1)
25var propertyLocations = properties.SelectAsArray(p => p.Locations.FirstOrDefault());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.BodyLevelSymbolKey.cs (3)
22Contract.ThrowIfTrue(symbol.DeclaringSyntaxReferences.IsEmpty && symbol.Locations.IsEmpty); 26foreach (var location in symbol.Locations) 61Contract.ThrowIfTrue(symbol.DeclaringSyntaxReferences.IsEmpty && symbol.Locations.IsEmpty);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (1)
705var location = module.Locations.FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TupleTypeSymbolKey.cs (1)
30locations.Add(element.Locations.FirstOrDefault() ?? Location.None);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TypeParameterSymbolKey.cs (1)
20visitor.WriteLocation(symbol.Locations[0]);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (2)
616=> symbol.Locations.Any() && symbol.Locations.All(location => location.IsInSource);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.EquivalenceVisitor.cs (4)
274return x.Locations.Length == 1 && y.Locations.Length == 1 && 275x.Locations.First().Equals(y.Locations.First());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (4)
103Hash.Combine(x.Locations.FirstOrDefault(), currentHash)); 107=> Hash.Combine(x.Locations.FirstOrDefault(), currentHash); 117return Hash.Combine(x.Locations.FirstOrDefault(), currentHash); 297=> Hash.Combine(x.Locations.FirstOrDefault(), currentHash);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\SymbolFinder\SymbolFinderInternal.cs (2)
71else if (!symbol.Locations.Any(static loc => loc.IsInMetadata)) 91=> symbol != null && symbol.Locations.Any(static loc => loc.IsInSource);
Microsoft.CodeAnalysis.AnalyzerUtilities (25)
src\RoslynAnalyzers\Utilities\Compiler\Extensions\DiagnosticExtensions.cs (2)
84return symbol.Locations.CreateDiagnostic(rule, args); 93return symbol.Locations.CreateDiagnostic(rule, properties, args);
src\RoslynAnalyzers\Utilities\Compiler\Options\AnalyzerOptionsExtensions.cs (4)
42tree = symbol.Locations[0].SourceTree; 321=> options.GetDisallowedSymbolNamesWithValueOption(rule, symbol.Locations[0].SourceTree, compilation); 335=> options.GetAdditionalRequiredSuffixesOption(rule, symbol.Locations[0].SourceTree, compilation); 384=> options.GetAdditionalRequiredGenericInterfaces(rule, symbol.Locations[0].SourceTree, compilation);
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\DataFlowOperationVisitor.cs (1)
2223invokedMethod.Locations.All(l => !l.IsInSource) ||
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs (1)
32visitor.WriteLocation(symbol.Locations.First());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousTypeSymbolKey.cs (1)
25var propertyLocations = properties.SelectAsArray(p => p.Locations.FirstOrDefault());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.BodyLevelSymbolKey.cs (3)
22Contract.ThrowIfTrue(symbol.DeclaringSyntaxReferences.IsEmpty && symbol.Locations.IsEmpty); 26foreach (var location in symbol.Locations) 61Contract.ThrowIfTrue(symbol.DeclaringSyntaxReferences.IsEmpty && symbol.Locations.IsEmpty);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (1)
705var location = module.Locations.FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TupleTypeSymbolKey.cs (1)
30locations.Add(element.Locations.FirstOrDefault() ?? Location.None);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TypeParameterSymbolKey.cs (1)
20visitor.WriteLocation(symbol.Locations[0]);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (2)
616=> symbol.Locations.Any() && symbol.Locations.All(location => location.IsInSource);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.EquivalenceVisitor.cs (4)
274return x.Locations.Length == 1 && y.Locations.Length == 1 && 275x.Locations.First().Equals(y.Locations.First());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (4)
103Hash.Combine(x.Locations.FirstOrDefault(), currentHash)); 107=> Hash.Combine(x.Locations.FirstOrDefault(), currentHash); 117return Hash.Combine(x.Locations.FirstOrDefault(), currentHash); 297=> Hash.Combine(x.Locations.FirstOrDefault(), currentHash);
Microsoft.CodeAnalysis.BannedApiAnalyzers (26)
src\RoslynAnalyzers\Utilities\Compiler\Extensions\DiagnosticExtensions.cs (2)
84return symbol.Locations.CreateDiagnostic(rule, args); 93return symbol.Locations.CreateDiagnostic(rule, properties, args);
src\RoslynAnalyzers\Utilities\Compiler\Options\AnalyzerOptionsExtensions.cs (4)
42tree = symbol.Locations[0].SourceTree; 321=> options.GetDisallowedSymbolNamesWithValueOption(rule, symbol.Locations[0].SourceTree, compilation); 335=> options.GetAdditionalRequiredSuffixesOption(rule, symbol.Locations[0].SourceTree, compilation); 384=> options.GetAdditionalRequiredGenericInterfaces(rule, symbol.Locations[0].SourceTree, compilation);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs (1)
32visitor.WriteLocation(symbol.Locations.First());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousTypeSymbolKey.cs (1)
25var propertyLocations = properties.SelectAsArray(p => p.Locations.FirstOrDefault());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.BodyLevelSymbolKey.cs (3)
22Contract.ThrowIfTrue(symbol.DeclaringSyntaxReferences.IsEmpty && symbol.Locations.IsEmpty); 26foreach (var location in symbol.Locations) 61Contract.ThrowIfTrue(symbol.DeclaringSyntaxReferences.IsEmpty && symbol.Locations.IsEmpty);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (1)
705var location = module.Locations.FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TupleTypeSymbolKey.cs (1)
30locations.Add(element.Locations.FirstOrDefault() ?? Location.None);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TypeParameterSymbolKey.cs (1)
20visitor.WriteLocation(symbol.Locations[0]);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (2)
616=> symbol.Locations.Any() && symbol.Locations.All(location => location.IsInSource);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.EquivalenceVisitor.cs (4)
274return x.Locations.Length == 1 && y.Locations.Length == 1 && 275x.Locations.First().Equals(y.Locations.First());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (4)
103Hash.Combine(x.Locations.FirstOrDefault(), currentHash)); 107=> Hash.Combine(x.Locations.FirstOrDefault(), currentHash); 117return Hash.Combine(x.Locations.FirstOrDefault(), currentHash); 297=> Hash.Combine(x.Locations.FirstOrDefault(), currentHash);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\SymbolFinder\SymbolFinderInternal.cs (2)
71else if (!symbol.Locations.Any(static loc => loc.IsInMetadata)) 91=> symbol != null && symbol.Locations.Any(static loc => loc.IsInSource);
Microsoft.CodeAnalysis.CodeStyle (30)
src\Analyzers\Core\Analyzers\Helpers\HashCodeAnalyzer\HashCodeAnalyzer.cs (2)
59if (method.Locations.Length != 1 || method.DeclaringSyntaxReferences.Length != 1) 62if (!method.Locations[0].IsInSource)
src\Analyzers\Core\Analyzers\MakeFieldReadonly\AbstractMakeFieldReadonlyDiagnosticAnalyzer.cs (2)
168Locations.Length: 1, 235=> field.Locations[0];
src\Analyzers\Core\Analyzers\NamingStyle\NamingStyleDiagnosticAnalyzerBase.cs (3)
58var sourceTree = symbolContext.Symbol.Locations.FirstOrDefault()?.SourceTree; 86if (symbol?.Locations.FirstOrDefault()?.SourceTree is not { } sourceTree) 167return DiagnosticHelper.Create(Descriptor, symbol.Locations.First(), NotificationOption2.ForSeverity(applicableRule.EnforcementLevel), options, additionalLocations: null, builder.ToImmutable(), failureReason);
src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (1)
793var isPartial = symbol.Locations.Length > 1;
src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (2)
166=> symbol.Locations[0]; 661foreach (var tree in namedTypeSymbol.Locations.Select(l => l.SourceTree).Distinct().WhereNotNull())
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.cs (1)
132var location = parameter.Locations[0];
src\Analyzers\Core\Analyzers\UseSystemHashCode\UseSystemHashCodeDiagnosticAnalyzer.cs (1)
46var diagnosticLocation = owningSymbol.Locations[0];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs (1)
32visitor.WriteLocation(symbol.Locations.First());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousTypeSymbolKey.cs (1)
25var propertyLocations = properties.SelectAsArray(p => p.Locations.FirstOrDefault());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.BodyLevelSymbolKey.cs (3)
22Contract.ThrowIfTrue(symbol.DeclaringSyntaxReferences.IsEmpty && symbol.Locations.IsEmpty); 26foreach (var location in symbol.Locations) 61Contract.ThrowIfTrue(symbol.DeclaringSyntaxReferences.IsEmpty && symbol.Locations.IsEmpty);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (1)
705var location = module.Locations.FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TupleTypeSymbolKey.cs (1)
30locations.Add(element.Locations.FirstOrDefault() ?? Location.None);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TypeParameterSymbolKey.cs (1)
20visitor.WriteLocation(symbol.Locations[0]);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (2)
616=> symbol.Locations.Any() && symbol.Locations.All(location => location.IsInSource);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.EquivalenceVisitor.cs (4)
274return x.Locations.Length == 1 && y.Locations.Length == 1 && 275x.Locations.First().Equals(y.Locations.First());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (4)
103Hash.Combine(x.Locations.FirstOrDefault(), currentHash)); 107=> Hash.Combine(x.Locations.FirstOrDefault(), currentHash); 117return Hash.Combine(x.Locations.FirstOrDefault(), currentHash); 297=> Hash.Combine(x.Locations.FirstOrDefault(), currentHash);
Microsoft.CodeAnalysis.CodeStyle.Fixes (7)
src\Analyzers\Core\CodeFixes\AddParameter\AddParameterService.cs (2)
101declarationLocation => solution.GetRequiredDocument(declarationLocation.Locations[0].SourceTree!)); 118var methodNode = syntaxRoot.FindNode(currentMethodToUpdate.Locations[0].SourceSpan, getInnermostNodeForTie: true);
src\Analyzers\Core\CodeFixes\GenerateMember\AbstractGenerateMemberService.cs (1)
51var locations = typeToGenerateIn.Locations;
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.State.cs (2)
354AfterThisLocation ??= previousAssignedSymbol?.Locations.FirstOrDefault(); 355BeforeThisLocation ??= nextAssignedSymbol?.Locations.FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\SymbolFinder\SymbolFinderInternal.cs (2)
71else if (!symbol.Locations.Any(static loc => loc.IsInMetadata)) 91=> symbol != null && symbol.Locations.Any(static loc => loc.IsInSource);
Microsoft.CodeAnalysis.CSharp (3)
Compilation\SyntaxTreeSemanticModel.cs (1)
2048foreach (var location in extensionParameter.Locations)
SymbolDisplay\SymbolDisplayVisitor_Minimal.cs (2)
243if (this.IsMinimizing && !symbol.Locations.IsEmpty) 245var location = symbol.Locations.First();
Microsoft.CodeAnalysis.CSharp.CodeStyle (3)
src\Analyzers\CSharp\Analyzers\MakeStructFieldsWritable\CSharpMakeStructFieldsWritableDiagnosticAnalyzer.cs (1)
73=> namedTypeSymbol.Locations[0];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SemanticFacts\CSharpSemanticFacts.cs (2)
72if (symbol.Locations.Any(static (loc, location) => loc.SourceTree == location.SourceTree && loc.SourceSpan.Contains(location.SourceSpan), location)) 78if (symbol.Locations.Contains(location))
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (2)
src\Analyzers\CSharp\CodeFixes\MakeMethodAsynchronous\CSharpMakeMethodAsynchronousCodeFixProvider.cs (1)
168=> method.Locations.Any(static (loc, cancellationToken) => loc.FindNode(cancellationToken).ContainsYield(), cancellationToken);
src\Analyzers\CSharp\CodeFixes\Nullable\CSharpDeclareAsNullableCodeFixProvider.cs (1)
193else if (symbol is IFieldSymbol { CorrespondingTupleField: IFieldSymbol { Locations: [{ IsInSource: true } location] } })
Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests (2)
CommandLineTests.cs (2)
15993symbolContext.ReportDiagnostic(Diagnostic.Create(Warning01, symbolContext.Symbol.Locations.First())); 16010symbolContext.ReportDiagnostic(Diagnostic.Create(Warning02, symbolContext.Symbol.Locations.First()));
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (1)
Diagnostics\DiagnosticAnalyzerDriver\DiagnosticAnalyzerDriverTests.cs (1)
865var diagnostic = Diagnostic.Create(descriptor, context.Symbol.Locations[0]);
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (19)
CodeGen\CodeGenTupleTest.cs (19)
5883Assert.All(tupleWithoutNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()), 5920Assert.Equal(loc1, tuple.GetMembers("i1").Single().Locations.Single()); 5921Assert.Equal(loc2, tuple.GetMembers("i2").Single().Locations.Single()); 5960Assert.All(tupleWithoutNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()), 5979Assert.All(tupleWithNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()), 5998Assert.All(tupleWithSomeNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()), 6016Assert.All(tupleWithNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()), 6041Assert.All(tuple8WithoutNames.TupleElements.Select(f => f.Locations.FirstOrDefault()), 6068Assert.All(tuple8WithoutNames.GetMembers().OfType<IFieldSymbol>().Where(f => f.Name != "Rest").Select(f => f.Locations.FirstOrDefault()), 6093Assert.All(tuple8WithNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()), 6118Assert.All(tuple9WithoutNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()), 6144Assert.All(tuple9WithNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()), 6176Assert.All(tuple9WithNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()), 6200Assert.All(tupleWithoutNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()), 6374Assert.True(tupleWithoutNames.GetMembers("Item1").Single().Locations.IsEmpty); 6399Assert.Equal(loc1, tuple.GetMembers("Item1").Single().Locations.Single()); 6400Assert.Equal(loc2, tuple.GetMembers("Item2").Single().Locations.Single()); 17376Assert.Equal(nc.Name.GetLocation(), sym.Symbol.Locations[0]); 17411Assert.Equal(secondElement.GetLocation(), bobField.Locations[0]);
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (14)
Diagnostics\DiagnosticAnalyzerTests.cs (2)
272var diag1 = CodeAnalysis.Diagnostic.Create(s_descriptor, context.Symbol.Locations[0], "NamedType"); 841ctxt.ReportDiagnostic(CodeAnalysis.Diagnostic.Create(Descriptor1, method.Locations[0], method.ToDisplayString()));
PartialEventsAndConstructorsTests.cs (12)
2009Assert.NotEqual(defSymbol.Locations.Single(), implSymbol.Locations.Single()); 2027Assert.NotEqual(defSymbol.Locations.Single(), implSymbol.Locations.Single()); 2048Assert.NotEqual(defSymbol.Locations.Single(), implSymbol.Locations.Single()); 2085Assert.NotEqual(defSymbol.Locations.Single(), implSymbol.Locations.Single()); 2116Assert.NotEqual(defSymbol.Locations.Single(), implSymbol.Locations.Single()); 2158Assert.NotEqual(defSymbol.Locations.Single(), implSymbol.Locations.Single());
Microsoft.CodeAnalysis.CSharp.Features (11)
ConvertPrimaryToRegularConstructor\ConvertPrimaryToRegularConstructorCodeRefactoringProvider.cs (3)
192if (member is IFieldSymbol { IsImplicitlyDeclared: true, Locations: [var location, ..] } field) 198if (parameter.Locations is [var location, ..] && 476foreach (var location in namedType.Locations.OrderBy(l => !ReferenceEquals(l.SourceTree, typeDeclaration.SyntaxTree)))
Copilot\CSharpImplementNotImplementedExceptionDiagnosticAnalyzer.cs (1)
72foreach (var location in context.OwningSymbol.Locations)
Debugging\BreakpointResolver.cs (1)
35var location = method.Locations.First(loc => loc.IsInSource);
Debugging\CSharpProximityExpressionsService.cs (1)
74var statement = info.Symbol.Locations.First().FindToken(cancellationToken).GetAncestor<StatementSyntax>();
GoToDefinition\CSharpGoToDefinitionSymbolService.cs (1)
69return symbol.Locations.FirstOrDefault()?.SourceSpan.Start ?? 0;
ImplementInterface\AbstractChangeImplementationCodeRefactoringProvider.cs (1)
234foreach (var location in implMember.Locations)
src\Analyzers\CSharp\Analyzers\MakeStructFieldsWritable\CSharpMakeStructFieldsWritableDiagnosticAnalyzer.cs (1)
73=> namedTypeSymbol.Locations[0];
src\Analyzers\CSharp\CodeFixes\MakeMethodAsynchronous\CSharpMakeMethodAsynchronousCodeFixProvider.cs (1)
168=> method.Locations.Any(static (loc, cancellationToken) => loc.FindNode(cancellationToken).ContainsYield(), cancellationToken);
src\Analyzers\CSharp\CodeFixes\Nullable\CSharpDeclareAsNullableCodeFixProvider.cs (1)
193else if (symbol is IFieldSymbol { CorrespondingTupleField: IFieldSymbol { Locations: [{ IsInSource: true } location] } })
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (2)
Diagnostics\Suppression\RemoveUnnecessaryPragmaSuppressionsTests.cs (2)
99context.ReportDiagnostic(Diagnostic.Create(rule, local.Locations[0])); 1515var diagnostic = Diagnostic.Create(Descriptor, context.Symbol.ContainingNamespace.Locations[0]);
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (3)
Semantics\OperatorTests.cs (2)
7658Assert.Equal(0, symbol1.Locations.Length); 8453Assert.Equal(0, symbol1.Locations.Length);
SourceGeneration\GeneratorDriverTests.cs (1)
141Assert.True(generatedClass.Locations.Single().IsInSource);
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (57)
Compilation\CompilationAPITests.cs (5)
2612Assert.All(type.GetMembers().OfType<IPropertySymbol>().Select(p => p.Locations.FirstOrDefault()), 2632Assert.Equal(loc1, type.GetMembers("m1").Single().Locations.Single()); 2633Assert.Equal(loc2, type.GetMembers("m2").Single().Locations.Single()); 2648Assert.All(type.GetMembers().OfType<IPropertySymbol>().Select(p => p.Locations.FirstOrDefault()), 3453Assert.Equal(2, types[0].Locations.Length);
Compilation\SemanticModelAPITests.cs (10)
878Assert.Equal(2, ptSym01.Locations.Length); 905Assert.Equal(1, ppSym01.Locations.Length); 906Assert.Equal(1, ppSym02.Locations.Length); 975Assert.NotEqual(sym1.Locations[0], sym2.Locations[0]); 1016Assert.NotEqual(sym1.Locations[0], sym2.Locations[0]); 1198var ploc = parasym.Locations[0]; 1207Assert.Equal(ploc, argsym1.Locations[0]); 1208Assert.Equal(ploc, argsym2.Locations[0]);
Compilation\SemanticModelGetDeclaredSymbolAPITests.cs (16)
3743Assert.Equal(3, declSymbol.Locations.Length); 3903Assert.Equal(param.Identifier.Span, symbol.Locations[0].SourceSpan); 3934Assert.NotEqual(alias1.Locations.Single(), alias2.Locations.Single()); 4802Assert.True(type.Locations.Single().IsInSource); 4825Assert.True(type.Locations.Single().IsInSource); 4848Assert.True(type.Locations.Single().IsInSource); 4871Assert.True(type.Locations.Single().IsInSource); 4894Assert.True(type.Locations.Single().IsInSource); 4917Assert.True(element.Locations.Single().IsInSource); 4940Assert.True(element.Locations.Single().IsInSource); 4963Assert.True(element.Locations.Single().IsInSource); 4998Assert.True(element.Locations.Single().IsInSource); 5044Assert.True(element.Locations.Single().IsInSource); 5093Assert.True(element.Locations.Single().IsInSource); 5116Assert.True(element.Locations.Single().IsInSource);
Symbols\AnonymousTypesSemanticsTests.cs (4)
1994Assert.Equal(1, type.Locations.Length); 1995Assert.Equal(typeSpan, type.Locations[0].SourceSpan); 2023Assert.Equal(1, property.Locations.Length); 2024Assert.Equal(span, property.Locations[0].SourceSpan);
Symbols\AnonymousTypesSymbolTests.cs (8)
1645Assert.False(sym.Symbol.Locations.IsEmpty, "Symbol Location"); 1646Assert.True(sym.Symbol.Locations[0].IsInSource); 1654Assert.False(m.Locations.IsEmpty, String.Format("No Location: {0}", m)); 1655Assert.True(m.Locations[0].IsInSource); 1698Assert.NotEqual(typeA3.Locations[0], typeA4.Locations[0]); 1702Assert.True(statement1.Span.Contains(typeA3.Locations[0].SourceSpan)); 1703Assert.True(statement2.Span.Contains(typeA4.Locations[0].SourceSpan));
Symbols\CompilationCreationTests.cs (2)
60Assert.Equal(Math.Sign(compilation.CompareSourceLocations(types[i].Locations[0], types[j].Locations[0])), Math.Sign(i.CompareTo(j)));
Symbols\PartialPropertiesTests.cs (8)
5243Assert.Equal("SourceFile(Program.cs[43..47))", defSymbol.Locations.Single().ToString()); 5244Assert.Equal("SourceFile(Program.cs[81..85))", implSymbol.Locations.Single().ToString()); 5280Assert.Equal("SourceFile(Program.cs[46..50))", defSymbol.Locations.Single().ToString()); 5281Assert.Equal("SourceFile(Program.cs[84..88))", implSymbol.Locations.Single().ToString()); 5327Assert.Equal("SourceFile(Program.cs[43..47))", defSymbol.Locations.Single().ToString()); 5328Assert.Equal("SourceFile(Program.cs[88..92))", implSymbol.Locations.Single().ToString()); 5361Assert.Equal("SourceFile(Program.cs[52..53))", defSymbol.Locations.Single().ToString()); 5362Assert.Equal("SourceFile(Program.cs[97..98))", implSymbol.Locations.Single().ToString());
Symbols\Source\DeclaringSyntaxNodeTests.cs (4)
349Assert.Equal(1, localType.Locations.Length); 350Assert.Equal(localType.Locations[0], anonObjectCreation.NewKeyword.GetLocation()); 382Assert.Equal(1, member.Locations.Length); 383Assert.Equal(member.Locations[0], propertyInitializer.NameEquals.Name.GetLocation());
Microsoft.CodeAnalysis.CSharp.Workspaces (10)
Rename\CSharpRenameRewriterLanguageService.cs (8)
144_renamableDeclarationLocation = _renamedSymbol.Locations.FirstOrDefault(loc => loc.IsInSource && loc.SourceTree == _semanticModel.SyntaxTree); 811var token = renamedSymbol.Locations.Single().FindToken(cancellationToken); 826token = matchingParameterSymbol.Locations.Single().FindToken(cancellationToken); 835var token = renamedSymbol.Locations.Single().FindToken(cancellationToken); 864var location = renamedSymbol.Locations.Single(); 894foreach (var location in renamedSymbol.Locations) 912.SelectMany(t => t.Locations); 935foreach (var location in symbol.Locations)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SemanticFacts\CSharpSemanticFacts.cs (2)
72if (symbol.Locations.Any(static (loc, location) => loc.SourceTree == location.SourceTree && loc.SourceSpan.Contains(location.SourceSpan), location)) 78if (symbol.Locations.Contains(location))
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (5)
CodeGeneration\SymbolEditorTests.cs (5)
347var location = symbol.Locations.Last(); 384var location = symbol.Locations.First(); 421var location = symbol.Locations.Last(); 467var location = symbol.Locations.Last(); 474var newLocation = newSymbol.Locations.Last();
Microsoft.CodeAnalysis.EditorFeatures (6)
InlineRename\AbstractEditorInlineRenameService.SymbolRenameInfo.cs (2)
158if (RenameSymbol.Locations.Length > 1) 166var symbolSourceDocument = this.Document.Project.Solution.GetDocument(RenameSymbol.Locations.Single().SourceTree);
Navigation\AbstractDefinitionLocationService.cs (1)
265if (otherPart.Locations is not [{ SourceTree: { } sourceTree, SourceSpan: var span }])
Peek\DefinitionPeekableItem.cs (1)
83var sourceLocations = symbol.Locations.Where(l => l.IsInSource).ToList();
Peek\PeekableItemFactory.cs (1)
84var firstLocation = symbol.Locations.FirstOrDefault();
RenameTracking\RenameTrackingTaggerProvider.TrackingSession.cs (1)
253return sourceSymbol.Locations.Any(static (loc, token) => loc == token.GetLocation(), token)
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (12)
Diagnostics\DiagnosticAnalyzerServiceTests.cs (1)
913c.ReportDiagnostic(Diagnostic.Create(_supportedDiagnostics[0], c.Symbol.Locations[0]));
MetadataAsSource\AbstractMetadataAsSourceTests.cs (1)
127Assert.False(generatedSymbol.Locations.Where(loc => loc.IsInSource).IsEmpty());
SymbolFinder\SymbolFinderTests.cs (10)
588Assert.True(delegates.Any(i => i.Locations.Any(loc => loc.IsInMetadata)), "We should find a metadata delegate"); 589Assert.Single(delegates, i => i.Locations.Any(loc => loc.IsInSource)); // We should find a single source delegate 618Assert.True(enums.Any(i => i.Locations.Any(loc => loc.IsInMetadata)), "We should find a metadata enum"); 619Assert.Single(enums, i => i.Locations.Any(loc => loc.IsInSource)); // We should find a single source type 825Assert.True(classInSource.Locations.Any(loc => loc.IsInMetadata)); 832Assert.True(sourceDefinition.Locations.Any(loc => loc.IsInSource)); 835var document = solution.GetDocument(sourceDefinition.Locations.First(loc => loc.IsInSource).SourceTree); 873Assert.True(classInSource.Locations.Any(loc => loc.IsInMetadata)); 880Assert.True(sourceDefinition.Locations.Any(loc => loc.IsInSource)); 883var document = solution.GetDocument(sourceDefinition.Locations.First(loc => loc.IsInSource).SourceTree);
Microsoft.CodeAnalysis.EditorFeatures2.UnitTests (17)
CodeFixes\CodeFixServiceTests.vb (2)
204context.ReportDiagnostic(Diagnostic.Create(DiagDescriptor, context.Symbol.Locations.First(), context.Symbol.Locations.Skip(1)))
Diagnostics\AdditionalFileDiagnosticsTests.vb (1)
95context.ReportDiagnostic(Diagnostic.Create(Rule, context.Symbol.Locations.First()))
Diagnostics\DiagnosticServiceTests.vb (7)
1266Dim sourceLoc = context.Symbol.Locations.First(Function(l) l.IsInSource) 1467Dim diag = Diagnostic.Create(Descriptor, symbolContext.Symbol.Locations(0), additionalFileText) 1554context.ReportDiagnostic(Diagnostic.Create(DiagDescriptor, context.Symbol.Locations.First(), context.Symbol.Locations.Skip(1))) 1580For Each location In context.Symbol.Locations 1609sc.ReportDiagnostic(Diagnostic.Create(DiagDescriptor, sc.Symbol.Locations.First())) 1893ctxt.ReportDiagnostic(Diagnostic.Create(Descriptor, method.Locations(0), method.ToDisplayString))
Workspaces\TryFindSourceDefinitionTests.vb (7)
64Assert.True(fieldType.Locations.All(Function(Loc) Loc.IsInMetadata)) 70Assert.True(mappedType.Locations.All(Function(Loc) Loc.IsInSource)) 108Assert.True(fieldType.Locations.All(Function(Loc) Loc.IsInMetadata)) 114Assert.True(mappedType.Locations.All(Function(Loc) Loc.IsInSource)) 151Assert.True(mappedMember.Locations.All(Function(Loc) Loc.IsInSource)) 188Assert.True(mappedMember.Locations.All(Function(Loc) Loc.IsInSource)) 225Assert.True(mappedMember.Locations.All(Function(Loc) Loc.IsInSource))
Microsoft.CodeAnalysis.Extensions.Package (10)
Symbols\ISymbolExtensions.cs (2)
616=> symbol.Locations.Any() && symbol.Locations.All(location => location.IsInSource);
Symbols\SymbolEquivalenceComparer.EquivalenceVisitor.cs (4)
274return x.Locations.Length == 1 && y.Locations.Length == 1 && 275x.Locations.First().Equals(y.Locations.First());
Symbols\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (4)
103Hash.Combine(x.Locations.FirstOrDefault(), currentHash)); 107=> Hash.Combine(x.Locations.FirstOrDefault(), currentHash); 117return Hash.Combine(x.Locations.FirstOrDefault(), currentHash); 297=> Hash.Combine(x.Locations.FirstOrDefault(), currentHash);
Microsoft.CodeAnalysis.Features (66)
ChangeSignature\AbstractChangeSignatureService.cs (5)
149if (symbol.Locations.Any(static loc => loc.IsInMetadata)) 155var declarationLocation = symbol.Locations.FirstOrDefault(); 281if (symbol.Definition.Locations.Any(static loc => loc.IsInMetadata)) 334foreach (var def in symbolWithSyntacticParameters.Locations) 946.OrderByDescending(s => s.Locations.First().SourceSpan.Start);
CodeLens\CodeLensFindReferenceProgress.cs (4)
96var locations = symbol.Locations.Intersect(_queriedSymbol.Locations, LocationComparer.Instance).Any() 98: symbol.Locations; 125!definition.Locations.Any(static loc => loc.IsInSource);
Debugging\AbstractBreakpointResolver.cs (2)
80var location = methodSymbol.Locations.First(loc => loc.IsInSource); 270if ((methodOrProperty.Language == _language) && methodOrProperty.Locations.Any(static location => location.IsInSource))
DocumentHighlighting\AbstractDocumentHighlightsService.cs (4)
216symbol.Locations.Length > 0) 220if (symbol.Locations.First().IsInSource) 223await AddLocationSpanAsync(symbol.Locations.First(), solution, spanSet, tagMap, HighlightSpanKind.Definition, cancellationToken).ConfigureAwait(false); 232foreach (var location in reference.Definition.Locations)
EditAndContinue\AbstractEditAndContinueAnalyzer.cs (2)
6199symbol.Locations.FirstOrDefault()?.SourceSpan ?? symbol.ContainingSymbol.Locations.First().SourceSpan;
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingWorkCoordinator.UnitTestingSemanticChangeProcessor.cs (2)
172=> EnqueueWorkItemAsync(document, symbol.ContainingType != null ? symbol.ContainingType.Locations : symbol.Locations);
ExtractMethod\MethodExtractor.Analyzer.cs (2)
103var localFunctionCallsNotWithinSpan = symbolMap.Keys.Where(s => s.IsLocalFunction() && !s.Locations.Any(static (l, self) => self.SelectionResult.FinalSpan.Contains(l.SourceSpan), this)); 741if (typeParameter.Locations is not [var location] || selectionSpan.Contains(location.SourceSpan))
ExtractMethod\MethodExtractor.VariableSymbol.cs (3)
106var locationLeft = left.Locations.First(); 107var locationRight = right.Locations.First(); 167=> Symbol.Locations.First().FindToken(cancellationToken);
FindUsages\AbstractFindUsagesService_FindImplementations.cs (1)
131foreach (var location in implementation.Locations)
FindUsages\DefinitionItemFactory.cs (5)
40=> ToNonClassifiedDefinitionItem(definition, definition.Locations, solution, options, isPrimary: false, includeHiddenLocations); 70var sourceLocations = GetSourceLocations(definition, definition.Locations, solution, includeHiddenLocations); 86var locations = group.Symbols.SelectManyAsArray(s => s.Locations); 168if (!definition.Locations.Any(static location => location.MetadataModule != null)) 197if (!constituentNamespace.Locations.Any(static location => location.MetadataModule != null))
GenerateType\AbstractGenerateTypeService.State.cs (2)
298!symbol.Locations.Any(static loc => loc.IsInSource)) 304var sourceTreeToBeGeneratedIn = symbol.Locations.First(loc => loc.IsInSource).SourceTree;
GoToBase\AbstractGoToBaseService.cs (1)
74else if (baseSymbol.Locations.Any(static l => l.IsInMetadata))
InheritanceMargin\AbstractInheritanceMarginService_Helpers.cs (4)
311var derivedSymbols = allDerivedSymbols.WhereAsArray(symbol => symbol.Locations.Any(static l => l.IsInSource)); 356var implementingSymbols = allImplementingSymbols.WhereAsArray(symbol => symbol.Locations.Any(static l => l.IsInSource)); 383var overridingSymbols = allOverridingSymbols.WhereAsArray(symbol => symbol.Locations.Any(static l => l.IsInSource)); 716var locations = symbol.Locations;
MetadataAsSource\AbstractMetadataAsSourceService.AbstractWrappedSymbol.cs (1)
65public ImmutableArray<Location> Locations => _symbol.Locations;
MetadataAsSource\MetadataAsSourceFileService.cs (1)
283if (!symbol.Locations.Any(static l => l.IsInMetadata))
MetadataAsSource\MetadataAsSourceHelpers.cs (1)
92foreach (var location in symbol.Locations)
MoveStaticMembers\MoveStaticMembersWithDialogCodeAction.cs (1)
57.Select(symbol => symbol.Locations.FirstOrDefault())
Navigation\NavigableItemFactory.cs (1)
56var locations = symbol.Locations;
NavigationBar\AbstractNavigationBarItemService.cs (2)
67var navigationLocationSpan = symbol.Locations.FirstOrDefault(loc => loc.SourceTree == tree)?.SourceSpan ?? 79var navigationLocation = symbol.Locations.FirstOrDefault(loc => loc.SourceTree != null && loc.SourceTree != tree) ??
PullMemberUp\MemberAndDestinationValidator.cs (1)
25destination.Locations.Any(static (location, arg) => location.IsInSource && !arg.solution.GetRequiredDocument(location.SourceTree).IsGeneratedCode(arg.cancellationToken), (solution, cancellationToken));
Rename\SymbolicRenameInfo.cs (1)
210var symbolLocations = symbol.Locations;
ReplaceMethodWithProperty\AbstractReplaceMethodWithPropertyService.cs (1)
35if (current.Locations.Any(static loc => loc.IsInMetadata))
Shared\Utilities\AnnotatedSymbolMapping.cs (1)
69var location = symbol.Locations.Single();
src\Analyzers\Core\Analyzers\Helpers\HashCodeAnalyzer\HashCodeAnalyzer.cs (2)
59if (method.Locations.Length != 1 || method.DeclaringSyntaxReferences.Length != 1) 62if (!method.Locations[0].IsInSource)
src\Analyzers\Core\Analyzers\MakeFieldReadonly\AbstractMakeFieldReadonlyDiagnosticAnalyzer.cs (2)
168Locations.Length: 1, 235=> field.Locations[0];
src\Analyzers\Core\Analyzers\NamingStyle\NamingStyleDiagnosticAnalyzerBase.cs (3)
58var sourceTree = symbolContext.Symbol.Locations.FirstOrDefault()?.SourceTree; 86if (symbol?.Locations.FirstOrDefault()?.SourceTree is not { } sourceTree) 167return DiagnosticHelper.Create(Descriptor, symbol.Locations.First(), NotificationOption2.ForSeverity(applicableRule.EnforcementLevel), options, additionalLocations: null, builder.ToImmutable(), failureReason);
src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (1)
793var isPartial = symbol.Locations.Length > 1;
src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (2)
166=> symbol.Locations[0]; 661foreach (var tree in namedTypeSymbol.Locations.Select(l => l.SourceTree).Distinct().WhereNotNull())
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.cs (1)
132var location = parameter.Locations[0];
src\Analyzers\Core\Analyzers\UseSystemHashCode\UseSystemHashCodeDiagnosticAnalyzer.cs (1)
46var diagnosticLocation = owningSymbol.Locations[0];
src\Analyzers\Core\CodeFixes\AddParameter\AddParameterService.cs (2)
101declarationLocation => solution.GetRequiredDocument(declarationLocation.Locations[0].SourceTree!)); 118var methodNode = syntaxRoot.FindNode(currentMethodToUpdate.Locations[0].SourceSpan, getInnermostNodeForTie: true);
src\Analyzers\Core\CodeFixes\GenerateMember\AbstractGenerateMemberService.cs (1)
51var locations = typeToGenerateIn.Locations;
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.State.cs (2)
354AfterThisLocation ??= previousAssignedSymbol?.Locations.FirstOrDefault(); 355BeforeThisLocation ??= nextAssignedSymbol?.Locations.FirstOrDefault();
ValueTracking\ValueTracker.cs (1)
286foreach (var definitionLocation in symbol.Locations)
Microsoft.CodeAnalysis.LanguageServer.Protocol (1)
Handler\References\FindUsagesLSPContext.cs (1)
256if (symbol == null || symbol.Locations.IsEmpty || symbol.Kind is SymbolKind.Namespace)
Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzers (26)
src\RoslynAnalyzers\Utilities\Compiler\Extensions\DiagnosticExtensions.cs (2)
84return symbol.Locations.CreateDiagnostic(rule, args); 93return symbol.Locations.CreateDiagnostic(rule, properties, args);
src\RoslynAnalyzers\Utilities\Compiler\Options\AnalyzerOptionsExtensions.cs (4)
42tree = symbol.Locations[0].SourceTree; 321=> options.GetDisallowedSymbolNamesWithValueOption(rule, symbol.Locations[0].SourceTree, compilation); 335=> options.GetAdditionalRequiredSuffixesOption(rule, symbol.Locations[0].SourceTree, compilation); 384=> options.GetAdditionalRequiredGenericInterfaces(rule, symbol.Locations[0].SourceTree, compilation);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs (1)
32visitor.WriteLocation(symbol.Locations.First());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousTypeSymbolKey.cs (1)
25var propertyLocations = properties.SelectAsArray(p => p.Locations.FirstOrDefault());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.BodyLevelSymbolKey.cs (3)
22Contract.ThrowIfTrue(symbol.DeclaringSyntaxReferences.IsEmpty && symbol.Locations.IsEmpty); 26foreach (var location in symbol.Locations) 61Contract.ThrowIfTrue(symbol.DeclaringSyntaxReferences.IsEmpty && symbol.Locations.IsEmpty);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (1)
705var location = module.Locations.FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TupleTypeSymbolKey.cs (1)
30locations.Add(element.Locations.FirstOrDefault() ?? Location.None);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TypeParameterSymbolKey.cs (1)
20visitor.WriteLocation(symbol.Locations[0]);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (2)
616=> symbol.Locations.Any() && symbol.Locations.All(location => location.IsInSource);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.EquivalenceVisitor.cs (4)
274return x.Locations.Length == 1 && y.Locations.Length == 1 && 275x.Locations.First().Equals(y.Locations.First());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (4)
103Hash.Combine(x.Locations.FirstOrDefault(), currentHash)); 107=> Hash.Combine(x.Locations.FirstOrDefault(), currentHash); 117return Hash.Combine(x.Locations.FirstOrDefault(), currentHash); 297=> Hash.Combine(x.Locations.FirstOrDefault(), currentHash);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\SymbolFinder\SymbolFinderInternal.cs (2)
71else if (!symbol.Locations.Any(static loc => loc.IsInMetadata)) 91=> symbol != null && symbol.Locations.Any(static loc => loc.IsInSource);
Microsoft.CodeAnalysis.PublicApiAnalyzers (29)
DeclarePublicApiAnalyzer.Impl.cs (5)
246var locations = isImplicitlyDeclaredConstructor ? symbol.ContainingType.Locations : symbol.Locations; 322var locations = isImplicitlyDeclaredConstructor ? method.ContainingType.Locations : method.Locations; 825foreach (var location in symbol.Locations)
src\RoslynAnalyzers\Utilities\Compiler\Extensions\DiagnosticExtensions.cs (2)
84return symbol.Locations.CreateDiagnostic(rule, args); 93return symbol.Locations.CreateDiagnostic(rule, properties, args);
src\RoslynAnalyzers\Utilities\Compiler\Options\AnalyzerOptionsExtensions.cs (4)
42tree = symbol.Locations[0].SourceTree; 321=> options.GetDisallowedSymbolNamesWithValueOption(rule, symbol.Locations[0].SourceTree, compilation); 335=> options.GetAdditionalRequiredSuffixesOption(rule, symbol.Locations[0].SourceTree, compilation); 384=> options.GetAdditionalRequiredGenericInterfaces(rule, symbol.Locations[0].SourceTree, compilation);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs (1)
32visitor.WriteLocation(symbol.Locations.First());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousTypeSymbolKey.cs (1)
25var propertyLocations = properties.SelectAsArray(p => p.Locations.FirstOrDefault());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.BodyLevelSymbolKey.cs (3)
22Contract.ThrowIfTrue(symbol.DeclaringSyntaxReferences.IsEmpty && symbol.Locations.IsEmpty); 26foreach (var location in symbol.Locations) 61Contract.ThrowIfTrue(symbol.DeclaringSyntaxReferences.IsEmpty && symbol.Locations.IsEmpty);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (1)
705var location = module.Locations.FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TupleTypeSymbolKey.cs (1)
30locations.Add(element.Locations.FirstOrDefault() ?? Location.None);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TypeParameterSymbolKey.cs (1)
20visitor.WriteLocation(symbol.Locations[0]);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (2)
616=> symbol.Locations.Any() && symbol.Locations.All(location => location.IsInSource);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.EquivalenceVisitor.cs (4)
274return x.Locations.Length == 1 && y.Locations.Length == 1 && 275x.Locations.First().Equals(y.Locations.First());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (4)
103Hash.Combine(x.Locations.FirstOrDefault(), currentHash)); 107=> Hash.Combine(x.Locations.FirstOrDefault(), currentHash); 117return Hash.Combine(x.Locations.FirstOrDefault(), currentHash); 297=> Hash.Combine(x.Locations.FirstOrDefault(), currentHash);
Microsoft.CodeAnalysis.ResxSourceGenerator (24)
src\RoslynAnalyzers\Utilities\Compiler\Extensions\DiagnosticExtensions.cs (2)
84return symbol.Locations.CreateDiagnostic(rule, args); 93return symbol.Locations.CreateDiagnostic(rule, properties, args);
src\RoslynAnalyzers\Utilities\Compiler\Options\AnalyzerOptionsExtensions.cs (4)
42tree = symbol.Locations[0].SourceTree; 321=> options.GetDisallowedSymbolNamesWithValueOption(rule, symbol.Locations[0].SourceTree, compilation); 335=> options.GetAdditionalRequiredSuffixesOption(rule, symbol.Locations[0].SourceTree, compilation); 384=> options.GetAdditionalRequiredGenericInterfaces(rule, symbol.Locations[0].SourceTree, compilation);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs (1)
32visitor.WriteLocation(symbol.Locations.First());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousTypeSymbolKey.cs (1)
25var propertyLocations = properties.SelectAsArray(p => p.Locations.FirstOrDefault());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.BodyLevelSymbolKey.cs (3)
22Contract.ThrowIfTrue(symbol.DeclaringSyntaxReferences.IsEmpty && symbol.Locations.IsEmpty); 26foreach (var location in symbol.Locations) 61Contract.ThrowIfTrue(symbol.DeclaringSyntaxReferences.IsEmpty && symbol.Locations.IsEmpty);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (1)
705var location = module.Locations.FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TupleTypeSymbolKey.cs (1)
30locations.Add(element.Locations.FirstOrDefault() ?? Location.None);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TypeParameterSymbolKey.cs (1)
20visitor.WriteLocation(symbol.Locations[0]);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (2)
616=> symbol.Locations.Any() && symbol.Locations.All(location => location.IsInSource);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.EquivalenceVisitor.cs (4)
274return x.Locations.Length == 1 && y.Locations.Length == 1 && 275x.Locations.First().Equals(y.Locations.First());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (4)
103Hash.Combine(x.Locations.FirstOrDefault(), currentHash)); 107=> Hash.Combine(x.Locations.FirstOrDefault(), currentHash); 117return Hash.Combine(x.Locations.FirstOrDefault(), currentHash); 297=> Hash.Combine(x.Locations.FirstOrDefault(), currentHash);
Microsoft.CodeAnalysis.Test.Utilities (29)
Diagnostics\CommonDiagnosticAnalyzers.cs (21)
610codeBlockContext.ReportDiagnostic(Diagnostic.Create(CodeBlockTopLevelRule, codeBlockContext.OwningSymbol.Locations[0], codeBlockContext.OwningSymbol.Name)); 619codeBlockContext.ReportDiagnostic(Diagnostic.Create(CodeBlockPerCompilationRule, codeBlockContext.OwningSymbol.Locations[0], codeBlockContext.OwningSymbol.Name)); 766context.ReportDiagnostic(Diagnostic.Create(Rule, context.Symbol.Locations[0])); 798context.ReportDiagnostic(Diagnostic.Create(Rule, ns.Locations[0])); 1003symbolContext.ReportDiagnostic(Diagnostic.Create(Rule, symbolContext.Symbol.Locations[0])); 1043symbolContext.ReportDiagnostic(Diagnostic.Create(Rule, symbolContext.Symbol.Locations[0], symbolContext.Symbol.Name)); 1177var diagnostic = Diagnostic.Create(Descriptor, symbolContext.Symbol.Locations[0], symbolContext.Symbol.Name); 1219var diagnostic = Diagnostic.Create(Descriptor, symbolContext.Symbol.Locations[0]); 1335blockStartContext.RegisterOperationBlockEndAction(c => ReportDiagnostic(c.ReportDiagnostic, c.OwningSymbol.Locations[0])); 1344ReportDiagnostic(blockContext.ReportDiagnostic, blockContext.OwningSymbol.Locations[0]); 1392var diagnostic = Diagnostic.Create(Descriptor, c.OwningSymbol.Locations[0], c.OwningSymbol.Name, operationRoot.Kind); 1660ReportDiagnosticsCore(addDiagnostic, symbol.Locations[0], symbol.Name); 1706var diagnostic = Diagnostic.Create(Rule, namedType.Locations[0], namedType.Name, namedTypes.Count); 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])); 2463=> reportDiagnostic(Diagnostic.Create(_rule, symbol.Locations[0], symbol.Name)); 2542var diagnostic = Diagnostic.Create(Descriptor, context.Symbol.Locations[0], _reportedSeverity, additionalLocations: null, properties: null, messageArgs: null); 2570endContext => endContext.ReportDiagnostic(Diagnostic.Create(s_descriptor, context.OwningSymbol.Locations[0]))); 2610context => context.ReportDiagnostic(Diagnostic.Create(Descriptor, context.Symbol.Locations[0])), 2940context.RegisterSymbolAction(context => HandleCallback(context.Symbol.Locations[0], context.Compilation, context.ReportDiagnostic, context.CancellationToken), SymbolKind.NamedType);
Diagnostics\CouldHaveMoreSpecificTypeAnalyzer.cs (2)
295context.ReportDiagnostic(Diagnostic.Create(descriptor, local.Locations.FirstOrDefault(), local, moreSpecificType)); 300context.ReportDiagnostic(Diagnostic.Create(descriptor, field.Locations.FirstOrDefault(), field, moreSpecificType));
Diagnostics\FieldCouldBeReadOnlyAnalyzer.cs (1)
144context.ReportDiagnostic(Diagnostic.Create(descriptor, field.Locations.FirstOrDefault()));
Diagnostics\LocalCouldBeConstAnalyzer.cs (1)
135context.ReportDiagnostic(Diagnostic.Create(descriptor, local.Locations.FirstOrDefault()));
Diagnostics\SuppressMessageAttributeTests.DiagnosticAnalyzers.cs (4)
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)); 154context.ReportDiagnostic(CodeAnalysis.Diagnostic.Create(s_rule, context.OwningSymbol.Locations.First(), messageArgs: context.OwningSymbol.Name + ":end")); 173context.ReportDiagnostic(CodeAnalysis.Diagnostic.Create(s_rule, context.OwningSymbol.Locations.First(), messageArgs: context.OwningSymbol.Name + ":end"));
Microsoft.CodeAnalysis.UnitTests (1)
Diagnostics\SuppressMessageTargetSymbolResolverTests.cs (1)
1403where candidate != null && candidate.Locations.Contains(location)
Microsoft.CodeAnalysis.VisualBasic (1)
Symbols\Symbol.vb (1)
1295Private ReadOnly Property ISymbol_Locations As ImmutableArray(Of Location) Implements ISymbol.Locations, ISymbolInternal.Locations
Microsoft.CodeAnalysis.VisualBasic.CommandLine.UnitTests (3)
CommandLineTests.vb (3)
11028context.ReportDiagnostic(Diagnostic.Create(Warning01, context.Symbol.Locations.First())) 11029context.ReportDiagnostic(Diagnostic.Create(Warning03, context.Symbol.Locations.First())) 11052context.ReportDiagnostic(Diagnostic.Create(Warning04, context.Symbol.Locations.First()))
Microsoft.CodeAnalysis.VisualBasic.Features (3)
Debugging\BreakpointResolver.vb (1)
31Dim location = method.Locations.First(Function(loc) loc.IsInSource)
Debugging\ProximityExpressionsGetter.vb (1)
82Dim statement = info.Symbol.Locations.First().FindToken(cancellationToken).GetAncestor(Of StatementSyntax)()
GoToDefinition\VisualBasicGoToDefinitionSymbolService.vb (1)
48Return If(Symbol.Locations.FirstOrDefault()?.SourceSpan.Start, 0)
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (49)
Compilation\SemanticModelGetDeclaredSymbolAPITests.vb (47)
1253paramSymbol1.Locations.Single().SourceSpan.Start) 1261paramSymbol2.Locations.Single().SourceSpan.Start - "Optional ".Length) 1269paramSymbol3.Locations.Single().SourceSpan.Start) 1277paramSymbol4.Locations.Single().SourceSpan.Start) 1285paramSymbol5.Locations.Single().SourceSpan.Start) 1364Assert.Equal(syntax.SpanStart + 6, paramSymbol1.Locations.Single().SourceSpan.Start) 1369Assert.Equal(syntax.SpanStart + 6, paramSymbol2.Locations.Single().SourceSpan.Start) 1374Assert.Equal(syntax.SpanStart, paramSymbol3.Locations.Single().SourceSpan.Start) 1379Assert.Equal(syntax.SpanStart + 6, paramSymbol4.Locations.Single().SourceSpan.Start) 1843Assert.Equal(2, tpSymbol1.Locations.Length()) 1844Assert.True(syntax.SpanStart = tpSymbol1.Locations.Item(0).SourceSpan.Start OrElse 1845syntax.SpanStart = tpSymbol1.Locations.Item(1).SourceSpan.Start, 1852Assert.Equal(2, tpSymbol2.Locations.Length()) 1853Assert.True(syntax.SpanStart = tpSymbol2.Locations.Item(0).SourceSpan.Start OrElse 1854syntax.SpanStart = tpSymbol2.Locations.Item(1).SourceSpan.Start, 1861Assert.Equal(2, tpSymbol3.Locations.Length()) 1862Assert.True(syntax.SpanStart = tpSymbol3.Locations.Item(0).SourceSpan.Start OrElse 1863syntax.SpanStart = tpSymbol3.Locations.Item(1).SourceSpan.Start, 1870Assert.Equal(2, tpSymbol4.Locations.Length()) 1871Assert.True(syntax.SpanStart = tpSymbol4.Locations.Item(0).SourceSpan.Start OrElse 1872syntax.SpanStart = tpSymbol4.Locations.Item(1).SourceSpan.Start, 1879Assert.Equal(1, tpSymbol5.Locations.Length()) 1880Assert.Equal(syntax.SpanStart, tpSymbol5.Locations.Single().SourceSpan.Start) 2016Assert.Equal(1, varSymbol1.Locations.Length()) 2017Assert.True(syntax.SpanStart = varSymbol1.Locations.Item(0).SourceSpan.Start OrElse 2018syntax.SpanStart = varSymbol1.Locations.Item(1).SourceSpan.Start, 2026Assert.Equal(1, varSymbol2.Locations.Length()) 2027Assert.True(syntax.SpanStart = varSymbol2.Locations.Item(0).SourceSpan.Start OrElse 2028syntax.SpanStart = varSymbol2.Locations.Item(1).SourceSpan.Start, 2036Assert.Equal(1, varSymbol3.Locations.Length()) 2037Assert.True(syntax.SpanStart = varSymbol3.Locations.Item(0).SourceSpan.Start OrElse 2038syntax.SpanStart = varSymbol3.Locations.Item(1).SourceSpan.Start, 2046Assert.Equal(1, varSymbol4.Locations.Length()) 2047Assert.True(syntax.SpanStart = varSymbol4.Locations.Item(0).SourceSpan.Start OrElse 2048syntax.SpanStart = varSymbol4.Locations.Item(1).SourceSpan.Start, 2056Assert.Equal(1, varSymbol5.Locations.Length()) 2057Assert.True(syntax.SpanStart = varSymbol5.Locations.Item(0).SourceSpan.Start OrElse 2058syntax.SpanStart = varSymbol5.Locations.Item(1).SourceSpan.Start, 2066Assert.Equal(1, varSymbol6.Locations.Length()) 2067Assert.True(syntax.SpanStart = varSymbol6.Locations.Item(0).SourceSpan.Start OrElse 2068syntax.SpanStart = varSymbol6.Locations.Item(1).SourceSpan.Start, 2077Assert.Equal(1, varSymbol7.Locations.Length()) 2078Assert.True(syntax.SpanStart = varSymbol7.Locations.Item(0).SourceSpan.Start OrElse 2079syntax.SpanStart = varSymbol7.Locations.Item(1).SourceSpan.Start, 2087Assert.Equal(1, varSymbol8.Locations.Length()) 2088Assert.True(syntax.SpanStart = varSymbol8.Locations.Item(0).SourceSpan.Start OrElse 2089syntax.SpanStart = varSymbol8.Locations.Item(1).SourceSpan.Start,
Diagnostics\DiagnosticAnalyzerTests.vb (2)
315Dim sourceLoc = context.Symbol.Locations.First(Function(l) l.IsInSource) 509Dim sourceLoc = context.Symbol.Locations.First(Function(l) l.IsInSource)
Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests (2)
DocumentationComments\DocCommentTests.vb (2)
4997Array.Sort(list, Function(x As ISymbol, y As ISymbol) compilation.CompareSourceLocations(x.Locations(0), y.Locations(0)))
Microsoft.CodeAnalysis.VisualBasic.Test.Utilities (2)
SemanticModelTestBase.vb (2)
84" Location1.SourceSpan.Start : " & tpSymbol.Locations.Item(0).SourceSpan.Start & 85" Location2.SourceSpan.Start : " & tpSymbol.Locations.Item(0).SourceSpan.Start
Microsoft.CodeAnalysis.VisualBasic.Workspaces (6)
Rename\VisualBasicRenameRewriterLanguageService.vb (6)
124_renamableDeclarationLocation = _renamedSymbol.Locations.Where(Function(loc) loc.IsInSource AndAlso loc.SourceTree Is _semanticModel.SyntaxTree).FirstOrDefault() 698Dim token = renamedSymbol.Locations.Single().FindToken(cancellationToken) 724token = matchingParameterSymbol.Locations.Single().FindToken(cancellationToken) 747conflicts.AddRange(renamedSymbol.ContainingSymbol.Locations _ 755Dim token = renamedSymbol.Locations.Single().FindToken(cancellationToken) 780For Each location In renamedSymbol.Locations
Microsoft.CodeAnalysis.Workspaces (61)
FindSymbols\FindReferences\DependentProjectsFinder.cs (1)
120var project = assembly.Locations.Any(static loc => loc.IsInMetadata)
FindSymbols\FindReferences\DependentTypeFinder.cs (3)
74var searchInMetadata = type.Locations.Any(s_isInMetadata); 364derivedType.Locations.Any(s_isInMetadata) && 379Debug.Assert(type.Locations.All(assert), message);
FindSymbols\FindReferences\Finders\AbstractMemberScopedReferenceFinder.cs (1)
37var location = symbol.Locations.FirstOrDefault();
FindSymbols\FindReferences\MetadataUnifyingEquivalenceComparer.cs (1)
51=> symbol.Locations.Any(static l => l.IsInSource);
FindSymbols\SymbolFinder_Helpers.cs (1)
18if (symbol.Locations.Any(static l => l.IsInMetadata))
ReassignedVariable\AbstractReassignedVariableService.cs (2)
245if (parameter.Locations.Length > 0) 247var parameterLocation = parameter.Locations[0];
Recommendations\AbstractRecommendationServiceRunner.cs (1)
351recommendationSymbol.Locations.Any(
Rename\ConflictEngine\ConflictResolver.cs (7)
100var renameSymbolDeclarationLocation = renameLocations.Symbol.Locations.Where(loc => loc.IsInSource).FirstOrDefault(); 171return conflictResolution.ReplacementTextValid && renamedSymbol != null && renamedSymbol.Locations.Any(static loc => loc.IsInSource); 329foreach (var newLocation in newSymbol.Locations) 354var locations = symbol.Locations; 367overriddenFromMetadata = overriddenSymbol == null || overriddenSymbol.Locations.All(loc => loc.IsInMetadata); 409var locations = symbol.Locations; 413locations = originalsourcesymbol.Locations;
Rename\ConflictEngine\ConflictResolver.Session.cs (3)
244var definitionLocations = _renameLocationSet.Symbol.Locations; 587if (conflictAnnotation.RenameDeclarationLocationReferences[symbolIndex].SymbolLocationsCount != symbol.Locations.Length) 624if (overriddenSymbol == null || !overriddenSymbol.Locations.All(loc => loc.IsInMetadata))
Rename\ConflictEngine\DeclarationConflictHelpers.cs (2)
64builder.AddRange(conflictingSymbol.Locations); 69builder.AddRange(conflictingSymbol.Locations);
Rename\IRenameRewriterLanguageService.cs (1)
146conflicts.AddRange(conflictingParameter.Locations);
Rename\RenameUtilities.cs (1)
91var documentsOfRenameSymbolDeclaration = symbol.Locations.Where(l => l.IsInSource).Select(l => solution.GetRequiredDocument(l.SourceTree!));
Rename\SymbolicRenameLocations.ReferenceProcessing.cs (8)
68referencedSymbol.Locations.Any(static loc => loc.IsInSource)) 182var location = originalSymbol.Locations.Single(); 188foreach (var location in referencedSymbol.Locations) 198if (referencedSymbol.Kind == SymbolKind.NamedType && referencedSymbol.Locations.All(l => l.IsInSource)) 200var firstLocation = referencedSymbol.Locations[0]; 213foreach (var location in method.Locations) 273var aliasLocation = location.Alias.Locations.Single(); 296var aliasLocation = location.Alias.Locations.Single();
Shared\Extensions\IFindReferencesResultExtensions.cs (4)
23? [definition.Locations.First()] 24: definition.Locations; 82if (definition.Locations.Any(static loc => loc.IsInSource)) 88definition.Locations.Any(static loc => loc.IsInMetadata))
Shared\Extensions\ISymbolExtensions.cs (2)
76if (!includingSourceSymbols && symbol.Locations.All(loc => loc.IsInSource)) 670(s is INamespaceSymbol || s.Locations.Any(static loc => loc.IsInSource) || !s.HasUnsupportedMetadata) &&
Shared\Extensions\ITypeSymbolExtensions.cs (1)
158typeSymbol.Locations.Any(static location => location.IsInSource)) ||
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs (1)
32visitor.WriteLocation(symbol.Locations.First());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousTypeSymbolKey.cs (1)
25var propertyLocations = properties.SelectAsArray(p => p.Locations.FirstOrDefault());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.BodyLevelSymbolKey.cs (3)
22Contract.ThrowIfTrue(symbol.DeclaringSyntaxReferences.IsEmpty && symbol.Locations.IsEmpty); 26foreach (var location in symbol.Locations) 61Contract.ThrowIfTrue(symbol.DeclaringSyntaxReferences.IsEmpty && symbol.Locations.IsEmpty);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (1)
705var location = module.Locations.FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TupleTypeSymbolKey.cs (1)
30locations.Add(element.Locations.FirstOrDefault() ?? Location.None);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TypeParameterSymbolKey.cs (1)
20visitor.WriteLocation(symbol.Locations[0]);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (2)
616=> symbol.Locations.Any() && symbol.Locations.All(location => location.IsInSource);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.EquivalenceVisitor.cs (4)
274return x.Locations.Length == 1 && y.Locations.Length == 1 && 275x.Locations.First().Equals(y.Locations.First());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (4)
103Hash.Combine(x.Locations.FirstOrDefault(), currentHash)); 107=> Hash.Combine(x.Locations.FirstOrDefault(), currentHash); 117return Hash.Combine(x.Locations.FirstOrDefault(), currentHash); 297=> Hash.Combine(x.Locations.FirstOrDefault(), currentHash);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\SymbolFinder\SymbolFinderInternal.cs (2)
71else if (!symbol.Locations.Any(static loc => loc.IsInMetadata)) 91=> symbol != null && symbol.Locations.Any(static loc => loc.IsInSource);
Workspace\Solution\SolutionCompilationState.SymbolToProjectId.cs (2)
82var syntaxTree = symbol.Locations[0].SourceTree; 179Locations: [{ SourceTree: var typeParameterSourceTree }, ..],
Microsoft.CodeAnalysis.Workspaces.UnitTests (3)
FindReferencesTests.cs (1)
687foreach (var location in reference.Definition.Locations)
SymbolKeyTests.cs (2)
1432Assert.True(resolved.Symbol.Locations[0].SourceSpan.Start > symbol.Locations[0].SourceSpan.Start);
Microsoft.Extensions.Logging.Generators (8)
LoggerMessageGenerator.Parser.cs (8)
374Diag(DiagnosticDescriptors.InvalidLoggingMethodParameterOut, paramSymbol.Locations[0], paramName); 402Diag(DiagnosticDescriptors.ShouldntMentionLoggerInMessage, paramSymbol.Locations[0], paramName); 407Diag(DiagnosticDescriptors.ShouldntMentionExceptionInMessage, paramSymbol.Locations[0], paramName); 412Diag(DiagnosticDescriptors.ShouldntMentionLogLevelInMessage, paramSymbol.Locations[0], paramName); 417Diag(DiagnosticDescriptors.ArgumentHasNoCorrespondingTemplate, paramSymbol.Locations[0], paramName); 421Diag(DiagnosticDescriptors.ArgumentHasNoCorrespondingTemplate, paramSymbol.Locations[0], paramName); 428Diag(DiagnosticDescriptors.InvalidLoggingMethodParameterName, paramSymbol.Locations[0]); 701Diag(DiagnosticDescriptors.PrimaryConstructorParameterLoggerHidden, parameter.Locations[0], classDec.Identifier.Text);
Microsoft.Extensions.Options.SourceGeneration (3)
Parser.cs (1)
305Diag(DiagDescriptors.MemberIsInaccessible, member.Locations.First(), member.Name);
ParserUtilities.cs (2)
47return symbol.Locations.IsDefaultOrEmpty 49: symbol.Locations[0];
Microsoft.Gen.ComplianceReports (3)
Parser.cs (3)
124FileLinePositionSpan fileLine = ps.Locations[0].GetLineSpan(); 185FileLinePositionSpan fileLine = member.Locations[0].GetLineSpan(); 219FileLinePositionSpan fileLine = p.Locations[0].GetLineSpan();
Microsoft.Gen.Logging (2)
src\Generators\Shared\ParserUtilities.cs (2)
52return symbol.Locations.IsDefaultOrEmpty 54: symbol.Locations[0];
Microsoft.Gen.Logging.Unit.Tests (3)
ParserUtilitiesTests.cs (3)
91symbolMock.SetupGet(x => x.Locations) 96symbolMock.SetupGet(x => x.Locations) 107symbolMock.SetupGet(x => x.Locations)
Microsoft.Gen.MetadataExtractor (13)
src\Generators\Microsoft.Gen.ComplianceReports\Parser.cs (3)
124FileLinePositionSpan fileLine = ps.Locations[0].GetLineSpan(); 185FileLinePositionSpan fileLine = member.Locations[0].GetLineSpan(); 219FileLinePositionSpan fileLine = p.Locations[0].GetLineSpan();
src\Generators\Microsoft.Gen.Metrics\Parser.cs (8)
550Diag(DiagDescriptors.ErrorInvalidParameterName, paramSymbol.Locations[0]); 651strongTypeSymbol.Locations[0], 659Diag(DiagDescriptors.ErrorTooManyTagNames, strongTypeSymbol.Locations[0]); 734Diag(DiagDescriptors.ErrorDuplicateTagName, member.Locations[0], member.Name); 766Diag(DiagDescriptors.ErrorDuplicateTagName, member.Locations[0], member.Name); 809Diag(DiagDescriptors.ErrorInvalidTagNameType, member.Locations[0]); 818Diag(DiagDescriptors.ErrorInvalidTagNameType, member.Locations[0]); 839Diag(DiagDescriptors.ErrorInvalidTagNameType, member.Locations[0]);
src\Generators\Shared\ParserUtilities.cs (2)
52return symbol.Locations.IsDefaultOrEmpty 54: symbol.Locations[0];
Microsoft.Gen.Metrics (10)
Parser.cs (8)
550Diag(DiagDescriptors.ErrorInvalidParameterName, paramSymbol.Locations[0]); 651strongTypeSymbol.Locations[0], 659Diag(DiagDescriptors.ErrorTooManyTagNames, strongTypeSymbol.Locations[0]); 734Diag(DiagDescriptors.ErrorDuplicateTagName, member.Locations[0], member.Name); 766Diag(DiagDescriptors.ErrorDuplicateTagName, member.Locations[0], member.Name); 809Diag(DiagDescriptors.ErrorInvalidTagNameType, member.Locations[0]); 818Diag(DiagDescriptors.ErrorInvalidTagNameType, member.Locations[0]); 839Diag(DiagDescriptors.ErrorInvalidTagNameType, member.Locations[0]);
src\Generators\Shared\ParserUtilities.cs (2)
52return symbol.Locations.IsDefaultOrEmpty 54: symbol.Locations[0];
Microsoft.Gen.MetricsReports (10)
src\Generators\Microsoft.Gen.Metrics\Parser.cs (8)
550Diag(DiagDescriptors.ErrorInvalidParameterName, paramSymbol.Locations[0]); 651strongTypeSymbol.Locations[0], 659Diag(DiagDescriptors.ErrorTooManyTagNames, strongTypeSymbol.Locations[0]); 734Diag(DiagDescriptors.ErrorDuplicateTagName, member.Locations[0], member.Name); 766Diag(DiagDescriptors.ErrorDuplicateTagName, member.Locations[0], member.Name); 809Diag(DiagDescriptors.ErrorInvalidTagNameType, member.Locations[0]); 818Diag(DiagDescriptors.ErrorInvalidTagNameType, member.Locations[0]); 839Diag(DiagDescriptors.ErrorInvalidTagNameType, member.Locations[0]);
src\Generators\Shared\ParserUtilities.cs (2)
52return symbol.Locations.IsDefaultOrEmpty 54: symbol.Locations[0];
Microsoft.Interop.ComInterfaceGenerator (5)
ComInterfaceGenerator.cs (2)
331generatorDiagnostics.ReportDiagnostic(DiagnosticInfo.Create(GeneratorDiagnostics.ComMethodManagedReturnWillBeOutVariable, symbol.Locations[0])); 369symbol.Locations[0],
ComMethodInfo.cs (3)
107foreach (var methodLocation in method.Locations) 119return DiagnosticOr<(ComMethodInfo, IMethodSymbol)>.From(DiagnosticInfo.Create(GeneratorDiagnostics.MethodNotDeclaredInAttributedInterface, method.Locations.FirstOrDefault(), method.ToDisplayString())); 135return DiagnosticOr<(ComMethodInfo, IMethodSymbol)>.From(DiagnosticInfo.Create(GeneratorDiagnostics.CannotAnalyzeMethodPattern, method.Locations.FirstOrDefault(), method.ToDisplayString()));
Microsoft.Interop.SourceGeneration (6)
DiagnosticExtensions.cs (4)
17return symbol.Locations.CreateDiagnostic(descriptor, args); 26return symbol.Locations.CreateDiagnostic(descriptor, properties, args); 121return symbol.Locations.CreateDiagnosticInfo(descriptor, args); 130return symbol.Locations.CreateDiagnosticInfo(descriptor, properties, args);
TypePositionInfo.cs (2)
111return methodSymbol.Locations[0]; 113return methodSymbol.Parameters[info.ManagedIndex].Locations[0];
Microsoft.ML.CodeAnalyzer.Tests (1)
Code\RelaxTestNamingTest.cs (1)
133context.ReportDiagnostic(Diagnostic.Create(Rule, method.Locations[0]));
Microsoft.ML.InternalCodeAnalyzer (3)
BaseTestClassAnalyzer.cs (1)
78context.ReportDiagnostic(Diagnostic.Create(Rule, namedType.Locations[0], namedType));
InstanceInitializerAnalyzer.cs (2)
59var diagnostic = Diagnostic.Create(Rule, symbol.Locations[0], symbol.Name, "field"); 75var diagnostic = Diagnostic.Create(Rule, symbol.Locations[0], symbol.Name, "property");
Microsoft.VisualStudio.LanguageServices (10)
Library\ObjectBrowser\AbstractListItemFactory.cs (5)
134|| symbol.Locations.Any(static l => l.IsInSource || l.IsInMetadata); 149if (symbol.Locations.Any(static l => l.IsInSource)) 154if (symbol.Locations.Any(static l => l.IsInMetadata)) 571if (typeMember.Locations.Any(static l => l.IsInSource)) 576if (typeMember.Locations.Any(static l => l.IsInMetadata))
MoveStaticMembers\VisualStudioMoveStaticMembersOptionsService.cs (1)
173return t.Locations
Venus\ContainedLanguageCodeSupport.cs (3)
209var position = type.Locations.First(loc => loc.SourceTree == targetSyntaxTree).SourceSpan.Start; 299? semanticModel.LookupSymbols(position: type.Locations[0].SourceSpan.Start, container: type, name: null) 490var typeLocation = type.Locations.FirstOrDefault(d => d.SourceTree == containingTree);
Workspace\VisualStudioSymbolNavigationService.cs (1)
57var sourceLocations = symbol.Locations.Where(loc => loc.IsInSource);
Microsoft.VisualStudio.LanguageServices.VisualBasic (2)
Venus\ContainedLanguageStaticEventBinding.vb (2)
65Dim targetDocument = document.Project.Solution.GetDocument(memberSymbol.Locations.First().SourceTree) 93Dim targetDocument = document.Project.Solution.GetDocument(memberSymbol.Locations.First().SourceTree)
Mvc.Api.Analyzers.Test (4)
ActualApiResponseMetadataFactoryTest.cs (4)
77var methodSyntax = syntaxTree.GetRoot().FindNode(method.Locations[0].SourceSpan); 374var methodSyntax = (MethodDeclarationSyntax)syntaxTree.GetRoot().FindNode(method.Locations[0].SourceSpan); 394var methodSyntax = syntaxTree.GetRoot().FindNode(method.Locations[0].SourceSpan); 413var methodSyntax = syntaxTree.GetRoot().FindNode(method.Locations[0].SourceSpan);
Roslyn.Diagnostics.Analyzers (31)
AbstractCreateTestAccessor`1.cs (1)
44var location = typeSymbol.Locations.FirstOrDefault(location => location.IsInSource && Equals(location.SourceTree, semanticModel.SyntaxTree));
AbstractExposeMemberForTesting`1.cs (1)
50var location = testAccessorType.Locations.FirstOrDefault(location => location.IsInSource && Equals(location.SourceTree, semanticModel.SyntaxTree));
DefaultableTypeShouldHaveDefaultableFieldsAnalyzer.cs (2)
98var semanticModel = originalContext.Compilation.GetSemanticModel(field.Locations[0].SourceTree); 100if (!semanticModel.GetNullableContext(field.Locations[0].SourceSpan.Start).WarningsEnabled())
src\RoslynAnalyzers\Utilities\Compiler\Extensions\DiagnosticExtensions.cs (2)
84return symbol.Locations.CreateDiagnostic(rule, args); 93return symbol.Locations.CreateDiagnostic(rule, properties, args);
src\RoslynAnalyzers\Utilities\Compiler\Options\AnalyzerOptionsExtensions.cs (4)
42tree = symbol.Locations[0].SourceTree; 321=> options.GetDisallowedSymbolNamesWithValueOption(rule, symbol.Locations[0].SourceTree, compilation); 335=> options.GetAdditionalRequiredSuffixesOption(rule, symbol.Locations[0].SourceTree, compilation); 384=> options.GetAdditionalRequiredGenericInterfaces(rule, symbol.Locations[0].SourceTree, compilation);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs (1)
32visitor.WriteLocation(symbol.Locations.First());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousTypeSymbolKey.cs (1)
25var propertyLocations = properties.SelectAsArray(p => p.Locations.FirstOrDefault());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.BodyLevelSymbolKey.cs (3)
22Contract.ThrowIfTrue(symbol.DeclaringSyntaxReferences.IsEmpty && symbol.Locations.IsEmpty); 26foreach (var location in symbol.Locations) 61Contract.ThrowIfTrue(symbol.DeclaringSyntaxReferences.IsEmpty && symbol.Locations.IsEmpty);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (1)
705var location = module.Locations.FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TupleTypeSymbolKey.cs (1)
30locations.Add(element.Locations.FirstOrDefault() ?? Location.None);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TypeParameterSymbolKey.cs (1)
20visitor.WriteLocation(symbol.Locations[0]);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (2)
616=> symbol.Locations.Any() && symbol.Locations.All(location => location.IsInSource);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.EquivalenceVisitor.cs (4)
274return x.Locations.Length == 1 && y.Locations.Length == 1 && 275x.Locations.First().Equals(y.Locations.First());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (4)
103Hash.Combine(x.Locations.FirstOrDefault(), currentHash)); 107=> Hash.Combine(x.Locations.FirstOrDefault(), currentHash); 117return Hash.Combine(x.Locations.FirstOrDefault(), currentHash); 297=> Hash.Combine(x.Locations.FirstOrDefault(), currentHash);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\SymbolFinder\SymbolFinderInternal.cs (2)
71else if (!symbol.Locations.Any(static loc => loc.IsInMetadata)) 91=> symbol != null && symbol.Locations.Any(static loc => loc.IsInSource);
SymbolDeclaredEventMustBeGeneratedForSourceSymbols.cs (1)
186Diagnostic diagnostic = Diagnostic.Create(SymbolDeclaredEventRule, sourceSymbol.Locations[0], sourceSymbol.Name, _compilationType.Name, SymbolDeclaredEventName);
Roslyn.Diagnostics.Analyzers.UnitTests (1)
RelaxTestNamingSuppressorTests.cs (1)
134context.ReportDiagnostic(Diagnostic.Create(Rule, method.Locations[0]));
Roslyn.Diagnostics.CSharp.Analyzers (2)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SemanticFacts\CSharpSemanticFacts.cs (2)
72if (symbol.Locations.Any(static (loc, location) => loc.SourceTree == location.SourceTree && loc.SourceSpan.Contains(location.SourceSpan), location)) 78if (symbol.Locations.Contains(location))
Roslyn.Diagnostics.VisualBasic.Analyzers (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Services\SemanticFacts\VisualBasicSemanticFacts.vb (1)
78If symbol.Locations.Contains(location) Then
System.Text.Json.SourceGeneration (2)
Helpers\RoslynExtensions.cs (2)
29=> typeSymbol.Locations.Length > 0 ? typeSymbol.Locations[0] : null;
System.Windows.Forms.Analyzers.CSharp (1)
System\Windows\Forms\CSharp\Analyzers\MissingPropertySerializationConfiguration\MissingPropertySerializationConfigurationAnalyzer.cs (1)
100location: propertySymbol.Locations[0],
System.Windows.Forms.Analyzers.VisualBasic (1)
Analyzers\MissingPropertySerializationConfiguration\MissingPropertySerializationConfigurationDiagnosticAnalyzer.vb (1)
98location:=propertySymbol.Locations(0),
Test.Utilities (24)
src\RoslynAnalyzers\Utilities\Compiler\Extensions\DiagnosticExtensions.cs (2)
84return symbol.Locations.CreateDiagnostic(rule, args); 93return symbol.Locations.CreateDiagnostic(rule, properties, args);
src\RoslynAnalyzers\Utilities\Compiler\Options\AnalyzerOptionsExtensions.cs (4)
42tree = symbol.Locations[0].SourceTree; 321=> options.GetDisallowedSymbolNamesWithValueOption(rule, symbol.Locations[0].SourceTree, compilation); 335=> options.GetAdditionalRequiredSuffixesOption(rule, symbol.Locations[0].SourceTree, compilation); 384=> options.GetAdditionalRequiredGenericInterfaces(rule, symbol.Locations[0].SourceTree, compilation);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs (1)
32visitor.WriteLocation(symbol.Locations.First());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousTypeSymbolKey.cs (1)
25var propertyLocations = properties.SelectAsArray(p => p.Locations.FirstOrDefault());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.BodyLevelSymbolKey.cs (3)
22Contract.ThrowIfTrue(symbol.DeclaringSyntaxReferences.IsEmpty && symbol.Locations.IsEmpty); 26foreach (var location in symbol.Locations) 61Contract.ThrowIfTrue(symbol.DeclaringSyntaxReferences.IsEmpty && symbol.Locations.IsEmpty);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (1)
705var location = module.Locations.FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TupleTypeSymbolKey.cs (1)
30locations.Add(element.Locations.FirstOrDefault() ?? Location.None);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TypeParameterSymbolKey.cs (1)
20visitor.WriteLocation(symbol.Locations[0]);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (2)
616=> symbol.Locations.Any() && symbol.Locations.All(location => location.IsInSource);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.EquivalenceVisitor.cs (4)
274return x.Locations.Length == 1 && y.Locations.Length == 1 && 275x.Locations.First().Equals(y.Locations.First());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (4)
103Hash.Combine(x.Locations.FirstOrDefault(), currentHash)); 107=> Hash.Combine(x.Locations.FirstOrDefault(), currentHash); 117return Hash.Combine(x.Locations.FirstOrDefault(), currentHash); 297=> Hash.Combine(x.Locations.FirstOrDefault(), currentHash);
Text.Analyzers (28)
EnumsShouldHavePluralNames.cs (2)
102context.ReportDiagnostic(symbol.CreateDiagnostic(Rule_CA1714, symbol.OriginalDefinition.Locations.First(), symbol.Name)); 109context.ReportDiagnostic(symbol.CreateDiagnostic(Rule_CA1717, symbol.OriginalDefinition.Locations.First(), symbol.Name));
src\RoslynAnalyzers\Utilities\Compiler\Extensions\DiagnosticExtensions.cs (2)
84return symbol.Locations.CreateDiagnostic(rule, args); 93return symbol.Locations.CreateDiagnostic(rule, properties, args);
src\RoslynAnalyzers\Utilities\Compiler\Options\AnalyzerOptionsExtensions.cs (4)
42tree = symbol.Locations[0].SourceTree; 321=> options.GetDisallowedSymbolNamesWithValueOption(rule, symbol.Locations[0].SourceTree, compilation); 335=> options.GetAdditionalRequiredSuffixesOption(rule, symbol.Locations[0].SourceTree, compilation); 384=> options.GetAdditionalRequiredGenericInterfaces(rule, symbol.Locations[0].SourceTree, compilation);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs (1)
32visitor.WriteLocation(symbol.Locations.First());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousTypeSymbolKey.cs (1)
25var propertyLocations = properties.SelectAsArray(p => p.Locations.FirstOrDefault());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.BodyLevelSymbolKey.cs (3)
22Contract.ThrowIfTrue(symbol.DeclaringSyntaxReferences.IsEmpty && symbol.Locations.IsEmpty); 26foreach (var location in symbol.Locations) 61Contract.ThrowIfTrue(symbol.DeclaringSyntaxReferences.IsEmpty && symbol.Locations.IsEmpty);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (1)
705var location = module.Locations.FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TupleTypeSymbolKey.cs (1)
30locations.Add(element.Locations.FirstOrDefault() ?? Location.None);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TypeParameterSymbolKey.cs (1)
20visitor.WriteLocation(symbol.Locations[0]);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (2)
616=> symbol.Locations.Any() && symbol.Locations.All(location => location.IsInSource);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.EquivalenceVisitor.cs (4)
274return x.Locations.Length == 1 && y.Locations.Length == 1 && 275x.Locations.First().Equals(y.Locations.First());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (4)
103Hash.Combine(x.Locations.FirstOrDefault(), currentHash)); 107=> Hash.Combine(x.Locations.FirstOrDefault(), currentHash); 117return Hash.Combine(x.Locations.FirstOrDefault(), currentHash); 297=> Hash.Combine(x.Locations.FirstOrDefault(), currentHash);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\SymbolFinder\SymbolFinderInternal.cs (2)
71else if (!symbol.Locations.Any(static loc => loc.IsInMetadata)) 91=> symbol != null && symbol.Locations.Any(static loc => loc.IsInSource);