Update code to use GetFirstLocation() instead of Locations[0] or Locations.First()#80709
Merged
CyrusNajmabadi merged 12 commits intodotnet:mainfrom Oct 20, 2025
Merged
Update code to use GetFirstLocation() instead of Locations[0] or Locations.First()#80709CyrusNajmabadi merged 12 commits intodotnet:mainfrom
CyrusNajmabadi merged 12 commits intodotnet:mainfrom
Conversation
CyrusNajmabadi
commented
Oct 14, 2025
| CustomSymbolDisplayFormatter.QualifiedName(outermostVariantInterface), | ||
| AssociatedSymbol.Name), | ||
| Locations(0))) | ||
| GetFirstLocation())) |
Contributor
Author
There was a problem hiding this comment.
note: if we don't want to update VB, i'm fine with that and can revert this. But it seems sensible to me. It also means we can optimize GetFirstLocation in the future (like we have for C#) and get the benfit for vb as well automatically.
333fred
reviewed
Oct 14, 2025
Member
333fred
left a comment
There was a problem hiding this comment.
I'm fine with adding this to VB, but only if it doesn't stackoverflow
Contributor
|
@CyrusNajmabadi Please use more descriptive PR title so that it would be clear what is the goal and expected impact of this change. |
333fred
approved these changes
Oct 14, 2025
jcouv
reviewed
Oct 15, 2025
jcouv
reviewed
Oct 15, 2025
jcouv
reviewed
Oct 15, 2025
Member
jcouv
left a comment
There was a problem hiding this comment.
Done with review pass (commit 11)
Contributor
Author
|
@dotnet/roslyn-compiler for a second pair of eyes. |
This was referenced Oct 25, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #29707
This is faster in C# for some symbols as it does not need to realize arrays to wrap a single location for many symbols. There is also GetFirstLocationOrNone if you need to call on a symbol which does not have locations.