ImageSharp
ImageSharp copied to clipboard
cleanup projects and environment variables
cleanup projects and use modern environment variables.
Looks like .NET 9 introduces a bunch of new required fixes. A good thing but also a chore.
.net9 work can be a separate pr from this one.
reverted, here is the history: https://github.com/SixLabors/ImageSharp/commits/522843cf11e6f965a3ad8f82304a573dd44222ff/. it fixes all CA warnings, passes all CI jobs with .net8, but fails all CI jobs with .net9 due to ONE test failure:
xUnit.net 00:06:14.30] Finished: SixLabors.ImageSharp.Tests
ImageSharp.Tests test net9.0 failed with 1 error(s) and 14 warning(s) (375.2s)
/home/codespace/.dotnet9/sdk/9.0.100-rc.1.24452.12/Microsoft.TestPlatform.targets(48,5): warning :
[xUnit.net 00:00:00.29] SixLabors.ImageSharp.Tests: BenchmarkDotNet=v0.13.0, OS=ubuntu 20.04 (container)
AMD EPYC 7763, 1 CPU, 4 logical and 2 physical cores
.NET SDK=9.0.100-rc.1.24452.12
[Host] : .NET 9.0.0 (9.0.24.43107), X64 RyuJIT
/home/codespace/.dotnet9/sdk/9.0.100-rc.1.24452.12/Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:07.92] CreateAndResize [SKIP]
/home/codespace/.dotnet9/sdk/9.0.100-rc.1.24452.12/Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:12.99] Encode_Animated_VisualTest [SKIP]
/home/codespace/.dotnet9/sdk/9.0.100-rc.1.24452.12/Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:18.76] ResizeBicubic [SKIP]
/home/codespace/.dotnet9/sdk/9.0.100-rc.1.24452.12/Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:01:09.30] LargeImage [SKIP]
/home/codespace/.dotnet9/sdk/9.0.100-rc.1.24452.12/Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:01:13.66] Benchmark_ToVector4 [SKIP]
/home/codespace/.dotnet9/sdk/9.0.100-rc.1.24452.12/Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:01:27.97] LoadAsync_IsCancellable [SKIP]
/workspaces/ImageSharp/tests/ImageSharp.Tests/TestUtilities/ImageComparison/ImageComparer.cs(125): error TESTERROR:
TiffDecoder_CanDecode_TiledWithBadZlib (33ms): Error Message: SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison.ImageDifferenceIsOverThresholdExcepti
on : Image difference is over threshold
!Test Environment OS : Linux
Test Environment is CI : False
Test Environment is .NET Core : True
Test Environment is Mono : False
Test Environment OS Architecture : X64
Test Environment Process Architecture : X64
Report ImageFrame 0:
Total difference: 0.0018%
[Δ(0,0,55512,0) @ (10,107)];
[Δ(3855,65535,0,0) @ (11,107)]
Stack Trace:
at SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison.ImageComparerExtensions.VerifySimilarity[TPixelA,TPixelB](ImageComparer comparer, Image`1 exp
ected, Image`1 actual, Func`3 predicate) in /workspaces/ImageSharp/tests/ImageSharp.Tests/TestUtilities/ImageComparison/ImageComparer.cs:line 125
at SixLabors.ImageSharp.Tests.TestImageExtensions.CompareToReferenceOutput[TPixel](Image`1 image, ImageComparer comparer, ITestImageProvider provider, Ob
ject testOutputDetails, String extension, Boolean grayscale, Boolean appendPixelTypeToFileName, Boolean appendSourceFileOrDescription, IImageDecoder decoder
) in /workspaces/ImageSharp/tests/ImageSharp.Tests/TestUtilities/TestImageExtensions.cs:line 230
at SixLabors.ImageSharp.Tests.Formats.Tiff.TiffDecoderTests.TiffDecoder_CanDecode_TiledWithBadZlib[TPixel](TestImageProvider`1 provider) in /workspaces/I
mageSharp/tests/ImageSharp.Tests/Formats/Tiff/TiffDecoderTests.cs:line 721
at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr)
/home/codespace/.dotnet9/sdk/9.0.100-rc.1.24452.12/Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:02:39.38] PrintNonNormalizedKernelMap [SKIP]
/home/codespace/.dotnet9/sdk/9.0.100-rc.1.24452.12/Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:03:26.48] LoadResizeSave [SKIP]
/home/codespace/.dotnet9/sdk/9.0.100-rc.1.24452.12/Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:03:30.27] Decoder_ParseStream_SaveSpectralResult [SKIP]
/home/codespace/.dotnet9/sdk/9.0.100-rc.1.24452.12/Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:03:36.50] BenchmarkMagickBmpDecoder [SKIP]
/home/codespace/.dotnet9/sdk/9.0.100-rc.1.24452.12/Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:03:36.51] BenchmarkMagickPngDecoder [SKIP]
/home/codespace/.dotnet9/sdk/9.0.100-rc.1.24452.12/Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:03:36.51] BenchmarkSystemDrawingPngDecoder [SKIP]
/home/codespace/.dotnet9/sdk/9.0.100-rc.1.24452.12/Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:03:36.51] BenchmarkSystemDrawingBmpDecoder [SKIP]
ImageSharp.Benchmarks net9.0 succeeded (0.1s) → artifacts/bin/tests/ImageSharp.Benchmarks/Debug/net9.0/ImageSharp.Benchmarks.dll
Test summary: total: 36767, failed: 1, succeeded: 36753, skipped: 13, duration: 375.2s
https://github.com/kasperk81/ImageSharp/actions/runs/11124894544 it doesn't show in github action logs had to run it locally.
@adamsitnik @eerhardt this is either .net9 regression with ReadExactly or a fix but it doesn't repro in .net8 as you can see in this github run https://github.com/kasperk81/ImageSharp/actions/runs/11124894544. unfortunately i don't have a simple repro.
@kasperk81 - can you log an issue in dotnet/runtime?
Hey @kasperk81 Did you ever raise that issue? I'm wondering whether there is a zlib implementation change in .NET 9 which might be responsible for the differences given the test input image has damaged compression.
@JimBobSquarePants i didn't get a chance to isolate a repro to report something actionable upstream. it's off by 0.0018% can we adjust the tolerance for VerifySimilarity? i haven't checked how much it differs net8.0, i.e. slightly less than 0.0018% or exactly 0%?
I'll pull down your branch and compare the output. It's likely we can simply adjust that tolerance.
I was right about the zlib changes. The underlying library .NET uses has changed. It actually decodes an extra 2 pixels in the busted image!
https://learn.microsoft.com/en-us/dotnet/core/whats-new/dotnet-9/libraries#compression-with-zlib-ng