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 — Fix Parameter Binder bug with Advanced Functions and ValueFromRemainingArguments by dlwyatt · Pull Request #2038 · PowerShell/PowerShell

Conversation

@dlwyatt

@dlwyatt Dave Wyatt (dlwyatt) commented Aug 23, 2016 •
edited by TravisEz13
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

Resolves issues #2035

In the current code, two calls to BindParameter are potentially made, and the assumption was that if a caller had specified Set-ClusterOwnerNode foo,bar instead of Set-ClusterOwnerNode foo bar, the first call would fail.

This was not the case with Advanced Functions, so the logic which was supposed to cover that case in HandleRemainingArguments() wasn't being triggered. This update unwraps a single-element list first, rather than requiring a failed call to BindParameter before that happens.

As a result, Write-Object no longer needs its own foreach loop to compensate for being sent a List<Object> from HandleRemainingArguments().

Sorry, something went wrong.

Uh oh!

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

iSazonov reacted with thumbs down emoji
All reactions
  • 👎 1 reaction
@msftclas Microsoft Contribution License Agreements (msftclas) added the cla-already-signed label Aug 23, 2016
@dlwyatt Dave Wyatt (dlwyatt) mentioned this pull request Aug 23, 2016
Join multiple paths in one call to Join-Path #2014
Closed
@lzybkr Jason Shirk (lzybkr) assigned Dongbo Wang (daxian-dbw) Aug 23, 2016
@lzybkr

Jason Shirk (lzybkr) commented Aug 23, 2016

Copy link
Copy Markdown
Contributor

I think this is a bucket 2 breaking change, so maybe we need an RFC.

Dongbo Wang (@daxian-dbw) - can you review?

All reactions

Sorry, something went wrong.

Uh oh!

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

@dlwyatt

Dave Wyatt (dlwyatt) commented Aug 23, 2016

Copy link
Copy Markdown
Contributor Author

If someone's depending on this difference in behavior between Do-Something 1 2 3 and Do-Something 1,2,3, I want to give that person a stern talking-to. :)

ForNeVeR reacted with thumbs up emoji jpsnover and mklement0 reacted with thumbs down emoji
All reactions
  • 👍 1 reaction
  • 👎 2 reactions

Sorry, something went wrong.

Uh oh!

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

@TravisEz13 Travis Plunk (TravisEz13) added the Review - Needed label Aug 23, 2016
@TravisEz13 Travis Plunk (TravisEz13) changed the title Fixes #2035 (Parameter Binder bug with Advanced Functions and ValueFromRemainingArguments) Fix Parameter Binder bug with Advanced Functions and ValueFromRemainingArguments Aug 23, 2016
@lzybkr Jason Shirk (lzybkr) added the WG-Engine core PowerShell engine, interpreter, and runtime label Aug 23, 2016
daxian-dbw
daxian-dbw reviewed Aug 24, 2016
View reviewed changes
Comment thread src/Microsoft.PowerShell.Commands.Utility/commands/utility/Write-Object.cs Outdated

@daxian-dbw Dongbo Wang (daxian-dbw) Aug 24, 2016

Copy link
Copy Markdown
Member

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.

this shouldn't been changed even if the fix to parameter binder is accepted. it will break the following scenario:

Write-Output aa,bb cc,dd

Sorry, something went wrong.

Uh oh!

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

All reactions

@dlwyatt Dave Wyatt (dlwyatt) Aug 24, 2016

Copy link
Copy Markdown
Contributor Author

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.

Hmm, that's tricky. In fact I'd say it's been a bug in Write-Output all along.

Write-Output aa,bb cc,dd

# is equivalent to

Write-Output -InputObject @( @('aa', 'bb'), @('cc', 'dd') )

Either way, InputObject is a 2-element array, and each element also happens to be a 2-element array. What I would expect to happen here is what happens after this PR: You send two objects down the pipeline, both of which are 2-element arrays. If you added the -NoEnumerate switch, then you would send one object down the pipeline, which is a 2-element array containing two other 2-element arrays. (In fact, with the -NoEnumerate switch, you should only ever send one object, an array, down the pipeline, which is sort of the point.)

Today, Write-Output aa,bb cc,dd instead sends 4 strings down the pipeline. It enumerates two levels deep instead of one. If you use the -NoEnumerate switch on that command today, you get two 2-element arrays going down the pipeline (what I'd expect to see without -NoEnumerate).

Without this change, several other Write-Output tests failed when I ran Start-PSPester. With this change, everything was green, but apparently that just means that the test coverage isn't good enough right now.

Sorry, something went wrong.

Uh oh!

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

All reactions

@dlwyatt Dave Wyatt (dlwyatt) Aug 24, 2016

Copy link
Copy Markdown
Contributor Author

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.

Here are the results of Write-Output.Tests.ps1 with the binder fix but without the change to Write-Output:

Describing Write-Output DRT Unit Tests
 [-] Simple Write Object Test 1.28s
   Expected: {4}
   But was:  {6}
   at line: 5 in C:\Users\dlwya_000\Documents\GitHub\powershell\test\powershell\Modules\Microsoft.PowerShell.Utility\Write-Output.Tests.ps1
   5:         $results.Length | Should Be $objectWritten.Length
 [-] Works with NoEnumerate switch 144ms
   Expected: {1 2.2 System.Object[] abc}
   But was:  {1}
   at line: 19 in C:\Users\dlwya_000\Documents\GitHub\powershell\test\powershell\Modules\Microsoft.PowerShell.Utility\Write-Output.Tests.ps1
   19:         Write-Output $objectWritten -NoEnumerate 6>&1 | Should be  '1 2.2 System.Object[] abc'
Describing Write-Output
   Context Input Tests
    [+] Should allow piped input 335ms
    [+] Should write output to the output stream when using piped input 23ms
    [+] Should use inputobject switch 25ms
    [+] Should write output to the output stream when using inputobject switch 38ms
    [+] Should be able to write to a variable 21ms
   Context Pipeline Command Tests
    [+] Should send object to the next command in the pipeline 69ms
    [+] Should have the same result between inputobject switch and piped input 23ms
   Context Enumerate Objects
    [+] Should see individual objects when not using the NoEnumerate switch 62ms
    [-] Should be able to treat a collection as a single object using the NoEnumerate switch 32ms
      Expected: {1}
      But was:  {3}
      at line: 71 in C:\Users\dlwya_000\Documents\GitHub\powershell\test\powershell\Modules\Microsoft.PowerShell.Utility\Write-Output.Tests.ps1
      71:           $singleCollection | Should Be 1
Tests completed in 2.06s
Passed: 8 Failed: 3 Skipped: 0 Pending: 0

Sorry, something went wrong.

Uh oh!

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

All reactions

@dlwyatt Dave Wyatt (dlwyatt) Aug 24, 2016

Copy link
Copy Markdown
Contributor Author

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.

Man, what a mess. Here's some of Write-Output's behavior today:

 write-output -NoEnumerate a b c | % { $_.GetType().FullName; $_.Count; $_ -join '/' }
System.String
1
a
System.String
1
b
System.String
1
c

 write-output -NoEnumerate a,b,c | % { $_.GetType().FullName; $_.Count; $_ -join '/' }
System.Object[]
3
a/b/c

This is a symptom of the flawed binding logic I changed (assuming the first call to BindParameter would fail when the a,b,c syntax was used), and the workaround that was created for it in Write-Output. Whatever the correct behavior is, there should never be a difference between these two calls when ValueFromRemainingArguments is in effect:

Do-Something a b c
Do-Something a,b,c

The values bound to the parameter should be identical in both cases.

Sorry, something went wrong.

Uh oh!

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

All reactions

@dlwyatt Dave Wyatt (dlwyatt) Aug 24, 2016

Copy link
Copy Markdown
Contributor Author

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.

I don't think it's possible to fix the binding logic without somehow changing (breaking or fixing, depending on your point of view) the behavior of Write-Output. The whole point of the binding fix is to ensure consistent behavior between those two syntax options I listed, and it happens before the cmdlet ever gets to look at the values.

Sorry, something went wrong.

Uh oh!

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

All reactions

@daxian-dbw Dongbo Wang (daxian-dbw) Aug 24, 2016 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

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.

Write-Output a,b,c
This is a symptom of the flawed binding logic I changed (assuming the first call to BindParameter would fail when the a,b,c syntax was used)

in this case, the first call to BindParameter is successful, because the parameter type of InputObject is PSObject[], and type conversion from list<object[]> to it would be successful.

write-output -NoEnumerate a b c | % { $_.GetType().FullName; $_.Count; $_ -join '/' }
System.String
1
a
System.String
1
b
System.String
1
c

write-output -NoEnumerate a,b,c | % { $_.GetType().FullName; $_.Count; $_ -join '/' }
System.Object[]
3
a/b/c

IMHO, this behavior of Write-Output is pretty intuitive -- when -NoEnumerate is specified, give me back what ever items I gave you. In case of a b c, I gave you 3 items, so 3 items should be returned by Write-Output; in case of a,b,c, I gave you 1 item, which is an array, so the same item should be returned back.

However, it gets confusing when -InputObject is explicitly specified:

PS D:\> Write-Output -InputObject a,b,c -NoEnumerate | % { $_.GetType().FullName; $_.Count; $_ -join '/' }
System.String
1
a
System.String
1
b
System.String
1
c
PS D:\> Write-Output a,b,c -NoEnumerate | % { $_.GetType().FullName; $_.Count; $_ -join '/' }
System.Object[]
3
a/b/c

This is the part I don't like about ValueFromRemainingArgument, but changing it would definitely break something.

Sorry, something went wrong.

Uh oh!

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

mklement0 reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

@dlwyatt Dave Wyatt (dlwyatt) Aug 24, 2016

Copy link
Copy Markdown
Contributor Author

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.

In case of a b c, I gave you 3 items, so 3 items should be returned by Write-Output
in case of a,b,c, I gave you 1 item,

I disagree with that. ValueFromRemainingArguments is just syntax sugar, similar to a params parameter in C#. You gave 3 objects in both versions of the command.

Sorry, something went wrong.

Uh oh!

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

All reactions
@daxian-dbw

Dongbo Wang (daxian-dbw) commented Aug 24, 2016

Copy link
Copy Markdown
Member

as shown by the discussion about Write-Output, the change to HandleRemainingArguments in this PR would be a breaking change.
another example would be when an array of string can be converted to a specific element type of the parameter type:

class dummy {
    [object] $Path
    [object] $Name
    dummy ([object[]] $a) {
        $this.Path = $a[0]
        $this.Name = $a[1]
    }
    [string] ToString() {
        return ($this.Path + " -- " + $this.Name)
    }
}


function Test-Attribute
{
    param(
         [string[]]
         [Parameter(Position=0)]
         $Path,

         [dummy[]]
         [Parameter(ValueFromRemainingArguments)]
         $Extra
         )


     $Extra.Count;
     for ($i = 0; $i -lt $Extra.Count; $i++)
     {
        "${i}: $($Extra[$i].GetType().FullName) $($Extra[$i])"
     }
}

PS D:\> Test-Attribute root aa,bb
1
0: dummy aa -- bb
PS D:\>
PS D:\> Test-Attribute root aa bb
Test-Attribute : Cannot process argument transformation on parameter 'Extra'. Cannot convert value
"System.Collections.Generic.List`1[System.Object]" to type "dummy[]". Error: "Cannot convert the "aa" value of type
"System.String" to type "dummy"."
At line:1 char:1
+ Test-Attribute root aa bb
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Test-Attribute], ParameterBindingArgumentTransformationException
    + FullyQualifiedErrorId : ParameterArgumentTransformationError,Test-Attribute

Another proposal of the fix:
If the parameter is declared with ValueFromRemaningArgument and Position, and valueFromRemainingArguments.Count == 1, then we use the specified argument directly instead of wrapping it in a List.

When Position is specified, I assume the author would like do-something aa to be interpreted as do-something -param aa instead of treating aa as remaining arguments.

This won't solve the problem to parameters with ValueFromRemaningArgument but without Position, and also would require Write-Object to be changed -- remove Position=0 from the parameter declaration of InputObject. So this would also be a breaking change.

Fixing parameter binder bugs is very tricky. It would be so easy to break existing behavior.

All reactions

Sorry, something went wrong.

Uh oh!

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

@dlwyatt

Dave Wyatt (dlwyatt) commented Aug 24, 2016

Copy link
Copy Markdown
Contributor Author

The more I play with this, the more I think it's the existing behavior that's broken. I'd advise people not to declare ValueFromRemainingArguments parameters at all, in the current form.

All reactions

Sorry, something went wrong.

Uh oh!

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

@daxian-dbw

Dongbo Wang (daxian-dbw) commented Aug 24, 2016

Copy link
Copy Markdown
Member

Let me get more data about the usage of ValueFromRemainingArguments and Write-Output. Will reply back here.

All reactions

Sorry, something went wrong.

Uh oh!

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

@jpsnover

Jeffrey Snover (jpsnover) commented Aug 28, 2016 •
edited by daxian-dbw
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

IMHO, this behavior of Write-Output is pretty intuitive -- when -NoEnumerate is specified, give me back what ever items I gave you. In case of a b c, I gave you 3 items, so 3 items should be returned by Write-Output; in case of a,b,c, I gave you 1 item, which is an array, so the same item should be returned back.

Dave Wyatt (@dlwyatt) I'm not a good person to explain the parsing (maybe Bruce Payette (@BrucePay) can weigh in) but in this example, the parser views this as 1 parameter - an array with 3 values.

Or in this example:

Do-Something 1 2 3
This has 3 parameters with one value each.

Do-Something 1,2,3
This has 1 parameter with 3 values.

I don't see any value in breaking existing semantics but we could consider adding a new attribute [CollapseAllArgumentsIntoASingleArray](name TBD)
That seems like a bad thing because cmdlets with positional parameters are, and need to be, precise.
So a change like this would yield a unpredictable UX.

iSazonov reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

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

@dlwyatt

Dave Wyatt (dlwyatt) commented Aug 28, 2016

Copy link
Copy Markdown
Contributor Author

Jeffrey Snover (@jpsnover) : That's exactly what ValueFromRemainingArguments is supposed to do already. It's the equivalent of declaring params string[] someParam in C#. There are just some implementation quirks that cause it to not behave the same way when one syntax or the other are used.

All reactions

Sorry, something went wrong.

Uh oh!

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

@lzybkr

Jason Shirk (lzybkr) commented Sep 22, 2016

Copy link
Copy Markdown
Contributor

We have discussed this and would like more data about potential breakage if we took the change.
We'll leave this open until somebody (likely us) do that work.

All reactions

Sorry, something went wrong.

Uh oh!

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

@dlwyatt Dave Wyatt (dlwyatt) closed this Sep 26, 2016
@iSazonov Ilya (iSazonov) mentioned this pull request Sep 27, 2016
Parameter binding problem with ValueFromRemainingArguments in PS functions #2035
Closed
@lzybkr Jason Shirk (lzybkr) reopened this Nov 2, 2016
@msftclas Microsoft Contribution License Agreements (msftclas) added the cla-already-signed label Nov 2, 2016
@mirichmo Mike Richmond (mirichmo) added the Breaking-Change breaking change that may affect users label Nov 3, 2016
@PowerShellTeam PowerShellTeam added the Review - Needed The PR is being reviewed label Nov 22, 2016
@HemantMahawar Hemant Mahawar (HemantMahawar) added Review - Needed The PR is being reviewed and removed Review - Needed The PR is being reviewed Review-Needed labels Dec 1, 2016
@dlwyatt
Dave Wyatt (dlwyatt) force-pushed the ValueFromRemainingArgumentsFix branch from 6becaf0 to 578bbfd Compare May 25, 2017 18:25
iSazonov
Ilya (iSazonov) reviewed May 26, 2017
View reviewed changes
Comment thread test/powershell/engine/ParameterBinding/ParameterBinding.Tests.ps1 Outdated

@iSazonov Ilya (iSazonov) May 26, 2017

Copy link
Copy Markdown
Collaborator

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.

We can use '$TestDrive' instead of '$env:temp' and '/tmp'

Sorry, something went wrong.

Uh oh!

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

All reactions

@dlwyatt Dave Wyatt (dlwyatt) May 26, 2017

Copy link
Copy Markdown
Contributor Author

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.

There's already a comment explaining why that doesn't work.

Sorry, something went wrong.

Uh oh!

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

All reactions

@iSazonov Ilya (iSazonov) May 26, 2017

Copy link
Copy Markdown
Collaborator

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.

I see. Please clarify - Pester will fail to clean up or Pester will fail all test batch?

Sorry, something went wrong.

Uh oh!

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

All reactions

@iSazonov Ilya (iSazonov) May 26, 2017

Copy link
Copy Markdown
Collaborator

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.

Should we use explicit assembly?
Can we use:

Add-Type -TypeDefinition $a -PassThru | ForEach-Object {$_.assembly} | Import-module -Force 

Sorry, something went wrong.

Uh oh!

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

All reactions
@dlwyatt

Dave Wyatt (dlwyatt) commented May 30, 2017

Copy link
Copy Markdown
Contributor Author

