You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As I understand the Avalonia and Reactive UI documentation when unhandled exception is thrown from ReactiveCommand an application should terminate. But this does not happen.
To Reproduce
Create application from Avalonia MVVM template.
Add ReactiveCommand to MainWindowViewModel which just throws exception.
// in MainWindowViewModel class
public ReactiveCommand<Unit, Unit> ThrowExceptionCommand { get; }
// in MainWindowViewModel constructor
ThrowExceptionCommand = ReactiveCommand.Create(() =>
{
throw new Exception("Exception should terminate app.");
});
Add Button to invoke ReactiveCommand added in step 2 in MainWindow.axaml.
Override RxApp.DefaultExceptionHandler if you want a proper control over unhandled exceptions in Rx pipeline.
From my point of view the proper handling of an unhandled exception is to terminate an application.
As a workaround I added RxApp.DefaultExceptionHandler to bypass AvaloniaScheduler current thread optimization like that:
RxApp.DefaultExceptionHandler = Observer.Create<Exception>(exception =>
{
Dispatcher.UIThread.Post(() => throw new UnhandledErrorException("Unhandled exception was thrown.", exception),
DispatcherPriority.Send);
});
Describe the bug
As I understand the Avalonia and Reactive UI documentation when unhandled exception is thrown from ReactiveCommand an application should terminate. But this does not happen.
To Reproduce
Create application from Avalonia MVVM template.
Add ReactiveCommand to MainWindowViewModel which just throws exception.
Add Button to invoke ReactiveCommand added in step 2 in MainWindow.axaml.
Start application and press the Throw Exception Command Button
See that nothing happens. Application stays open.
Expected behavior
Applcation should terminate.
Avalonia version
11.0.6
OS
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: