-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Fail more gracefully when option collections cleared #4690
Comments
@dougbu can you take a look? Some issue with nullable decimals? |
Sure |
I gave a quick try to this yesterday, (just rendering a Product with a decimal? property set to null) and it didn't repro for me, I would test the scenario in which you add an error and render the view again |
@lammia07 Can you provide the full call stack, or even better, a repro for this? What version are you using RC2? |
Hi. Sry for bothering you. Best regards Michael |
Thanks for the update. If this is happening due to clearing something in the options we should give a better error message than just a nullref |
If this is about failing more gracefully, I'm moving it to 1.0.1. |
Went through all MVC-defined options and broke them in two groups. Will send a PR to improve failure modes for the first group. Worth improving errors when
|
|
Was actually on the fence about |
Left out checks for New list of must-not-be-empty options properties:
|
- #4690 - move `ModelBindingMessageProvider` init from `DefaultBindingMetadataProvider` to `DefaultModelMetadata` - in addition to avoiding error cases, this removes some boilerplate - add specific errors to `BodyModelBinderProvider`, `CompositeViewEngine`, `DefaultRazorViewEngineFileProviderAccessor`, `ModelBinderFactory`, and `ObjectResultExecutor`
- #4690 - move `ModelBindingMessageProvider` init from `DefaultBindingMetadataProvider` to `DefaultModelMetadata` - in addition to avoiding error cases, this removes some boilerplate - add specific errors to `BodyModelBinderProvider`, `CompilerCache`, `CompositeViewEngine`, `ModelBinderFactory`, and `ObjectResultExecutor` - `DefaultRazorViewEngineFileProviderAccessor.FileProvider` now a `NullFileProvider` in empty case
Hi.
When I try to call Html.TextBox on a decimal? Property in a View, with a null value, I get a NullReferenceException.
at Microsoft.AspNetCore.Mvc.DataAnnotations.Internal.NumericClientModelValidator.GetErrorMessage(ModelMetadata modelMetadata)
Can you please provide me with some help.
regards Michael
The text was updated successfully, but these errors were encountered: