Hopefully you can all handle the VB.NET
without feeling too dirty! :-)
I have a WPF application, .NET 4.5.2, ReactiveUI v126.96.36.199 from NuGet. I am trying to handle exceptions thrown by my commands. This works OK when my command is triggered by a button click, but I also want to execute the command when my view is loaded. Here's the basic setup:
Me.FetchData = ReactiveCommand.CreateAsyncTask( Async Function(x))
Return Await FunctionThatThrowsAnException()End Function
Me.FetchData.ToProperty(Me, Function(x) x.MyData, _myData)
' Just an example of error handling, will use UserError and handle in view...
Sub(ex) Me.Log().ErrorException(ex.Message, ex))' I've also tried this here...
Me.WhenAnyValue(The result is that the exception is thrown, the log message (from the ThrownExceptions handler) is printed, and the application terminates. If I remove the ExecuteAsync call from the view constructor, and just click the button to fetch the data (bound to the same command), then the message is printed and the application stays running.
So, what am I missing about handling ThrownExceptions when calling ExecuteAsync? Please point out anything else the indicates I haven't a clue, since I am really struggling to grok ReactiveUI at this point!