-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Update code to use GetFirstLocation() instead of Locations[0] or Locations.First() #80709
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
CustomSymbolDisplayFormatter.QualifiedName(outermostVariantInterface), | ||
AssociatedSymbol.Name), | ||
Locations(0))) | ||
GetFirstLocation())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with adding this to VB, but only if it doesn't stackoverflow
@CyrusNajmabadi Please use more descriptive PR title so that it would be clear what is the goal and expected impact of this change. |
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.