question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Plugin depending on System.Drawing.Common cannot be used properly

See original GitHub issue

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:

  1. Add a reference to System.Drawing.Common to your plugin project.
  2. Write some basic functionality that uses that library (instantiating a PrintDocument is sufficient).
  3. Use McMaster.NETCore.Plugins 0.2.0 in you main project
  4. Load primary DLL of your plugin using PluginLoader
  5. Use reflection (or whatever is easiest) to call the offending System.Drawing code
  6. 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:closed
  • Created 5 years ago
  • Comments:34 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
gbrown-cecommented, Oct 26, 2018

@nathanaw thanks for the tip! That got us over this hump.

And thanks for all of your help along the way too @natemcmaster

0reactions
gbrown-cecommented, Oct 26, 2018

@natemcmaster it looks like currently you need to specify a RID still when using <UseAppHost>.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found