GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Preserve DSC resource names during alias correction by Copilot · Pull Request #2270 · PowerShell/PSScriptAnalyzer

Conversation

Copilot AI commented Oct 27, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Alias correction can rewrite DSC resource declarations such as Package PackageExample to Get-Package PackageExample, invalidating the configuration.

  • Resource detection: Exclude resource-shaped declarations inside configurations from implicit Get- prefix correction, supporting opening braces on either line.
  • Command handling: Preserve correction of explicit aliases and executable commands inside functions and DSC script properties.
  • Regression coverage: Cover both brace layouts and distinguish resource declarations from ordinary commands.

The following declaration should remain unchanged:

Configuration PackageTest {
    Package PackageExample
    {
        Name = 'TestPackage'
    }
}
  • Fixes Auto Correct Aliases incorrectly expands DSC resources name thinking its an alias of a cmdlet #2025

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Initial plan
cafb813
Copilot AI assigned Copilot and Christoph Bergmeister (bergmeister) Oct 27, 2026
Copilot started work on behalf of Christoph Bergmeister (bergmeister) October 27, 2026 22:41
View session
Copilot AI linked an issue Oct 27, 2026 that may be closed by this pull request
Auto Correct Aliases incorrectly expands DSC resources name thinking its an alias of a cmdlet #2025
Open
5 of 6 tasks
@bergmeister
Avoid implicit Get-prefix corrections for DSC resource declarations
be98895
Co-authored-by: bergmeister <[email protected]>
Copilot AI changed the title [WIP] Fix auto correct aliases for DSC resources Preserve DSC resource names during alias correction Oct 27, 2026
Copilot finished work on behalf of Christoph Bergmeister (bergmeister) October 27, 2026 22:55
Copilot AI requested a review from Christoph Bergmeister (bergmeister) October 27, 2026 22:55
@bergmeister
Christoph Bergmeister (bergmeister) requested a balanced review from Copilot October 28, 2026 08:01
Copilot started reviewing on behalf of Christoph Bergmeister (bergmeister) October 28, 2026 08:01
View session
Copilot AI reviewed Oct 28, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

🟡 Changes recommended

The shared guard suppresses expected Get- corrections for executable commands in configurations and adds quadratic sibling-statement searches even in ordinary scripts.

3 open issues
  • Medium severity Defer DSC body lookup to prevent quadratic scans in ordinary scripts · New
  • Medium severity Avoid correcting commands in directly assigned script blocks · New
  • Medium severity Restrict resource command detection to standalone single-command pipelines · New
What changed in this PR

This PR updates alias correction to distinguish DSC resource declarations from executable commands, addressing resource names such as Package being incorrectly rewritten as Get-Package.

Changes:

  • Adds resource detection for opening braces on the same or following line.
  • Adds context checks intended to preserve corrections inside executable code.
  • Adds regression tests for resource formatting, explicit aliases, and ordinary commands.
File Description
Tests/​Rules/​AvoidUsingAlias.tests.ps1 Adds formatting and command-analysis regression coverage.
Rules/​AvoidAlias.cs Adds DSC resource detection before implicit Get- prefix correction.

Review effort: Balanced

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Rules/AvoidAlias.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Rules/AvoidAlias.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Rules/AvoidAlias.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Copilot started work on behalf of Christoph Bergmeister (bergmeister) October 28, 2026 08:32
View session
@bergmeister
Handle wrapped DSC resource bodies
4b4bb19
Co-authored-by: bergmeister <[email protected]>
Copilot finished work on behalf of Christoph Bergmeister (bergmeister) October 28, 2026 08:56
Copilot started work on behalf of Christoph Bergmeister (bergmeister) October 28, 2026 09:29
View session
@bergmeister
Handle DSC resources before command matching
b64eda7
Co-authored-by: bergmeister <[email protected]>
Copilot finished work on behalf of Christoph Bergmeister (bergmeister) October 28, 2026 09:37
Copilot started work on behalf of Christoph Bergmeister (bergmeister) October 28, 2026 11:35
View session
@bergmeister
Fix DSC resource alias classification
cabfc17
Co-authored-by: bergmeister <[email protected]>
Copilot finished work on behalf of Christoph Bergmeister (bergmeister) October 28, 2026 11:45
Copilot started work on behalf of Christoph Bergmeister (bergmeister) October 28, 2026 14:11
View session
@bergmeister
Ignore parser diagnostics in DSC alias test
5c3cbec
Co-authored-by: bergmeister <[email protected]>
Copilot finished work on behalf of Christoph Bergmeister (bergmeister) October 28, 2026 14:17
@bergmeister
Christoph Bergmeister (bergmeister) requested a balanced review from Copilot October 28, 2026 14:42
Copilot started reviewing on behalf of Christoph Bergmeister (bergmeister) October 28, 2026 14:43
View session
Copilot AI reviewed Oct 28, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

