Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
Failsafe.Tests Add project files. Feb 8, 2019
Failsafe Remove years from copyright Feb 17, 2019
.gitattributes Add .gitignore and .gitattributes. Feb 8, 2019
.gitignore Add project files. Feb 8, 2019
Failsafe.sln Add project files. Feb 8, 2019
License.txt Add project files. Feb 8, 2019 Add project files. Feb 8, 2019
appveyor.yml Add appveyor.yml Feb 8, 2019
favicon.png Add favicon Feb 8, 2019


Build Tests NuGet NuGet

Failsafe is a library that provides a fluent interface for retrying an operation.



  • Retry on specific, derived or any exception
  • Match exceptions with a predicate
  • Limit number of retries
  • Configurable delay between retries
  • Supports synchronous and asynchronous execution
  • Fluent interface
  • Targets .NET Framework 4.5+ and .NET Standard 2.0+
  • No external dependencies


Basic example

var result = Retry.Create().CatchAnyException().Execute(FlakyMethod);

Retry only on specific exceptions

var result = Retry.Create()
	.Catch<InvalidOperationException>() // match specific exception
	.Catch<IOException>(true) // match specific exception and derived from it
	.Catch<FileNotFoundException>(false, ex => ex.FileName == "file.txt") // match specific exception and use predicate

Configure retry limit and delay

var result = Retry.Create()
	.WithMaxTryCount(15) // no more than 15 attempts
	.WithDelay(TimeSpan.FromSeconds(0.2)) // wait 0.2s before trying again

Libraries used