Skip to content

Remove Microsoft.Extensions.DependencyModel 6.0.0 pre-build dependency #84925

Closed

Description

@oleksandr-didyk

Required by #81468

As stated in the discussion for the above-mentioned issue #81468 (comment):

We build that library ourselves in the repository so we should remove the prebuilt package dependency entirely

The package in question is marked as pre-built in source-build. Furthermore, the package cannot be SBRPed as it is loaded during the build:

Microsoft.NETCore.App.Runtime.Composite -> 
  microsoft.dotnet.sharedframework.sdk/8.0.0-beta.23213.1/targets/sharedfx.targets(189,5): error MSB4018: The "GenerateSharedFrameworkDepsFile" task failed unexpectedly. [/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.Composite.sfxproj]
  microsoft.dotnet.sharedframework.sdk/8.0.0-beta.23213.1/targets/sharedfx.targets(189,5): error MSB4018: System.BadImageFormatException: Could not load file or assembly 'Microsoft.Extensions.DependencyModel, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. Reference assemblies cannot be loaded for execution. (0x80131058) [src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.Composite.sfxproj]

CC: @ViktorHofer

Activity

  1. ghost added
    needs-area-label
    on Apr 17, 2023
  2. oleksandr-didyk commented on Apr 17, 2023

    @oleksandr-didyk
    ContributorAuthor

    Additionally, currently runtime cannot be build with the latest SBRP, since the latter now contains a ref pack for Microsoft.Extensions.DependencyModel 6.0.0 which was added to deal with pre-builts in Arcade -> dotnet/source-build-assets#604

    Would be great if someone could take a look at this since its blocking opening PR for #81468. Thanks!

  3. ViktorHofer commented on Apr 17, 2023

    @ViktorHofer
    Member

    Microsoft.Extensions.DependencyModel 6.0.0 which was added to deal with pre-builts in Arcade -> dotnet/source-build-assets#604

    Makes sense as Arcade must build before runtime. Does that mean that except for the sourcelink dependency, every other dependency in Arcade is considered a prebuild?

    Would be great if someone could take a look at this since its blocking opening PR for #81468. Thanks!

    I tried to avoid that self referencing dependency multiple times in the past but failed. Just mentioning to adjust expectations. Will take a look again. cc @ericstj @MichaelSimons

  4. added and removed
    needs-area-label
    on Apr 17, 2023
  5. added this to the 8.0.0 milestone on Apr 17, 2023
  6. added
    blocking
    and removed on Apr 17, 2023
  7. self-assigned this
    on Apr 17, 2023
  8. oleksandr-didyk commented on Apr 17, 2023

    @oleksandr-didyk
    ContributorAuthor

    Does that mean that except for sourcelink, everything in Arcade is considered a prebuild?

    I think @MichaelSimons can answer this question better than me

    Will take a look again.

    Appreciate the help, thank you

  9. MichaelSimons commented on Apr 17, 2023

    @MichaelSimons
    Member

    Makes sense as Arcade must build before runtime. Does that mean that except for the sourcelink dependency, every other dependency in Arcade is considered a prebuild?

    No, this is where previous source-built artifacts comes in. A repo is free to take a dependency on these. This is required to break the circular dependencies that the product has.

  10. MichaelSimons commented on Apr 17, 2023

    @MichaelSimons
    Member

    I'm not following what exactly is happening here but if Microsoft.Extensions.DependencyModel,6.0.0 is being loaded indirectly as a result of using the source-built version of arcade, then this problem resides in arcade as a result of it utilizing an SBRP. This reference would need to be updated to the live (n-1) version.

  11. mthalman commented on Apr 17, 2023

    @mthalman
    Member

    I've run into this error myself when attempting to implement pre-repo-PVP for arcade. When doing that, it causes the SBRP version of Microsoft.Extensions.DependencyModel to be included in one of the NuGet packages output by arcade. This is then consumed later on in the build of runtime which attempts to use the arcade package. By adding Microsoft.Extensions.DependencyModel.6.0.0 to the Version.Details of arcade, it should resolve this to avoid taking it from SBRP.

  12. mthalman commented on Apr 17, 2023

    @mthalman
    Member

    Adding this to Arcade's Version.Details.xml file worked for my particular scenario:

    <Dependency Name="Microsoft.Extensions.DependencyModel" Version="6.0.0">
      <Uri>https://github.com/dotnet/runtime</Uri>
      <Sha>8470979eb44c2218025515234d3e01138bd74afb</Sha>
    </Dependency>
  13. 4 remaining items

  14. ViktorHofer commented on Apr 18, 2023

    @ViktorHofer
    Member

    It prevents source-build from getting the 6.0.0 version from SBRP by instead getting a newer version from previously source-built artifacts.

    We usually delete Version.Details.xml entries that aren't used by dependency flow. Is this pattern documented anywhere? Why does this need to be in Version.Details.xml if we usually use Versions.props to define the version to be used?

  15. mthalman commented on Apr 18, 2023

    @mthalman
    Member

    It is preferrable if both the microsoft and source-builds utilize the same versions. The reason being, the repo source-build CI leg will surface more issues at the repo level before the flow. Can we update this to the current version?

    Well I suppose the issue here is that arcade can't reference the current version because runtime depends on arcade.

  16. mmitche commented on Apr 18, 2023

    @mmitche
    Member

    It prevents source-build from getting the 6.0.0 version from SBRP by instead getting a newer version from previously source-built artifacts.

    We usually delete Version.Details.xml entries that aren't used by dependency flow. Is this pattern documented anywhere? Why does this need to be in Version.Details.xml if we usually use Versions.props to define the version to be used?

    PVP flow requires that you declare dependencies explicitly so that source-build knows what properties to flow between repos. non-PVP flow just creates a version property for every possible package that is in the input set (previously source-built + currently produced).

    The problem with non-PVP flow is that what versions a repo consumes ends up being build-order dependent, rather than based on the dependency graph actually looks like. Microsoft's product build ends up differing from source-build significantly. As you build, you just build up more and more properties and new versions.

  17. mmitche commented on Apr 18, 2023

    @mmitche
    Member

    It is preferrable if both the microsoft and source-builds utilize the same versions. The reason being, the repo source-build CI leg will surface more issues at the repo level before the flow. Can we update this to the current version?

    I can try that out. The same thing would need to be done for System.IO.Packaging.4.5.0 that arcade is referencing.

    @mmitche - Do you foresee any issue with updating arcade to referencing current versions of Microsoft.Extensions.DependencyModel and System.IO.Packaging?

    What would be the exact version changes here and ongoing maintenance of them? That is my primary concern with updating them to reference newer versions. This is one reason we have plenty of SBRPs on 7.0.0 and 6.0.0. We rely on .NET's breaking change policies to avoid major problems when building in source-build.

  18. ViktorHofer commented on Apr 18, 2023

    @ViktorHofer
    Member

    Honestly while looking into various repositories inside our stack I noticed that there just isn't any policy today. Some use an ancient msbuild version, others are on the nuget.org latest available version via dependabot, etc. Some unification for versions that aren't handled via our internal dependency flow is necessary.

    We could all together let dependabot always update to the very latest. Unfortunately that comes with a high pressure on SBRP as packages would need to be added every month. Another option would be to flow stable package versions to use via some other mechanism.

  19. mmitche commented on Apr 18, 2023

    @mmitche
    Member

    I think it depends on why they are using such versions. If they're using some ancient version so that they can implement ITask and use ITaskItem, there's probably no issue at all whatsoever.

  20. ViktorHofer commented on Apr 18, 2023

    @ViktorHofer
    Member

    I think it depends on why they are using such versions. If they're using some ancient version so that they can implement ITask and use ITaskItem, there's probably no issue at all whatsoever.

    I tend to disagree as keeping these ancient versions around in SBRP is non trivial cost. You need to patch vulnerable dependencies, keep targeting packs checked in to build corresponding TFMs (which adds onto size and build complexity) and bring in a larger dependency graph (i.e. netstandard1.x) than what's necessary.

  21. mmitche commented on Apr 18, 2023

    @mmitche
    Member

    Sure, but you probably want somewhere between ancient and updated every release. Both extremes are going to have a high impact on SBRP. Maybe you really only want netstandard2.0 and netminimum+?

  22. ViktorHofer commented on Apr 19, 2023

    @ViktorHofer
    Member

    Absolutely agree. At this time it might make sense to define versions to upgrade our stack to consistently, i.e. I usually pick the latest version available in SBRP when I modernized repositories (17.3.2 for MSBuild packages and similar for NuGet). Microsoft.CodeAnalysis packages are a different story as VS depends on their version and by blindly upgrading, you lock out customers from using your packages on specific versions of VS. MSBuild doesn't have such a problem as they are pinning their assembly version down.

    Repositories like templating that use dependabot to update internal packages put a high pressure on SBRP and I would like us to find a better solution there.

    We already have a meeting set up for Thursday. Let's talk about this in more detail then.

  23. oleksandr-didyk commented on Apr 24, 2023

    @oleksandr-didyk
    ContributorAuthor

    @ViktorHofer is there any update on the status of the issue / or on the meeting from the last Thursday? Thanks!

  24. ViktorHofer commented on Apr 24, 2023

    @ViktorHofer
    Member

    As dotnet/arcade#13009 was opened, I don't think that your team is blocked, or are you?

  25. oleksandr-didyk commented on Apr 25, 2023

    @oleksandr-didyk
    ContributorAuthor

    We are blocked, but this is not an issue on runtime's side. It is caused by Arcade's transitive dependency on the package.

    As such, closing the issue

  26. ViktorHofer commented on Apr 25, 2023

    @ViktorHofer
    Member

    As of current main in arcade, DependencyModel is only used in a single place and not referenced transitively anywhere else: https://github.com/dotnet/arcade/blob/7b204a2774abb34ab119d5b69b1286fcbb49d21d/src/Microsoft.DotNet.SharedFramework.Sdk/Microsoft.DotNet.SharedFramework.Sdk.csproj#L14

    I just checked and unfortunately that's a hard dependency that can't be avoided.

  27. ghost locked as resolved and limited conversation to collaborators on May 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area-Infrastructure-installerblocking

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions