Frame based navigation OnActivateAsync and exceptions
If an Exception occurs inside OnActivateAsync the view gets activated anyway.
What is the recommended way to handle exceptions inside OnActivateAsync?
Thanks, Enrico
OnActivateAsync is a place to run code before the View is shown. For example, you could get data from a database or web service to display to a user. I would use a try catch block to handle any exceptions that may occur in the OnActivateAsync. If an exception does happen, I would show the user an error message.
What are you expecting to happen?
I was expecting it to cancel the navigation and call Deactivate. I understand now that this is by design and It's also related to my other issue.
I'd need to modify my code and check if I can navigate to a vm before activating it. Right?
I'm using Aurelia (another Rob's creature) for web solutions and the router has an elegant way to allow vm to be activated: https://aurelia.io/docs/api/router/interface/RoutableComponentCanActivate/method/canActivate/ maybe some idea to bring to Caliburn Micro.