Skip to content

Add robust error handling to nuget.config PowerShell script - #11702

Open
Deniz Güney Yıldırım (denizguney) wants to merge 1 commit into
microsoft:mainfrom
denizguney:patch-1
Open

Add robust error handling to nuget.config PowerShell script#11702
Deniz Güney Yıldırım (denizguney) wants to merge 1 commit into
microsoft:mainfrom
denizguney:patch-1

Conversation

@denizguney

Copy link
Copy Markdown

Added a try-catch block, Set-StrictMode, and $ErrorActionPreference = "Stop" to the PowerShell script in WinUI-BuildSampleApps-Steps.yml to ensure unexpected file or XML manipulation errors are explicitly caught and fail the build safely.

Fixes #11701

Fixes #11701

PR Type

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no API changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

Description

Current Behavior

The PowerShell script updating nuget.config lacks robust error handling, strict mode, and stop preferences, which can lead to obscure or silent failures during pipeline execution.

New Behavior

Adds a proper try-catch block, Set-StrictMode, and $ErrorActionPreference = "Stop" to the PowerShell script in WinUI-BuildSampleApps-Steps.yml to explicitly catch and report errors, failing the build safely when issues occur.

Customer Impact

None (Internal CI/CD build pipeline improvement).

Regression Potential

  • Low risk — isolated change, limited scope
  • Medium risk — touches shared components or public APIs
  • High risk — architectural or breaking API change

How Has This Been Tested?

  • I have performed a self-review of my own code
  • I have added tests to cover my changes
  • Existing tests pass locally

Screenshots (if appropriate)

Added a try-catch block, Set-StrictMode, and $ErrorActionPreference = "Stop" to the PowerShell script in WinUI-BuildSampleApps-Steps.yml to ensure unexpected file or XML manipulation errors are explicitly caught and fail the build safely.
@microsoft-github-policy-service microsoft-github-policy-service Bot added the needs-triage Issue needs to be triaged by the area owners label Aug 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-triage Issue needs to be triaged by the area owners

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Proposal: [WinUI-BuildSampleApps] Optimize pipeline conditions and add error handling in NuGet source script

1 participant