Kjetil Haga
未讀,2011年8月4日 上午8:55:242011/8/4登入以回覆作者
登入以轉寄訊息
你的權限不足,無法在這個群組刪除訊息
登入以檢舉訊息
該群組的電子郵件地址為匿名,或你需要檢視成員電子郵件地址的權限才能查看原始貼文
收件者:mvccontrib-discuss
Upgrading mvccontrib from 3.0.68.0 to 3.0.81.0 (from NuGet) breaks my
MVC3 app. I get the following exception:
The model item passed into the dictionary is of type 'System.String',
but this dictionary requires a model item of type
'MvcContrib.UI.InputBuilder.Views.PropertyViewModel`1[System.Object]'.
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 of type 'System.String', but this
dictionary requires a model item of type
'MvcContrib.UI.InputBuilder.Views.PropertyViewModel`1[System.Object]'.
Source Error:
Line 9: </p>
Line 10:
Line 11: @Html.DisplayForModel()
Source File: c:\dev\tmp\MvcApplication1\Views\Home\Index.cshtml
Line: 11
Reverting back to old version solves the problem.
I have reproduced the problem in a new empty MVC 3 app created from
the wizard. Calling
PortableAreaRegistration.RegisterEmbeddedViewEngine() in
Application_Start will introduce the same exception as above when
calling a templated helper.
My modified Index.cshtml view:
@model MvcApplication1.Models.UserInfo
@Html.DisplayForModel()
The controller method:
public ActionResult Index()
{
return View(new UserInfo{Name = "Ola", Age = 100});
}
UserInfo class:
public class UserInfo
{
public string Name { get; set; }
public int Age { get; set; }
}
Is this a known bug or a breaking change in mvccontrib?