You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TransitionToMainThreadRaisedWhenSwitchingToMainThread [FAIL]
Assert.Equal() Failure
Expected: 1
Actual: 0
Stack Trace:
src\Microsoft.VisualStudio.Threading.Tests.Shared\JoinableTaskTests.cs(529,0): at Microsoft.VisualStudio.Threading.Tests.JoinableTaskTests.<>c__DisplayClass19_0.<<TransitionToMainThreadRaisedWhenSwitchingToMainThread>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
src\Microsoft.VisualStudio.Threading.Shared\JoinableTask.cs(519,0): at Microsoft.VisualStudio.Threading.JoinableTask.<JoinAsync>d__76.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
src\Microsoft.VisualStudio.Threading.Shared\JoinableTask.cs(884,0): at Microsoft.VisualStudio.Threading.JoinableTask.CompleteOnCurrentThread()
src\Microsoft.VisualStudio.Threading.Shared\JoinableTask.cs(497,0): at Microsoft.VisualStudio.Threading.JoinableTask.Join(CancellationToken cancellationToken)
src\Microsoft.VisualStudio.Threading.Tests.Shared\JoinableTaskTests.cs(546,0): at Microsoft.VisualStudio.Threading.Tests.JoinableTaskTests.TransitionToMainThreadRaisedWhenSwitchingToMainThread()
The text was updated successfully, but these errors were encountered:
…oMainThread
If the threadpool executed the Task.Run delegate fast enough, the returned Task can actually be completed before the calling thread tries to await on it, leading to the next assertion to fail because the main thread transitions never took place.
I fix this by forcing a yield in all cases.
Fixes#44
This test has been observed to fail
The text was updated successfully, but these errors were encountered: