-
-
Notifications
You must be signed in to change notification settings - Fork 241
Description
First of all, I would like to sincerely thank McMaster for providing such an excellent and user-friendly plugin library.
Is your feature request related to a problem? Please describe.
I'm trying to load plugin assemblies that are stored in AWS S3 object storage, but the current PluginLoader.CreateFromAssemblyFile() method only accepts file paths. This forces me to download the DLL from S3 to a temporary local file first, then load it from the file system. This approach introduces unnecessary I/O overhead, temporary file management complexity, and potential security concerns with storing sensitive DLLs on local disk.
Describe the solution you'd like
I would like PluginLoader to support loading assemblies directly from Stream objects. This would enable loading plugins from cloud storage services, compressed archives, or any other stream source without requiring intermediate file operations.
Proposed API:
// Basic stream loading
public static PluginLoader CreateFromStream(Stream assemblyStream, string assemblyName)
// With shared types
public static PluginLoader CreateFromStream(Stream assemblyStream, string assemblyName, Type[] sharedTypes)
// With configuration
public static PluginLoader CreateFromStream(Stream assemblyStream, string assemblyName, Action<PluginConfig> configure)
// With symbol stream support for debugging
public static PluginLoader CreateFromStream(Stream assemblyStream, Stream symbolStream, string assemblyName, Action<PluginConfig> configure)Example usage:
// Download DLL from S3
using var s3Client = new AmazonS3Client();
var response = await s3Client.GetObjectAsync("my-plugins-bucket", "MyPlugin.dll");
using var assemblyStream = response.ResponseStream;
// Load plugin directly from stream
var loader = PluginLoader.CreateFromStream(assemblyStream, "MyPlugin");
var assembly = loader.LoadDefaultAssembly();Describe alternatives you've considered
-
Current workaround: Download S3 objects to temporary files, then use
CreateFromAssemblyFile(). This works but adds complexity and performance overhead. -
Pre-loading to memory: Download all plugins to memory as byte arrays and use
Assembly.Load(byte[]). However, this bypasses the plugin isolation and dependency resolution features thatPluginLoaderprovides. -
Custom AssemblyLoadContext: Implement a custom
AssemblyLoadContextthat handles S3 loading. This would require duplicating much of the functionality already provided by this library.
Additional context
- The underlying
AssemblyLoadContext.LoadFromStream()method already supports stream-based loading, so this feature would primarily involve exposing this capability through thePluginLoaderAPI - This feature would be valuable for cloud-native applications where plugin assemblies are stored in object storage (AWS S3, Azure Blob Storage, Google Cloud Storage, etc.)
- Stream-based loading should automatically enable
LoadInMemorymode for proper plugin isolation - This feature would complement existing file-based loading without introducing breaking changes
- Many modern applications are moving towards cloud storage for better scalability, security, and cost efficiency
This feature request would make McMaster.NETCore.Plugins more suitable for cloud-native and distributed application architectures.