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

RID specific assets in component dependency resolution on self-contained apps #3659

Open
vitek-karas opened this issue Jun 27, 2019 · 3 comments
Assignees
Milestone

Comments

@vitek-karas
Copy link
Member

The scenario is using AssemblyDependencyResolver to dynamically load a component when running in a self-contained app.

The component can be portable, that means it has all necessary assets for all platforms included in it. It's .deps.json will have runtimeTarget sections which will describe which assets are to be used by which RID. For example it might have a native mycode.dll for Windows and libmycode.so for Linux.

In order for the dependency resolution to work correctly it needs to have a RID fallback graph. That is a data structure which describes how the various RIDs fallback. So for example it states that win10-x64 falls back to win-x64. That means that if we're running on win10-x64 and there are no win10-x64 specific assets, as a next step look at win-x64 assets and use those if available.

For applications the RID fallback graph is read from the Microsoft.NETCore.App.deps.json which is part of the Microsoft.NETCore.App framework. The RID fallback graph is only needed for portable apps and those must be framework dependent.

Self-contained apps are always RID specific and thus they only contain assets for the target RID. The RID resolution is performed at build time by the SDK/NuGet. So the .deps.json of a self-contained app does not include the RID fallback graph.

When AssemblyDependencyResolver is used it takes the RID fallback graph from the app. For framework dependent apps that will come from the core framework and everything works. But for self-contained apps, there's no RID fallback graph in the app. The result is that portable components don't work well when hosted by self-contained apps.

There's currently no workaround as there's no way to make SDK include the RID fallback graph in self-contained apps and similarly the component can't carry the RID fallback graph with it.

@vitek-karas vitek-karas self-assigned this Jun 27, 2019
@vitek-karas
Copy link
Member Author

The proposed solution is to include the RID fallback graph in self-contained app's .deps.json so that it can act as the root framework.

See the SDK issue for this: dotnet/sdk#3361

@eerhardt
Copy link
Member

eerhardt commented Sep 4, 2019

See also https://github.com/dotnet/core-setup/issues/1846 for a related proposal - The dotnet host should respect a RID graph from an app's .deps.json.

@vitek-karas
Copy link
Member Author

@eerhardt I am aware of that one - it's related but not quite the same. In this case there's no RID graph at all, so it's really just a matter of taking the RID graph from the app instead of a framework - in fact the host change is trivial, the meat of the change is in the SDK to actually bake the RID graph into the app's .deps.json in this case.

In #2663 it becomes a little trickier as we would have to somehow merge two graphs - one potentially coming from the framework and another from the app. Maybe it's trivial (we use the app, and if that doesn't work, we use the framework, or something like that) - but it's a little bit more complex problem. There's also no good authoring story - other than .runtimeconfig.template.

But I definitely see value in both.

@msftgits msftgits transferred this issue from dotnet/core-setup Jan 30, 2020
@msftgits msftgits added this to the 3.1 milestone Jan 30, 2020
@maryamariyan maryamariyan added the untriaged New issue has not been triaged by the area owner label Feb 23, 2020
@jeffschwMSFT jeffschwMSFT removed the untriaged New issue has not been triaged by the area owner label Feb 24, 2020
@jkotas jkotas modified the milestones: 3.1, 5.0 Mar 1, 2020
@agocke agocke modified the milestones: 5.0.0, 6.0.0 Jul 13, 2020
@agocke agocke modified the milestones: 6.0.0, 7.0.0 Aug 9, 2021
@agocke agocke added this to AppModel Jul 28, 2022
@vitek-karas vitek-karas modified the milestones: 7.0.0, 8.0.0 Aug 5, 2022
@vitek-karas vitek-karas modified the milestones: 8.0.0, 9.0.0 Aug 2, 2023
@agocke agocke modified the milestones: 9.0.0, 10.0.0 Aug 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

7 participants