After switching to DNX and upgrading to Beta4 we get the following error only when publishing to a server. The code runs locally in VS. We made sure the server had KRE removed and DNX upgraded. Any suggestions?
Error:
InvalidCastException: Unable to cast object of type 'System.Collections.Generic.HashSet`1[System.String]' to type 'System.Collections.Generic.IReadOnlyCollection`1[System.String]'.
Microsoft.AspNet.Mvc.Rendering.DefaultHtmlGenerator.GetCurrentValues(ViewContext viewContext, ModelExplorer modelExplorer, String expression, Boolean allowMultiple)
View:
@Html.DropDownListFor(m => m.Criteria.Level, Enum.GetNames(typeof(LogManager.Web.Models.EventLevels)).Select(e => new SelectListItem { Text = e, Value = e }), "", new { @class = "form-control" })
project.json
"EntityFramework.SqlServer": "7.0.0-beta4",
"EntityFramework.Commands": "7.0.0-beta4",
"Microsoft.AspNet.Mvc": "6.0.0-beta4",
"Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-beta4",
"Microsoft.AspNet.Authentication.Cookies": "1.0.0-beta4",
"Microsoft.AspNet.Authentication.Facebook": "1.0.0-beta4",
"Microsoft.AspNet.Authentication.Google": "1.0.0-beta4",
"Microsoft.AspNet.Authentication.MicrosoftAccount": "1.0.0-beta4",
"Microsoft.AspNet.Authentication.Twitter": "1.0.0-beta4",
"Microsoft.AspNet.Diagnostics": "1.0.0-beta4",
"Microsoft.AspNet.Diagnostics.Entity": "7.0.0-beta4",
"Microsoft.AspNet.Identity.EntityFramework": "3.0.0-beta4",
"Microsoft.AspNet.Server.IIS": "1.0.0-beta4",
"Microsoft.AspNet.Server.WebListener": "1.0.0-beta4",
"Microsoft.AspNet.StaticFiles": "1.0.0-beta4",
"Microsoft.AspNet.Tooling.Razor": "1.0.0-beta4",
"Microsoft.Framework.ConfigurationModel.Json": "1.0.0-beta4",
"Microsoft.Framework.ConfigurationModel.UserSecrets": "1.0.0-beta4",
"Microsoft.Framework.CodeGenerators.Mvc": "1.0.0-beta4",
"Microsoft.Framework.Logging": "1.0.0-beta4",
"Microsoft.Framework.Logging.Console": "1.0.0-beta4",
"Microsoft.Framework.Caching.Distributed": "1.0.0-beta4",
"Microsoft.AspNet.SignalR.Server": "3.0.0-beta4",
"Microsoft.Framework.Logging.NLog": "1.0.0-beta4"
DNX version is Beta4.
Update to latest DNX, the problem is fixed there (2015-08-24 it is Beta6).
Also you need to change the project to use that latest dnx version by right clicking the project:
Then you need to change all of your beta4 in project.json to this version you installed (intellisense doesn't seem to help you correctly there, so ie. beta6 might be there even if it is not shown).
Some trics are needed in the startup.cs to make everything run correctly. check what doesn't compile and try to fix those compilation errors.