Interface IRecursionHandler

Namespace: AutoFixture.Kernel
Assembly: AutoFixture.dll

Handles a recursive request.

public interface IRecursionHandler

Remarks

When AutoFixture is asked to create instances of complex custom types, it uses Reflection to figure out which constructor arguments and property values to assign. If the custom types contains circular references, this will cause an infinite recursion. To prevent that, `RecursionGuard` monitors requests in order to detect this type of situation. If RecursionGuard detects this situation, it calls `Object%7d)` on a composed IRecursionHandler.

Methods

HandleRecursiveRequest(object, IEnumerable<object>)

Handles a recursive request.

object HandleRecursiveRequest(object request, IEnumerable<object> recordedRequests)

Parameters

request object

The request causing the recursion.

recordedRequests IEnumerable<object>

Previously recorded, and yet unhandled, requests.

Returns

object

An object intended to break the recursion.

Remarks

This method is called when AutoFixture detects an infinite recursion. The request is the request that triggered the recursion detection; recordedRequests contains all previous, but still unhandled requests: the current call stack, if you will.