Mark -NoTypeInformation as obsolete no-op and evaluate -IncludeTypeInformation by value#26719
Merged
TravisEz13 merged 2 commits intoJan 28, 2026
Conversation
…formation by value (PowerShell#26569)
Collaborator
|
@yotsuda Please open new issue in PowerShell-Docs and add reference to it in the PR description. |
iSazonov
reviewed
Jan 22, 2026
2 tasks
iSazonov
approved these changes
Jan 23, 2026
Collaborator
|
@yotsuda Thanks! |
Member
|
Last time we marked something as obsolete we got a lot of push back. Marking for cmdlet working group triages. |
Member
|
Verified with working group. |
TravisEz13
approved these changes
Jan 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
PR Summary
Make
-NoTypeInformationa pure no-op obsolete parameter and evaluate-IncludeTypeInformationby its value inExport-CsvandConvertTo-Csv.Fixes #26569
PR Context
Problem
When specifying both
-IncludeTypeInformation:$falseand-NoTypeInformation:$false, PowerShell throws an error even though both switches are explicitly set to$false:This is because the code checked whether the parameters were provided, not their actual values.
Solution
Per WG-Cmdlets discussion:
-IncludeTypeInformationnow respects its actual value (not just presence)-NoTypeInformationis marked obsolete and treated as a pure no-op for backward compatibility-NoTypeInformation- it simply triggers a deprecation warningPR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright header-IncludeTypeInformationand-NoTypeInformationno longer throws an errorChanges Made
1.
CsvCommands.cs(-16/+6 lines)[Obsolete]attribute to-NoTypeInformationparameter-IncludeTypeInformationand-NoTypeInformationNoTypeInformationvalue adjustment logicif (NoTypeInformation == false)toif (IncludeTypeInformation)2.
Export-Csv.Tests.ps1(-5 lines)3.
ConvertTo-Csv.Tests.ps1(-5 lines)Total: 3 files changed, 6 insertions(+), 26 deletions(-)
Behavior Examples
Both switches with $false
-IncludeTypeInformation:$true
#TYPE System.String#TYPE System.String-IncludeTypeInformation:$false
"Length""Length"-NoTypeInformation (obsolete)
"Length""Length"Testing
Test Results
Design Decision
The WG-Cmdlets comment mentioned moving
-NoTypeInformationto a separate parameter set. However, since-NoTypeInformationis purely a no-op switch that has no effect on behavior, separating parameter sets would cause unnecessary errors when both parameters are specified together (even with$falsevalues). Instead, this PR treats-NoTypeInformationas a truly ignored parameter that simply triggers a deprecation warning.