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

Stay on the UI thread if it's blocked waiting for us #64813

Conversation

jasonmalinowski
Copy link
Member

We were jumping to the background thread here since the rest of the method doesn't need to run on the UI thead. Since a number of legacy callers may be running us under a JoinableTaskFactory.Run(), we should stay on the UI thread in that case rather than wait for the thread pool which could also be starved.

Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1637719

We were jumping to the background thread here since the rest of the
method doesn't need to run on the UI thead. Since a number of legacy
callers may be running us under a JoinableTaskFactory.Run(), we should
stay on the UI thread in that case rather than wait for the thread pool
which could also be starved.

Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1637719
@jasonmalinowski jasonmalinowski requested a review from a team as a code owner October 18, 2022 23:28
@jasonmalinowski jasonmalinowski self-assigned this Oct 18, 2022
@jasonmalinowski jasonmalinowski merged commit 10cfffd into dotnet:main Oct 19, 2022
@jasonmalinowski jasonmalinowski deleted the stay-on-ui-thread-if-already-blocked branch October 19, 2022 01:53
@ghost ghost added this to the Next milestone Oct 19, 2022
@@ -144,14 +151,16 @@ public Task<VisualStudioProject> CreateAndAddToWorkspaceAsync(string projectSyst
{
w.OnProjectAdded(projectInfo);
}
}).ConfigureAwait(false);
});
Copy link
Member

Choose a reason for hiding this comment

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

would prefer an explicit ConfigureAwait(true) here.


// Ensure that other VS contexts get accurate information that the UIContext for this language is now active.
// This is not cancellable as we have already mutated the solution.
await _visualStudioWorkspaceImpl.RefreshProjectExistsUIContextForLanguageAsync(language, CancellationToken.None).ConfigureAwait(false);
await _visualStudioWorkspaceImpl.RefreshProjectExistsUIContextForLanguageAsync(language, CancellationToken.None);
Copy link
Member

Choose a reason for hiding this comment

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

would prefer an explicit ConfigureAwait(true) here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants