Closed IainmXray closed 6 years ago
I'm not sure what [NoFormat]
is - I have never heard of that before.
If there's no meaningful validation to do on this type, I would suggest adding it to the list of types for which we don't validate their properties.
services.AddMvc(options =>
{
options.ModelMetadataDetailsProviders.Add(new SuppressChildValidationMetadataProvider(typeof(DbGeography)));
});
This issue is being closed because it has not been updated in 3 months.
We apologize if this causes any inconvenience. We ask that if you are still encountering this issue, please log a new issue with updated information and we will investigate.
I ran into this same exact error. I'll create a new ticket.
I am facing issues with the model validation in aspnet.core 1.1.1 throwing a System.InsufficientExecutionStackException when processing an incoming Json payload. I have narrowed this down to the fact that I have a System.Data.Entity.Spatial.DBGeography object in the model. A cut down example for recreation:
Framework version
"frameworks": { "net452": { "imports": [ "dotnet5.4", "portable-net451+win8" ] } }
Example Controller ` [Route("api/v1/[controller]")] public class TestController : Controller {
Example Entity ` public class Test {
Exception thrown (cut down for brevity)
System.InsufficientExecutionStackException: Insufficient stack to continue executing the program safely. This can happen from having too many functions on the call stack or function on the stack using too much stack space. at System.Runtime.CompilerServices.RuntimeHelpers.EnsureSufficientExecutionStack() at Microsoft.AspNetCore.Mvc.ModelBinding.Validation.ValidationVisitor.Visit(ModelMetadata metadata, String key, Object model) at Microsoft.AspNetCore.Mvc.ModelBinding.Validation.ValidationVisitor.VisitChildren(IValidationStrategy strategy) at Microsoft.AspNetCore.Mvc.ModelBinding.Validation.ValidationVisitor.VisitComplexType() at Microsoft.AspNetCore.Mvc.ModelBinding.Validation.ValidationVisitor.Visit(ModelMetadata metadata, String key, Object model) at Microsoft.AspNetCore.Mvc.ModelBinding.Validation.ValidationVisitor.VisitChildren(IValidationStrategy strategy) at Microsoft.AspNetCore.Mvc.ModelBinding.Validation.ValidationVisitor.VisitComplexType() at Microsoft.AspNetCore.Mvc.ModelBinding.Validation.ValidationVisitor.Visit(ModelMetadata metadata, String key, Object model) at Microsoft.AspNetCore.Mvc.ModelBinding.Validation.ValidationVisitor.VisitChildren(IValidationStrategy strategy) at Microsoft.AspNetCore.Mvc.ModelBinding.Validation.ValidationVisitor.VisitComplexType()
Is there any way to intercept the model validation process? I tried creating a NoFormat attribute using the documentation at https://docs.microsoft.com/en-us/aspnet/core/mvc/models/validation but this was never called before the stack overflow.