Skip to content
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

FAR missing occurrences in Shared Project Files #3351

Closed
amcasey opened this issue Jun 5, 2015 · 11 comments
Closed

FAR missing occurrences in Shared Project Files #3351

amcasey opened this issue Jun 5, 2015 · 11 comments
Assignees
Milestone

Comments

@amcasey
Copy link
Member

amcasey commented Jun 5, 2015

  1. Sync to amcasey@abbca49
  2. Open roslyn.sln
  3. Open ExpressionEvaluator\Core\Source\ResultProvider\Formatter.TypeNames.cs in the ResultProviderTestUtilities head
  4. On line 305 (sawInvalidIdentifier = !IsIdentifier(identifier);), Find All References of IsIdentifier.

Expected: 3 defs, each with 4 refs
Actual: 3 defs, two with 4 refs each, one with 0 refs

@amcasey
Copy link
Member Author

amcasey commented Jun 5, 2015

FYI @dpoeschl

@dpoeschl
Copy link
Contributor

dpoeschl commented Jun 7, 2015

This repros without syncing to the specified commit by using members from the same type, like GetTypeName.

@dpoeschl
Copy link
Contributor

dpoeschl commented Jun 7, 2015

The scope of this problem is limited to documents linked into projects with the same assembly name. In the given example, ResultProvider.Portable and ResultProvider.NetFX20 both have assembly name Microsoft.CodeAnalysis.ExpressionEvaluator.ResultProvider. Changing either to ...ResultProvider2 allows the Find Symbol Results to show the correct information.

The actual results from AbstractFindReferencesService.FindReferencedSymbolsAsync are incorrect:

image

The first three lines show the projects containing the three definitions, and things look good there. The next three lines show the projects containing the first reference to each of these symbols, and you can see the NetFX20 definition has a reference in Portable. This probably points to a problem under SymbolFinder.FindReferencesAsync somewhere in this situation.

@Pilchie Pilchie added this to the 1.1 milestone Jun 9, 2015
@Pilchie
Copy link
Member

Pilchie commented Jun 9, 2015

IIRC, there are numerous cases where we unify projects based on assembly name.

@balajikris
Copy link
Member

Note: Please also verify and test related bug(s) #3352 when resolving this bug.

@balajikris
Copy link
Member

Note: Added one more customer scenario to the related bug mentioned above (Asp.Net vNext Applications).

@Pilchie
Copy link
Member

Pilchie commented Aug 5, 2015

Tagging @jasonmalinowski. We should consider doing something here to support the Asp.NET 5.0 cases)

@Pilchie Pilchie modified the milestones: 1.2, 1.1 Oct 15, 2015
@jasonmalinowski
Copy link
Member

@Pilchie: hah, somebody testing my csproj -> xproj prototype immediately hit this bug. Already debugged it a bit yesterday, will fix today.

@dpoeschl
Copy link
Contributor

Verify internal bug 162818 when verifying this fix.

@jasonmalinowski
Copy link
Member

I've verified internal bug 162818.

jasonmalinowski added a commit to jasonmalinowski/roslyn that referenced this issue Jan 27, 2016
Before this change, if you had two projects that had the same assembly
name, you might get weird results from find references. Internally it
used assembly name as a cache key for dependent projects, and so as long
as the two projects with same assembly name had different dependent
projects, we might not actually search all the projects we need to in
your solution.

Further, if you had the same linked file in both of these projects,
we wouldn't search all projects that had it linked. This was because
the LinkedFileReferenceFinder would correcty find all the symbols in
linked projects, but the engine would then dedup the list calling those
equal because once again the assembly names were equal. We make a
decision here that when searching for symbols, symbols from source
should never be deduplicated across projects that define them, but
we will still merge metadata symbols as a single referenced symbol.
There is an argument that we should also split up metadata symbols as
well, but many consumers might find it very surprising that suddenly
they get N referenced symbols in the result if there are N projects
in the solution. For now, we'll maintain the result there.

Fixes issue dotnet#3351.
@jasonmalinowski
Copy link
Member

Fixed by #8096.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants