Skip to content
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

Merged
merged 1 commit into from
Mar 23, 2019

Conversation

sharwell
Copy link
Member

@sharwell sharwell commented Mar 22, 2019

This is an interim stability improvement while @jasonmalinowski continues to investigate asynchronous operations in this path.

@sharwell sharwell requested a review from a team as a code owner March 22, 2019 20:39
@@ -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,
Copy link
Member

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);
Copy link
Member

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"?

Copy link
Member Author

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) =>
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

@JoeRobich JoeRobich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sharwell sharwell merged commit ced90cb into dotnet:dev16.0 Mar 23, 2019
@sharwell sharwell deleted the fix-editorconfig-tests branch July 2, 2020 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants