Repository navigation
Description
The current implementation of AssemblyDependencyResolver which underneath is implemented in hostpolicy as corehost_resolve_component_dependencies currently uses the same probing paths as the app. This means that it gets the paths specified in .runtimeconfig.json, .runtimeconfig.dev.json and command line --additionalProbingPath.
The probing paths always include the app folder itself and by default for dotnet build the .runtimeconfig.dev.json includes NuGet caches in the paths.
This means that if we're trying to "load a plugin" using this API, if the plugin has a .deps.json record for asset lib.dll, but the file is missing from the plugin, we will search for it in the app as well as nuget cache and potentially other places.
Typically the resolution should fail in such cases (the plugin should behave as close to app as possible). Resolving the dependency from the app's directory is actually potentially dangerous as it may resolve to a wrong version.
AssemblyDependencyResolver is new in .NET Core 3.0 where the SDK will always copy all necessary references to the output, so the presence of NuGet caches in the .runtimeconfig.dev.json is not necessary - and in this case it's actually hurtful. If the dependency is resolved from NuGet cache (even if it's the right version), typically in the plugin scenario it will be loaded in isolation into the plugin's ALC. If the dependency was missing due to it being a "shared" dependency, this breaks the sharing contract and duplicate load occurs (same thing happens if it's resolved from the app folder as well).
The correct behavior for plugins would be to only resolve against probing paths which are not from the app. So the app path must be explicitly ignored. Also paths from .runtimeconfig.json and .runtimeconfig.dev.json for the app should probably be ignored as well (as those belong to the app).
It's sort of questionable if we should also ignore --additionalProbingPahts, but we probably should.
This would mean that plugins can't customize the probing paths - so we may consider either:
- Supporting a new API on
AssemblyDependencyResolverto add probing paths that way - Supporting parsing
.runtimeconfig.json/.runtimeconfig.dev.jsonfrom the plugin itself and getting the paths from there - Potentially somehow using the app's probing paths, but avoiding the problem described above
Note that any change in this will be a breaking change against .NET 3.0.
This is related to potential SDK issues where non-private references do not correctly propagate into transitive dependencies. For example dotnet/sdk#1366.
Activity
vitek-karas commentedon Nov 11, 2019
Related to this are doc issues dotnet/docs#15811 and dotnet/samples#1760 which try to address the overall scenario and the SDK behavior.
dotnet-policy-service commentedon Feb 1, 2026
Due to lack of recent activity, this issue has been marked as a candidate for backlog cleanup. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will undo this process.
This process is part of our issue cleanup automation.
dotnet-policy-service commentedon Feb 16, 2026
This issue will now be closed since it had been marked
no-recent-activitybut received no further activity in the past 14 days. It is still possible to reopen or comment on the issue, but please note that the issue will be locked if it remains inactive for another 30 days.