Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

netstandard compatibility #346

Closed
maitredede opened this issue Nov 13, 2017 · 14 comments · Fixed by #509
Closed

netstandard compatibility #346

maitredede opened this issue Nov 13, 2017 · 14 comments · Fixed by #509

Comments

@maitredede
Copy link

Hi,
Is it possible to refactor SVG a bit so core SVG parsing is compatible with netstandard, and rendering is split into other libraries ? So there can be an implementation for the framework (the actual one), and implementations for dotnet core (based on ImageSharp for example).
Thanks.

@tebjan
Copy link
Contributor

tebjan commented Nov 13, 2017

hello @maitredede, the library is open source. you are welcome do refactor it to your liking. if got something running, don't hesitate to open a pull request.

@wyshmily
Copy link

@maitredede do you have a solution now?

@maitredede
Copy link
Author

@wyshmily The solution would be to fork and refactor.

The System.Drawing library is deeply integrated inside SVG, so does System.Web. Removing dependencies on both needs to rethink the library.

This will be really time-consuming.

@mmosca
Copy link

mmosca commented Nov 22, 2017 via email

@maitredede
Copy link
Author

maitredede commented Nov 22, 2017 via email

@JimBobSquarePants
Copy link

Having had a quick look at the library it would take serious refactoring to allow enough abstraction to use another rendering engine like ImageSharp since the integration is so tightly coupled.

Since System.Drawing will never be part of the NetStandard and is being worked on now as part of the Windows Compatibility Pack to help with migrations only I would recommend making such an abstraction a priority if NetStandard support is a goal for the library.

@jaedson-barbosa
Copy link

Hi, I'll try to port that for the .NET Standard, but that port won't have the renderer system, it just will generate the SVG files using a black and white image.

@wieslawsoltes
Copy link
Contributor

To make it compatible with netstandard2.0 System.Drawing.Common can be used.

@tub5
Copy link

tub5 commented Oct 11, 2021

To make it compatible with netstandard2.0 System.Drawing.Common can be used.

Please note this is not ideal on Linux due to System.Drawing.Common not being properly supported

@mrbean-bremen
Copy link
Member

@wieslawsoltes, @gvheertum: any thoughts on this?

@wieslawsoltes
Copy link
Contributor

System.Drawing.Common is basically dead for anything else then Windows https://docs.microsoft.com/en-us/dotnet/core/compatibility/core-libraries/6.0/system-drawing-common-windows-only

No idea what we can do now

@gvheertum
Copy link
Member

gvheertum commented Oct 11, 2021

Maybe with the new crossplatform frontend libraries that are emerging like MAUI, I think eventually some of the drawing logic might come into the .net standard scope somehow. Although maybe not these specific libs. (Edit: they mention maui in the article, but that means we need to migrate code).

We could try wrapping the libraries for non windows environments and reroute to an alternative (basically making our own system.drawing), but this might break stuff and adds complexities along the way (and this means we are proxying a lot of stuff). So perhaps this could be an experimental path (since the behavior and output will most likely differ in the first versions).

But perhaps before doing much research and work we could check whether non windows environments are common and what stuff is being used that might cause issues.

edit: Changed some bits due to confusion on my side. I wonder why they explicitly break builds if there are wrappers for non windows system available. I’m curious whether this will also break if the SVG all is already built and served over nuget, because that might not throw the error and magically might make the library work without further issues.

@gvheertum
Copy link
Member

According to the Microsoft article there is a “work around” to prevent the error being emitted when working on non windows systems

System.Drawing.EnableUnixSupport runtime configuration switch to true in the runtimeconfig.json file

They might remove this switch in the future, but for now this buys time when building against framework 6.

@mrbean-bremen
Copy link
Member

Note: I have copied over that discussion to the separate discussion issue #910.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants