Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Known issue in 3.0.2 and 3.1.1 for ASP.NET Core #401

Closed
Pilchie opened this issue Jan 14, 2020 · 1 comment
Closed

Known issue in 3.0.2 and 3.1.1 for ASP.NET Core #401

Pilchie opened this issue Jan 14, 2020 · 1 comment
Labels
3.0.0 Announcements related to ASP.NET Core 3.0 3.1.0 Announcements related to ASP.NET Core 3.1 Announcement

Comments

@Pilchie
Copy link

Pilchie commented Jan 14, 2020

Packages and Shared Framework

Scenario

If your project has a package reference that transtively references certain assemblies in the Microsoft.AspNetCore.App shared framework
that are also available as NuGet packages and executes on a runtime other than 64-bit Windows, you will receive a runtime exception at the time the assembly is loaded with a message like:

Could not load file or assembly 'Microsoft.AspNetCore.DataProtection.Abstractions, Version=3.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The located assembly's manifest definition does not match the assembly reference. (0x80131040)

Workaround

Reference the package for the assembly which is failing to load explicitly in your application.

List of assemblies impacted:

  • Microsoft.AspNetCore.DataProtection.Abstractions
  • Microsoft.AspNetCore.Cryptography.Internal
  • Microsoft.AspNetCore.Cryptography.KeyDerivation
  • Microsoft.AspNetCore.Metadata

Identity UI

Scenario

Alternatively, if you use the Microsoft.AspNetCore.Identity.UI package and executes on a runtime other than 64-bit Windows, you will receive a runtime exception at the time the Microsoft.AspNetCore.Http.Features assembly is loaded with a message like:

FileNotFoundException: Could not load file or assembly 'Microsoft.AspNetCore.Http.Features, Version=3.0.2.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.

Workaround

Reference the Microsoft.AspNetCore.Http.Features package explicitly in your application.

Azure App Service

Note that by default Azure App Service runs websites in an x86 Windows environment, so you might see these issues when you deploy to
Azure App Service, even if your app works locally on your 64-bit Windows development machine. To workaround, you can either apply one of
the workarounds above or configure your app to run in a 64-bit environment. See the documentation for details.

Updating packages without updating shared runtime

Scenario

If you update some packages to version 3.1.1, but don't have the 3.1.1 shared runtime installed, you may end up with an error like the below:

Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.AspNetCore.Razor.Runtime, Version=3.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
File name: 'Microsoft.AspNetCore.Razor.Runtime, Version=3.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'
   at System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
   at System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
   at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(MetadataToken caCtorToken, MetadataImport& scope, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, ListBuilder`1& derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg)
   at System.Reflection.CustomAttribute.AddCustomAttributes(ListBuilder`1& attributes, RuntimeModule decoratedModule, Int32 decoratedMetadataToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, ListBuilder`1 derivedAttributes)
   at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType)
   at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType)
   at System.Reflection.RuntimeAssembly.GetCustomAttributes(Type attributeType, Boolean inherit)
   at System.Attribute.GetCustomAttributes(Assembly element, Type attributeType, Boolean inherit)
   at System.Attribute.GetCustomAttribute(Assembly element, Type attributeType, Boolean inherit)
   at System.Reflection.CustomAttributeExtensions.GetCustomAttribute[T](Assembly element)
   at Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartFactory.GetApplicationPartFactory(Assembly assembly)
   at Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartManager.PopulateDefaultParts(String entryAssemblyName)
   at Microsoft.Extensions.DependencyInjection.MvcCoreServiceCollectionExtensions.GetApplicationPartManager(IServiceCollection services)
   at Microsoft.Extensions.DependencyInjection.MvcCoreServiceCollectionExtensions.AddMvcCore(IServiceCollection services)
   at Microsoft.Extensions.DependencyInjection.MvcServiceCollectionExtensions.AddControllersCore(IServiceCollection services)
   at Microsoft.Extensions.DependencyInjection.MvcServiceCollectionExtensions.AddControllersWithViewsCore(IServiceCollection services)
   at Microsoft.Extensions.DependencyInjection.MvcServiceCollectionExtensions.AddControllersWithViews(IServiceCollection services)
   at Microsoft.Extensions.DependencyInjection.MvcServiceCollectionExtensions.AddMvc(IServiceCollection services)
   at Microsoft.AspNetCore.Identity.IdentityBuilderUIExtensions.AddRelatedParts(IdentityBuilder builder)
   at Microsoft.AspNetCore.Identity.IdentityBuilderUIExtensions.AddDefaultUI(IdentityBuilder builder)
   at Microsoft.Extensions.DependencyInjection.IdentityServiceCollectionUIExtensions.AddDefaultIdentity[TUser](IServiceCollection services, Action`1 configureOptions)

Workaround

Ensure that you have the 3.1.1 shared runtime installed when updating packages. If you are using Razor runtime compilation, you may also need:

<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="3.4.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.4.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="3.1.1" />

See also

@Pilchie Pilchie added Announcement 3.0.0 Announcements related to ASP.NET Core 3.0 3.1.0 Announcements related to ASP.NET Core 3.1 labels Jan 14, 2020
@aspnet aspnet locked and limited conversation to collaborators Jan 14, 2020
@Pilchie
Copy link
Author

Pilchie commented Feb 18, 2020

This should be fixed in the 3.1.2 release that was published today (2020-02-18). Please file a new issue on https://github.com/dotnet/aspnetcore if you are still seeing issues.

@Pilchie Pilchie closed this as completed Feb 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
3.0.0 Announcements related to ASP.NET Core 3.0 3.1.0 Announcements related to ASP.NET Core 3.1 Announcement
Projects
None yet
Development

No branches or pull requests

1 participant