When you import the temporary module, the assembly is in use until PowerShell exits. That's why I don't create it in TestDrive:, and why I use the same file name every time (so we're not littering the test system with multiple dlls).

All reactions

Sorry, something went wrong.

Uh oh!

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

@iSazonov

Ilya (iSazonov) commented May 31, 2017

Copy link
Copy Markdown
Collaborator

Dave Wyatt (@dlwyatt) Thanks for clafify!
We use temporary modules in several tests and we never cared about unloading them. That's why I'm surprised we're doing this here.

All reactions

Sorry, something went wrong.

Uh oh!

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

@lzybkr Jason Shirk (lzybkr) mentioned this pull request Aug 17, 2017
"-"-prefixed barewords in argument mode should always be interpreted as parameter names #4591
Closed
@msftgits Microsoft GitHub User (msftgits) removed the cla-already-signed label Sep 26, 2017
@dlwyatt
Dave Wyatt (dlwyatt) requested a review from sergei (vors) as a code owner October 11, 2017 22:24
@dlwyatt

Dave Wyatt (dlwyatt) commented Oct 11, 2017

Copy link
Copy Markdown
Contributor Author

Just rebased. Will check back in a bit to make sure the tests are still passing.

All reactions

Sorry, something went wrong.

Uh oh!

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

@daxian-dbw

Dongbo Wang (daxian-dbw) commented Oct 12, 2017

Copy link
Copy Markdown
Member

Dave Wyatt (@dlwyatt) Thank you! This will be the last rebase for sure 😄

All reactions

Sorry, something went wrong.

Uh oh!

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

@daxian-dbw
Dongbo Wang (daxian-dbw) merged commit 94a71b0 into PowerShell:master Oct 12, 2017
@iSazonov

Ilya (iSazonov) commented Oct 12, 2017

Copy link
Copy Markdown
Collaborator

Dongbo Wang (@daxian-dbw) Should we add Docs-Needed and remove Review-Needed?

daxian-dbw reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

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

@dlwyatt
Dave Wyatt (dlwyatt) deleted the ValueFromRemainingArgumentsFix branch October 12, 2017 13:05
@daxian-dbw Dongbo Wang (daxian-dbw) added Documentation Needed in this repo Documentation is needed in this repo and removed Review - Needed The PR is being reviewed labels Oct 12, 2017
PetSerAl
PetSerAl reviewed Oct 13, 2017
View reviewed changes
Comment thread src/System.Management.Automation/engine/CmdletParameterBinderController.cs
// Set-ClusterOwnerNode foo bar
// Set-ClusterOwnerNode foo,bar
// we unwrap our List, but only if there is a single argument of type object[].
if (valueFromRemainingArguments.Count == 1 && valueFromRemainingArguments[0] is object[])

@PetSerAl PetSerAl Oct 13, 2017

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.

Should it be valueFromRemainingArguments[0]?.GetType() == typeof(object[]) or valueFromRemainingArguments[0] is Array?
Given array covariance in .NET, any array of reference type (like string[]) will pass is object[] check, but not array of value type (like int[]). Should it be only object[] or all arrays instead?

Sorry, something went wrong.

Uh oh!

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

All reactions

@lzybkr Jason Shirk (lzybkr) Oct 13, 2017

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.

PetSerAl - good question, I think the intent was all arrays, though object[] in this context is nearly the same thing.

Dave Wyatt (@dlwyatt) , Dongbo Wang (@daxian-dbw) - thoughts?

Sorry, something went wrong.

Uh oh!

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

All reactions

@dlwyatt Dave Wyatt (dlwyatt) Oct 13, 2017

Copy link
Copy Markdown
Contributor Author

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.

Looks like you're right. Most of the time, PowerShell's building object[] arrays from arguments at that point, but if you explicitly make a variable of another type and pass it in, it doesn't get unwrapped.

Rather than is Array, though, I'd recommend using LanguagePrimitives.GetEnumerable(valueFromRemainingArguments[0]) . That will cover other types of collections using the same rules that you'd expect from PowerShell (not treating strings / dictionaries as collections, etc.)

Sorry, something went wrong.

Uh oh!

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

All reactions

@dlwyatt Dave Wyatt (dlwyatt) Oct 13, 2017

Copy link
Copy Markdown
Contributor Author

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.

I'm putting together new tests for this and will follow up with a second PR

Sorry, something went wrong.

Uh oh!

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

All reactions
@dlwyatt Dave Wyatt (dlwyatt) mentioned this pull request Oct 13, 2017
More value from remaining arguments fixes #5109
Merged
@PetSerAl PetSerAl mentioned this pull request Oct 14, 2017
Write-Output -NoEnumerate wrap singular items into PSObject[] #5122
Closed
@mklement0 Michael Klement (mklement0) mentioned this pull request Nov 26, 2017
Fix accidental wrapping of scalar Write-Output input #5552
Closed
@mklement0 Michael Klement (mklement0) mentioned this pull request Jan 19, 2018
Write-Output -NoEnumerate outputs PSObject[] rather than Object[] and generally doesn't respect the input collection type #5955
Closed
@mklement0 Michael Klement (mklement0) mentioned this pull request Mar 21, 2018
Write-Output $null -NoEnumerate produces different Collection<PSObject> in 5.1 vs 6.0 #6451
Closed
Michael Klement (mklement0) referenced this pull request in mklement0/PowerShell Mar 22, 2018
@mklement0
Fix accidental wrapping of scalar Write-Output input
673117c
when -NoEnumerate is used.

Fix PowerShell#5122
@mklement0 Michael Klement (mklement0) mentioned this pull request Apr 26, 2018
Is it time for "PowerShell vZeroTechnicalDebt" ("vNext") and/or for an opt-in mechanism into new/fixed features that break backward compatibility? #6745
Closed
@alx9r alx9r mentioned this pull request Jun 15, 2018
pre-#2038 Write-Output: {Write-Output @() -NoEnumerate}.Invoke() returns empty Collection<PSObject> #7081
Closed
@alx9r alx9r mentioned this pull request Jun 24, 2018
Why is ([System.Collections.ObjectModel.Collection[psobject]]1)[0] a string? #7154
Closed
@joeyaiello Joey Aiello (joeyaiello) mentioned this pull request Oct 15, 2018
Docs needed for 'Fix Parameter Binder bug with Advanced Functions and ValueFromRemainingArguments' MicrosoftDocs/PowerShell-Docs#3116
Closed
@joeyaiello Joey Aiello (joeyaiello) removed Documentation Needed in this repo Documentation is needed in this repo labels Oct 15, 2018
@mklement0 Michael Klement (mklement0) mentioned this pull request Oct 26, 2018
Write-Output -NoEnumerate should not convert items in list to PSObject #8124
Closed
@daxian-dbw Dongbo Wang (daxian-dbw) mentioned this pull request Mar 8, 2019
Fix -NoEnumerate behaviour in Write-Output #9069
Merged
4 of 11 tasks
Ilya (iSazonov) pushed a commit that referenced this pull request Mar 13, 2019
@vexx32 @iSazonov
Fix -NoEnumerate behaviour in Write-Output (#9069)
18d5037
Fix is to preserve input collection type in output.
The regression was caused by #2038
Travis Plunk (TravisEz13) pushed a commit that referenced this pull request Mar 13, 2019
@vexx32 @TravisEz13
Fix -NoEnumerate behaviour in Write-Output (#9069)
ea4bf50
Fix is to preserve input collection type in output.
The regression was caused by #2038
@mklement0 Michael Klement (mklement0) mentioned this pull request Nov 12, 2020
Write-Output -NoEnumerate doesn't handle Hashtable properly #14047
Closed
@coderabbitai coderabbitai Bot mentioned this pull request Jul 12, 2026
fix(launcher): friction-free install for unsigned builds (macOS/Windows/Linux) — release 0.2.3 cli-ck/cli-ck#256
Merged
Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj-contribs/PowerShell that referenced this pull request Aug 6, 2026
@dlwyatt @daxian-dbw
Fix ValueFromRemainingArguments to have consistent behavior between s…
3681f6e
…cript and C# (PowerShell#2038)
Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj-contribs/PowerShell that referenced this pull request Aug 6, 2026
@vexx32 @iSazonov
Fix -NoEnumerate behaviour in Write-Output (PowerShell#9069)
81aecc7
Fix is to preserve input collection type in output.
The regression was caused by PowerShell#2038
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@iSazonov Ilya (iSazonov) iSazonov left review comments
@BrucePay Bruce Payette (BrucePay) Awaiting requested review from BrucePay
@dantraMSFT Dan Travison (dantraMSFT) Awaiting requested review from dantraMSFT
@daxian-dbw Dongbo Wang (daxian-dbw) Awaiting requested review from daxian-dbw
@JamesWTruher James Truher (JamesWTruher) Awaiting requested review from JamesWTruher
@lzybkr Jason Shirk (lzybkr) Awaiting requested review from lzybkr
@PaulHigin Paul Higinbotham (PaulHigin) Awaiting requested review from PaulHigin
@vors sergei (vors) Awaiting requested review from vors
+1 more reviewer
@PetSerAl PetSerAl PetSerAl left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

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

Assignees

@daxian-dbw Dongbo Wang (daxian-dbw)

Labels

Breaking-Change breaking change that may affect users Committee-Reviewed PS-Committee has reviewed this and made a decision WG-Engine core PowerShell engine, interpreter, and runtime

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

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

13 participants

@dlwyatt @lzybkr @daxian-dbw @jpsnover @iSazonov @joeyaiello @PetSerAl @PowerShellTeam @msftclas @msftgits @TravisEz13 @HemantMahawar @mirichmo
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.