Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 4040e13

Browse files
committed
Make InUIThread return false on non-UIThread
Was always returning true when not InUnitTestRunner.
1 parent 9e71747 commit 4040e13

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/GitHub.Exports/Helpers/ThreadingHelper.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public interface IAwaiter : INotifyCompletion
2424

2525
public static class ThreadingHelper
2626
{
27-
public static bool InUIThread => (!Guard.InUnitTestRunner && Application.Current.Dispatcher.CheckAccess()) || !(Guard.InUnitTestRunner);
27+
public static bool InUIThread => Guard.InUnitTestRunner ? true : Application.Current.Dispatcher.CheckAccess();
2828

2929
/// <summary>
3030
/// Gets the Dispatcher for the main thread.
@@ -88,7 +88,7 @@ public AwaiterWrapper()
8888
{
8989
isCompleted = () => true;
9090
onCompleted = c => c();
91-
getResult = () => {};
91+
getResult = () => { };
9292
}
9393

9494
public AwaiterWrapper(MainThreadAwaiter awaiter)

0 commit comments

Comments
 (0)