-
Notifications
You must be signed in to change notification settings - Fork 473
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
Netcore2.2 #495
Netcore2.2 #495
Conversation
- This build supports targeting .Net Framework 4.0 and .Netstandard2.0 allowing use of Svg library by .Net core apps. - Solution can be built using Visual Studio 2017 Preview and .Net Core 2.0 Preview 2+
# Conflicts: # Source/Svg.csproj
# Conflicts: # Tests/Svg.UnitTests/Svg.UnitTests.csproj
@tebjan - as far as I can see, the only difference to master here is the automatic git versioning and the version number. Is there a reason not to add this directly to master? |
Ah, and a suggestion - I noticed that you added me to the authors, maybe you can also add H1Gdev, who did most of the latest fixes and refactoring. |
yes, good point. indeed, the idea is to merge to master once there is some positive feedback on the nuget preview. |
I was wondering, does this mean that it's also non-Windows compatible? I tried building on VSCode on my Macbook, but there were still some references to Windows related libraries. Since we work with graphics for the bitmap conversion, it's plausible that Windows libs are still needed (at least until .NET Core 3, where they will possibly also port forms and all other windows specific stuff). Is that something one of you looked into already? Just wondering :) |
This should work with MacOS and Linux, though it has not really been tested yet (see #427 for a test @thedonciuxx made under Linux). You may try that also with master, as there seems to be some problem with the pre-release branch). |
I'm hitting the NullReferenceException (#427 (comment)) when running on linux (works fine on windows). I'm guessing the commit mentioned there is not part of this version (3.0.3)? |
Yep, my bad. I just did a dotnet build, which tried to build both target-frameworks (including .net 4.5.2, which ofcourse will not work on a Mac). If I specify the framework Nice job getting it ported to .NET Core! 👍 |
@ErlendSB - the commit in question is part of this branch, so this should not be the issue. |
Just to put a reference here: under Linux and MacOs you need libgdiplus installed. There is a packaging project on Github that makes this easier and also contains installation instructions (copied here for convenience): Using libgdiplus on Ubuntu LinuxYou can install libgdiplus on Ubuntu Linux using the Quamotion PPA. Follow these steps:
Using libgdiplus on macOSOn macOS, add a reference to the runtime.osx.10.10-x64.CoreCompat.System.Drawing package:
|
I can imagine it's a bit confusing. The SvgDocument.Open() will in some cases ignore the gdi error and just return a null. This at least explained why together with the dll reference issues, I also had some tests failing with null pointer exceptions if the CoreCompat package is not installed. For example, the tests that use the drawing elements like the one in SvgTextTests will yield the TypeInitializationException (the do calls directly on SVG elements), while the LexerIssueTests yield a null pointer since they use the SvgDocument.Open() which seems to ignore this type of error. I think it might be more useful for the users if we did something to catch that error and rethrow it or wrap it with a message that makes more sense to the user. In the most likely scenario's users will not work on the SVG elements, but will start by creating an SvgDocument from a string or XML. |
Installing libgdiplus fixed it. |
… a more logical message (including reference to documentation)
… the mac (by having the CoreCompat included)
Gdi+ related errors are now wrapped in a specific exception with more detailed information
also merged master into the netcore branch, new nuget preview is ready to test: |
resolved by #503 |
This is the branch currently used for the new nugets with major version 3. I'll keep this here so we can discuss issues and get feedback whether the nuget works.
https://www.nuget.org/packages/Svg/3.0.3-gecdc54b12b