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

Apps fail when app-local binary is lower than the version provided by a shared runtime #3252

Closed
natemcmaster opened this issue Jul 18, 2018 · 13 comments · Fixed by dotnet/core-setup#4423
Assignees
Milestone

Comments

@natemcmaster
Copy link
Contributor

Steps to reproduce

Install ASP.NET Core 2.1.3 and dotnet run this project

<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>netcoreapp2.1</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.1" />
    <PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="2.1.2" />
  </ItemGroup>
</Project>
using System;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Server.Kestrel.Core;

public class Program
{
    public static void Main(string[] args)
    {
        Console.WriteLine("Kestrel assembly location = " + typeof(KestrelServerOptions).Assembly.Location);
        Console.WriteLine("Kestrel assembly version  = " + typeof(KestrelServerOptions).Assembly.GetName().ToString());
        Console.WriteLine("Deps files = " + AppContext.GetData("APP_CONTEXT_DEPS_FILES") as string);
        
        // run the kestrel server
        WebHost.CreateDefaultBuilder(args).Build().Run();
    }
}

Expected behavior

I expected the host to rollforward to the latest Microsoft.AspNetCore.App shared runtime (2.1.3), and to prefer the version of Microsoft.AspNetCore.Server.Kestrel.Core.dll it provides (AssemblyVersion=2.1.3.0) because it is higher than the app-local version (Version=2.1.2.0)

Actual behavior

The host prefers the app-local version (2.1.2.0), and when it rollsforward to the highest patch, the application fails with FileLoadException due to an assembly verison downgrade forced upon the other binaries in the Microsoft.AspNetCore.App shared runtime.

$ dotnet run
Kestrel assembly location = /Users/namc/.nuget/packages/microsoft.aspnetcore.server.kestrel.core/2.1.2/lib/netcoreapp2.1/Microsoft.AspNetCore.Server.Kestrel.Core.dll
Kestrel assembly version  = Microsoft.AspNetCore.Server.Kestrel.Core, Version=2.1.2.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
Deps files = /private/tmp/lift/bin/Debug/netcoreapp2.1/lift.deps.json;/Users/namc/.dotnet/shared/Microsoft.AspNetCore.App/2.1.3/Microsoft.AspNetCore.App.deps.json;/Users/namc/.dotnet/shared/Microsoft.NETCore.App/2.1.3/Microsoft.NETCore.App.deps.json

Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'Microsoft.AspNetCore.Server.Kestrel.Core, Version=2.1.3.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
   at Microsoft.AspNetCore.WebHost.CreateDefaultBuilder(String[] args)
   at Program.Main(String[] args) in /private/tmp/lift/Program.cs:line 15

Environment data

.NET Core SDK (reflecting any global.json):
 Version:   2.1.301
 Commit:    59524873d6

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.14
 OS Platform: Darwin
 RID:         osx-x64
 Base Path:   /Users/namc/.dotnet/sdk/2.1.301/

Host (useful for support):
  Version: 2.2.0-preview1-26618-02
  Commit:  8b1cd0cdab

.NET Core SDKs installed:
  2.1.4 [/Users/namc/.dotnet/sdk]
  2.1.102 [/Users/namc/.dotnet/sdk]
  2.1.105 [/Users/namc/.dotnet/sdk]
  2.1.200 [/Users/namc/.dotnet/sdk]
  2.1.300 [/Users/namc/.dotnet/sdk]
  2.1.301 [/Users/namc/.dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.0 [/Users/namc/.dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.1 [/Users/namc/.dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.2 [/Users/namc/.dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.0 [/Users/namc/.dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.1 [/Users/namc/.dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.2 [/Users/namc/.dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.3 [/Users/namc/.dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.0.0 [/Users/namc/.dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.5 [/Users/namc/.dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.6 [/Users/namc/.dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.7 [/Users/namc/.dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.0 [/Users/namc/.dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.1 [/Users/namc/.dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.2 [/Users/namc/.dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.3-servicing-26708-02 [/Users/namc/.dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.3 [/Users/namc/.dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.0-preview1-26618-02 [/Users/namc/.dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download
@steveharter
Copy link
Member

@natemcmaster once a build is available can you verify this before I create the 2.2 and 2.1.x PRs. Thanks

@natemcmaster
Copy link
Contributor Author

Yes, happy to help verify.

@natemcmaster
Copy link
Contributor Author

@steveharter what is the status of backporting this to 2.1? Users are running into this now in 2.1.3.

@natemcmaster
Copy link
Contributor Author

I've opened https://github.com/dotnet/core-setup/issues/4512 to track the work to backport the fix to 2.1.x.

@steveharter
Copy link
Member

@natemcmaster I was waiting for test verification (and was OOF last week).

@natemcmaster
Copy link
Contributor Author

Verified the fix in Microsoft.NETCore.App\3.0.0-preview1-26830-01

@GustavSt
Copy link

GustavSt commented Sep 3, 2018

Will this be fixed in 2.2 as well?

@natemcmaster
Copy link
Contributor Author

@GustavSt yes, this should be fixed in 2.2 Preview 3. The proposed fix for dotnet/core-setup#4521 should be merged up into 2.2 after we're done testing it for 2.1.x.

@mikebridge
Copy link

Just to clarify, is this currently working in 2.1.x?

@natemcmaster
Copy link
Contributor Author

Yes, this should be fixed in .NET Core 2.1.5.

@mikebridge
Copy link

mikebridge commented Oct 18, 2018

@natemcmaster I was able to explicitly reference Kestrel 2.1.3 and that seems to work, thanks!

@nalla
Copy link

nalla commented Jan 11, 2019

Hi, I'm experiencing the same behavior when running implicit versioned netcoreapp2.1 app with the 2.2.102 sdk installed..

(dotnet/AspNetCore.Docs#6430 (comment))

I created a new issue for this because it seems to be specific to having a reference to signalr..

https://github.com/dotnet/cli/issues/10592.

@natemcmaster
Copy link
Contributor Author

@nalla please see dotnet/aspnetcore#3503.

@msftgits msftgits transferred this issue from dotnet/core-setup Jan 30, 2020
@msftgits msftgits added this to the 3.0 milestone Jan 30, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants