Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 13, 2025

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:

  • Added VisualTestUtils project (netstandard2.0) with core visual regression testing infrastructure
  • Added VisualTestUtils.MagickNet project with ImageMagick-based image comparison implementations
  • Updated 4 test projects (Android, iOS, Mac, WinUI) to reference local projects instead of NuGet packages
  • Added projects to all solution files (slnx and slnf variants)
  • Fixed documentation typos in source code comments

Rationale: Full control over maintenance and security updates, eliminates external dependency on unlisted package.

Note on UseLocalVisualTestUtils condition: 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

Can you create a new PR with main as the base branch and just copy all the changes over from this PR #32591?


💡 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.

Copilot AI changed the title [WIP] Copy changes from PR #32591 Add VisualTestUtils source to replace deprecated NuGet package Nov 13, 2025
Copilot AI requested a review from PureWeen November 13, 2025 21:53
Copilot finished work on behalf of PureWeen November 13, 2025 21:53
@PureWeen PureWeen added this to the .NET 10.0 SR2 milestone Nov 13, 2025
@PureWeen PureWeen marked this pull request as ready for review November 14, 2025 00:37
Copilot AI review requested due to automatic review settings November 14, 2025 00:37
Copilot finished reviewing on behalf of PureWeen November 14, 2025 00:39
Copy link
Contributor

Copilot AI left a 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 (VisualTestUtils and VisualTestUtils.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" +
Copy link

Copilot AI Nov 14, 2025

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.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

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".

Comment on lines 34 to 37
<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>
Copy link

Copilot AI Nov 14, 2025

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.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

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.

Comment on lines 34 to 37
<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>
Copy link

Copilot AI Nov 14, 2025

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.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

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.

Comment on lines 34 to 37
<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>
Copy link

Copilot AI Nov 14, 2025

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.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

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>
Copy link

Copilot AI Nov 14, 2025

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".

Suggested change
/// <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>

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

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.
Copy link

Copilot AI Nov 14, 2025

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".

Suggested change
/// width the updates.
/// with the updates.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

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".

Comment on lines 34 to 37
<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>
Copy link

Copilot AI Nov 14, 2025

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.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

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.

@PureWeen
Copy link
Member

@copilot evaluate @copilot s comments and see if you should apply them.

Also if you could verify that everything compiles and fix anything you think needs to be improved

Copy link
Contributor Author

Copilot AI commented Nov 14, 2025

@copilot evaluate @copilot s comments and see if you should apply them.

Also if you could verify that everything compiles and fix anything you think needs to be improved

All review comments evaluated and addressed in c691740:

  • Fixed 3 documentation typos
  • Verified all projects compile successfully (VisualTestUtils, VisualTestUtils.MagickNet, and test projects)
  • Explained the UseLocalVisualTestUtils condition naming (it's intentional to support external development checkouts)

Copilot finished work on behalf of PureWeen November 14, 2025 21:42
@PureWeen
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

2 participants