Cannot load plugins with external dependencies in plugin interface
See original GitHub issueI’m having trouble with loading plugin that contains an external dependency in the plugin interface. Let’s say that PluginBase project depends on System.Collections.Immutable package and my plugin interface looks as follows:
public interface ICommand
{
string Name { get; }
string Description { get; }
int Execute(ImmutableArray<string> input);
}
When I try to load my plugin type I’m getting the following exeception:
System.Reflection.ReflectionTypeLoadException: 'Unable to load one or more of the requested types.
Method 'Execute' in type 'PluginArchitectureDemo.SamplePlugins' from assembly 'PluginArchitectureDemo.SamplePlugins, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.
Here is a repository with a solution that reproduces that problem https://github.com/cezarypiatek/PluginArchitectureDemo - just run PluginArchitectureDemo with a path to PluginArchitectureDemo.SamplePlugins.dll as the parameter.
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: 06023407-704f-0ace-e89a-eedd9f95a007
- Version Independent ID: f25a6e1a-cb10-867b-0522-a377bf9d016b
- Content: Create a .NET Core application with plugins - .NET Core
- Content Source: docs/core/tutorials/creating-app-with-plugin-support.md
- Product: dotnet-core
- GitHub Login: @jkoritzinsky
- Microsoft Alias: jekoritz
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:14 (8 by maintainers)
Top Results From Across the Web
How do I resolve a dependency in an Eclipse plug-in I didn' ...
I tried importing the plugin as a source project, but the src/ directory is empty. The plugin doesn't appear in the list of...
Read more >Create a .NET Core application with plugins
The tutorial correctly isolates the plugin's dependencies from the hosting application. You'll learn how to: Structure a project to support ...
Read more >Difficulty Sharing Code Between Swift Package Manager ...
I'm currently writing an SPM package to house several utility plugins for a codebase, and these plugins overlap in functionality.
Read more >Dependent Assembly plug-ins (preview) - Power Apps
If any signed assemblies depend on unsigned assemblies, you will get an error like the following: Could not load file or assembly '<AssemblyName> ......
Read more >Feature Project: Plugin Dependencies – Make WordPress Core
Any plugin that requires another plugin (i.e., a dependency) is on its own to make sure admins install the dependency. After all, the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@cezarypiatek Could you please describe in more detail what is the exact failure you get after the suggested workaround?
I cloned your repo https://github.com/cezarypiatek/PluginArchitectureDemo and made one change in the
PluginArchitectureDemo.SamplePlugins.csproj
adding the<ExcludeAssets>runtime</ExcludeAssets>
metadata to the project reference, like this:Then I Rebuild the entire solution and the ran it - it works just fine for me.
Does this help with reproduction: https://github.com/ljani/dotnet-sdk-3814
I cleanup the sample a little bit and added some methods. Now it fails:
I thought it was because
System.CommandLine.Hosting
tries to pull v3.1.5 libs, but adding<PackageReference Include="Microsoft.Extensions.Hosting" Version="5.0.0" />
did not help. I did not have time to investigate this further.