Error after upgrading from ASP MVC 5.0 to 5.2.7

Eli Hellmer 1 Reputation point
2022-01-07T20:25:33.12+00:00

Hello,

I just recently upgraded MVC to 5.2.7. I installed MVC using Nuget. Upon running my project, I receive the following error:

Method not found: 'System.Web.Routing.RouteValueDictionary System.Web.WebPages.TypeHelper.ObjectToDictionaryUncached(System.Object)'.

[MissingMethodException: Method not found: 'System.Web.Routing.RouteValueDictionary System.Web.WebPages.TypeHelper.ObjectToDictionaryUncached(System.Object)'.]
   System.Web.Mvc.RouteCollectionExtensions.CreateRouteValueDictionaryUncached(Object values) +0
   System.Web.Mvc.RouteCollectionExtensions.MapRoute(RouteCollection routes, String name, String url, Object defaults, Object constraints, String[] namespaces) +102
   System.Web.Mvc.AreaRegistrationContext.MapRoute(String name, String url, Object defaults, Object constraints, String[] namespaces) +56
   System.Web.Mvc.AreaRegistrationContext.MapRoute(String name, String url, Object defaults) +18
   LabSys.Areas.Dashfeed.DashfeedAreaRegistration.RegisterArea(AreaRegistrationContext context) in C:\Users\elihe\Source\Workspaces\LabSys\LabSys\LabSys\App_Data\Areas\Dashfeed\DashfeedAreaRegistration.cs:17
   System.Web.Mvc.AreaRegistration.CreateContextAndRegister(RouteCollection routes, Object state) +104
   System.Web.Mvc.AreaRegistration.RegisterAllAreas(RouteCollection routes, IBuildManager buildManager, Object state) +190
   System.Web.Mvc.AreaRegistration.RegisterAllAreas(Object state) +35
   System.Web.Mvc.AreaRegistration.RegisterAllAreas() +7
   LabSys.MvcApplication.Application_Start() in C:\Users\elihe\Source\Workspaces\LabSys\LabSys\LabSys\Global.asax.cs:18

[HttpException (0x80004005): Method not found: 'System.Web.Routing.RouteValueDictionary System.Web.WebPages.TypeHelper.ObjectToDictionaryUncached(System.Object)'.]
   System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +475
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +118
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +176
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +219
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +303

[HttpException (0x80004005): Method not found: 'System.Web.Routing.RouteValueDictionary System.Web.WebPages.TypeHelper.ObjectToDictionaryUncached(System.Object)'.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +659
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +89
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +188

There is another post on this issue, but I have tried the recommendations and haven't found a solution (https://stackoverflow.com/questions/21376261/mvc-5-1-missingmethodexception-system-web-webpages-typehelper-objecttodictionary).

He mentioned to replace the System.Web.Webpages, which I tried and did not work.

Here is my current Web.config

 <dependentAssembly>
    <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="0.0.0.0-5.2.7.0" newVersion="5.2.7.0" />
  </dependentAssembly>  

I need to keep the new version of MVC in order to use Telerik.

What else can I try? I have tried reinstalling MVC, modifing the Web.WebPages dll?

Any help is much appreciated I am confused!

ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,288 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,308 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Lan Huang-MSFT 25,876 Reputation points Microsoft Vendor
    2022-01-10T03:08:51.993+00:00

    Hi @Eli Hellmer ,
    Have you tried cleaning and rebuilding the solution?
    You can try to clear the package directory and download it again.
    Check the Web.config and packages.config and web.config files in the Views folder.
    You can refer to this tutorial.
    https://learn.microsoft.com/en-us/aspnet/mvc/overview/releases/how-to-upgrade-an-aspnet-mvc-4-and-web-api-project-to-aspnet-mvc-5-and-web-api-2
    Best regards,
    Lan Huang


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments