Share via

ModelStateDictionary.MaxAllowedErrors Property


Gets or sets the maximum allowed model state errors in this instance of ModelStateDictionary. Defaults to 200.

 property int MaxAllowedErrors { int get(); void set(int value); };
public int MaxAllowedErrors { get; set; }
member this.MaxAllowedErrors : int with get, set
Public Property MaxAllowedErrors As Integer

Property Value


ModelStateDictionary tracks the number of model errors added by calls to AddModelError(String, Exception, ModelMetadata) or TryAddModelError(String, Exception, ModelMetadata). Once the value of MaxAllowedErrors - 1 is reached, if another attempt is made to add an error, the error message will be ignored and a TooManyModelErrorsException will be added.

Errors added via modifying ModelStateEntry directly do not count towards this limit.

Applies to