-
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
Updated wait operations to fix unreliable .editorconfig integration tests #34361
Conversation
@@ -197,6 +197,12 @@ class C | |||
MarkupTestFile.GetSpans(markup, out var text, out ImmutableArray<TextSpan> spans); | |||
SetUpEditor(markup); | |||
VisualStudio.WaitForApplicationIdle(CancellationToken.None); | |||
VisualStudio.Workspace.WaitForAllAsyncOperations( | |||
Helper.HangMitigatingTimeout, | |||
FeatureAttribute.Workspace, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So it occurred to me this one is necessary, because there's the window between the file being opened and we haven't wired up to it. So it's not just a unknown reason...there's logic behind it.
|
||
public void EndWaitForCodingConventionsChange(TimeSpan timeout) | ||
{ | ||
var watcher = Interlocked.Exchange(ref _codingConventionsChangedWatcher, null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the Interlocked.Exchange actually necessary for any threading reason or just a less annoying way to deal with the "copy to a local, then set the field to null"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The latter. None of the integration test out-of-proc/in-proc helpers are safe for concurrent use.
{ | ||
var codingConventionsManager = GetComponentModelService<ICodingConventionsManager>(); | ||
_codingConventionContext = codingConventionsManager.GetConventionContextAsync(filePath, CancellationToken.None).Result; | ||
_codingConventionContext.CodingConventionsChangedAsync += (sender, e) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're not unsubscribing anywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently we are not. I can send a follow-up PR to the master branch to fix this after this one is merged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This is an interim stability improvement while @jasonmalinowski continues to investigate asynchronous operations in this path.