Skip to content

Fix IDE0019: InlineAsTypeCheck#27406

Open
xtqqczze wants to merge 1 commit into
PowerShell:masterfrom
xtqqczze:IDE0019-p1
Open

Fix IDE0019: InlineAsTypeCheck#27406
xtqqczze wants to merge 1 commit into
PowerShell:masterfrom
xtqqczze:IDE0019-p1

Conversation

@xtqqczze
Copy link
Copy Markdown
Contributor

@xtqqczze xtqqczze commented May 8, 2026

Fix IDE0019: InlineAsTypeCheck in src/System.Management.Automation/namespaces/*

Copilot AI review requested due to automatic review settings May 8, 2026 18:47
@xtqqczze xtqqczze requested a review from a team as a code owner May 8, 2026 18:47
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

Note

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

Fixes IDE0019 (“InlineAsTypeCheck”) occurrences by converting as-casts + null checks into C# pattern matching across System.Management.Automation/namespaces.

Changes:

  • Replaced x as T + != null checks with x is T t pattern matching in multiple providers.
  • Simplified type-checking flows using is not patterns for argument validation.
  • Reduced temporary variables in a few places by scoping pattern variables to conditionals.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/System.Management.Automation/namespaces/VariableProvider.cs Uses pattern matching for SetVariable result and variable type checks (introduces a behavioral change).
src/System.Management.Automation/namespaces/ProviderBase.cs Pattern matching for PSObject and NavigationCmdletProvider checks.
src/System.Management.Automation/namespaces/LocationGlobber.cs Pattern matching for provider capability casts.
src/System.Management.Automation/namespaces/FunctionProvider.cs Pattern matching for PSObject, ScriptBlock, FunctionInfo, and string checks.
src/System.Management.Automation/namespaces/FileSystemSecurity.cs Uses is not pattern to validate FileSystemSecurity type.
src/System.Management.Automation/namespaces/FileSystemProvider.cs Pattern matching for various dynamic parameter types and FileSystemInfo extraction.
src/System.Management.Automation/namespaces/FileSystemContentStream.cs Pattern matching for object[] content lines.
src/System.Management.Automation/namespaces/EnvironmentProvider.cs Uses is not string pattern to validate/coerce values.
src/System.Management.Automation/namespaces/CoreCommandContext.cs Pattern matching for MshCommandRuntime extraction.
src/System.Management.Automation/namespaces/AliasProvider.cs Pattern matching for AliasInfo and string checks.

Comment thread src/System.Management.Automation/namespaces/VariableProvider.cs Outdated
Fix IDE0019: InlineAsTypeCheck in `src/System.Management.Automation/namespaces/*`
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 10 out of 10 changed files in this pull request and generated no new comments.

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 10 out of 10 changed files in this pull request and generated no new comments.

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.

2 participants