-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Add VisualTestUtils source to replace deprecated NuGet package #32607
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: PureWeen <[email protected]>
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.
Pull Request Overview
This PR replaces the deprecated VisualTestUtils NuGet package (v0.9.46-beta, unlisted) with vendored source code to gain full control over maintenance and address security advisory CVE-2025-53015 by updating Magick.NET to v13.5.0.
Key Changes:
- Added two new projects (
VisualTestUtilsandVisualTestUtils.MagickNet) with complete visual regression testing infrastructure - Updated 4 test projects (Android, iOS, Mac, WinUI) to reference local projects instead of NuGet packages
- Added new projects to all solution files (slnx and slnf variants) for proper build integration
Reviewed Changes
Copilot reviewed 30 out of 30 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| src/TestUtils/src/VisualTestUtils/VisualTestUtils.csproj | New netstandard2.0 project for core visual testing utilities |
| src/TestUtils/src/VisualTestUtils/*.cs | Core visual testing infrastructure including regression tester, image snapshots, and interfaces |
| src/TestUtils/src/VisualTestUtils.MagickNet/VisualTestUtils.MagickNet.csproj | New project with Magick.NET v13.5.0 dependency for image comparison |
| src/TestUtils/src/VisualTestUtils.MagickNet/*.cs | ImageMagick-based implementations for visual comparison and diff generation |
| src/Controls/tests/TestCases..Tests/.csproj | Updated to reference local VisualTestUtils projects instead of deprecated NuGet packages |
| Microsoft.Maui*.slnf, Microsoft.Maui.slnx | Added new VisualTestUtils projects to solution files |
| { | ||
| this.Fail( | ||
| $"Snapshot different than baseline: {imageFileName} ({imageDifference.Description})\n" + | ||
| $"If the correct baseline has changed (this isn't a a bug), then update the baseline image.\n" + |
Copilot
AI
Nov 14, 2025
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.
Typo in error message: "a a" should be "a". The phrase "this isn't a a bug" contains a duplicate article.
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.
Fixed in c691740. Changed "this isn't a a bug" to "this isn't a bug".
| <ItemGroup Condition="$(UseLocalVisualTestUtils) == ''"> | ||
| <PackageReference Include="VisualTestUtils.MagickNet" Version="0.9.46-beta" /> | ||
| <PackageReference Include="VisualTestUtils" Version="0.9.46-beta" /> | ||
| <ProjectReference Include="..\..\..\TestUtils\src\VisualTestUtils.MagickNet\VisualTestUtils.MagickNet.csproj" /> | ||
| <ProjectReference Include="..\..\..\TestUtils\src\VisualTestUtils\VisualTestUtils.csproj" /> | ||
| </ItemGroup> |
Copilot
AI
Nov 14, 2025
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.
The condition $(UseLocalVisualTestUtils) == '' now always uses project references instead of NuGet packages, which contradicts the condition name. Since the NuGet package is deprecated and being replaced, consider either removing this condition entirely or updating the ItemGroup at line 39 (the $(UseLocalVisualTestUtils) != '' condition) to avoid confusion about which path is the "local" one.
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.
The condition naming is intentional. When $(UseLocalVisualTestUtils) is not set (the default), it uses the vendored VisualTestUtils in the MAUI repo. When set, it allows developers to reference an external checkout of visual-test-utils for development purposes. This preserves the existing developer workflow.
| <ItemGroup Condition="$(UseLocalVisualTestUtils) == ''"> | ||
| <PackageReference Include="VisualTestUtils.MagickNet" Version="0.9.46-beta" /> | ||
| <PackageReference Include="VisualTestUtils" Version="0.9.46-beta" /> | ||
| <ProjectReference Include="..\..\..\TestUtils\src\VisualTestUtils.MagickNet\VisualTestUtils.MagickNet.csproj" /> | ||
| <ProjectReference Include="..\..\..\TestUtils\src\VisualTestUtils\VisualTestUtils.csproj" /> | ||
| </ItemGroup> |
Copilot
AI
Nov 14, 2025
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.
The condition $(UseLocalVisualTestUtils) == '' now always uses project references instead of NuGet packages, which contradicts the condition name. Since the NuGet package is deprecated and being replaced, consider either removing this condition entirely or updating the ItemGroup at line 39 (the $(UseLocalVisualTestUtils) != '' condition) to avoid confusion about which path is the "local" one.
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.
The condition naming is intentional. When $(UseLocalVisualTestUtils) is not set (the default), it uses the vendored VisualTestUtils in the MAUI repo. When set, it allows developers to reference an external checkout of visual-test-utils for development purposes. This preserves the existing developer workflow.
| <ItemGroup Condition="$(UseLocalVisualTestUtils) == ''"> | ||
| <PackageReference Include="VisualTestUtils.MagickNet" Version="0.9.46-beta" /> | ||
| <PackageReference Include="VisualTestUtils" Version="0.9.46-beta" /> | ||
| <ProjectReference Include="..\..\..\TestUtils\src\VisualTestUtils.MagickNet\VisualTestUtils.MagickNet.csproj" /> | ||
| <ProjectReference Include="..\..\..\TestUtils\src\VisualTestUtils\VisualTestUtils.csproj" /> | ||
| </ItemGroup> |
Copilot
AI
Nov 14, 2025
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.
The condition $(UseLocalVisualTestUtils) == '' now always uses project references instead of NuGet packages, which contradicts the condition name. Since the NuGet package is deprecated and being replaced, consider either removing this condition entirely or updating the ItemGroup at line 39 (the $(UseLocalVisualTestUtils) != '' condition) to avoid confusion about which path is the "local" one.
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.
The condition naming is intentional. When $(UseLocalVisualTestUtils) is not set (the default), it uses the vendored VisualTestUtils in the MAUI repo. When set, it allows developers to reference an external checkout of visual-test-utils for development purposes. This preserves the existing developer workflow.
| /// <param name="actualImage">Actual image screenshot.</param> | ||
| /// <param name="environmentName">Optional name for the test environment (e.g. device type, like | ||
| /// "android"). If present it's used as the parent directory for the images. It not present, all images are stored directly in the "snapshots" directory.</param> | ||
| /// <param name="testContext">Optional client provied test context, used to attach screenshots/diff images to failed tests if supported by client test framework</param> |
Copilot
AI
Nov 14, 2025
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.
Typo in parameter documentation: "provied" should be "provided".
| /// <param name="testContext">Optional client provied test context, used to attach screenshots/diff images to failed tests if supported by client test framework</param> | |
| /// <param name="testContext">Optional client provided test context, used to attach screenshots/diff images to failed tests if supported by client test framework</param> |
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.
Fixed in c691740. Changed "provied" to "provided".
| /// Create an image editor, to update the specified image snapshot. | ||
| /// The original image snapshot is unchanged. After making edits, | ||
| /// call IImageEditor.GetImageSnapshot to get a new image snapshot | ||
| /// width the updates. |
Copilot
AI
Nov 14, 2025
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.
Typo in documentation: "width the updates" should be "with the updates".
| /// width the updates. | |
| /// with the updates. |
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.
Fixed in c691740. Changed "width the updates" to "with the updates".
| <ItemGroup Condition="$(UseLocalVisualTestUtils) == ''"> | ||
| <PackageReference Include="VisualTestUtils.MagickNet" Version="0.9.46-beta" /> | ||
| <PackageReference Include="VisualTestUtils" Version="0.9.46-beta" /> | ||
| <ProjectReference Include="..\..\..\TestUtils\src\VisualTestUtils.MagickNet\VisualTestUtils.MagickNet.csproj" /> | ||
| <ProjectReference Include="..\..\..\TestUtils\src\VisualTestUtils\VisualTestUtils.csproj" /> | ||
| </ItemGroup> |
Copilot
AI
Nov 14, 2025
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.
The condition $(UseLocalVisualTestUtils) == '' now always uses project references instead of NuGet packages, which contradicts the condition name. Since the NuGet package is deprecated and being replaced, consider either removing this condition entirely or updating the ItemGroup at line 39 (the $(UseLocalVisualTestUtils) != '' condition) to avoid confusion about which path is the "local" one.
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.
The condition naming is intentional. When $(UseLocalVisualTestUtils) is not set (the default), it uses the vendored VisualTestUtils in the MAUI repo. When set, it allows developers to reference an external checkout of visual-test-utils for development purposes. This preserves the existing developer workflow.
Co-authored-by: PureWeen <[email protected]>
All review comments evaluated and addressed in c691740:
|
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Description of Change
Replaces deprecated VisualTestUtils NuGet package (v0.9.46-beta, unlisted) with vendored source code. Addresses Magick.NET security advisory CVE-2025-53015 by updating to v13.5.0.
Changes:
VisualTestUtilsproject (netstandard2.0) with core visual regression testing infrastructureVisualTestUtils.MagickNetproject with ImageMagick-based image comparison implementationsRationale: Full control over maintenance and security updates, eliminates external dependency on unlisted package.
Note on
UseLocalVisualTestUtilscondition: The condition in test project files is intentional. When not set (default), it uses the vendored VisualTestUtils in the MAUI repo. When set, it allows developers to reference an external checkout of visual-test-utils for development purposes.Issues Fixed
Fixes #31984
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.