Skip to content

Commit

Permalink
Fix NRE when accessing RxApp.SuspensionHost (reactiveui#2181)
Browse files Browse the repository at this point in the history
  • Loading branch information
worldbeater authored and glennawatson committed Sep 29, 2019
1 parent 5b93917 commit 89c4621
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/ReactiveUI/RxApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ static RxApp()
});
});

_suspensionHost = new SuspensionHost();
if (ModeDetector.InUnitTestRunner())
{
LogHost.Default.Warn("*** Detected Unit Test Runner, setting MainThreadScheduler to CurrentThread ***");
Expand All @@ -124,8 +125,6 @@ static RxApp()
{
_mainThreadScheduler = DefaultScheduler.Instance;
}

SuspensionHost = new SuspensionHost();
}

/// <summary>
Expand Down Expand Up @@ -202,12 +201,7 @@ public static IObserver<Exception> DefaultExceptionHandler
/// </summary>
public static ISuspensionHost SuspensionHost
{
get
{
var host = _unitTestSuspensionHost ?? _suspensionHost;
return host;
}

get => _unitTestSuspensionHost ?? _suspensionHost;
set
{
if (ModeDetector.InUnitTestRunner())
Expand Down

0 comments on commit 89c4621

Please sign in to comment.