Fix logic issue in find-refs that could fail to find related symbols in inheritance#61972
Conversation
|
|
||
| if (projects.Count == 1) | ||
| { | ||
| orderedProjectsToExamine = projects.ToImmutableArray(); |
There was a problem hiding this comment.
the issue here was htat we attempted to have an optimization whereby we assumed that if we were only examining a single project, that we only had to check that project alone to find out if it derived from teh type we were looking for. This is trivially not true with a case like:
project1
class A { }
class B : A { }
project2
class C : B { }
Here, searching for the derived types of 'A' would not find 'C' if we were looking only in project2 (which can happen as find-refs is sweeping projects).
This is often unnoticeable as we will normally find 'B' and then discover teh relation between B and C when in project2. However, in the reported issue teh user has:
project1
class A { public virtual void F() { } }
class B : A { }
project2
class C : B { public override void F() { } }
Here, as we're searching for overrides for 'F' we do not dive into 'B' (as it doesn't have an override itself). So we don't have consider the 'B' type when contiuing to look for derived types in project2. As such, we miss the override in it.
Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1555496