-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
Description
Describe the bug
There seem to be 2 issues in the SuspensionHostExtensions class which appeared after upgrading to version 11.5.1. I'll describe them both here since they are quite small. I believe this is because of changes introduced in this commit.
SetupDefaultSuspendResumealways throwsNullReferenceException. I think this is because this code was added to the method:
if (item.AppState == null)
{
throw new NullReferenceException(nameof(item.AppState));
}
As far as I understand, item.AppState is always going to be null at this point, because we're just setting up the suspension host and the app state didn't have a chance to be initialized yet.
ObserveAppStatealways throwsInvalidCastException. This is because this line:
return item.WhenAny(x => x.AppState, x => (T)x.Value)
was changed to this:
return item.WhenAny(x => x.AppState, x => (T)x)
So now instead of casting x.Value, it tries to cast x which is of type ObservedChange.
Steps To Reproduce
- Try to set up the suspension driver as described in ReactiveUI's docs or in Avalonia's docs.
Expected behavior
Well, I would expect it not to throw any exceptions :)
Environment
- OS: Windows 10
- Version: 11.5.1
eli191 and worldbeater