After doing some upgrades to my project, suddenly my generated "_createoredit.cshtml" file is blowing up with this:
The model item passed into the dictionary is null, but this dictionary requires a non-null model item of type 'System.Int32'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: The model item passed into the dictionary is null, but this dictionary requires a non-null model item of type 'System.Int32'.
Source Error:
Line 273:</div>
Line 274:<div class="editor-field">
Line 275:@Html.EditorFor(model => model.NumOfStores)
Line 276:@Html.ValidationMessageFor(model => model.NumOfStores)
Line 277:</div>
The field it references is a nullable int type. This just worked before (the production version is still running fine), and the changes I made to the project shouldnt have touched anything this uses, so now i can't figure out why the heck this is blowing up.
update 1- adding the field def from the model
[DisplayName("Number of Stores (if applicable)")]
public Nullable<int> NumOfStores { get; set; }
Also I have verified that all the nullable value types are having this same issue.