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

Migrate to supported .NET Core versions #787

Merged

Conversation

wieslawsoltes
Copy link
Contributor

@wieslawsoltes wieslawsoltes commented Jan 8, 2021

Reference Issue

What does this implement/fix? Explain your changes.

  1. Migrates to supported .NET Core versions:
    • from .NET Core 2.2 (Out of support version) to .NET Core 2.1
    • from .NET Core 3.0 (Out of support version) to .NET Core 3.1
  2. Adds support for .NET 5.0 as it's is currently recommended .NET SDK

.NET Core 2.1 and 3.1 are LTS (Long-term support) releases, .NET 5.0 is basically basically new version of netstandard.

https://dotnet.microsoft.com/download/dotnet-core

Any other comments?

@wieslawsoltes
Copy link
Contributor Author

I think adding net5.0 target would also be good, we are already using it on AppVeyor for building and Source Generators require new compiler toolchain so this would not introduce any new dependency.

@wieslawsoltes
Copy link
Contributor Author

wieslawsoltes commented Jan 8, 2021

I will fix later samples, there are some breaking changes in netcoreapp3.1 and net5.0-windows regarding Windows Forms.

https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms

Copy link
Member

@mrbean-bremen mrbean-bremen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, and makes sense in my opinion, though I would like to hear from @tebjan about this (regarding removing support for unsupported versions).
I got an initial GH Actions workflow running based on this branch, though one test is failing both in .NetCore 3.1 and .Net 5 (__issue-084-01 comparison test). I have not looked into this, but would probably handle this in a separate issue, if this is not a false positive (which happens with the comparison tests).

@wieslawsoltes
Copy link
Contributor Author

Looks good to me, and makes sense in my opinion, though I would like to hear from @tebjan about this (regarding removing support for unsupported versions).

Well I am and moving netcoreapp2.2 to netcoreapp2.1 so it's is event better, netcoreapp3.0 to netcoreapp3.1 is not that bad as we have netcoreapp2.1, so I think in terms of compatibility we are pretty good. The net5.0 is pretty important as it is becoming new standard target.

I got an initial GH Actions workflow running based on this branch, though one test is failing both in .NetCore 3.1 and .Net 5 (__issue-084-01 comparison test). I have not looked into this, but would probably handle this in a separate issue, if this is not a false positive (which happens with the comparison tests).

I have checked the test (quickly) and it seems that issue is with saving and reloading the svg, not sure what is wrong, maybe I need to update System.Drawing package.

@mrbean-bremen
Copy link
Member

I think it makes sense for @tebjan to make a release with the old supported versions, and merge this afterwards. I would make a PR for GitHub actions after this is merged (with the current version, the tests for .NetCore 2.2 fail because it is not supported). As for the failing test - if you don't find the problem right away, I would create a new issue for this and temproraily remove this image from the tests. It still works with the older versions, so this is not a regression.

@wieslawsoltes
Copy link
Contributor Author

I think it makes sense for @tebjan to make a release with the old supported versions, and merge this afterwards.

That's fine with me.

I would make a PR for GitHub actions after this is merged (with the current version, the tests for .NetCore 2.2 fail because it is not supported).

You need to install:

  • .NET Core sdk 2.2.207
  • .NET Core sdk 3.0.103
    to make it work.

As for the failing test - if you don't find the problem right away, I would create a new issue for this and temproraily remove this image from the tests. It still works with the older versions, so this is not a regression.

The new issue would be good.

@wieslawsoltes
Copy link
Contributor Author

Testing the failing test:

       [Test]
        public void Test_Issue_084_01()
        {
            var svgPath = Path.Combine(AssemblyDirectory, "..", "..", "..", "..", "W3CTestSuite", "svg");
            var file = Directory.GetFiles(svgPath, "__issue-084-01.svg").FirstOrDefault(); 
            var doc1 = SvgDocument.Open<SvgDocument>(file);

            using (var memStream = new MemoryStream())
            {
                var targetFrameworkAttribute = Assembly.GetExecutingAssembly()
                    .GetCustomAttributes(typeof(System.Runtime.Versioning.TargetFrameworkAttribute), false)
                    .SingleOrDefault() as System.Runtime.Versioning.TargetFrameworkAttribute;
                
                
                doc1.Write(memStream);
                memStream.Position = 0;

                var streamReader = new StreamReader(memStream);
                var str = streamReader.ReadToEnd();
                File.WriteAllText($"c:\\DOWNLOADS\\__issue-084-01_{targetFrameworkAttribute.FrameworkName}.svg", str);

                memStream.Position = 0;

                var baseUri = doc1.BaseUri;
                var doc2 = SvgDocument.Open<SvgDocument>(memStream);
                doc2.BaseUri = baseUri;
            }

__issue-084-01.zip

@wieslawsoltes
Copy link
Contributor Author

wieslawsoltes commented Jan 9, 2021

Looks like the .NETCoreApp,Version=v3.1 and .NETCoreApp,Version=v5.0 produce different floating points for some reason.

TOTALCMD64_2021-01-09_14-11-01

@wieslawsoltes
Copy link
Contributor Author

@mrbean-bremen
Copy link
Member

__issue-084-01.zip

Cannot download this file, as it supposedly contains a virus.

@wieslawsoltes
Copy link
Contributor Author

@wieslawsoltes
Copy link
Contributor Author

@mrbean-bremen I will add float extension method for ToString, so we have one place for all conversion from float to string and can control output.

@mrbean-bremen
Copy link
Member

mrbean-bremen commented Jan 9, 2021

Here is the test result for this branch (with the failing test removed, Windows only).

@wieslawsoltes
Copy link
Contributor Author

Here is the test result for this branch (with the failing test removed, Windows only).

This is great, I think I have smaller repro for failing issue.

@mrbean-bremen
Copy link
Member

Do you think it makes sense to add all or some benchmark tests to the CI build? Currently only the unittests are run.

@wieslawsoltes
Copy link
Contributor Author

Do you think it makes sense to add all or some benchmark tests to the CI build? Currently only the unittests are run.

I don't think they will be comparable, probably by limited CI machine resources and will increase the build times.

Maybe we can add separate job only for benchmarks, the cpu performance will vary but memory usage can be useful.

@mrbean-bremen
Copy link
Member

Maybe we can add separate job only for benchmarks

Yes, this is what I have been thinking.

@wieslawsoltes
Copy link
Contributor Author

wieslawsoltes commented Jan 10, 2021

Do you think it makes sense to add all or some benchmark tests to the CI build? Currently only the unittests are run.

I don't think they will be comparable, probably by limited CI machine resources and will increase the build times.

Maybe we can add separate job only for benchmarks, the cpu performance will vary but memory usage can be useful.

I would start we this benchmark:

dotnet run -c Release -f netcoreapp3.1 ./Tests/Svg.Benchmark/Svg.Benchmark.csproj -- -f '*SvgDocument_*'

@mrbean-bremen
Copy link
Member

mrbean-bremen commented Jan 10, 2021

Yeah, this increases the build times a bit, but that is still acceptable. Could further parallelize the tests, if needed, and probably add an option to show less output.

@wieslawsoltes
Copy link
Contributor Author

Yeah, this increases the build times a bit, but that is still acceptable. Could further parallize the tests, if needed, and probably add an option to show less output.

Yes that looks acceptable.

@mrbean-bremen
Copy link
Member

@wieslawsoltes - I'm going to merge this now, if you don't object - the release is out!

@wieslawsoltes
Copy link
Contributor Author

@wieslawsoltes - I'm going to merge this now, if you don't object - the release is out!

@mrbean-bremen No objections, ready to merge.

@mrbean-bremen mrbean-bremen merged commit 58424cc into svg-net:master Jan 12, 2021
@wieslawsoltes wieslawsoltes deleted the MigrateToSupportedDotNetCoreVersions branch January 14, 2021 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants