Class ThrowingRecursionHandler
Breaks a recursion by throwing a descriptive exception.
Inheritance
System.Object
ThrowingRecursionHandler
Implements
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: AutoFixture.Kernel
Assembly: AutoFixture.dll
Syntax
public class ThrowingRecursionHandler : IRecursionHandler
Methods
| Improve this Doc View SourceHandleRecursiveRequest(Object, IEnumerable<Object>)
Handles a recursive request.
Declaration
public object HandleRecursiveRequest(object request, IEnumerable<object> recordedRequests)
Parameters
Type | Name | Description |
---|---|---|
System.Object | request | The request causing the recursion. |
System.Collections.Generic.IEnumerable<System.Object> | recordedRequests | Previously recorded, and yet unhandled, requests. |
Returns
Type | Description |
---|---|
System.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.
This implementation always throws a descriptive exception, instructing the user that the requested type contains a circular reference, and that this is bad API design. The message also contains instructions on how to move on.
Exceptions
Type | Condition |
---|---|
ObjectCreationException | Always. |