Can I use the Exception Handling Block to retry operations?

Topics: Exception Handling Application Block
Nov 22, 2007 at 2:01 PM
I'd like to be able to use the exception handling block to retry an operation. Here's the sort of code I have:

DoOperation(); // can fail at runtime
catch (Exception ex)
bool rethrow = ExceptionPolicy.HandleException(ex, "RetryOption");

In my exception handler, I'd like to log the exception and offer the user a dialog box with a "Retry" button that can be used to retry the operation.

Is there a nice way to do this using the Exception Handling Block? There doesn't seem to be a way to return any information from the HandleException method other than the rethrow flag.

Aug 15, 2012 at 5:04 PM

Not the Exception Handling Application Block, but a new Transient Fault Handling Application Block.

It provides an extensible collection of retry strategies including:

  • Incremental
  • Fixed interval
  • Exponential back-off

It also includes a collection of error detection strategies for cloud-based services.

For more information see this chapter of the Developer's Guide.

Available via NuGet (search for 'topaz').