-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
Description
Describe the bug
If a command throws an exception the IsExecuting observable is not set to False
Steps To Reproduce
This is a test to reproduce the issue. Thanks to @anaisbetts and @glennawatson for the constant support on Slack.
[Fact]
public void Test1()
{
var subj = new Subject<Unit>();
var isExecuting = false;
Exception fail = null;
var fixture = ReactiveCommand.CreateFromTask(async _ => {
await subj.Take(1);
throw new Exception("die");
});
fixture.IsExecuting.Subscribe(x => isExecuting = x);
Assert.False(isExecuting);
Assert.Null(fail);
fixture.Execute().Subscribe();
Assert.True(isExecuting);
Assert.Null(fail);
subj.OnNext(Unit.Default);
Assert.False(isExecuting); //here it fails
Assert.NotNull(fail);
}
Expected behavior
IsExecuting should be set to False after exception
Environment
Blazor Server on .NET 5
- OS: Windows 10