Don't throw exceptions for file changes after a project is unloaded#57782
Merged
jasonmalinowski merged 2 commits intodotnet:mainfrom Nov 16, 2021
Merged
Conversation
ryzngard
approved these changes
Nov 16, 2021
| _eventSubscriptionTracker.Clear(); | ||
| } | ||
|
|
||
| _documentFileChangeContext.Dispose(); |
Contributor
There was a problem hiding this comment.
Should the dispose be in the lock, or are we guaranteed no race calls to RemoveFromWorkspace?
Member
Author
There was a problem hiding this comment.
Once we're at this point, we know there's only one thread handling the disposal.
| Private ReadOnly _lock As New Object | ||
| Private ReadOnly _watchedFiles As New List(Of WatchedEntity) | ||
| Private ReadOnly _watchedDirectories As New List(Of WatchedEntity) | ||
| Private _watchedFiles As ImmutableList(Of WatchedEntity) = ImmutableList(Of WatchedEntity).Empty |
Contributor
There was a problem hiding this comment.
I'm not entirely sure why these were changed. Is it a perf concern? List actually seems better since we treat them as mutable under a lock.
Member
Author
There was a problem hiding this comment.
To properly test this fix, I need to implement support in the mock to test the sequence of events of:
- Capture the list of watched entities.
- Unsubscribe from something.
- Raise the event from the captured list in 1.
Making this immutable means I can easily capture it for later.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
File change notifications are async, and can come after we've removed the project from the workspace. As of this writing, this has happened approximately 58 million times since 16.0 according to fault telemetry.
Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1433689