Exception handling and bug fix

* Fix bug that resulted in exception that could crash VS
* Handle non-critical exceptions in actions dispatched on the main thread (but not through a `TaskScheduler`)