Skip to content

Fixes bug that UsingStatementAst.Copy always throws#27235

Open
TSlivede wants to merge 2 commits intoPowerShell:masterfrom
TSlivede:fixUsingStatementAstCopy
Open

Fixes bug that UsingStatementAst.Copy always throws#27235
TSlivede wants to merge 2 commits intoPowerShell:masterfrom
TSlivede:fixUsingStatementAstCopy

Conversation

@TSlivede
Copy link
Copy Markdown

@TSlivede TSlivede commented Apr 9, 2026

Fixes #8973

PR Summary

Implements the change as suggested in the issue.

Fixes examples like

$ast = [System.Management.Automation.Language.Parser]::ParseInput('using namespace System', [ref] $null, [ref] $null)
$ast.UsingStatements[0].Copy()

or

[scriptblock]::Create(@'
using namespace System;
'@).Ast.UsingStatements[0].Copy()

which currently always throw.

PR Context

This should have been merged back when the issue was created. Really sad state that such issues with obvious solutions are closed by bots. Especially now in times of llm's such issues could automatically be found and fixed...

PR Checklist

@TSlivede TSlivede requested review from a team, SeeminglyScience and daxian-dbw as code owners April 9, 2026 17:11
@microsoft-github-policy-service microsoft-github-policy-service bot added the Review - Needed The PR is being reviewed label Apr 17, 2026
@microsoft-github-policy-service
Copy link
Copy Markdown
Contributor

This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days.
Maintainer, please provide feedback and/or mark it as Waiting on Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Review - Needed The PR is being reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UsingStatementAst.Copy always throws

1 participant