Commit db0983c
committed
Merge branch 'bugfix/AttributeBindingModel.Value-required' into release/5.1.0
In a previous update, we changed the syntax for non-nullable properties to use the null-forgiving operator instead of the nullable attributes (e.g., `[NotNull]`, `[DisallowNull]`). These should be equivalent, but the ASP.NET Core model validation syntax doesn't treat them as such. As a result, it started throwing model validation exceptions for `Value` when a radio button wasn't selected, in which case no value is set. Technically, this should have been a long-standing bug; the new behavior is actually correct. This exposes an issue that the `Value` _should_ be nullable, for the specific case of radio buttons.
By marking this nullable, some downstream calls in `EditorController` raised potential null dereference warnings. In both cases, we would never expect the value to be null, since those types (`Key`, relationships) don't use radio buttons. As such, these were both decorated with the null-forgiving operator as well; if they are _not_ null, a dereference exception _should_ occur—though we never expect this to occur, so we're not _explicitly_ checking for this scenario.2 files changed
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
438 | 438 | | |
439 | 439 | | |
440 | 440 | | |
441 | | - | |
| 441 | + | |
442 | 442 | | |
443 | 443 | | |
444 | 444 | | |
| |||
471 | 471 | | |
472 | 472 | | |
473 | 473 | | |
474 | | - | |
| 474 | + | |
475 | 475 | | |
476 | 476 | | |
477 | 477 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
0 commit comments