Comments (6)
There are two facade projects in your repro. I'm not exactly sure what I'm looking for.
from dotnetcoreplugins.
@natemcmaster You're right. Use Samples.Specifications
as it's easily reproduced there
from dotnetcoreplugins.
I read the code and I'm still not 100% I understand what you're trying to do, but it appears to me that at least one problem is that you're creating a unique assembly loader per .dll here: https://github.com/godrose/netcore-load/blob/b09327732a891b174b83e9ef8e6c453a56abfc3f/Samples.Specifications.Server.Facade/Startup.cs#L26-L29
I think there may be a general misunderstanding here of how PluginLoader
is supposed to be used. Generally, each plugin should be in a directory of its own with the plugin's dependency .dll's in that same directory. Easiest way to prepare a plugin is with dotnet publish
. See https://github.com/natemcmaster/DotNetCorePlugins#the-host for a more detailed description.
from dotnetcoreplugins.
@natemcmaster
So the general idea in my example is to have all plugins compiling in the same directory. It is the solution configuration which will decide whether the specific plugin is eventually built. This is useful for the cases where I would like to substitute implementations of a particular interface and test the app behavior.
I examined the example you provided within the link. It states that each assembly file indeed has its own loader
var loader = PluginLoader.CreateFromAssemblyFile(
pluginDll,
sharedTypes: new [] { typeof(IPlugin) });
loaders.Add(loader);
So I don't really see how it's different from what I'm doing.
The question here is what happens if you use
var loader = PluginLoader.CreateFromAssemblyFile(
pluginDll,
config => config.PreferSharedTypes = true);
loaders.Add(loader);
instead and remove the explicit reference to the project containing the IPlugin
interface.
Will it still work? Should it?
from dotnetcoreplugins.
The distinction I was trying to make was that 1 plugin = 1 plugin loader. There might be multiple assemblies per plugin, but you should still only use 1 instance of PluginLoader. The assembly you pass to PluginLoader is the "entry" assembly, also called the "default" assembly. All dependencies of the default assembly will be found and loaded by PluginLoader. Normally, the dependencies of the plugin sit in a directory next to the default assembly.
Because you are sharing a common directory and creating multiple loaders from the same directory, you might have multiple instances of Samples.Specifications.Server.Domain.dll loaded. PreferSharedTypes
only handles sharing between the host and the plugin, not between multiple plugins, so this might be why
you're code is having trouble finding implementations of IWarehouseRepository.
from dotnetcoreplugins.
This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.
from dotnetcoreplugins.
Related Issues (20)
- Use WeakReference to check if unload is successful HOT 3
- [Question] What happened to AddDependencyContext? HOT 9
- Add hot-reload to ASP.NET Core sample HOT 2
- How do I "Unload" a plugin/dll HOT 1
- Error starting application when plugin controller decorating with [ApiController]
- How can i use Plugin DBContext ? HOT 4
- Docker file build problems HOT 3
- [Question] Diamond dependency & shared types doesn't work
- Diamond dependency & shared types doesn't work when using NuGet packages HOT 2
- Error on loading NuGet package HOT 2
- [Question] [Help Wanted] JSON Serialization problems; can assembly name or version be changed at load time? HOT 1
- [Question] Some questions about the state of the project HOT 8
- 支持卸载吗 HOT 2
- [Question] How to inject Logger or IConfiguration in Plugins ? I tried and failed HOT 3
- Using the library in MacOs project HOT 2
- [Question] Capturing exceptions HOT 2
- RobiniaDocs API Explorer
- [Question] System.Data.SqlClient could not be found on my plugin HOT 3
- [Question] Hot-reload managed assemblies using assembly file lock instead of through FileStream
- System.PlatformNotSupportedException on Android
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dotnetcoreplugins.