Skip to content

fix(repository:) Add input validation for GetOperation#2002

Open
Gijsreyn wants to merge 2 commits into
PowerShell:masterfrom
Gijsreyn:gh-2001/main/fix-unhandled-null
Open

fix(repository:) Add input validation for GetOperation#2002
Gijsreyn wants to merge 2 commits into
PowerShell:masterfrom
Gijsreyn:gh-2001/main/fix-unhandled-null

Conversation

@Gijsreyn
Copy link
Copy Markdown

PR Summary

This pull request adds a simple input validation when it's empty for the GetOperation on the Repository resource.

PR Context

When --input is omitted, DSC closes the child process stdin without writing anything. The
resource manifest uses "input": "stdin" and invokes the script as $Input | ./psresourceget.ps1 ..., so $Input is an empty enumerator and the $stdinput pipeline parameter is never bound (keeping it $null).

Fixes #2001

PR Checklist

Copilot AI review requested due to automatic review settings May 24, 2026 07:08
@Gijsreyn Gijsreyn changed the title fix(Repository:) Add input validation for GetOperation fix(repository:) Add input validation for GetOperation May 24, 2026
Copy link
Copy Markdown

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

Note

Copilot was unable to run its full agentic suite in this review.

Adds explicit handling for resource get when no --input/stdin is provided, preventing PowerShell parameter-binding errors and returning a clean non-zero exit code.

Changes:

  • Add an early validation in GetOperation to fail fast when no input is provided.
  • Add a CI test ensuring resource get without --input exits non-zero and avoids an unhandled exception.

Reviewed changes

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

File Description
test/DscResource/PSResourceGetDSCResource.Tests.ps1 Adds a regression test for resource get without input to ensure clean failure behavior.
src/dsc/psresourceget.ps1 Adds a guard clause to reject missing stdin/--input before attempting JSON parsing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/dsc/psresourceget.ps1
Comment thread test/DscResource/PSResourceGetDSCResource.Tests.ps1 Outdated
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.

get without --input crashes with unhandled null pipeline exception on Repository

2 participants