Portable areas breaks my templated helpers with latest version of mvccontrib

193 views
Skip to first unread message

Kjetil Haga

unread,
Aug 4, 2011, 8:55:24 AM8/4/11
to 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

unread,
Aug 4, 2011, 10:58:35 AM8/4/11
to 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
Reply all
Reply to author
Forward
0 new messages