The model item passed into the dictionary is of type ‘mvc.Models.ModelA’ but this dictionary requires a model item of type ‘mvc.Models.ModelB‘

Solution 1:

Even if the types match, you can get this error when a null is passed to a partial view.

You can fix this by calling RenderPartial with an empty ViewDataDictionary like this:

helper.RenderPartial("~/Views/Player/PlayerName.ascx", player, new ViewDataDictionary());

For reference, I found this solution at:
renderpartial with null model gets passed the wrong type

Solution 2:

ASP.NET MVC Partials

NULL model was passed!!!

@Html.Partial("PartialView", model: Model)

Solution 3:

This error can occur (and does) when there is a mismatch between the data that the controller action method is supplying to the view and the type of data the view is expecting. This will not normally show up as a build error, even with precompiled views.

For example, if I have a method...

public ActionResult Create()
{
    // Do something
    return View(new CustomerCreateViewModel());
}

...and a Create view with a Page attribute...

<%@ Page ... Inherits="System.Web.Mvc.ViewPage<CustomerDetailsViewModel>" %>

...this will compile and build without error. However, when I call the Create action, I'm going to get a yellow screen, because the Create action method is throwing data of one type and the view is expecting data of a different type. You might want to verify that your types are matching...