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

Recognize JoinableTaskSynchronizationContext as a foreground kind #7749

Conversation

jasonmalinowski
Copy link
Member

This is quick fix to prevent throwing asserts if CPS has changed the foreground SynchronizationContext.

Looking at this, I suspect we could probably delete half of our foreground logic with something simpler,
but this unblocks others for now.

Review: @dotnet/roslyn-ide

return kind;
switch (syncConextTypeName)
{
case "System.Windows.Threading.DispatcherSynchronizationContext":
Copy link
Member

Choose a reason for hiding this comment

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

minor minor nit . I really don't like all your newlines here.

@CyrusNajmabadi
Copy link
Member

Any idea why all the tests are failing?

@@ -18,7 +18,7 @@ public static T WaitAndGetResult<T>(this Task<T> task, CancellationToken cancell
{
#if DEBUG
var threadKind = ForegroundThreadDataInfo.CurrentForegroundThreadDataKind;
if (threadKind != ForegroundThreadDataKind.Wpf && threadKind != ForegroundThreadDataKind.StaUnitTest)
if (threadKind != ForegroundThreadDataKind.Unknown)
Copy link
Member

Choose a reason for hiding this comment

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

this should probably be ==. If you change to that and everything passes, then 👍 from me.

Copy link
Member Author

Choose a reason for hiding this comment

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

Uh, yeah. That's why you don't write code on New Year's Eve.

This is quick fix to prevent throwing asserts if CPS has changed the
foreground SynchronizationContext.
@jasonmalinowski jasonmalinowski force-pushed the allow-joinable-task-context-as-foreground-thread branch from 1c0259c to 3ae6474 Compare January 4, 2016 16:57
@paulvanbrenk
Copy link
Contributor

👍 Thanks!

@brettfo
Copy link
Member

brettfo commented Jan 4, 2016

I'll be looking into the failed mac build. Link to failed build.

But in the meantime,
test mac please

jasonmalinowski added a commit that referenced this pull request Jan 5, 2016
…text-as-foreground-thread

Recognize JoinableTaskSynchronizationContext as a foreground kind
@jasonmalinowski jasonmalinowski merged commit 7e8e533 into dotnet:master Jan 5, 2016
@jasonmalinowski jasonmalinowski deleted the allow-joinable-task-context-as-foreground-thread branch January 5, 2016 07:35
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.

5 participants