aspnet/AspNetWebStack

Updating from 5.2.9 to 6.0.0 in ASP.NET project using Framework 4.6 crashes application

GregObleshchuk opened this issue · 3 comments

Hi ,
When i upgrade the following packages in the project from
<package id="Microsoft.AspNet.WebApi" version="5.2.9" targetFramework="net48" /> <package id="Microsoft.AspNet.WebApi.Client" version="5.2.9" targetFramework="net48" /> <package id="Microsoft.AspNet.WebApi.Core" version="5.2.9" targetFramework="net48" /> <package id="Microsoft.AspNet.WebApi.Cors" version="5.2.9" targetFramework="net48" /> <package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.9" targetFramework="net48" />

to

<package id="Microsoft.AspNet.WebApi" version="5.3.0" targetFramework="net48" /> <package id="Microsoft.AspNet.WebApi.Client" version="6.0.0" targetFramework="net48" /> <package id="Microsoft.AspNet.WebApi.Core" version="5.3.0" targetFramework="net48" /> <package id="Microsoft.AspNet.WebApi.Cors" version="5.3.0" targetFramework="net48" /> <package id="Microsoft.AspNet.WebApi.WebHost" version="5.3.0" targetFramework="net48" />

my project fails with

System.IO.FileLoadException
HResult=0x80131040
Message=Could not load file or assembly 'Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Source=System.Net.Http.Formatting
StackTrace:
at System.Net.Http.Formatting.BaseJsonMediaTypeFormatter..ctor()
at System.Net.Http.Formatting.JsonMediaTypeFormatter..ctor()
at System.Net.Http.Formatting.MediaTypeFormatterCollection.CreateDefaultFormatters()
at System.Web.Http.HttpConfiguration.DefaultFormatters(HttpConfiguration config)
at System.Web.Http.HttpConfiguration..ctor(HttpRouteCollection routes)
at System.Web.Http.GlobalConfiguration.<>c.b__11_0()
at System.Lazy1.CreateValue() at System.Lazy1.LazyInitValue()
at System.Web.Http.GlobalConfiguration.Configure(Action`1 configurationCallback)
at TravelAgentSearchMulti.MvcApplication.Application_Start() in E:\Tour Atlas\TravelCMS-Web-Site\Global.asax.vb:line 9

This is the package update log

Attempting to gather dependency information for multiple packages with respect to project 'TravelCMS-Web-Site', targeting '.NETFramework,Version=v4.8'
Gathering dependency information took 13.07 sec
Attempting to resolve dependencies for multiple packages.
Resolving dependency information took 0 ms
Resolving actions install multiple packages
Removed package 'Microsoft.AspNet.WebApi 5.2.9' from 'packages.config'
Successfully uninstalled 'Microsoft.AspNet.WebApi 5.2.9' from TravelCMS-Web-Site
Removed package 'Microsoft.AspNet.WebApi.WebHost 5.2.9' from 'packages.config'
Successfully uninstalled 'Microsoft.AspNet.WebApi.WebHost 5.2.9' from TravelCMS-Web-Site
Removed package 'Microsoft.AspNet.WebApi.Cors 5.2.9' from 'packages.config'
Successfully uninstalled 'Microsoft.AspNet.WebApi.Cors 5.2.9' from TravelCMS-Web-Site
Removed package 'Microsoft.AspNet.WebApi.Core 5.2.9' from 'packages.config'
Successfully uninstalled 'Microsoft.AspNet.WebApi.Core 5.2.9' from TravelCMS-Web-Site
Removed package 'Microsoft.AspNet.WebApi.Client 5.2.9' from 'packages.config'
Successfully uninstalled 'Microsoft.AspNet.WebApi.Client 5.2.9' from TravelCMS-Web-Site
Adding package 'Microsoft.AspNet.WebApi.Client.6.0.0' to folder 'E:\Tour Atlas\TravelCMS-Web-Site\packages'
Added package 'Microsoft.AspNet.WebApi.Client.6.0.0' to folder 'E:\Tour Atlas\TravelCMS-Web-Site\packages'
Added package 'Microsoft.AspNet.WebApi.Client.6.0.0' to 'packages.config'
Successfully installed 'Microsoft.AspNet.WebApi.Client 6.0.0' to TravelCMS-Web-Site
Adding package 'Microsoft.AspNet.WebApi.Core.5.3.0' to folder 'E:\Tour Atlas\TravelCMS-Web-Site\packages'
Added package 'Microsoft.AspNet.WebApi.Core.5.3.0' to folder 'E:\Tour Atlas\TravelCMS-Web-Site\packages'
Added package 'Microsoft.AspNet.WebApi.Core.5.3.0' to 'packages.config'
Successfully installed 'Microsoft.AspNet.WebApi.Core 5.3.0' to TravelCMS-Web-Site
Adding package 'Microsoft.AspNet.WebApi.Cors.5.3.0' to folder 'E:\Tour Atlas\TravelCMS-Web-Site\packages'
Added package 'Microsoft.AspNet.WebApi.Cors.5.3.0' to folder 'E:\Tour Atlas\TravelCMS-Web-Site\packages'
Added package 'Microsoft.AspNet.WebApi.Cors.5.3.0' to 'packages.config'
Successfully installed 'Microsoft.AspNet.WebApi.Cors 5.3.0' to TravelCMS-Web-Site
Adding package 'Microsoft.AspNet.WebApi.WebHost.5.3.0' to folder 'E:\Tour Atlas\TravelCMS-Web-Site\packages'
Added package 'Microsoft.AspNet.WebApi.WebHost.5.3.0' to folder 'E:\Tour Atlas\TravelCMS-Web-Site\packages'
Added package 'Microsoft.AspNet.WebApi.WebHost.5.3.0' to 'packages.config'
Successfully installed 'Microsoft.AspNet.WebApi.WebHost 5.3.0' to TravelCMS-Web-Site
Adding package 'Microsoft.AspNet.WebApi.5.3.0', which only has dependencies, to project 'TravelCMS-Web-Site'.
Adding package 'Microsoft.AspNet.WebApi.5.3.0' to folder 'E:\Tour Atlas\TravelCMS-Web-Site\packages'
Added package 'Microsoft.AspNet.WebApi.5.3.0' to folder 'E:\Tour Atlas\TravelCMS-Web-Site\packages'
Added package 'Microsoft.AspNet.WebApi.5.3.0' to 'packages.config'
Successfully installed 'Microsoft.AspNet.WebApi 5.3.0' to TravelCMS-Web-Site
Removing package 'Microsoft.AspNet.WebApi 5.2.9' from folder 'E:\Tour Atlas\TravelCMS-Web-Site\packages'
Removed package 'Microsoft.AspNet.WebApi 5.2.9' from folder 'E:\Tour Atlas\TravelCMS-Web-Site\packages'
Removing package 'Microsoft.AspNet.WebApi.WebHost 5.2.9' from folder 'E:\Tour Atlas\TravelCMS-Web-Site\packages'
Removed package 'Microsoft.AspNet.WebApi.WebHost 5.2.9' from folder 'E:\Tour Atlas\TravelCMS-Web-Site\packages'
Removing package 'Microsoft.AspNet.WebApi.Cors 5.2.9' from folder 'E:\Tour Atlas\TravelCMS-Web-Site\packages'
Removed package 'Microsoft.AspNet.WebApi.Cors 5.2.9' from folder 'E:\Tour Atlas\TravelCMS-Web-Site\packages'
Removing package 'Microsoft.AspNet.WebApi.Core 5.2.9' from folder 'E:\Tour Atlas\TravelCMS-Web-Site\packages'
Removed package 'Microsoft.AspNet.WebApi.Core 5.2.9' from folder 'E:\Tour Atlas\TravelCMS-Web-Site\packages'
Removing package 'Microsoft.AspNet.WebApi.Client 5.2.9' from folder 'E:\Tour Atlas\TravelCMS-Web-Site\packages'
Removed package 'Microsoft.AspNet.WebApi.Client 5.2.9' from folder 'E:\Tour Atlas\TravelCMS-Web-Site\packages'
Executing nuget actions took 2.06 sec
Time Elapsed: 00:00:15.6025890
========== Finished ==========

The issue seems to be related to Newtonsoft.Json.Bson which is a dependancy on the client project

I have included a copy of the packages.config , before and after the upgrade. You cna see that the Newtonsoft.Json packages are already installed and at teh latest level.

packages_files.zip

Rolling back the update fixes teh runtime issue but it means im on the older version of the package, I have verified that the files are in the right location and before and after they don't change.

Let me know if you need anything else.

why this Microsoft.AspNet.WebApi.Client library`s version jump from v-5.2.9 to 6.0.0? it should be 5.3.0.

Did you have automatic binding redirects enabled or add them yourself using something like Get-Project –All | Add-BindingRedirect?