6 implementations of Locations
Microsoft.CodeAnalysis.CodeStyle.Fixes (1)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationSymbol.cs (1)
140public 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.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)
140public ImmutableArray<Location> Locations
508 references to Locations
ILLink.RoslynAnalyzer (15)
DynamicallyAccessedMembersAnalyzer.cs (9)
123 var location = GetPrimaryLocation (type.Locations); 152 var location = GetPrimaryLocation (member.Locations); 186 Location attributableSymbolLocation = GetPrimaryLocation (attributableMethod.Locations); 197 GetPrimaryLocation (returnOrigin.Locations), sourceLocation, DAMArgs?.ToImmutableDictionary (), overrideMethod.GetDisplayName (), baseMethod.GetDisplayName ())); 219 GetPrimaryLocation (parameterOrigin?.Locations), sourceLocation, DAMArgs?.ToImmutableDictionary (), 232 Location attributableSymbolLocation = GetPrimaryLocation (attributableSymbol.Locations); 243 GetPrimaryLocation (typeParameterOrigin.Locations), sourceLocation, DAMArgs?.ToImmutableDictionary (), 256 GetPrimaryLocation (methodOrigin.Locations), 295 GetPrimaryLocation (propertySymbol.Locations),
RequiresAnalyzerBase.cs (3)
245 ctor.Locations[0], 253 entryPoint.Locations[0], 263 origin.Locations[0],
RequiresUnreferencedCodeAnalyzer.cs (1)
37 typeSymbol.Locations[0],
TrimAnalysis\ParameterProxy.cs (1)
44 public Location? Location => ParameterSymbol?.Locations[0];
TrimAnalysis\ReflectionAccessAnalyzer.cs (1)
133 location = DynamicallyAccessedMembersAnalyzer.GetPrimaryLocation (member.Locations);
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)
1514foreach (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.CodeStyle (28)
src\Analyzers\Core\Analyzers\Helpers\HashCodeAnalyzer\HashCodeAnalyzer.cs (2)
67if (method.Locations.Length != 1 || method.DeclaringSyntaxReferences.Length != 1) 70if (!method.Locations[0].IsInSource)
src\Analyzers\Core\Analyzers\MakeFieldReadonly\AbstractMakeFieldReadonlyDiagnosticAnalyzer.cs (2)
165Locations.Length: 1, 241=> field.Locations[0];
src\Analyzers\Core\Analyzers\NamingStyle\NamingStyleDiagnosticAnalyzerBase.cs (3)
60var sourceTree = symbolContext.Symbol.Locations.FirstOrDefault()?.SourceTree; 88if (symbol?.Locations.FirstOrDefault()?.SourceTree is not { } sourceTree) 169return DiagnosticHelper.Create(Descriptor, symbol.Locations.First(), NotificationOption2.ForSeverity(applicableRule.EnforcementLevel), options, additionalLocations: null, builder.ToImmutable(), failureReason);
src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (2)
142=> symbol.Locations[0]; 618foreach (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\Extensions\ISymbolExtensions.cs (2)
619=> symbol.Locations.Any() && symbol.Locations.All(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)
26var propertyLocations = properties.SelectAsArray(p => p.Locations.FirstOrDefault());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.BodyLevelSymbolKey.cs (3)
23Contract.ThrowIfTrue(symbol.DeclaringSyntaxReferences.IsEmpty && symbol.Locations.IsEmpty); 27foreach (var location in symbol.Locations) 62Contract.ThrowIfTrue(symbol.DeclaringSyntaxReferences.IsEmpty && symbol.Locations.IsEmpty);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TupleTypeSymbolKey.cs (1)
32locations.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\Core\Utilities\SymbolEquivalenceComparer.EquivalenceVisitor.cs (4)
273return x.Locations.Length == 1 && y.Locations.Length == 1 && 274x.Locations.First().Equals(y.Locations.First());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (4)
100Hash.Combine(x.Locations.FirstOrDefault(), currentHash)); 104=> Hash.Combine(x.Locations.FirstOrDefault(), currentHash); 114return Hash.Combine(x.Locations.FirstOrDefault(), currentHash); 292=> Hash.Combine(x.Locations.FirstOrDefault(), currentHash);
Microsoft.CodeAnalysis.CodeStyle.Fixes (5)
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)
70else if (!symbol.Locations.Any(static loc => loc.IsInMetadata)) 92=> symbol != null && symbol.Locations.Any(static loc => loc.IsInSource);
Microsoft.CodeAnalysis.CSharp (2)
SymbolDisplay\SymbolDisplayVisitor_Minimal.cs (2)
242if (this.IsMinimizing && !symbol.Locations.IsEmpty) 244var location = symbol.Locations.First();
Microsoft.CodeAnalysis.CSharp.CodeStyle (1)
src\Analyzers\CSharp\Analyzers\MakeStructFieldsWritable\CSharpMakeStructFieldsWritableDiagnosticAnalyzer.cs (1)
74=> namedTypeSymbol.Locations[0];
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (1)
src\Analyzers\CSharp\CodeFixes\Nullable\CSharpDeclareAsNullableCodeFixProvider.cs (1)
194else if (symbol is IFieldSymbol { CorrespondingTupleField: IFieldSymbol { Locations: [{ IsInSource: true } location] } })
Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests (2)
CommandLineTests.cs (2)
16000symbolContext.ReportDiagnostic(Diagnostic.Create(Warning01, symbolContext.Symbol.Locations.First())); 16017symbolContext.ReportDiagnostic(Diagnostic.Create(Warning02, symbolContext.Symbol.Locations.First()));
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (1)
Diagnostics\DiagnosticAnalyzerDriver\DiagnosticAnalyzerDriverTests.cs (1)
879var diagnostic = Diagnostic.Create(descriptor, context.Symbol.Locations[0]);
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (18)
CodeGen\CodeGenTupleTest.cs (18)
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]);
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (2)
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()));
Microsoft.CodeAnalysis.CSharp.Features (6)
ConvertPrimaryToRegularConstructor\ConvertPrimaryToRegularConstructorCodeRefactoringProvider.cs (1)
186if (member is IFieldSymbol { IsImplicitlyDeclared: true, Locations: [var location, ..] } field)
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;
src\Analyzers\CSharp\Analyzers\MakeStructFieldsWritable\CSharpMakeStructFieldsWritableDiagnosticAnalyzer.cs (1)
74=> namedTypeSymbol.Locations[0];
src\Analyzers\CSharp\CodeFixes\Nullable\CSharpDeclareAsNullableCodeFixProvider.cs (1)
194else if (symbol is IFieldSymbol { CorrespondingTupleField: IFieldSymbol { Locations: [{ IsInSource: true } location] } })
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (2)
Diagnostics\Suppression\RemoveUnnecessaryPragmaSuppressionsTests.cs (2)
104context.ReportDiagnostic(Diagnostic.Create(rule, local.Locations[0])); 1308var diagnostic = Diagnostic.Create(Descriptor, context.Symbol.ContainingNamespace.Locations[0]);
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (3)
Semantics\OperatorTests.cs (2)
7657Assert.Equal(0, symbol1.Locations.Length); 8452Assert.Equal(0, symbol1.Locations.Length);
SourceGeneration\GeneratorDriverTests.cs (1)
141Assert.True(generatedClass.Locations.Single().IsInSource);
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (45)
Compilation\CompilationAPITests.cs (5)
2613Assert.All(type.GetMembers().OfType<IPropertySymbol>().Select(p => p.Locations.FirstOrDefault()), 2633Assert.Equal(loc1, type.GetMembers("m1").Single().Locations.Single()); 2634Assert.Equal(loc2, type.GetMembers("m2").Single().Locations.Single()); 2649Assert.All(type.GetMembers().OfType<IPropertySymbol>().Select(p => p.Locations.FirstOrDefault()), 3454Assert.Equal(2, types[0].Locations.Length);
Compilation\SemanticModelAPITests.cs (7)
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 (2)
1994Assert.Equal(1, type.Locations.Length); 1995Assert.Equal(typeSpan, type.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\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());
Symbols\Source\MethodTests.cs (1)
214Assert.Equal(1, m.First().Locations.Length);
Microsoft.CodeAnalysis.CSharp.Workspaces (8)
Rename\CSharpRenameRewriterLanguageService.cs (8)
146_renamableDeclarationLocation = _renamedSymbol.Locations.FirstOrDefault(loc => loc.IsInSource && loc.SourceTree == _semanticModel.SyntaxTree); 812var token = renamedSymbol.Locations.Single().FindToken(cancellationToken); 827token = matchingParameterSymbol.Locations.Single().FindToken(cancellationToken); 836var token = renamedSymbol.Locations.Single().FindToken(cancellationToken); 865var location = renamedSymbol.Locations.Single(); 895foreach (var location in renamedSymbol.Locations) 913.SelectMany(t => t.Locations); 964foreach (var location in symbol.Locations)
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (5)
CodeGeneration\SymbolEditorTests.cs (5)
356var location = symbol.Locations.Last(); 393var location = symbol.Locations.First(); 434var location = symbol.Locations.Last(); 480var location = symbol.Locations.Last(); 487var newLocation = newSymbol.Locations.Last();
Microsoft.CodeAnalysis.EditorFeatures (3)
InlineRename\AbstractEditorInlineRenameService.SymbolRenameInfo.cs (2)
159if (RenameSymbol.Locations.Length > 1) 167var symbolSourceDocument = this.Document.Project.Solution.GetDocument(RenameSymbol.Locations.Single().SourceTree);
Navigation\AbstractDefinitionLocationService.cs (1)
264if (otherPart.Locations is not [{ SourceTree: { } sourceTree, SourceSpan: var span }])
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (6)
Diagnostics\DiagnosticAnalyzerServiceTests.cs (1)
1047c.ReportDiagnostic(Diagnostic.Create(_supportedDiagnostics[0], c.Symbol.Locations[0]));
MetadataAsSource\AbstractMetadataAsSourceTests.cs (1)
113Assert.False(generatedSymbol.Locations.Where(loc => loc.IsInSource).IsEmpty());
SymbolFinder\DependentTypeFinderTests.cs (4)
583Assert.True(delegates.Any(i => i.Locations.Any(loc => loc.IsInMetadata)), "We should find a metadata delegate"); 584Assert.Single(delegates, i => i.Locations.Any(loc => loc.IsInSource)); // We should find a single source delegate 613Assert.True(enums.Any(i => i.Locations.Any(loc => loc.IsInMetadata)), "We should find a metadata enum"); 614Assert.Single(enums, i => i.Locations.Any(loc => loc.IsInSource)); // We should find a single source type
Microsoft.CodeAnalysis.EditorFeatures.Wpf (2)
Peek\DefinitionPeekableItem.cs (1)
83var sourceLocations = symbol.Locations.Where(l => l.IsInSource).ToList();
Peek\PeekableItemFactory.cs (1)
86var firstLocation = symbol.Locations.FirstOrDefault();
Microsoft.CodeAnalysis.EditorFeatures2.UnitTests (17)
CodeFixes\CodeFixServiceTests.vb (2)
205context.ReportDiagnostic(Diagnostic.Create(DiagDescriptor, context.Symbol.Locations.First(), context.Symbol.Locations.Skip(1)))
Diagnostics\AdditionalFileDiagnosticsTests.vb (1)
97context.ReportDiagnostic(Diagnostic.Create(Rule, context.Symbol.Locations.First()))
Diagnostics\DiagnosticServiceTests.vb (7)
1263Dim sourceLoc = context.Symbol.Locations.First(Function(l) l.IsInSource) 1461Dim diag = Diagnostic.Create(Descriptor, symbolContext.Symbol.Locations(0), additionalFileText) 1548context.ReportDiagnostic(Diagnostic.Create(DiagDescriptor, context.Symbol.Locations.First(), context.Symbol.Locations.Skip(1))) 1574For Each location In context.Symbol.Locations 1603sc.ReportDiagnostic(Diagnostic.Create(DiagDescriptor, sc.Symbol.Locations.First())) 1887ctxt.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.Features (67)
ChangeSignature\AbstractChangeSignatureService.cs (2)
149if (symbol.Locations.Any(static loc => loc.IsInMetadata)) 155var declarationLocation = symbol.Locations.FirstOrDefault();
CodeLens\CodeLensFindReferenceProgress.cs (3)
98var locations = symbol.Locations.Intersect(_queriedSymbol.Locations, LocationComparer.Instance).Any() 100: symbol.Locations; 127!definition.Locations.Any(static loc => loc.IsInSource);
CodeRefactorings\MoveType\AbstractMoveTypeService.State.cs (1)
59typeSymbol.Locations.Any(static loc => loc.IsInMetadata) ||
Debugging\AbstractBreakpointResolver.cs (2)
80var location = methodSymbol.Locations.First(loc => loc.IsInSource); 269if ((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)
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingWorkCoordinator.UnitTestingSemanticChangeProcessor.cs (2)
172=> EnqueueWorkItemAsync(document, symbol.ContainingType != null ? symbol.ContainingType.Locations : symbol.Locations);
ExtractMethod\MethodExtractor.Analyzer.cs (1)
127var localFunctionCallsNotWithinSpan = symbolMap.Keys.Where(s => s.IsLocalFunction() && !s.Locations.Any(static (l, self) => self.SelectionResult.FinalSpan.Contains(l.SourceSpan), this));
ExtractMethod\MethodExtractor.VariableSymbol.cs (19)
166var leftLocations = left.Locations; 167var rightLocations = right.Locations; 221Contract.ThrowIfFalse(_localSymbol.Locations.Length == 1); 222Contract.ThrowIfFalse(other._localSymbol.Locations.Length == 1); 223Contract.ThrowIfFalse(_localSymbol.Locations[0].IsInSource); 224Contract.ThrowIfFalse(other._localSymbol.Locations[0].IsInSource); 225Contract.ThrowIfFalse(_localSymbol.Locations[0].SourceTree == other._localSymbol.Locations[0].SourceTree); 226Contract.ThrowIfFalse(_localSymbol.Locations[0].SourceSpan.Start != other._localSymbol.Locations[0].SourceSpan.Start); 228return _localSymbol.Locations[0].SourceSpan.Start - other._localSymbol.Locations[0].SourceSpan.Start; 243Contract.ThrowIfFalse(_localSymbol.Locations.Length == 1); 244Contract.ThrowIfFalse(_localSymbol.Locations[0].IsInSource); 245Contract.ThrowIfNull(_localSymbol.Locations[0].SourceTree); 247var tree = _localSymbol.Locations[0].SourceTree; 248var span = _localSymbol.Locations[0].SourceSpan; 332var locationLeft = _symbol.Locations.First(); 333var locationRight = other._symbol.Locations.First();
FindUsages\AbstractFindUsagesService_FindImplementations.cs (1)
131foreach (var location in implementation.Locations)
FindUsages\DefinitionItemFactory.cs (4)
39=> ToNonClassifiedDefinitionItem(definition, definition.Locations, solution, options, isPrimary: false, includeHiddenLocations); 69var sourceLocations = GetSourceLocations(definition, definition.Locations, solution, includeHiddenLocations); 167if (!definition.Locations.Any(static location => location.MetadataModule != null)) 196if (!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 (1)
708var locations = symbol.Locations;
MetadataAsSource\AbstractMetadataAsSourceService.AbstractWrappedSymbol.cs (1)
65public ImmutableArray<Location> Locations => _symbol.Locations;
MetadataAsSource\MetadataAsSourceFileService.cs (1)
281if (!symbol.Locations.Any(static l => l.IsInMetadata))
MoveStaticMembers\MoveStaticMembersWithDialogCodeAction.cs (1)
57.Select(symbol => symbol.Locations.FirstOrDefault())
Navigation\NavigableItemFactory.cs (1)
57var 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)
24destination.Locations.Any(static (location, arg) => location.IsInSource && !arg.solution.GetRequiredDocument(location.SourceTree).IsGeneratedCode(arg.cancellationToken), (solution, cancellationToken));
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)
67if (method.Locations.Length != 1 || method.DeclaringSyntaxReferences.Length != 1) 70if (!method.Locations[0].IsInSource)
src\Analyzers\Core\Analyzers\MakeFieldReadonly\AbstractMakeFieldReadonlyDiagnosticAnalyzer.cs (2)
165Locations.Length: 1, 241=> field.Locations[0];
src\Analyzers\Core\Analyzers\NamingStyle\NamingStyleDiagnosticAnalyzerBase.cs (3)
60var sourceTree = symbolContext.Symbol.Locations.FirstOrDefault()?.SourceTree; 88if (symbol?.Locations.FirstOrDefault()?.SourceTree is not { } sourceTree) 169return DiagnosticHelper.Create(Descriptor, symbol.Locations.First(), NotificationOption2.ForSeverity(applicableRule.EnforcementLevel), options, additionalLocations: null, builder.ToImmutable(), failureReason);
src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (2)
142=> symbol.Locations[0]; 618foreach (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\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)
255if (symbol == null || symbol.Locations.IsEmpty || symbol.Kind == SymbolKind.Namespace)
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)
11042context.ReportDiagnostic(Diagnostic.Create(Warning01, context.Symbol.Locations.First())) 11043context.ReportDiagnostic(Diagnostic.Create(Warning03, context.Symbol.Locations.First())) 11066context.ReportDiagnostic(Diagnostic.Create(Warning04, context.Symbol.Locations.First()))
Microsoft.CodeAnalysis.VisualBasic.Features (3)
Debugging\BreakpointResolver.vb (1)
30Dim 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)
1258paramSymbol1.Locations.Single().SourceSpan.Start) 1266paramSymbol2.Locations.Single().SourceSpan.Start - "Optional ".Length) 1274paramSymbol3.Locations.Single().SourceSpan.Start) 1282paramSymbol4.Locations.Single().SourceSpan.Start) 1290paramSymbol5.Locations.Single().SourceSpan.Start) 1369Assert.Equal(syntax.SpanStart + 6, paramSymbol1.Locations.Single().SourceSpan.Start) 1374Assert.Equal(syntax.SpanStart + 6, paramSymbol2.Locations.Single().SourceSpan.Start) 1379Assert.Equal(syntax.SpanStart, paramSymbol3.Locations.Single().SourceSpan.Start) 1384Assert.Equal(syntax.SpanStart + 6, paramSymbol4.Locations.Single().SourceSpan.Start) 1848Assert.Equal(2, tpSymbol1.Locations.Length()) 1849Assert.True(syntax.SpanStart = tpSymbol1.Locations.Item(0).SourceSpan.Start OrElse 1850syntax.SpanStart = tpSymbol1.Locations.Item(1).SourceSpan.Start, 1857Assert.Equal(2, tpSymbol2.Locations.Length()) 1858Assert.True(syntax.SpanStart = tpSymbol2.Locations.Item(0).SourceSpan.Start OrElse 1859syntax.SpanStart = tpSymbol2.Locations.Item(1).SourceSpan.Start, 1866Assert.Equal(2, tpSymbol3.Locations.Length()) 1867Assert.True(syntax.SpanStart = tpSymbol3.Locations.Item(0).SourceSpan.Start OrElse 1868syntax.SpanStart = tpSymbol3.Locations.Item(1).SourceSpan.Start, 1875Assert.Equal(2, tpSymbol4.Locations.Length()) 1876Assert.True(syntax.SpanStart = tpSymbol4.Locations.Item(0).SourceSpan.Start OrElse 1877syntax.SpanStart = tpSymbol4.Locations.Item(1).SourceSpan.Start, 1884Assert.Equal(1, tpSymbol5.Locations.Length()) 1885Assert.Equal(syntax.SpanStart, tpSymbol5.Locations.Single().SourceSpan.Start) 2021Assert.Equal(1, varSymbol1.Locations.Length()) 2022Assert.True(syntax.SpanStart = varSymbol1.Locations.Item(0).SourceSpan.Start OrElse 2023syntax.SpanStart = varSymbol1.Locations.Item(1).SourceSpan.Start, 2031Assert.Equal(1, varSymbol2.Locations.Length()) 2032Assert.True(syntax.SpanStart = varSymbol2.Locations.Item(0).SourceSpan.Start OrElse 2033syntax.SpanStart = varSymbol2.Locations.Item(1).SourceSpan.Start, 2041Assert.Equal(1, varSymbol3.Locations.Length()) 2042Assert.True(syntax.SpanStart = varSymbol3.Locations.Item(0).SourceSpan.Start OrElse 2043syntax.SpanStart = varSymbol3.Locations.Item(1).SourceSpan.Start, 2051Assert.Equal(1, varSymbol4.Locations.Length()) 2052Assert.True(syntax.SpanStart = varSymbol4.Locations.Item(0).SourceSpan.Start OrElse 2053syntax.SpanStart = varSymbol4.Locations.Item(1).SourceSpan.Start, 2061Assert.Equal(1, varSymbol5.Locations.Length()) 2062Assert.True(syntax.SpanStart = varSymbol5.Locations.Item(0).SourceSpan.Start OrElse 2063syntax.SpanStart = varSymbol5.Locations.Item(1).SourceSpan.Start, 2071Assert.Equal(1, varSymbol6.Locations.Length()) 2072Assert.True(syntax.SpanStart = varSymbol6.Locations.Item(0).SourceSpan.Start OrElse 2073syntax.SpanStart = varSymbol6.Locations.Item(1).SourceSpan.Start, 2082Assert.Equal(1, varSymbol7.Locations.Length()) 2083Assert.True(syntax.SpanStart = varSymbol7.Locations.Item(0).SourceSpan.Start OrElse 2084syntax.SpanStart = varSymbol7.Locations.Item(1).SourceSpan.Start, 2092Assert.Equal(1, varSymbol8.Locations.Length()) 2093Assert.True(syntax.SpanStart = varSymbol8.Locations.Item(0).SourceSpan.Start OrElse 2094syntax.SpanStart = varSymbol8.Locations.Item(1).SourceSpan.Start,
Diagnostics\DiagnosticAnalyzerTests.vb (2)
316Dim sourceLoc = context.Symbol.Locations.First(Function(l) l.IsInSource) 510Dim sourceLoc = context.Symbol.Locations.First(Function(l) l.IsInSource)
Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests (2)
DocumentationComments\DocCommentTests.vb (2)
4996Array.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)
90" Location1.SourceSpan.Start : " & tpSymbol.Locations.Item(0).SourceSpan.Start & 91" Location2.SourceSpan.Start : " & tpSymbol.Locations.Item(0).SourceSpan.Start
Microsoft.CodeAnalysis.VisualBasic.Workspaces (6)
Rename\VisualBasicRenameRewriterLanguageService.vb (6)
123_renamableDeclarationLocation = _renamedSymbol.Locations.Where(Function(loc) loc.IsInSource AndAlso loc.SourceTree Is _semanticModel.SyntaxTree).FirstOrDefault() 697Dim token = renamedSymbol.Locations.Single().FindToken(cancellationToken) 723token = matchingParameterSymbol.Locations.Single().FindToken(cancellationToken) 746conflicts.AddRange(renamedSymbol.ContainingSymbol.Locations _ 754Dim token = renamedSymbol.Locations.Single().FindToken(cancellationToken) 779For Each location In renamedSymbol.Locations
Microsoft.CodeAnalysis.Workspaces (60)
FindSymbols\FindReferences\DependentProjectsFinder.cs (1)
120var project = assembly.Locations.Any(static loc => loc.IsInMetadata)
FindSymbols\FindReferences\DependentTypeFinder.cs (3)
73var searchInMetadata = type.Locations.Any(s_isInMetadata); 363derivedType.Locations.Any(s_isInMetadata) && 378Debug.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)
352recommendationSymbol.Locations.Any(
Rename\ConflictEngine\ConflictResolver.cs (7)
101var renameSymbolDeclarationLocation = renameLocations.Symbol.Locations.Where(loc => loc.IsInSource).FirstOrDefault(); 172return conflictResolution.ReplacementTextValid && renamedSymbol != null && renamedSymbol.Locations.Any(static loc => loc.IsInSource); 329foreach (var newLocation in newSymbol.Locations) 354var locations = symbol.Locations; 364overriddenFromMetadata = overriddenSymbol == null || overriddenSymbol.Locations.All(loc => loc.IsInMetadata); 403var locations = symbol.Locations; 407locations = originalsourcesymbol.Locations;
Rename\ConflictEngine\ConflictResolver.Session.cs (3)
243var definitionLocations = _renameLocationSet.Symbol.Locations; 581if (conflictAnnotation.RenameDeclarationLocationReferences[symbolIndex].SymbolLocationsCount != symbol.Locations.Length) 618if (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)
148conflicts.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) 272var aliasLocation = location.Alias.Locations.Single(); 291var 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)) 659(s.IsNamespace() || 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\Extensions\ISymbolExtensions.cs (2)
619=> symbol.Locations.Any() && symbol.Locations.All(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)
26var propertyLocations = properties.SelectAsArray(p => p.Locations.FirstOrDefault());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.BodyLevelSymbolKey.cs (3)
23Contract.ThrowIfTrue(symbol.DeclaringSyntaxReferences.IsEmpty && symbol.Locations.IsEmpty); 27foreach (var location in symbol.Locations) 62Contract.ThrowIfTrue(symbol.DeclaringSyntaxReferences.IsEmpty && symbol.Locations.IsEmpty);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TupleTypeSymbolKey.cs (1)
32locations.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\Core\Utilities\SymbolEquivalenceComparer.EquivalenceVisitor.cs (4)
273return x.Locations.Length == 1 && y.Locations.Length == 1 && 274x.Locations.First().Equals(y.Locations.First());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (4)
100Hash.Combine(x.Locations.FirstOrDefault(), currentHash)); 104=> Hash.Combine(x.Locations.FirstOrDefault(), currentHash); 114return Hash.Combine(x.Locations.FirstOrDefault(), currentHash); 292=> Hash.Combine(x.Locations.FirstOrDefault(), currentHash);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\SymbolFinder\SymbolFinderInternal.cs (2)
70else if (!symbol.Locations.Any(static loc => loc.IsInMetadata)) 92=> symbol != null && symbol.Locations.Any(static loc => loc.IsInSource);
Workspace\Solution\SolutionCompilationState.SymbolToProjectId.cs (2)
81var syntaxTree = symbol.Locations[0].SourceTree; 178Locations: [{ SourceTree: var typeParameterSourceTree }, ..],
Microsoft.CodeAnalysis.Workspaces.UnitTests (1)
FindReferencesTests.cs (1)
653foreach (var location in reference.Definition.Locations)
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.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)
308generatorDiagnostics.ReportDiagnostic(DiagnosticInfo.Create(GeneratorDiagnostics.ComMethodManagedReturnWillBeOutVariable, symbol.Locations[0])); 346symbol.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 (14)
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))
Progression\GraphBuilder.cs (4)
200var preferredLocation = symbol.Locations.FirstOrDefault(l => l.SourceTree != null); 207preferredLocation = symbol.Locations.FirstOrDefault(l => l.SourceTree == syntaxTree) ?? preferredLocation; 211if (preferredLocation == null && symbol.Locations.Any(static loc => loc.IsInMetadata)) 215preferredLocation = newSymbol.Locations.Where(loc => loc.IsInSource).FirstOrDefault();
Progression\GraphQueries\IsUsedByGraphQuery.cs (1)
34var allLocations = referencedSymbol.Locations.Concat(reference.Locations.Select(r => r.Location))
Venus\ContainedLanguageCodeSupport.cs (3)
210var position = type.Locations.First(loc => loc.SourceTree == targetSyntaxTree).SourceSpan.Start; 300? semanticModel.LookupSymbols(position: type.Locations[0].SourceSpan.Start, container: type, name: null) 491var typeLocation = type.Locations.FirstOrDefault(d => d.SourceTree == containingTree);
Workspace\VisualStudioSymbolNavigationService.cs (1)
60var sourceLocations = symbol.Locations.Where(loc => loc.IsInSource);
Microsoft.VisualStudio.LanguageServices.VisualBasic (2)
Venus\ContainedLanguageStaticEventBinding.vb (2)
66Dim targetDocument = document.Project.Solution.GetDocument(memberSymbol.Locations.First().SourceTree) 94Dim 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);
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)
74location: propertySymbol.Locations[0],
System.Windows.Forms.Analyzers.VisualBasic (1)
Analyzers\MissingPropertySerializationConfiguration\MissingPropertySerializationConfigurationDiagnosticAnalyzer.vb (1)
76location:=propertySymbol.Locations(0),