When processing a PUT call, the WebAPI handler seems to go into a type situation when checking the model. The exception is not clear, and there is no indication as to what in the model causes this verification class to be included in the loop. Attaching a debugger does nothing. The handler will never be called, the serializer will deserialize the sent json, usually without incident. What could be wrong?
The following code just loops a few hundred times before exiting the exception exception
There is not enough stack to continue executing the program safely. This may be due to too many functions on the call stack or functions on the stack, using too much stack space.
at System.Runtime.CompilerServices.RuntimeHelpers.EnsureSufficientExecutionStack() at System.Web.Http.Validation.DefaultBodyModelValidator.ValidateNodeAndChildren(ModelMetadata metadata, ValidationContext validationContext, Object container, IEnumerable`1 validators) at System.Web.Http.Validation.DefaultBodyModelValidator.ValidateProperties(ModelMetadata metadata, ValidationContext validationContext)
The model is similar to this simple example. The model has default values, which I can confirm, all are initialized. The model also has no references to itself.
public class Example { [Required] public string test {get; set;} [Required] public CustomEnumType myEnum {get; set;} }
source share