- Notifications
You must be signed in to change notification settings - Fork 8.1k
Do not require activity when creating a completed progress record#18474
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not require activity when creating a completed progress record #18474
Uh oh!
There was an error while loading. Please reload this page.
Conversation
MartinGC94 commented Nov 6, 2022 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
MartinGC94 commented Nov 6, 2022
It doesn't seem possible to fix this with parametersets without making a breaking change. It seems like the only option left is to keep the current parameterset and simply make |
SteveL-MSFT commented Nov 7, 2022
I'll queue this up for discussion on Cmdlets WG |
SteveL-MSFT commented Nov 7, 2022
This script example seems to work? [cmdletbinding(DefaultParameterSetName='two')] param( [parameter(ParameterSetName='one',mandatory=$true)] [parameter(ParameterSetName='two',mandatory=$false)] [string]$activity, [parameter(ParameterSetName='two')] [switch]$completed ) $activity$completed |
MartinGC94 commented Nov 8, 2022
That's not an accurate example though. This example is more accurate: but by making parameter set "two" the default set and the "completed" switch optional we allow people to call it without any parameters at all: |
ghost commented Nov 15, 2022
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
SteveL-MSFT commented Mar 1, 2023
@PowerShell/wg-powershell-cmdlets reviewed this. We agreed to make |
…and set a default value instead.
src/Microsoft.PowerShell.Commands.Utility/commands/utility/WriteProgressCmdlet.cs Outdated Show resolvedHide resolved
Uh oh!
There was an error while loading. Please reload this page.
ghost commented Mar 12, 2023
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
src/Microsoft.PowerShell.Commands.Utility/commands/utility/WriteProgressCmdlet.cs Outdated Show resolvedHide resolved
Uh oh!
There was an error while loading. Please reload this page.
doctordns commented May 3, 2023
The Cmdlet working group has reviewed this and we recognize the benefit of the requested behavior, and we have seen other scenarios where omitting activity and status is useful. |
MartinGC94 commented May 3, 2023
I don't understand where you want this check. I can't find |
SteveL-MSFT commented May 8, 2023
@MartinGC94 you are correct, when we discussed this in the WG, I had forgotten about the remoting scenario. Let me bring it up to the WG one more time. Sorry about this. |
ghost commented May 16, 2023
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
JamesWTruher commented Jun 7, 2023
The WG hasn't changed our mind about our earlier opinion, but we believe that the serialization of the progress record could be altered so it ensures that a space would be provided during the serialization process instead of changing the default value of the parameter. It looks like this could be done around line 486 in System.Management.Automation/engine/ProgressRecord.cs. |
MartinGC94 commented Jun 7, 2023
I've applied the WG suggestions with a slight modification: I added the runtime check to ProcessRecord instead of the setter for Activity because parameters can be bound in any order so we can't know for certain if the |
SteveL-MSFT left a comment
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.
Sorry for the back-and-forth on this, but we wanted to make sure we have the right long term design as well as addressing the app-compat issue. This looks good to me. Thanks!
src/Microsoft.PowerShell.Commands.Utility/commands/utility/WriteProgressCmdlet.csShow resolvedHide resolved
Uh oh!
There was an error while loading. Please reload this page.
This PR has Quantification details
Why proper sizing of changes mattersOptimal pull request sizes drive a better predictable PR flow as they strike a
What can I do to optimize my changes
How to interpret the change counts in git diff output
Was this comment helpful? 👍 :ok_hand: :thumbsdown: (Email) |
JamesWTruher left a comment
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.
lgtm
ghost commented Jun 29, 2023
🎉 Handy links: |
PR Summary
Fixes#15252
Allows you to complete progress records with
Write-Progresswithout specifying an activity.This is done by using a predefined string in the activity for
Completerecords because the API expects a non-empty string and updating the API would cause issues in remoting scenarios with a different PowerShell host.PR Context
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.Write-Progressthat theActivityparameter is optional MicrosoftDocs/PowerShell-Docs#9864(which runs in a different PS Host).