This guide walks you from a fresh .NET project to a fully wired chaos-engineering setup using Simmy. Each step builds on the last, so by the end you will have a synchronous fault-injection policy, aDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Polly-Contrib/Simmy/llms.txt
Use this file to discover all available pages before exploring further.
PolicyWrap that combines Simmy with standard Polly resilience policies, and an async latency-injection example ready to adapt for your own services.
Install the NuGet package
Add the Once the package is installed, add the required namespaces at the top of your file:
Polly.Contrib.Simmy package to your project. Simmy targets .NET Standard 1.1, 2.0, and 2.1, so it works with any modern .NET runtime.Create a chaos policy that injects an exception
Use the
MonkeyPolicy.InjectException fluent builder to define what fault to throw, how often to throw it, and whether the policy is active. The example below creates a SocketException and injects it on roughly 5 % of executions.Execute code through the chaos policy
A Simmy policy is executed exactly like any other Polly policy. Pass a delegate to When the policy triggers, it throws the configured
Execute and the policy decides — based on the injection rate — whether to run it normally or throw the configured fault.SocketException before someMethod() is ever called. Your surrounding try/catch or outer Polly policies receive the exception exactly as they would if the real network had failed.Wrap chaos inside a Polly PolicyWrap
Simmy policies are designed to sit innermost in a
PolicyWrap. In that position they subvert the outbound call at the last moment, while the outer Polly policies (fallback, timeout, retry, etc.) still observe and react to whatever Simmy injects. This lets you validate that your existing resilience configuration actually handles the failures it is supposed to handle.The outermost policy in a
PolicyWrap is the first to handle any exception or result. Placing Simmy innermost ensures that the fault it injects travels outward through every resilience layer — giving you an end-to-end resilience test rather than a test of Simmy alone.What’s next
Now that you have a working chaos policy, explore the individual policy pages to see the full range of configuration options — including context-driven injection rates, delegate-based fault factories, and dynamicEnabledWhen callbacks that let you tie chaos to external configuration at runtime.
Inject Exception
Full reference for
MonkeyPolicy.InjectException, including delegate-based fault factories.Inject Result
Stub return values such as HTTP error responses without throwing an exception.
Inject Latency
Configure variable delays and validate your timeout thresholds under realistic conditions.
Inject Behaviour
Execute arbitrary pre-call actions to simulate infrastructure-level chaos events.