Fix Hot Reload checksum mismatch for files without UTF-8 BOM#81480
Fix Hot Reload checksum mismatch for files without UTF-8 BOM#81480noiseonwires wants to merge 1 commit intodotnet:mainfrom
Conversation
|
@tmat could you please take a look? |
| // So by default it always calculates the checksum as BOM is present, | ||
| // and if the file is saved without BOM, it will not match the baseline checksum in PDB. | ||
| // In case if the current file is saved without BOM, it will cause the whole project marked is stale. | ||
| // This is a workaround to handle this specific scenario. |
There was a problem hiding this comment.
It seems like the core of the issue is in LSP server. I'd rather push on getting fix there. This workaround does not address other encodings people might use.
There was a problem hiding this comment.
So far, here Roslyn supports only UTF-8.
LSP protocol (and types like DidOpenTextDocumentParams) doesn't have encoding data (already discussed in #63583), so this will probably require much more massive work to be done.
Here we can apply the fallback if we see that checksum check failed. TBH I don't have any clear picture of how we can do something similar in LanguageServer (until we get encoding data from IDE, that will require also updating LSP clients in IDEs).
|
Superseded by #81933 |
When validating source files against PDB checksums during Hot Reload, try multiple UTF-8 encoding configurations without BOM to find a matching checksum.
This fixes ENC1008 errors that occur when files are created without a BOM (e.g., by VS Code) but Roslyn
assumes UTF-8 with BOM for checksum calculation (AzDO#2067885).
Please see my comment in
roslyn/src/Features/Core/Portable/EditAndContinue/CommittedSolution.csthat explains how it happens.See also: #63583