Fix o# getting stuck after undoing delete/rename/move transient files #1308
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Path "src/Foo.cs" is now "poisoned" because workspace removed the created document, but BufferManager didn't remove it from its internal collections of transient documents.
Adding anything to that path results in documend addition failing with "KeyAlreadyExists" exception, and from the user's perspective, there will be no language features on this path until omnisharp is restarted, and the rest of the workspace will treat contents on that path as non existing.
PR forces BufferManager.OnWorkspaceChanged to properly update its collections on DocumentRemove event.
I expanded existing test, which was file creation only, to test create-delete-create. I could copy that test and add addition asserts, just didn't want to dent on build time with seting up new o# test host (somebody correct me if this is too paranoid 😄).
Create-delete-create is a pretty artificial case, but similar issue can happen in many situations, as in undoing renames, accidental drag'n'drops and switching branches etc.