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
When formatting, if collection is modified, don't fail the entire pipeline #14438
Merged
Conversation
This file contains 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
…l the whole operation
ghost
assigned rjmholt
Dec 16, 2020
rjmholt
reviewed
Dec 16, 2020
src/System.Management.Automation/FormatAndOutput/common/Utilities/MshObjectUtil.cs
Outdated
Show resolved
Hide resolved
src/System.Management.Automation/resources/FormatAndOut_format_xxx.resx
Outdated
Show resolved
Hide resolved
iSazonov
reviewed
Dec 16, 2020
src/System.Management.Automation/FormatAndOutput/common/Utilities/MshObjectUtil.cs
Outdated
Show resolved
Hide resolved
iSazonov
added
the
CL-General
Indicates that a PR should be marked as a general cmdlet change in the Change Log
label
Dec 16, 2020
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
iSazonov
reviewed
Jan 8, 2021
src/System.Management.Automation/FormatAndOutput/common/Utilities/MshObjectUtil.cs
Show resolved
Hide resolved
iSazonov
reviewed
Jan 15, 2021
src/System.Management.Automation/FormatAndOutput/common/Utilities/MshObjectUtil.cs
Outdated
Show resolved
Hide resolved
src/System.Management.Automation/FormatAndOutput/common/Utilities/MshObjectUtil.cs
Outdated
Show resolved
Hide resolved
…ies/MshObjectUtil.cs Co-authored-by: Ilya <darpa@yandex.ru>
…ies/MshObjectUtil.cs Co-authored-by: Ilya <darpa@yandex.ru>
iSazonov
approved these changes
Jan 20, 2021
@SteveL-MSFT Can we merge this? |
rjmholt
approved these changes
Jan 27, 2021
src/System.Management.Automation/FormatAndOutput/common/Utilities/MshObjectUtil.cs
Outdated
Show resolved
Hide resolved
PaulHigin
approved these changes
Jan 27, 2021
🎉 Handy links: |
ghost
mentioned this pull request
Feb 12, 2021
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
If a cmdlet emitting objects in a collection inadvertently modifies an instance within the collection, an InvalidOperationException gets thrown. This results in the entire pipeline failing as the exception is not being handled. Customers are seeing this with apps that use PowerShell to enumerate a large collection like AD users, then piping that to
Format-List
(and thenOut-String
).The proposed fix is to modify the existing exception handling block to also cover InvalidOperationException.
Originally, the decision was to emit a warning message, however, the code calling this helper method is also within the engine for formatting which itself doesn't have a means to write a warning message. Since the existing code for ExtendedTypeSystemException already has this behavior, it seems acceptable to extend it to InvalidOperationException.
PR Context
Fix #11797
PR Checklist
.h
,.cpp
,.cs
,.ps1
and.psm1
files have the correct copyright headerWIP:
or[ WIP ]
to the beginning of the title (theWIP
bot will keep its status check atPending
while the prefix is present) and remove the prefix when the PR is ready.