Skip to content

Update test projets and simplify the Continuous Integration workflow#70

Merged
manuelbl merged 9 commits intomanuelbl:masterfrom
0xced:tests-net8.0
May 11, 2025
Merged

Update test projets and simplify the Continuous Integration workflow#70
manuelbl merged 9 commits intomanuelbl:masterfrom
0xced:tests-net8.0

Conversation

@0xced
Copy link
Collaborator

@0xced 0xced commented Apr 30, 2025

  • Remove DiffEngine package reference (it would fail with NU1605: Detected package downgrade: DiffEngine from 16.2.1 to 15.11.0)
  • Simplify projects
  • Don't use floating version. For example, 2.* resolves to 2.0.0 instead of 2.9.3
  • Cleanup unused dependencies
  • Use Verify.DocNet instead of custom code to convert PDF to PNG
  • Fix deprecation warning on VerifierSettings.RegisterFileConverter

* Remove DiffEngine package reference (it would fail with NU1605: Detected package downgrade: DiffEngine from 16.2.1 to 15.11.0)
* Simplify projects
* Don't use floating version. For example, 2.* resolves to 2.0.0 instead of 2.9.3
* Cleanup unused dependencies
* Fix deprecation warning on VerifierSettings.RegisterFileConverter
Package validation is now included in the .NET SDK.

This also fixes these warnings when restoring:
> warning NU1505: Duplicate 'PackageDownload' items found.
@0xced 0xced changed the title Update test projets to .NET 8.0 (Long Term Support) Update test projets and simplify the Continuous Integration workflow Apr 30, 2025
@manuelbl
Copy link
Owner

manuelbl commented May 8, 2025

Thanks for the updates. These are good changes in an area I'm struggling with. Projects supporting multiple .NET version have their challenges, and the .NET tools have some rough edges.

Unfortunately, the updates don't quite work yet. Some of the unit tests fail. It affects some tests of the EmfCanvasTest (for net481 only). I will have to look into it.

And dotnet pack --configuration Release also fails for all three subprojects with an error message that isn't very helpful:

Restore complete (2.3s)
  Core failed with 1 error(s) (1.2s) → bin\Release\netstandard2.0\Codecrete.SwissQRBill.Core.dll
    C:\Users\redacted\SwissQRBill.NET\Core\Core.csproj(67,5): error MSB3073: The command "dotnet validate package local bin\Release\Codecrete.SwissQRBill.Core.3.3.0.nupkg" exited with code 1.

Build failed with 1 error(s) in 5.9s

And what is the reason for increasing PackageValidationBaselineVersion?

@0xced
Copy link
Collaborator Author

0xced commented May 8, 2025

Unfortunately, the updates don't quite work yet. Some of the unit tests fail. It affects some tests of the EmfCanvasTest (for net481 only). I will have to look into it.

That's surprising because it works fine on the GitHub Windows runner. The TestResults-Windows.zip from the last action run has all 13 tests passing.

And dotnet pack --configuration Release also fails for all three subprojects with an error message that isn't very helpful:

That's what happens when the file can't be found. If you run dotnet validate package local aFileThatDoesNotExist.bin you'll get an exit code of 1 with no error message. This is likely happening because $(PackageOutputPath) evaluates to an empty string. What version of the .NET SDK are you using? Can you try with the latest .NET 8 SDK (which is the one used by the GitHub action)?

Also, does it work if you explicitly specify an output directory on the command line by running the dotnet pack --configuration Release --output . command?

And what is the reason for increasing PackageValidationBaselineVersion?

If you delete the ValidateNuGetPackage target (so that the package validation can run) you'll see that many breaking changes were introduced between version 3.0.0 and 3.3.0.

Here are the exact breaking changes that surface when running dotnet pack -c Release with a PackageValidationBaselineVersion set to 3.0.0.

API compatibility errors between 'lib/netstandard2.0/Codecrete.SwissQRBill.Core.dll' (~/.nuget/packages/codecrete.swissqrbill.core/3.0.0/codecrete.swissqrbill.core.3.0.0.nupkg) and 'lib/netstandard2.0/Codecrete.SwissQRBill.Core.dll' (~/Projects/SwissQRBill.NET/Core/bin/Release/Codecrete.SwissQRBill.Core.3.3.0.nupkg): [~/Projects/SwissQRBill.NET/Core/Core.csproj]
CP0011: Value of field 'EN' in enum 'Language' changed from '3' to '4'. [~/Projects/SwissQRBill.NET/Core/Core.csproj]
CP0002: Member 'ushort Codecrete.SwissQRBill.Generator.Canvas.CharWidthData.HelveticaNormalDefaultWidth' exists on [Baseline] lib/netstandard2.0/Codecrete.SwissQRBill.Core.dll but not on lib/netstandard2.0/Codecrete.SwissQRBill.Core.dll [~/Projects/SwissQRBill.NET/Core/Core.csproj]
CP0002: Member 'ushort[] Codecrete.SwissQRBill.Generator.Canvas.CharWidthData.HelveticaNormal_20_7F' exists on [Baseline] lib/netstandard2.0/Codecrete.SwissQRBill.Core.dll but not on lib/netstandard2.0/Codecrete.SwissQRBill.Core.dll [~/Projects/SwissQRBill.NET/Core/Core.csproj]
CP0002: Member 'ushort[] Codecrete.SwissQRBill.Generator.Canvas.CharWidthData.HelveticaNormal_A0_FF' exists on [Baseline] lib/netstandard2.0/Codecrete.SwissQRBill.Core.dll but not on lib/netstandard2.0/Codecrete.SwissQRBill.Core.dll [~/Projects/SwissQRBill.NET/Core/Core.csproj]
CP0002: Member 'ushort Codecrete.SwissQRBill.Generator.Canvas.CharWidthData.HelveticaBoldDefaultWidth' exists on [Baseline] lib/netstandard2.0/Codecrete.SwissQRBill.Core.dll but not on lib/netstandard2.0/Codecrete.SwissQRBill.Core.dll [~/Projects/SwissQRBill.NET/Core/Core.csproj]
CP0002: Member 'ushort[] Codecrete.SwissQRBill.Generator.Canvas.CharWidthData.HelveticaBold_20_7F' exists on [Baseline] lib/netstandard2.0/Codecrete.SwissQRBill.Core.dll but not on lib/netstandard2.0/Codecrete.SwissQRBill.Core.dll [~/Projects/SwissQRBill.NET/Core/Core.csproj]
CP0002: Member 'ushort[] Codecrete.SwissQRBill.Generator.Canvas.CharWidthData.HelveticaBold_A0_FF' exists on [Baseline] lib/netstandard2.0/Codecrete.SwissQRBill.Core.dll but not on lib/netstandard2.0/Codecrete.SwissQRBill.Core.dll [~/Projects/SwissQRBill.NET/Core/Core.csproj]
CP0002: Member 'ushort Codecrete.SwissQRBill.Generator.Canvas.CharWidthData.ArialNormalDefaultWidth' exists on [Baseline] lib/netstandard2.0/Codecrete.SwissQRBill.Core.dll but not on lib/netstandard2.0/Codecrete.SwissQRBill.Core.dll [~/Projects/SwissQRBill.NET/Core/Core.csproj]
CP0002: Member 'ushort[] Codecrete.SwissQRBill.Generator.Canvas.CharWidthData.ArialNormal_20_7F' exists on [Baseline] lib/netstandard2.0/Codecrete.SwissQRBill.Core.dll but not on lib/netstandard2.0/Codecrete.SwissQRBill.Core.dll [~/Projects/SwissQRBill.NET/Core/Core.csproj]
CP0002: Member 'ushort[] Codecrete.SwissQRBill.Generator.Canvas.CharWidthData.ArialNormal_A0_FF' exists on [Baseline] lib/netstandard2.0/Codecrete.SwissQRBill.Core.dll but not on lib/netstandard2.0/Codecrete.SwissQRBill.Core.dll [~/Projects/SwissQRBill.NET/Core/Core.csproj]
CP0002: Member 'ushort Codecrete.SwissQRBill.Generator.Canvas.CharWidthData.ArialBoldDefaultWidth' exists on [Baseline] lib/netstandard2.0/Codecrete.SwissQRBill.Core.dll but not on lib/netstandard2.0/Codecrete.SwissQRBill.Core.dll [~/Projects/SwissQRBill.NET/Core/Core.csproj]
CP0002: Member 'ushort[] Codecrete.SwissQRBill.Generator.Canvas.CharWidthData.ArialBold_20_7F' exists on [Baseline] lib/netstandard2.0/Codecrete.SwissQRBill.Core.dll but not on lib/netstandard2.0/Codecrete.SwissQRBill.Core.dll [~/Projects/SwissQRBill.NET/Core/Core.csproj]
CP0002: Member 'ushort[] Codecrete.SwissQRBill.Generator.Canvas.CharWidthData.ArialBold_A0_FF' exists on [Baseline] lib/netstandard2.0/Codecrete.SwissQRBill.Core.dll but not on lib/netstandard2.0/Codecrete.SwissQRBill.Core.dll [~/Projects/SwissQRBill.NET/Core/Core.csproj]
CP0002: Member 'ushort Codecrete.SwissQRBill.Generator.Canvas.CharWidthData.LiberationSansNormalDefaultWidth' exists on [Baseline] lib/netstandard2.0/Codecrete.SwissQRBill.Core.dll but not on lib/netstandard2.0/Codecrete.SwissQRBill.Core.dll [~/Projects/SwissQRBill.NET/Core/Core.csproj]
CP0002: Member 'ushort[] Codecrete.SwissQRBill.Generator.Canvas.CharWidthData.LiberationSansNormal_20_7F' exists on [Baseline] lib/netstandard2.0/Codecrete.SwissQRBill.Core.dll but not on lib/netstandard2.0/Codecrete.SwissQRBill.Core.dll [~/Projects/SwissQRBill.NET/Core/Core.csproj]
CP0002: Member 'ushort[] Codecrete.SwissQRBill.Generator.Canvas.CharWidthData.LiberationSansNormal_A0_FF' exists on [Baseline] lib/netstandard2.0/Codecrete.SwissQRBill.Core.dll but not on lib/netstandard2.0/Codecrete.SwissQRBill.Core.dll [~/Projects/SwissQRBill.NET/Core/Core.csproj]
CP0002: Member 'ushort Codecrete.SwissQRBill.Generator.Canvas.CharWidthData.LiberationSansBoldDefaultWidth' exists on [Baseline] lib/netstandard2.0/Codecrete.SwissQRBill.Core.dll but not on lib/netstandard2.0/Codecrete.SwissQRBill.Core.dll [~/Projects/SwissQRBill.NET/Core/Core.csproj]
CP0002: Member 'ushort[] Codecrete.SwissQRBill.Generator.Canvas.CharWidthData.LiberationSansBold_20_7F' exists on [Baseline] lib/netstandard2.0/Codecrete.SwissQRBill.Core.dll but not on lib/netstandard2.0/Codecrete.SwissQRBill.Core.dll [~/Projects/SwissQRBill.NET/Core/Core.csproj]
CP0002: Member 'ushort[] Codecrete.SwissQRBill.Generator.Canvas.CharWidthData.LiberationSansBold_A0_FF' exists on [Baseline] lib/netstandard2.0/Codecrete.SwissQRBill.Core.dll but not on lib/netstandard2.0/Codecrete.SwissQRBill.Core.dll [~/Projects/SwissQRBill.NET/Core/Core.csproj]
CP0002: Member 'ushort Codecrete.SwissQRBill.Generator.Canvas.CharWidthData.FrutigerNormalDefaultWidth' exists on [Baseline] lib/netstandard2.0/Codecrete.SwissQRBill.Core.dll but not on lib/netstandard2.0/Codecrete.SwissQRBill.Core.dll [~/Projects/SwissQRBill.NET/Core/Core.csproj]
CP0002: Member 'ushort[] Codecrete.SwissQRBill.Generator.Canvas.CharWidthData.FrutigerNormal_20_7F' exists on [Baseline] lib/netstandard2.0/Codecrete.SwissQRBill.Core.dll but not on lib/netstandard2.0/Codecrete.SwissQRBill.Core.dll [~/Projects/SwissQRBill.NET/Core/Core.csproj]
CP0002: Member 'ushort[] Codecrete.SwissQRBill.Generator.Canvas.CharWidthData.FrutigerNormal_A0_FF' exists on [Baseline] lib/netstandard2.0/Codecrete.SwissQRBill.Core.dll but not on lib/netstandard2.0/Codecrete.SwissQRBill.Core.dll [~/Projects/SwissQRBill.NET/Core/Core.csproj]
CP0002: Member 'ushort Codecrete.SwissQRBill.Generator.Canvas.CharWidthData.FrutigerBoldDefaultWidth' exists on [Baseline] lib/netstandard2.0/Codecrete.SwissQRBill.Core.dll but not on lib/netstandard2.0/Codecrete.SwissQRBill.Core.dll [~/Projects/SwissQRBill.NET/Core/Core.csproj]
CP0002: Member 'ushort[] Codecrete.SwissQRBill.Generator.Canvas.CharWidthData.FrutigerBold_20_7F' exists on [Baseline] lib/netstandard2.0/Codecrete.SwissQRBill.Core.dll but not on lib/netstandard2.0/Codecrete.SwissQRBill.Core.dll [~/Projects/SwissQRBill.NET/Core/Core.csproj]
CP0002: Member 'ushort[] Codecrete.SwissQRBill.Generator.Canvas.CharWidthData.FrutigerBold_A0_FF' exists on [Baseline] lib/netstandard2.0/Codecrete.SwissQRBill.Core.dll but not on lib/netstandard2.0/Codecrete.SwissQRBill.Core.dll [~/Projects/SwissQRBill.NET/Core/Core.csproj]

