This repository has been archived by the owner on Dec 14, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
ArgumentNullException
thrown in DefaultHtmlGenerator.GetCurrentValues()
#2664
Comments
dougbu
added a commit
that referenced
this issue
Jun 8, 2015
- test additional cases _close_ to these bugs as well for #1485 - show odd `@Html.CheckBox()`, `@Html.Hidden()` behaviour in unit tests - show odd `@Html.TextBox()` behaviour in functional tests (templates) for #1487 - show odd `@Html.Value()` behaviour in unit tests - show odd `@Html.RadioButton()`, `@Html.TextArea()` behaviour in functional tests - show lack of validation attributes for `@Html.RadioButton()`, `<select>` tag helper for #2662 - show odd `@Html.RadioButton(string.Empty)` behaviour in functional tests for #2664 - show failures with `@Html.ListBox()` in unit tests nits: - test `IHtmlHelper` methods, not extensions - use `ViewData`, not `ViewBag` in `HtmlGeneration_FormController` - name test methods a bit more consistently - rename `HtmlHelperValueExtensionsTest` to `HtmlHelperValueTest`
dougbu
added a commit
that referenced
this issue
Jun 9, 2015
- builds on dougbu/testing.1485.1487.2662.2664 branch, unblocking some #1487 tests - use new property to correctly determine `isTargetEnum` in `GetCurrentValues()` - avoid `ArgumentNullException` in all cases where raw values are `enum` but target is not - also use new property instead of private `GetElementType()` methods where possible nits: - move properties above methods in `ModelMetadata` - avoid accidentally-incorrect "Remove Unnecessary Usings"
dougbu
added a commit
that referenced
this issue
Jun 9, 2015
- test additional cases _close_ to these bugs as well for #1485 - show odd `@Html.CheckBox()`, `@Html.Hidden()` behaviour in unit tests - show odd `@Html.TextBox()` behaviour in functional tests (templates) for #1487 - show odd `@Html.Value()` behaviour in unit tests - show odd `@Html.RadioButton()`, `@Html.TextArea()` behaviour in functional tests - show lack of validation attributes for `@Html.RadioButton()`, `<select>` tag helper for #2662 - show odd `@Html.RadioButton(string.Empty)` behaviour in functional tests for #2664 - show failures with `@Html.ListBox()` in unit tests nits: - test `IHtmlHelper` methods, not extensions - use `ViewData`, not `ViewBag` in `HtmlGeneration_FormController` - name test methods a bit more consistently - rename `HtmlHelperValueExtensionsTest` to `HtmlHelperValueTest`
dougbu
added a commit
that referenced
this issue
Jun 9, 2015
- test additional cases _close_ to these bugs as well for #1485 - show odd `@Html.CheckBox()`, `@Html.Hidden()` behaviour in unit tests - show odd `@Html.TextBox()` behaviour in functional tests (templates) for #1487 - show odd `@Html.Value()` behaviour in unit tests - show odd `@Html.RadioButton()`, `@Html.TextArea()` behaviour in functional tests - show lack of validation attributes for `@Html.RadioButton()`, `<select>` tag helper for #2662 - show odd `@Html.RadioButton(string.Empty)` behaviour in functional tests for #2664 - show failures with `@Html.ListBox()` in unit tests nits: - test `IHtmlHelper` methods, not extensions - use `ViewData`, not `ViewBag` in `HtmlGeneration_FormController` - name test methods a bit more consistently - rename `HtmlHelperValueExtensionsTest` to `HtmlHelperValueTest`
dougbu
added a commit
that referenced
this issue
Jun 9, 2015
- builds on dougbu/testing.1485.1487.2662.2664 branch, unblocking some #1487 tests - use new property to correctly determine `isTargetEnum` in `GetCurrentValues()` - avoid `ArgumentNullException` in all cases where raw values are `enum` but target is not - also use new property instead of private `GetElementType()` methods where possible nits: - move properties above methods in `ModelMetadata` - avoid accidentally-incorrect "Remove Unnecessary Usings"
dougbu
added a commit
that referenced
this issue
Jun 9, 2015
- test additional cases _close_ to these bugs as well for #1485 - show odd `@Html.CheckBox()`, `@Html.Hidden()` behaviour in unit tests - show odd `@Html.TextBox()` behaviour in functional tests (templates) for #1487 - show odd `@Html.Value()` behaviour in unit tests - show odd `@Html.RadioButton()`, `@Html.TextArea()` behaviour in functional tests - show lack of validation attributes for `@Html.RadioButton()`, `<select>` tag helper for #2662 - show odd `@Html.RadioButton(string.Empty)` behaviour in functional tests for #2664 - show failures with `@Html.ListBox()` in unit tests nits: - test `IHtmlHelper` methods, not extensions - use `ViewData`, not `ViewBag` in `HtmlGeneration_FormController` - name test methods a bit more consistently - rename `HtmlHelperValueExtensionsTest` to `HtmlHelperValueTest`
dougbu
added a commit
that referenced
this issue
Jun 9, 2015
- builds on dougbu/testing.1485.1487.2662.2664 branch, unblocking some #1487 tests - use new property to correctly determine `isTargetEnum` in `GetCurrentValues()` - avoid `ArgumentNullException` in all cases where raw values are `enum` but target is not - also use new property instead of private `GetElementType()` methods where possible nits: - move properties above methods in `ModelMetadata` - avoid accidentally-incorrect "Remove Unnecessary Usings"
dougbu
added a commit
that referenced
this issue
Jun 10, 2015
- test additional cases _close_ to these bugs as well for #1485 - show odd `@Html.CheckBox()`, `@Html.Hidden()` behaviour in unit tests - show odd `@Html.TextBox()` behaviour in functional tests (templates) for #1487 - show odd `@Html.Value()` behaviour in unit tests - show odd `@Html.RadioButton()`, `@Html.TextArea()` behaviour in functional tests - show lack of validation attributes for `@Html.RadioButton()`, `<select>` tag helper for #2662 - show odd `@Html.RadioButton(string.Empty)` behaviour in functional tests for #2664 - show failures with `@Html.ListBox()` in unit tests nits: - test `IHtmlHelper` methods, not extensions - use `ViewData`, not `ViewBag` in `HtmlGeneration_FormController` - name test methods a bit more consistently - rename `HtmlHelperValueExtensionsTest` to `HtmlHelperValueTest`
dougbu
added a commit
that referenced
this issue
Jun 10, 2015
- #2664 - use new property to correctly determine `isTargetEnum` in `GetCurrentValues()` - avoid `ArgumentNullException` in all cases where raw values are `enum` but target is not - stop skipping tests blocked by #2664, exposing a couple more #1487 issues - use new property instead of private `GetElementType()` methods where possible - cleans up some duplicate code - also remove redundant use of `IsCollectionType` and `ElementMetadata` nits: - move properties above methods in `ModelMetadata` - avoid accidentally-incorrect "Remove Unnecessary Usings"
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
When the model contains a collection of
enum
values and the view uses@Html.ListBox()
for the property,GetCurrentValues()
will throw anArgumentNullException
. Collections ofenum
values may be unusual but should be correctly supported.The root cause is twofold:
GetCurrentValues()
determines theModelExplorer
for the property but uses that directly rather than theModelMetadata
for the element type. And the method assumesenumNames
(from thatModelMetadata
/ModelExplorer
) will be non-null
when a raw value is anenum
.The problem is a bit more general because it's possible to place
enum
values inViewDataDictionary
though the model is (say) anint
. But that's much less likely than the collection case.The text was updated successfully, but these errors were encountered: