Skip to content

EnC diagnostics not cleared on session end for Razor design time files #54582

@dibarbet

Description

@dibarbet

Currently, EnC triggers diagnostic reanalyze when the EnC session ends here - https://sourceroslyn.io/#Microsoft.CodeAnalysis.Features/EditAndContinue/Remote/RemoteDebuggingSessionProxy.cs,83

The documentsToReanalyze is retrieved by asking the OOP which documents it created EnC diagnostics for. However, for razor documents these documents are the compile time source generated razor documents and not the design time documents. So reanalysis is not triggered for the razor design time documents.

This prevents a problem for LSP as we listen to diagnostic change events per document to know when to clear our cached diagnostics. And in the razor case, all LSP requests are served on the design time razor document. Since re-analysis is not triggered for the design time razor documents, it does not send a diagnostics updated notification that tells the LSP handler to clear the cached diagnostics for the design time razor document. This results in stale EnC diagnostics as we do not know to remove them after session end.
Note that sometimes they are removed due to other diagnostic analysis triggering events for the design time razor document, and further typing will cause the diagnostics to refresh.

This can be reproduced by making a rude edit in a razor file and then immediately stopping the EnC session

cc @NTaylorMullen, @tmat

Metadata

Metadata

Assignees

Labels

Area-IDEBugLSPissues related to the roslyn language server protocol implementation

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions