BootStraper.OnUnhandledException does not trigger

Sep 6, 2011 at 3:25 PM
Edited Sep 6, 2011 at 3:29 PM

If the exception is thrown from an action method (Method that return IEnumerable<IResult>)

How can I fix this? I want all exceptions to be logged


Thanks, Anders

Oct 5, 2011 at 9:56 AM

Anyone knows whats causing this? We really need logging on exceptions....

Oct 5, 2011 at 10:18 AM

Have you looked at the documentation? This is intended behaviour. 

Caliburn.Micro’s enumerator checks these properties after it get’s called back from each IResult. If there is either an error or WasCancelled is set to true, we stop execution. You can use this to your advantage. Let’s say you create an IResult for the OpenFileDialog. You could check the result of that dialog, and if the user canceled it, set WasCancelled on the event args. By doing this, you can write an action that assumes that if the code following the Dialog.Show executes, the user must have selected a file. This sort of technique can simplify the logic in such situations. Obviously, you could use the same technique for the SaveFileDialog or any confirmation style message box if you so desired. My favorite part of the LoadCatalog implementation shown above, is that the original implementation was written by a CM user! Thanks janoveh for this awesome submission! As a side note, one of the things we added to the CM project site is a “Recipes” section. We are going to be adding more common solutions such as this to that area in the coming months. So, it will be a great place to check for cool plugins and customizations to the framework.

If you put a breakpoint in SequentialResult

if(moveNextSucceeded) {
                try {
                    var next = enumerator.Current;
                    next.Completed += ChildCompleted;
                catch(Exception ex) {
                    OnComplete(ex, false);

maybe you will get some idea on the exception..

Oct 5, 2011 at 1:26 PM

You can also hook an handler to Coroutine.Completed event, which is fired every time a coroutine execution ends.
That would allow you to determine whether the execution succeded and access possibly exception instance.  

Anyway, the default Coroutine.Completed handler already logs exceptions (in CM log).