Portable areas breaks my templated helpers with latest version of mvccontrib

瀏覽次數:193 次
跳到第一則未讀訊息

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?

Eric Hexter

未讀,
2011年8月4日 上午10:58:352011/8/4
收件者:mvccontri...@googlegroups.com

This sounds like a bug. Could you create an issue on the site for this?

sent from my mobile

> --
> Contact Jeffrey Palermo or Eric Hexter with specific questions about the MvcContrib project. Or go to http://mvccontrib.org
>
> To unsubscribe from this group, send email to mvccontrib-disc...@googlegroups.com
> For more options, visit this group at http://groups.google.com/group/mvccontrib-discuss?hl=en
回覆所有人
回覆作者
轉寄
0 則新訊息