-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix race in GetOpenDocumentInCurrentContextWithChanges #34195
Fix race in GetOpenDocumentInCurrentContextWithChanges #34195
Conversation
This was reading Workspace.CurrentSolution twice, so if the document was removed between two reads it'd end up throwing exceptions or triggering asserts.
Turns out this fixes #33652. |
@jasonmalinowski I believe this occurred while testing in a 16.0 branch. It might be worth taking there since it's also one of our top hitters in integration tests. |
Integration test failure was caused by #34197. Re-running... |
@sharwell, taking this in 16.0 would mean seeking QB approval and I'm not sure it meets the bar there since it's product code changing. It is undoubtedly a bug, but and the risk of the fix is zero though. @jinujoseph let's discuss this on Monday. I don't have a strong feeling of where we take this, but the bar application is pretty weird in this case. |
This comment has been minimized.
This comment has been minimized.
@jasonmalinowski can you fill out the ask mode template and let's do a barcheck for 16.0 |
@jinujoseph: moved this back to dev16.0 and filled out the ask mode template. I'm for taking it, if only because the risk of not fixing it is greater than the risk of fixing it. (i.e. this is negative risk!) |
This was reading Workspace.CurrentSolution twice, so if the document was removed between two reads it'd end up throwing exceptions or triggering asserts.
Fixes #33652
Ask Mode template
Customer scenario
Sometimes when you're using C# or VB code in Visual Studio and you have code lens on, it'll crash.
Bugs this fixes
#33652
Workarounds, if any
Turning off CodeLens will reduce the risk.
Risk
Zero. Trivial bug fix that closes a race.
Performance impact
Zero.
Is this a regression from a previous update?
Yes, ish. The bug has existed for ages, but some changes in 16.0 has probably made it easier to hit.
Root cause analysis
There's a longstanding race in a common helper function that's used in almost every Roslyn feature. The race can happen if a thread is updating the state of our projects while another thread is calling this function. I suspect we've never really noticed this because usually those were always both the UI thread. But in 16.0, we:
How was the bug found?
Internal automated test runs.