Skip to content

.NET validation checks updates - add next steps and update code checks invocation#14499

Merged
m-redding merged 13 commits intoAzure:mainfrom
m-redding:net-autofix-nextsteps
Mar 31, 2026
Merged

.NET validation checks updates - add next steps and update code checks invocation#14499
m-redding merged 13 commits intoAzure:mainfrom
m-redding:net-autofix-nextsteps

Conversation

@m-redding
Copy link
Copy Markdown
Member

@m-redding m-redding commented Mar 12, 2026

Issue

Fixes #14338

Description

Ensures .NET-specific validation checks provide actionable next-steps guidance when failures occur and auto-fix cannot be applied.

Changes

  • DotNetLanguageService.Checks.cs: Added NextSteps to \CheckGeneratedCode, \CheckAotCompat, and \VerifyDotnetVersion\ failure paths (including script-not-found cases)
  • PackageCheckTool.cs: Added NextSteps fallback to all individual run methods (Spelling, Snippets, Lint, Format, GeneratedCode, AotCompat, Samples) with conditional guidance based on --fix\ flag

Out of scope

  • CommonLanguageHelpers.cs: NextSteps for shared validation helpers (\ValidateChangelog, \ValidateReadme, \CheckSpelling) will be addressed separately, as those changes affect all languages.

Architecture

Two-layer NextSteps pattern:

  1. Language service layer (DotNetLanguageService.Checks.cs) → sets NextSteps that bubble up to \RunAllChecks\ aggregation
  2. PackageCheckTool individual run methods → provide fallback NextSteps when running checks individually (guarded by
    esult.NextSteps is not { Count: > 0 })

Ensure every .NET validation check provides actionable next-steps
guidance when failures occur and auto-fix cannot be applied.

Changes:
- DotNetLanguageService.Checks.cs: Added NextSteps to CheckGeneratedCode,
  CheckAotCompat, and VerifyDotnetVersion failure paths
- CommonLanguageHelpers.cs: Added NextSteps to ValidateChangelog,
  ValidateReadme, and CheckSpelling failure paths (both fix-on and fix-off)
- PackageCheckTool.cs: Added NextSteps fallback to all individual run
  methods (Spelling, Snippets, Lint, Format, GeneratedCode, AotCompat,
  Samples) with conditional guidance based on --fix flag
- DotNetLanguageSpecificChecksTests.cs: Added NextSteps assertions to
  existing failure test cases

Two-layer pattern: language service layer sets NextSteps that bubble up
to RunAllChecks aggregation, PackageCheckTool individual run methods
provide fallback NextSteps when running checks individually.

Fixes Azure#14338

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot added the azsdk-cli Issues related to Azure/azure-sdk-tools::tools/azsdk-cli label Mar 12, 2026
m-redding and others added 7 commits March 30, 2026 15:16
Normalize RunChangelogValidation, RunDependencyCheck, and RunReadmeValidation
to use the fallback guard pattern (result.NextSteps is not { Count: > 0 })
consistent with all other Run* methods.

- Use fallback NextSteps instead of unconditionally overwriting service-layer values
- Remove unnecessary new PackageCheckResponse creation in RunChangelogValidation
- Remove success-path NextSteps (no other method sets them on success)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Azure#14690

PR Azure#14690 covers CommonLanguageHelpers more thoroughly (including
script-not-found, config-not-found, and exception paths). Removing
these changes to avoid merge conflicts. This PR now focuses on
.NET-specific checks and PackageCheckTool fallbacks only.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
PackageCheckTool fallback NextSteps and pattern fixes will be addressed
separately during end-to-end testing/fixing pass.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… NextSteps

Leverage the -SkipDiffValidation flag added in Azure/azure-sdk-for-net#57422
so CodeChecks runs in prepare-PR mode (reports changed files instead of
failing on diffs). On failure, parse 'error : ' prefixed lines from the
script output and surface them as NextSteps, since the script already
provides actionable guidance.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Link to Azure SDK AOT compatibility guide for resolving warnings.
Make it clear that opting out should be an absolute last resort.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
When error lines are extracted from CodeChecks.ps1 output, prepend
a message explaining that the script output contains specific
instructions for each error.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@m-redding m-redding changed the title Add auto-fix and next-steps guidance to all .NET validation checks .NET validation checks updates - add next steps and update code checks invocation Mar 30, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@m-redding m-redding marked this pull request as ready for review March 30, 2026 23:03
@m-redding m-redding requested a review from a team as a code owner March 30, 2026 23:03
Copilot AI review requested due to automatic review settings March 30, 2026 23:03
Copy link
Copy Markdown
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

Updates the azsdk-cli .NET package validation checks to provide actionable NextSteps on failure, and adjusts the CodeChecks invocation to use an updated argument set (including skipping diff validation) to better align with the intended workflow.

Changes:

  • Add NextSteps to .NET generated-code, AOT compatibility, and dotnet --list-sdks/SDK version validation failure paths.
  • Update the CodeChecks script invocation arguments to include -SkipDiffValidation.
  • Extend existing .NET checks unit tests to assert NextSteps are populated for key failure scenarios.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
tools/azsdk-cli/Azure.Sdk.Tools.Cli/Services/Languages/DotNetLanguageService.Checks.cs Adds NextSteps guidance for several .NET check failure paths and updates CodeChecks script arguments.
tools/azsdk-cli/Azure.Sdk.Tools.Cli.Tests/Services/Languages/DotNetLanguageSpecificChecksTests.cs Adds assertions ensuring NextSteps are present in failure responses.

m-redding and others added 2 commits March 30, 2026 16:15
Populate NextSteps with actionable guidance when the CodeChecks.ps1
script is not found, advising users to verify they are in an
azure-sdk-for-net repo clone and how to restore the missing script.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Populate NextSteps with actionable guidance for changelog, readme,
and spelling validation failures. Covers script-not-found, validation
failure, config-missing, and unhandled exception paths in
ValidateChangelog, ValidateReadme, CheckSpelling, and
ValidatePackageAndDiscoverRepoAsync.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
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

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@m-redding m-redding merged commit 1348a06 into Azure:main Mar 31, 2026
12 checks passed
@m-redding m-redding deleted the net-autofix-nextsteps branch March 31, 2026 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

azsdk-cli Issues related to Azure/azure-sdk-tools::tools/azsdk-cli

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[NET] auto-fix and next-steps

3 participants