dotnet / roslyn

The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/
MIT License
19.11k stars 4.04k forks source link

CodeLens doesn't show all other references when unmapped lines exist #47606

Open NTaylorMullen opened 4 years ago

NTaylorMullen commented 4 years ago

Version Used: image

Steps to Reproduce:

Repro:

  1. Create new ASP.NET Core MVC Web Application (model -> view -> controller)
  2. Open ErrorViewModel'
  3. Expand the CodeLens

Expected Behavior: Reference count should read 1 instead of 3

Actual Behavior:

image

NTaylorMullen commented 4 years ago

Looking at the details of the application I would have expected ErrorViewModel to also report its usage in: image

And I think the 3rd reference count is from the unmapped line location. If I delete the @model ErrorViewModel in Error.cshtml I end up getting 0 references on ErrorViewModel which also seems odd though

JoeRobich commented 4 years ago

I think it is interesting that Find All References correctly includes the usage from HomeController. image