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
Provide correct ViewDataDictionary<TModel>.ModelMetadata
when Model
is null
#1426
Comments
hmm, removing last (incorrect) sentence in description. |
Problem reproduces consistently if the project contains a _ViewStart.cshtml file, even one that's empty. |
dougbu
added a commit
that referenced
this issue
Oct 23, 2014
…` is never that for `object` - `ViewDataDictionary<TModel>.ModelMetadata` was for `object` after base copy constructor got value from `ViewDataDictionary<object>` - problem led to #1426 symptoms - with copy constructor leaving `base.ModelMetadata==null` more often, `ViewDataDictionary<TModel>.ModelMetadata` usually tracks `TModel` if `Model==null` nit: - fix existing comment in main `ViewDataDictionary` copy constructor - add some `<remarks/>` to the four `ViewDataDictionary` copy constructors
dougbu
added a commit
that referenced
this issue
Oct 23, 2014
…` is never that for `object` - `ViewDataDictionary<TModel>.ModelMetadata` was for `object` after base copy constructor got value from `ViewDataDictionary<object>` - problem led to #1426 symptoms - with copy constructor leaving `base.ModelMetadata==null` more often, `ViewDataDictionary<TModel>.ModelMetadata` usually tracks `TModel` if `Model==null` nit: - fix existing comment in main `ViewDataDictionary` copy constructor - add some `<remarks/>` to the four `ViewDataDictionary` copy constructors
This was referenced Oct 23, 2014
Closed
We will take the copy constructor fix for beta1 and then revisit this for beta2. |
dougbu
added a commit
that referenced
this issue
Oct 27, 2014
…` is never that for `object` - `ViewDataDictionary<TModel>.ModelMetadata` was for `object` after base copy constructor got value from `ViewDataDictionary<object>` - problem led to #1426 symptoms - with copy constructor leaving `base.ModelMetadata==null` more often, `ViewDataDictionary<TModel>.ModelMetadata` usually tracks `TModel` if `Model==null` nit: - fix existing comment in main `ViewDataDictionary` copy constructor
dougbu
added a commit
that referenced
this issue
Oct 27, 2014
…` is never that for `object` - `ViewDataDictionary<TModel>.ModelMetadata` was for `object` after base copy constructor got value from `ViewDataDictionary<object>` - problem led to #1426 symptoms - with copy constructor leaving `base.ModelMetadata==null` more often, `ViewDataDictionary<TModel>.ModelMetadata` usually tracks `TModel` if `Model==null` nit: - fix existing comment in main `ViewDataDictionary` copy constructor
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
create views (any view where
Model==null
) currently haveViewData.ModelMetadata.ModelType==typeof(object)
and calculatedModelMetadata
for properties havemetadata.ModelType==typeof(string)
. the problem prevents correct operation of@Html.Editor()
and similar helpers. for example@Html.EditorFor(model => model.Alive)
in a create view returns<input type="text" .../>
thoughAlive
is abool
property and should have<input type="checkbox" .../>
.fix here is very small. should be done in the
ViewDataDictionary<TModel>.ModelMetadata
getter.The text was updated successfully, but these errors were encountered: