This is a fix for the specific case reported in #3743 and also a few related cases where the object being validated does not come from user input. Because the CancellationToken is bound using the 'empty prefix', suppressing validation causes the validation system to suppress ALL keys in the MSD. This will wipe out validation info for other, unrelated model data. The same can occur for [FromServices], IFormCollection, IFormFile, and HttpRequestMessage (anythere when MSD key == null and SuppressValidation == true). The other change here is related to the [FromBody]. We don't want to create an entry in the model state for a 'valid' model with the empty prefix. This can cause the system to miss validation errors. If you end up in a situation where there's an entry with the empty prefix for an invalid state, you won't accidentally miss validation errors. |
||
|---|---|---|
| .. | ||
| Models | ||
| ActionParametersIntegrationTest.cs | ||
| ArrayModelBinderIntegrationTest.cs | ||
| BinderTypeBasedModelBinderIntegrationTest.cs | ||
| BodyValidationIntegrationTests.cs | ||
| ByteArrayModelBinderIntegrationTest.cs | ||
| CancellationTokenModelBinderIntegrationTest.cs | ||
| CollectionModelBinderIntegrationTest.cs | ||
| CompanyNameAttribute.cs | ||
| DictionaryModelBinderIntegrationTest.cs | ||
| FormCollectionModelBindingIntegrationTest.cs | ||
| FormFileModelBindingIntegrationTest.cs | ||
| GenericModelBinderIntegrationTest.cs | ||
| HeaderModelBinderIntegrationTest.cs | ||
| KeyValuePairModelBinderIntegrationTest.cs | ||
| Microsoft.AspNetCore.Mvc.IntegrationTests.xproj | ||
| ModelBindingTestHelper.cs | ||
| ModelPrefixSelectionIntegrationTest.cs | ||
| MutableObjectModelBinderIntegrationTest.cs | ||
| ProductValidatorAttribute.cs | ||
| ServicesModelBinderIntegrationTest.cs | ||
| SimpleTypeModelBinderIntegrationTest.cs | ||
| TestMvcOptions.cs | ||
| TryUpdateModelIntegrationTest.cs | ||
| TryValidateModelIntegrationTest.cs | ||
| ValidationIntegrationTests.cs | ||
| project.json | ||