-
-
Notifications
You must be signed in to change notification settings - Fork 241
Description
Hi, thanks for the great work on this project!
I'm running into some ambiguity around how sharedTypes behaves, specifically in regard to assembly version resolution.
In the documentation under the section “What is a shared type?”, there's a statement:
“Configuring a shared type of IPlugin allows .NET to pass objects of this type across the plugin isolation boundary. It does this by ignoring the version of Contracts.dll in each plugin folder and sharing the version that comes with the Host.”
This phrasing seems to imply that simply including a type in sharedTypes will ignore the version of the corresponding assembly inside the plugin folder — and that the host’s version will be used instead.
However, i'm facing issues when trying to "share" IServiceCollection, if my plugin has a different version of Microsoft.Extensions.DependencyInjection.Abstractions even if i add IServiceCollection in the sharedType, the type in my plugin can't be resolved, seems that a mismatch is generated even when the host version is supposed to be used.
System.TypeLoadException: 'Method 'ConfigureServices' in type 'MyPlugin.MyClassRegistry' from assembly 'MyPlugin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.'
Project structure:
- PluginExtension =>Plugin interfaces and extension method to configure them
- Microsoft.Extensions.DependencyInjection.Abstractions 8.0.2
- McMaster.NETCore.Plugins 2.0.0
- Host
- Reference to PluginExtension
- Microsoft.Extensions.DependencyInjection.Abstractions 8.0.2
- MyPlugin
- Reference to PluginExtension
- Microsoft.Extensions.DependencyInjection.Abstractions 9.0.0
Minimal repro repo: https://github.com/yerald-mora/PluginTest/tree/master
- Is it expected that for some scenarios sharedType might not work as expected (Ignoring version and using host's version)?
- Are there any suggestions for handling this type of mismatch (beside align versions of the assembly in the project)?