You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We need a proper pipeline stop signal. This has been brought up before, and it really needs to be done. There are too many side effects from using a secret exception to do it.
This one bites you in really fun ways when using orchestration tools like RunDeck that strictly check the ErrorVariable of Invoke-Expression -ErrorVariable +myerr. Scripts run but the orchestration tools report failures. Quite a few refactors because of this.
Steve Lee (@SteveL-MSFT) is there anything we can do about this one for ps7? I'm more than willing to put some work in here, but I'm not at all clear on where to start :(
Rain Sallow (/u/ta11ow) (@vexx32) It seems that this is not going to be a small fix that maintains backwards compatibility. As such, seems risky to take for PS7.
Sure, but that will always be the case. Lots of little niggles like this all add up to a bit of an unfortunate mess in terms of error handling in PS. Joel B has several issues on various aspects of it, and all of them could potentially be breaking changes.
However, the behaviour is broken to begin with. If a major version isn't a time to fix these long-standing problems, when is? 🙂
I agree this should be addressed, however, it's also been like this for probably ever. From a priority standpoint, it's not clear to me how many customers are actually affected by this.
Definitely fair, I get that. I'm not asking for it to be solved yesterday, just if there are folks who might be familiar with the internals on your team, I'd appreciate some pointers on possible avenues for a solution / relevant code areas to be have a good chance of being able to put a solution in code. 🙂
In case it helps with prioritization, this showed up as a post-implementation issue for multiple clients at my organization when an internal product upgrade was applied that introduced 'Select -First' in a deploy script. Wrapper scripts falsely reported the error variable being set as a deploy failure. I added a workaround that ignores errors with 'HResult = -2146233087' in the most urgent cases, but I know there are some clients who haven't yet encountered this issue and will eventually.
It seems safe to assume that no one is depending on the error variable to be set in this scenario.
Thanks for whatever attention you can give to the solution. It may not help my clients who are unlikely to do a major version upgrade in the near future, but it certainly adds to the overall robustness of Powershell.
Activity
vexx32 commentedon Mar 21, 2019
sigh
We need a proper pipeline stop signal. This has been brought up before, and it really needs to be done. There are too many side effects from using a secret exception to do it.
mossrich commentedon Mar 29, 2019
Also reported 11/2018: https://windowsserver.uservoice.com/forums/301869-powershell/suggestions/36081100-error-select-object-with-first-parameter-populat
This issue is also present in Powershell 4 and 5, but manifests as 'System error. '
PS > 1..2 | Select -First 2 -ErrorVariable X; $X | select *
1
2
RequestingCommandProcessor : Select-Object
Message : System error.
Data : {}
InnerException :
TargetSite : Void ProcessRecord()
StackTrace : at Microsoft.PowerShell.Commands.SelectObjectCommand.ProcessRecord()
at System.Management.Automation.CommandProcessor.ProcessRecord()
HelpLink :
Source : Microsoft.PowerShell.Commands.Utility
HResult : -2146233087
PS > $PSVersionTable.PSVersion
Major Minor Build Revision
4 0 -1 -1
ericnelson commentedon Aug 28, 2019
This one bites you in really fun ways when using orchestration tools like RunDeck that strictly check the ErrorVariable of Invoke-Expression -ErrorVariable +myerr. Scripts run but the orchestration tools report failures. Quite a few refactors because of this.
vexx32 commentedon Aug 28, 2019
Steve Lee (@SteveL-MSFT) is there anything we can do about this one for ps7? I'm more than willing to put some work in here, but I'm not at all clear on where to start :(
SteveL-MSFT commentedon Aug 28, 2019
Rain Sallow (/u/ta11ow) (@vexx32) It seems that this is not going to be a small fix that maintains backwards compatibility. As such, seems risky to take for PS7.
vexx32 commentedon Aug 28, 2019
Sure, but that will always be the case. Lots of little niggles like this all add up to a bit of an unfortunate mess in terms of error handling in PS. Joel B has several issues on various aspects of it, and all of them could potentially be breaking changes.
However, the behaviour is broken to begin with. If a major version isn't a time to fix these long-standing problems, when is? 🙂
SteveL-MSFT commentedon Aug 29, 2019
I agree this should be addressed, however, it's also been like this for probably ever. From a priority standpoint, it's not clear to me how many customers are actually affected by this.
vexx32 commentedon Aug 30, 2019
Definitely fair, I get that. I'm not asking for it to be solved yesterday, just if there are folks who might be familiar with the internals on your team, I'd appreciate some pointers on possible avenues for a solution / relevant code areas to be have a good chance of being able to put a solution in code. 🙂
mossrich commentedon Sep 4, 2019
In case it helps with prioritization, this showed up as a post-implementation issue for multiple clients at my organization when an internal product upgrade was applied that introduced 'Select -First' in a deploy script. Wrapper scripts falsely reported the error variable being set as a deploy failure. I added a workaround that ignores errors with 'HResult = -2146233087' in the most urgent cases, but I know there are some clients who haven't yet encountered this issue and will eventually.
It seems safe to assume that no one is depending on the error variable to be set in this scenario.
Thanks for whatever attention you can give to the solution. It may not help my clients who are unlikely to do a major version upgrade in the near future, but it certainly adds to the overall robustness of Powershell.
SteveL-MSFT commentedon Oct 18, 2019
Looked into this and turned out to be simple
[-]Select-Object -First populates the ERROR Variable[/-][+]Select-Object -First populates `-ErrorVariable`[/+]