This project is read-only.


Rescue method is called 3 times for single error in IResult


I have a button x:Name="Start". When I click it OnError is invoked three times:
public bool OnError(Exception ex)
    return false;

public IEnumerable<IResult> Start()
    yield return new DelegateResult(callback => callback(new InvalidOperationException("Horrible error")));
DelegateResult is same as in

file attachments

Closed Apr 3, 2011 at 1:40 AM by EisenbergEffect
Bottom line here is that you shouldn't expect "normal" behavior if your Rescue returns false. That just indicates that you aren't capable of handling the exception and the framework is going to purposefully crash your application. That is by design. Yes, it would be idea if the rescue was only called once at that point, but it's not really relevant since the app is going to crash anyways. To fix this would require some major re-design to the filters mechanism, which just isn't going to happen. I recommend implementing a custom Rescue that does what you want it to do and then returns true. It will only be called once then.


EisenbergEffect wrote Apr 2, 2011 at 3:38 PM

Can you attach a sample that reproduces this? That would help me to get it fixed fast.

MatFiz wrote Apr 2, 2011 at 11:53 PM

Sample project attached.

Start method in ShellViewModel has [Rescue("OnError")].
OnError returns false.
Global exception handler is defined in MyBootstrapper.

After you click "Start" you'll see "Horrible Error" displayed three times (i.e. OnError is invoked three times).

It's better to first run the sample without debugger attached to see behaviour without Visual Studio unhandled exception pop-ups.