Embedded Assembly Resolution in new AppDomain
Izzyonstage
Posts: 5 New member
I am working on an application that uses SmartAssembly to embed all top level dependencies into the resulting application. Currently I am having issues trying to dynamically load "plugin" assemblies that have a dependency on the same top level assemblies.
For Example:
I have a library assembly which essentially contains all my internal business logic. This is a dependency of both the application (so I am able to load my custom "plugins") and the plugins themselves.
Due the need to filter loaded plugins, I am using a new AppDoamin in which to load them and retrieve their "metadata". This cannot be done using the reflectionOnly context as I am using that already for something else.
When I deploy my application, it loads fine until it gets to reading the plugin "metadata".
I am wondering if there is a way for me to pass the SmartAssembly resolver into my new AppDomain, such that my plugin can load it's dependencies from the application resources?
Application.exe
- library.dll
Plugin.plg (*.dll)
- library.dll
Any help would be greatly appreciated.
For Example:
I have a library assembly which essentially contains all my internal business logic. This is a dependency of both the application (so I am able to load my custom "plugins") and the plugins themselves.
Due the need to filter loaded plugins, I am using a new AppDoamin in which to load them and retrieve their "metadata". This cannot be done using the reflectionOnly context as I am using that already for something else.
When I deploy my application, it loads fine until it gets to reading the plugin "metadata".
I am wondering if there is a way for me to pass the SmartAssembly resolver into my new AppDomain, such that my plugin can load it's dependencies from the application resources?
Application.exe
- library.dll
Plugin.plg (*.dll)
- library.dll
Any help would be greatly appreciated.
Tagged:
Answers
I think this is a fundamental limitation of embedding, but I'm going to double check with the developers to confirm that and I will come back to you!
Kind regards,
Alex
Have you visited our Help Center?
Alternatively, some config to make the assembly write all embedded assemblies to disk (in a temp directory) on startup/request and then load from there. As this would likely enable me to locate it and dynamically load it in my child AppDomain (I believe this is usually the process for unmanaged embedded assembly loading).
The team indicated they didn't experience a problem when attempting this actually, would you be able to provide an example application replicating the issue you are experiencing? I can reach out via a support ticket to get the file if that is possible.
Kind regards,
Alex
Have you visited our Help Center?
Alternatively, some config to make the assembly write all embedded assemblies to disk (in a temp directory) on startup/request and then load from there. As this would likely enable me to locate it and dynamically load it in my child AppDomain (I believe this is usually the process for unmanaged embedded assembly loading).
I have an example PoC project I could send over. It has a working saproj which does merging of the main "library" dependency, and a broken version which is embedding that same dependency.
I've cleared up the duplicates and I will send a message from a support ticket shortly with a link to upload the files to us for further investigation!
Kind regards,
Alex
Have you visited our Help Center?