forked from dotnet/roslyn
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix crash in the preview of a code action that modified an .editorconfig
For reasons that aren't entirely clear, when we create a preview of a code fix, we remove and re-add documents that are being changed when we produce the PreviewWorkspace. This process had an bug which meant that the file path of an .editorconfig got dropped, so the resultant .editorconfig document path was null. This later caused a crash if the diagnostic engine, when processing the PreviewWorkspace's new solution, tried asking for a Compilation, since the null path would get passed to AnalyzerConfig.Parse(), and it would throw. This was exposed by dotnet#45076; until then if you had a preview of just an .editorconfig file, nothing would actually be analyzed and so nothing asked for the Compilation. The crash is "fixed" by dotnet#44331 in that asking for a Compilation no longer results in a call to AnalyzerConfig.Parse(); you have to ask for a Compilation and then do something with a semantic model. By luck, that doesn't happen in the common repro, but more obscure things absolutely could still fail. This is being tested by the integration test being added in dotnet#46639. We don't really have a good unit tests here as far as I can tell, but even then a unit test really doesn't validate any of the end-to-end here. Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1162464
- Loading branch information
1 parent
6b35d09
commit 0dae2e9
Showing
1 changed file
with
22 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters