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

additionalDeps downgrades shared runtime library #3091

Closed
pakrym opened this issue Mar 22, 2018 · 13 comments
Closed

additionalDeps downgrades shared runtime library #3091

pakrym opened this issue Mar 22, 2018 · 13 comments
Milestone

Comments

@pakrym
Copy link
Contributor

pakrym commented Mar 22, 2018

Steps to reproduce

  1. dotnet new web
  2. mkdir deps
  3. set yourdir\deps\shared\Microsoft.NETCore.App\2.1.0-preview2-26308-01\a.deps.json (modify runtime framework version to be the one referenced in .dotnet\x64\shared\Microsoft.AspNetCore.App\2.1.0-preview2-xxxxx\Microsoft.AspNetCore.App.runtimeconfig.json app references)
{
  "runtimeTarget": {
    "name": ".NETCoreApp,Version=v2.1.0",
    "signature": "5e814c43a4bb318be73c818ca300cacedf418e91"
  },
  "compilationOptions": {},
  "targets": {
    ".NETCoreApp,Version=v2.1.0": {
      "Microsoft.AspNetCore.Hosting.Abstractions/2.0.0": {
        "dependencies": {
          "Microsoft.AspNetCore.Hosting.Server.Abstractions": "2.0.0",
          "Microsoft.AspNetCore.Http.Abstractions": "2.0.0",
          "Microsoft.Extensions.Configuration.Abstractions": "2.0.0",
          "Microsoft.Extensions.DependencyInjection.Abstractions": "2.0.0",
          "Microsoft.Extensions.FileProviders.Abstractions": "2.0.0",
          "Microsoft.Extensions.Hosting.Abstractions": "2.0.0",
          "Microsoft.Extensions.Logging.Abstractions": "2.0.0"
        },
        "runtime": {
          "lib/netstandard2.0/Microsoft.AspNetCore.Hosting.Abstractions.dll": {}
        }
      }
    }
  },
  "libraries": {
    "Microsoft.AspNetCore.Hosting.Abstractions/2.0.0": {
      "type": "package",
      "serviceable": true,
      "sha512": "sha512-836NSTzCM1r1tgCRw92y2/TOKVI8HC0ahh+SDer4oMNwuk7LYgSayjQ3rYHDpQDAaGCMF8vFjFphhRECc9Xtog==",
      "path": "microsoft.aspnetcore.hosting.abstractions/2.0.0",
      "hashPath": "microsoft.aspnetcore.hosting.abstractions.2.0.0.nupkg.sha512"
    }
  }
}

  1. Set $env:DOTNET_ADDITIONAL_DEPS="yourdir\deps"
  2. dotnet run

Expected behavior

App runs fine because deps file does not override app

Actual behavior

App crashes with


Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'Microsoft.AspNetCore.Hosting.Abstractions, Version=2.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
   at depsydeps.Program.Main(String[] args)

Because library got resolved to C:\Program Files\dotnet\store\x64\netcoreapp2.1\microsoft.aspnetcore.hosting.abstractions\2.0.0\lib\netstandard2.0\Microsoft.AspNetCore.Hosting.Abstractions.dll

Environment data

Confirmed on hostxr built from latest preview/2.1 source and 2.1.0-preview2-26314-02

@steveharter
/cc @glennc @muratg

@pakrym pakrym changed the title additionalDeps overrides shared runtime library additionalDeps downgrades shared runtime library Mar 22, 2018
@steveharter
Copy link
Member

Note that https://github.com/dotnet/core-setup/issues/3546 may help with this feature, as it will pick the "highest" version of each assembly based on new assemblyVersion and fileVersion metadata in the deps.json files. This new feature is supported by the host, but the metadata is not yet being written by the SDK.

@steveharter
Copy link
Member

If the additional deps.json do not want to "upgrade" the app or framework versions of the same assemblies, then either they don't add the assemblyVersion\fileVersion metadata to the deps.json, or we change the host to treat additional deps file differently.

@steveharter
Copy link
Member

Closing this as addressed by #2994 which is expected to be in by 2.1 release.

@pakrym
Copy link
Contributor Author

pakrym commented Apr 16, 2018

But is it addressed? As you said there Yes framework wins will occur only during roll-forward of minor. it's not what's happening here.
Additional deps should never be able to downgrade dependencies, no matter app-fx relationship.

@steveharter
Copy link
Member

The PR has not yet been pushed: dotnet/sdk#2118

When this is in, and the framework deps.json file is generated with version numbers, I will verify the behavior. The fx will "win" over any app or additional deps.json file that doesn't have version numbers, or have older version numbers.

@pakrym
Copy link
Contributor Author

pakrym commented Apr 16, 2018

What about only during roll-forward of minor part?

@steveharter
Copy link
Member

I see. I was thinking this was a minor roll-forward. Re-opening.

If we change this behavior for additional-deps (assuming for both folder-version and individual deps modes), wouldn't that be considered a breaking change? Would additional-deps ever want to override (either upgrade or downgrade) the framework's versions?

@steveharter steveharter reopened this Apr 16, 2018
@pakrym
Copy link
Contributor Author

pakrym commented Apr 16, 2018

Upgrades are semi-fine, but having additional deps downgrade anything at all is a recipe for disaster.

@steveharter
Copy link
Member

@pakrym shouldn't the versions in the additional-deps (in the folder hierarchy with a "2.1.x" folder) be the same (or newer) than the framework version they targeted?

Is the desire to ship the same additional deps for both 2.0.x and 2.1.x?

@steveharter
Copy link
Member

Or could the example above target AspNetAll\AspNetApp instead of NetCoreApp (for 2.1 anyway)?

@steveharter
Copy link
Member

I understand that the additional-deps may be older than the "found" version of the framework (whether or not it rolled forward on major\minor\patch) because of the proposed roll-backwards functionality, but in this particular example the major.minor of the additional deps is the same as the framework, correct?

@pakrym
Copy link
Contributor Author

pakrym commented Apr 19, 2018

This sample is just a sample, in the real life, it can happen because of 2.0->2.1 roll forward.

@karelz
Copy link
Member

karelz commented May 3, 2018

Fixed in release/2.1 in PR dotnet/core-setup#4094.

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

No branches or pull requests

4 participants