So now that version 3.3.0 is out with the breaking changes the best think is acknowledge that those breaking changes were introduced and update the baseline to the last released version.

@manuelbl manuelbl merged commit 233e217 into manuelbl:master May 11, 2025
3 checks passed
@manuelbl
Copy link
Owner

Thanks again for the PR.

The failing tests are related to several factor:

  • The DPI value in EMF files cannot be controlled. It's copied from the current screen even though EMFs are resolution independent.
  • ImageMagick had a recent update where the DPI handling was changed.
  • Setting the application to DPI aware doesn't always work, probably when previous tests have already executed certain actions.

The worst part is that the test only fail sometimes, probably when executed in a certain order. I was only able to fix it partially. I will have to live with the fact that I cannot execute them all from within Visual Studio. If each project is executed separately (as in the CI pipeline), it works.

I was also able to resolve the issue with dotnet pack failing. Obviously, dotnet tool restore was missing. This was automatically executed before.

It's a shame that the incompatibilities with previous versions I have introduced were not detected. The baseline validator has been part of the project for some time and has detected incompatibilities before. But somehow, it hasn't detected all incompatibilities. Do you know if it has been extended to check for more issues?

@0xced 0xced deleted the tests-net8.0 branch May 13, 2025 21:57
@0xced
Copy link
Collaborator Author

0xced commented May 13, 2025

It's a shame that the incompatibilities with previous versions I have introduced were not detected. The baseline validator has been part of the project for some time and has detected incompatibilities before. But somehow, it hasn't detected all incompatibilities. Do you know if it has been extended to check for more issues?

The problem was this old SDK reference that was removed in commit 6534161:

<Sdk Name="Microsoft.DotNet.PackageValidation" Version="1.0.0-preview.7.21379.12" />

Without this SDK, the built-in package validation feature from the .NET 8 SDK detects more breaking changes.

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