dotnet / razor

Compiler and tooling experience for Razor ASP.NET Core apps in Visual Studio, Visual Studio for Mac, and VS Code.
https://asp.net
MIT License
496 stars 191 forks source link

Renaming a Razor page can lead to stale diagnostics #9024

Open vsfeedback opened 1 year ago

vsfeedback commented 1 year ago

This issue has been moved from a ticket on Developer Community.


Please see the attached picture.

In .Net Blazor server with .Net 6.0 Long Term Support, the following problem happens.

Repro steps:

  1. Create a new .Net Blazor project wiht .Net 6.0, Windows Auth (in case that matters) in Visual Studio 2022 17.6.

  2. In the project, create "Components" subfolder in Solution Explorer.

  3. Create a new Blazor component in the Components subfolder.

  4. Introduce an error of any kind that Error List would list as an error, such as Method must have a return type, CS1250.

  5. Right-Click, Copy the file to the same Components folder in Solution Exolorer

  6. Error List (appropriately) lists two errors in two files now.

  7. Rename the file, now named as TheOriginal - Copy.razor, as TheActualNameYouWant.razor

  8. Fix the bug in the the original file.

  9. Fix the bug in the newly copied, TheActualNameYouWant.razor

  10. The error list should now be clear, but, the error by the pre-rename file remains and does not go away.

image


Original Comments

Feedback Bot on 14/07/2023, 01:06 PM:

(private comment, text removed)


Original Solutions

(no solutions)

davidwengier commented 1 year ago

The fix here is to deal with workspace pull diagnostics, and return null for any documents that have been removed from the project since the previous workspace pull diagnostics request.