Plugin depending on System.Drawing.Common cannot be used properly
See original GitHub issueDescribe 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.
Issue Analytics
- State:
- Created 5 years ago
- Comments:34 (12 by maintainers)
Top Results From Across the Web
System.Drawing.Common.dll is not allowed or missing
I've tried uninstalling and reinstalling it through the package manager, and adding it directly into Assets/Plugins but i still get the ...
Read more >NET Core 5 dependencies not included in Release compile
The solution creates DLLs which are plugins for another application; ... Now there are 2 subtrees under System.Drawing.Common.
Read more >System.Drawing.Common only supported on Windows - .NET
Learn about the .NET 6 breaking change where the System.Drawing.Common package is no longer supported on non-Windows operating systems.
Read more >'PlatformNotSupportedException: System.Drawing is not ...
Currently I'm trying to create a report plugin in our project hat uses DevExpress reporting. The plugin is configured like this:
Read more >How do you use System.Drawing in .NET Core?
Common to provide access to GDI+ graphics functionality cross-platform. There is a lot of existing code - mine included - that makes assumptions ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@nathanaw thanks for the tip! That got us over this hump.
And thanks for all of your help along the way too @natemcmaster
@natemcmaster it looks like currently you need to specify a RID still when using
<UseAppHost>
.