I've been working on migrating a .NET Framework 4.7.2 project to .NET 6. After running through the upgrade assistant, upgrading packages, and migrating code to the .NET 6 equivalent, I'm getting this error with this full callstack:
System.TypeLoadException: Could not load type 'System.Web.HttpContextBase' from assembly 'System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
at System.Signature.GetSignature(Void* pCorSig, Int32 cCorSig, RuntimeFieldHandleInternal fieldHandle, IRuntimeMethodInfo methodHandle, RuntimeType declaringType)
at System.Reflection.RuntimePropertyInfo.get_Signature()
at System.Reflection.RuntimePropertyInfo.get_PropertyType()
at Microsoft.Extensions.Internal.PropertyHelper.IsRefStructProperty(PropertyInfo property)
at Microsoft.Extensions.Internal.PropertyHelper.IsInterestingProperty(PropertyInfo property)
at Microsoft.Extensions.Internal.PropertyHelper.<>c.<GetProperties>b__44_0(PropertyInfo p)
at System.Linq.Enumerable.WhereSelectArrayIterator`2.ToArray()
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at Microsoft.Extensions.Internal.PropertyHelper.GetProperties(Type type, Func`2 createPropertyHelper, ConcurrentDictionary`2 cache)
at Microsoft.Extensions.Internal.PropertyHelper.GetProperties(Type type)
at Microsoft.AspNetCore.Mvc.ApplicationModels.DefaultApplicationModelProvider.OnProvidersExecuting(ApplicationModelProviderContext context)
at Microsoft.AspNetCore.Mvc.ApplicationModels.ApplicationModelFactory.CreateApplicationModel(IEnumerable`1 controllerTypes)
at Microsoft.AspNetCore.Mvc.ApplicationModels.ControllerActionDescriptorProvider.GetDescriptors()
at Microsoft.AspNetCore.Mvc.ApplicationModels.ControllerActionDescriptorProvider.OnProvidersExecuting(ActionDescriptorProviderContext context)
at Microsoft.AspNetCore.Mvc.Infrastructure.DefaultActionDescriptorCollectionProvider.UpdateCollection()
at Microsoft.AspNetCore.Mvc.Infrastructure.DefaultActionDescriptorCollectionProvider.Initialize()
at Microsoft.AspNetCore.Mvc.Infrastructure.DefaultActionDescriptorCollectionProvider.get_ActionDescriptors()
at Microsoft.AspNetCore.Mvc.Routing.AttributeRoute.GetTreeRouter()
at Microsoft.AspNetCore.Mvc.Routing.AttributeRoute.RouteAsync(RouteContext context)
at Microsoft.AspNetCore.Routing.RouteCollection.RouteAsync(RouteContext context)
at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)
at Web.BenefitScreenings.Startup.<>c.<<Configure>b__5_1>d.MoveNext() in D:\*Redacted*\Startup.cs:line 212
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
Visual Studio isn't breaking anywhere in the debugger. I've tried dotnet clean/restore/build
, deleting the bin folder, and verifying all packages are upgraded and no version conflicts are happening. When I remove the bit of code on Startup.cs:line 212
it throws the same exact error.
Does anyone have any troubleshooting steps to see what the issue could be?