🟡 Changes recommended

DSC resource detection incorrectly suppresses alias diagnostics for executable commands and pipeline elements, while introducing quadratic scanning for ordinary scripts.

7 open issues
  • Medium severity This scans sibling statements before checking whether the command belongs to a configuration. For… · New
  • Medium severity Inside a configuration, executable commands such as $result = Verb Argument {}, `$action = { Verb… · New
  • Medium severity The CommandExpressionAst exception accepts standalone blocks without checking that they belong to… · New
  • Medium severity The resource-body checks also accept commands belonging to a multi-command pipeline. For example,… · New
  • Medium severity Restrict resource command detection to standalone single-command pipelines
  • Medium severity Avoid correcting commands in directly assigned script blocks
  • Medium severity Defer DSC body lookup to prevent quadratic scans in ordinary scripts

Review effort: Balanced

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Rules/AvoidAlias.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Rules/AvoidAlias.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Rules/AvoidAlias.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Rules/AvoidAlias.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

@bergmeister
Christoph Bergmeister (bergmeister) added this pull request to stack #2281 October 28, 2026 14:54
Copilot AI mentioned this pull request Oct 28, 2026
Tighten DSC resource detection in AvoidAlias #2280
Merged
@bergmeister
Christoph Bergmeister (bergmeister) removed this pull request from stack #2281 October 28, 2026 15:16
@bergmeister
Christoph Bergmeister (bergmeister) added this pull request to stack #2292 October 29, 2026 07:04
@bergmeister
Christoph Bergmeister (bergmeister) removed this pull request from stack #2292 October 29, 2026 09:10
@bergmeister
Reject background pipelines as DSC resources (#2290)
3b14fd8
* Initial plan

* Reject background pipelines as DSC resources

Co-authored-by: bergmeister <[email protected]>

* Guard background AST API for CoreCLR

Co-authored-by: bergmeister <[email protected]>

* Make background pipeline test expectations version-aware

Co-authored-by: bergmeister <[email protected]>

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: bergmeister <[email protected]>
@bergmeister
Christoph Bergmeister (bergmeister) requested a balanced review from Copilot October 29, 2026 09:24
Copilot started reviewing on behalf of Christoph Bergmeister (bergmeister) October 29, 2026 09:25
View session
Copilot AI reviewed Oct 29, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Human assessment is needed because the following-line AST path can misclassify an executable cmdlet as configuration syntax and suppress an expected Get-Verb diagnostic.

No open issues 🎉

2 resolved since last review
  • Medium severity Handle trailing ampersands after fallback resource blocks
  • Medium severity Reject background pipelines before fallback resource classification

Review effort: Balanced

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bergmeister
Christoph Bergmeister (bergmeister) requested a balanced review from Copilot October 29, 2026 09:42
Copilot started reviewing on behalf of Christoph Bergmeister (bergmeister) October 29, 2026 09:43
View session
Copilot AI reviewed Oct 29, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

🟡 Changes recommended

The fallback AST handling can misclassify an executable command followed by a standalone block as a resource, suppressing a valid Get-Verb diagnostic; it needs the same alias and command-resolution checks as the same-line path, preserving the Node exception, plus a regression test.

1 open issue
  • Medium severity Preserve diagnostics for following-line verb blocks in fallback AST · New

Review effort: Balanced

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Rules/AvoidAlias.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

@bergmeister
Christoph Bergmeister (bergmeister) added this pull request to stack #2294 October 29, 2026 09:53
Copilot AI mentioned this pull request Oct 29, 2026
Preserve alias diagnostics after executable commands in DSC ASTs #2293
Merged
@bergmeister
Christoph Bergmeister (bergmeister) removed this pull request from stack #2294 October 29, 2026 11:23
@bergmeister
Preserve alias diagnostics after executable commands in DSC ASTs (#2293)
e51412d
* Initial plan

* Guard following-line DSC resource detection

Co-authored-by: bergmeister <[email protected]>

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: bergmeister <[email protected]>
@bergmeister
Christoph Bergmeister (bergmeister) requested a balanced review from Copilot October 29, 2026 11:35
Copilot started reviewing on behalf of Christoph Bergmeister (bergmeister) October 29, 2026 11:36
View session
Copilot AI reviewed Oct 29, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Human assessment is needed because separate-runspace command resolution can misclassify script-defined function callbacks as resource bodies, suppressing expected corrections.

No open issues 🎉

1 resolved since last review
  • Medium severity Preserve diagnostics for following-line verb blocks in fallback AST

Review effort: Balanced

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bergmeister
Christoph Bergmeister (bergmeister) requested a balanced review from Copilot October 29, 2026 12:53
Copilot started reviewing on behalf of Christoph Bergmeister (bergmeister) October 29, 2026 12:54
View session
Copilot AI reviewed Oct 29, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

🟡 Changes recommended

The two-element exception in AvoidAlias.cs suppresses the Get-ChildItem correction for gci . followed by a next-line block, making alias handling inconsistent with same-line brace placement.

1 open issue
  • Medium severity Fix gci alias handling when block follows on the next line · New

Review effort: Balanced

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Rules/AvoidAlias.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

@bergmeister
Christoph Bergmeister (bergmeister) added this pull request to stack #2296 October 29, 2026 13:15
Copilot AI mentioned this pull request Oct 29, 2026
Preserve alias diagnostics for two-element DSC-shaped commands #2295
Merged
@bergmeister
Christoph Bergmeister (bergmeister) removed this pull request from stack #2296 October 29, 2026 14:53
@bergmeister
Preserve alias diagnostics for two-element DSC-shaped commands (#2295)
9914f20
* Initial plan

* Fix AvoidAlias DSC regression

Co-authored-by: bergmeister <[email protected]>

* Fix Windows Pester expected alias count

Co-authored-by: bergmeister <[email protected]>

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: bergmeister <[email protected]>
@bergmeister
Christoph Bergmeister (bergmeister) requested a balanced review from Copilot October 29, 2026 14:55
Copilot started reviewing on behalf of Christoph Bergmeister (bergmeister) October 29, 2026 14:55
View session
Copilot AI reviewed Oct 29, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are reported for the change preventing alias correction from rewriting DSC resource names.

No open issues 🎉

1 resolved since last review
  • Medium severity Fix gci alias handling when block follows on the next line

Review effort: Balanced

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bergmeister
Christoph Bergmeister (bergmeister) marked this pull request as ready for review October 29, 2026 15:54
@bergmeister
Christoph Bergmeister (bergmeister) requested a review from a team as a code owner October 29, 2026 15:54
@bergmeister
Christoph Bergmeister (bergmeister) added this pull request to stack #2298 October 29, 2026 17:25
Copilot AI mentioned this pull request Oct 29, 2026
Distinguish script-defined functions from DSC resources #2297
Draft
5 of 6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments
@bergmeister Christoph Bergmeister (bergmeister) Awaiting requested review from bergmeister bergmeister is a code owner

At least 1 approving review is required to merge this pull request.

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@bergmeister Christoph Bergmeister (bergmeister)

Copilot code review Copilot

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Auto Correct Aliases incorrectly expands DSC resources name thinking its an alias of a cmdlet

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@bergmeister
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.