Skip to content

Make NuGet Apex tests self-suppress the Preview Changes dialog - #7500

Merged
Nigusu-Allehu merged 1 commit into
devfrom
dev-nyenework-Apex-init
Jun 24, 2026
Merged

Nigusu-Allehu merged 1 commit into
devfrom
dev-nyenework-Apex-init

Conversation

@Nigusu-Allehu

@Nigusu-Allehu Nigusu-Allehu commented Jun 23, 2026 •

Copy link
Copy Markdown
Member

Bug

Fixes: https://github.com/NuGet/Client.Engineering/issues/3784

Description

The NuGet.Tests.Apex StagingGate were failing in the staging pipeline but succeed in nuget test pipeline. And it looks like the NuGet test pipeline has a predeployment operation SetupFunctionalTests.ps1.

The setup suppresses two HKCU:\Software\NuGet registry values (DoNotShowPreviewWindow, SuppressUILegalDisclaimer).

Adds NuGetUISuppression , IDisposable  helper. On construction it captures the original registry state of each value and then writes the suppression values as. On Dispose()  it restores the captured state exactly: deletes values that were absent before, and rewrites pre-existing values with their original data and kind.

Tested: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=14455613&view=results

I ran a test on this in staging by creating a branch that points to this PRs drop path. I hard coded it in the branch and ran the tests.

The tests are failing with

Method not found: 'System.Collections.Generic.IEnumerable`1<NuGet.VisualStudio.Internal.Contracts.IProjectContextInfo> NuGet.PackageManagement.UI.INuGetUIContext.get_Projects()'

I think that is probably because the NuGet.PackageManagement bit in the test VS is different from the Nuget.PackageManagement in the test dll I attached by hard coding the VS drop url. That means we probably have to wait until this is inserted to see the results in the staging pipeline.

My local tests show with this change one can run these tests without having to run the setup PS1 file.

PR Checklist

  • Meaningful title, helpful description and a linked NuGet/Home issue
  • Added tests
  • Link to an issue or pull request to update docs if this PR changes settings, environment variables, new feature, etc.

@Nigusu-Allehu Nigusu-Allehu changed the title Disable preview window Make NuGet Apex tests self-suppress the Preview Changes dialog Jun 23, 2026
@Nigusu-Allehu Nigusu-Allehu self-assigned this Jun 23, 2026
@Nigusu-Allehu
Nigusu-Allehu marked this pull request as ready for review June 23, 2026 16:57
@Nigusu-Allehu
Nigusu-Allehu requested a review from a team as a code owner June 23, 2026 16:57
@Nigusu-Allehu
Nigusu-Allehu marked this pull request as draft June 23, 2026 17:10
@Nigusu-Allehu
Nigusu-Allehu marked this pull request as ready for review June 23, 2026 17:53
@Nigusu-Allehu
Nigusu-Allehu requested a review from nkolev92 June 23, 2026 18:40
nkolev92
nkolev92 previously approved these changes Jun 23, 2026

@nkolev92 nkolev92 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'll let you make a choice for the unsetting logic, if any.

@Nigusu-Allehu
Nigusu-Allehu force-pushed the dev-nyenework-Apex-init branch from eceb14a to 3f89fe0 Compare June 24, 2026 00:17
@Nigusu-Allehu
Nigusu-Allehu enabled auto-merge (squash) June 24, 2026 00:23
private const string DoNotShowPreviewWindowRegistryName = "DoNotShowPreviewWindow";
private const string SuppressUILegalDisclaimerRegistryName = "SuppressUILegalDisclaimer";

private readonly List<RegistryValueSnapshot> _originalValues = new();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We only have two values, so I feel like keeping a list and defining a custom data type is overkill. I think two string? fields would be sufficient.

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.

4 participants