DotNetCorePlugins: Plugin depending on System.Drawing.Common cannot be used properly
Describe the bug
When using the PluginLoader to load a library that references System.Drawing.Common, anytime any code executes from your plugin that uses a component from that library (PrintDocument in our case), the code blows up with an error claiming System.Drawing is not supported on this platform.
. Obviously that is cross platform now (and I’m running this on Windows to boot).
To Reproduce Steps to reproduce the behavior:
- Add a reference to System.Drawing.Common to your plugin project.
- Write some basic functionality that uses that library (instantiating a PrintDocument is sufficient).
- Use McMaster.NETCore.Plugins 0.2.0 in you main project
- Load primary DLL of your plugin using PluginLoader
- Use reflection (or whatever is easiest) to call the offending System.Drawing code
- See the exception generated
Expected behavior I would expect this code to work properly as if it weren’t being loaded by a plugin
Additional context As a temporary workaround, if I use the PluginLoaderOptions.PreferSharedTypes flag and reference System.Drawing.Common directly in my host project, things work properly if that helps at all.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 34 (12 by maintainers)
@nathanaw thanks for the tip! That got us over this hump.
And thanks for all of your help along the way too @natemcmaster