-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Allow SVG exporting under .NET 6 on Linux #490
Conversation
@@ -103,6 +103,7 @@ public void can_render_svg_qrcode_without_quietzones_hex() | |||
result.ShouldBe("4ab0417cc6127e347ca1b2322c49ed7d"); | |||
} | |||
|
|||
#if NETFRAMEWORK || NETSTANDARD2_0 || NET5_0 || NET6_0_WINDOWS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#if !NET6_0
would exclude both .NET 6 on Linux and .NET 6 on Windows. So the ifdef has been fixed to properly run on all applicable test targets
Hi @Shane32 , thanks for your PR and your appreciation. I had a first look at your changes. It looks good to me so far. However, before I merge, I would like to run my test cases again. In addition, unfortunately the build and test pipeline (workflow.yml) is also broken. I haven't made any progress on the project for far too long... :-( Long story short: I'm open to a merge, but I want to fix the workflow first. |
Test cases ran without failures. Let's merge. |
Added .NET 6.0 support for SvgQRCode in the compatibility matrix: https://github.com/codebude/QRCoder/wiki/Advanced-usage---QR-Code-renderers |
Summary
This PR allows SVGs to be created under .NET 6 on Linux. The majority of the code is already compatible and does not use System.Drawing. The only code that does is the constructor for SvgLogo. This implementation simply removes only that constructor on .NET 6 on Linux, without removing any other code, allowing:
This does not allow users to use PNG-based logos on .NET 6+ on Linux -- a 3rd constructor could be added for that scenario, either public or protected, where the user would supply the PNG data (generated from a third-party image library, for example). This is solved by #491 which can be merged independently.
What existing problem does the pull request solve?
This allows users of QRCoder on Linux to export SVG files
What is unique about this proposal?
Does not introduce any new dependencies
Test plan
The currently existing tests within the codebase have been updated to run on .NET 6 on Linux, excluding the one for the constructor that references
System.Drawing.Bitmap
.