Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion src/ReactiveUI/RxApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public static class RxApp
[ThreadStatic]
private static ISuspensionHost _unitTestSuspensionHost;
private static ISuspensionHost _suspensionHost;
private static bool _hasSchedulerBeenChecked;

/// <summary>
/// Initializes static members of the <see cref="RxApp"/> class.
Expand Down Expand Up @@ -135,7 +136,25 @@ static RxApp()
/// </summary>
public static IScheduler MainThreadScheduler
{
get => _unitTestMainThreadScheduler ?? _mainThreadScheduler;
get
{
if (_unitTestMainThreadScheduler != null)
{
return _unitTestMainThreadScheduler;
}

// If Scheduler is DefaultScheduler, user is likely using .NET Standard
if (!_hasSchedulerBeenChecked && _mainThreadScheduler == Scheduler.Default)
{
_hasSchedulerBeenChecked = true;
LogHost.Default.Warn("It seems you are running .NET Standard, but there is no host package installed!\n");
LogHost.Default.Warn("You will need to install the specific host package for your platform (ReactiveUI.WPF, ReactiveUI.Blazor, ...)\n");
LogHost.Default.Warn("You can install the needed package via NuGet, see https://reactiveui.net/docs/getting-started/installation/");
}

return _mainThreadScheduler;
}

set
{
// N.B. The ThreadStatic dance here is for the unit test case -
Expand Down