Skip to content

Conversation

@SteveL-MSFT
Copy link
Member

@SteveL-MSFT SteveL-MSFT commented Dec 16, 2020

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 then Out-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

@ghost ghost assigned rjmholt Dec 16, 2020
@iSazonov 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
@ghost ghost added the Review - Needed The PR is being reviewed label Dec 24, 2020
@ghost
Copy link

ghost commented Dec 24, 2020

This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days.
Maintainer, please provide feedback and/or mark it as Waiting on Author

SteveL-MSFT and others added 2 commits January 15, 2021 15:27
…ies/MshObjectUtil.cs

Co-authored-by: Ilya <darpa@yandex.ru>
…ies/MshObjectUtil.cs

Co-authored-by: Ilya <darpa@yandex.ru>
@krishnayalavarthi
Copy link
Contributor

krishnayalavarthi commented Jan 27, 2021

@SteveL-MSFT Can we merge this?

@rjmholt rjmholt merged commit ec5a776 into PowerShell:master Jan 28, 2021
@ghost ghost removed the Review - Needed The PR is being reviewed label Jan 28, 2021
@SteveL-MSFT SteveL-MSFT deleted the smarttostring branch January 28, 2021 01:08
@iSazonov iSazonov added this to the 7.2.0-preview.3 milestone Jan 28, 2021
@ghost
Copy link

ghost commented Feb 12, 2021

🎉v7.2.0-preview.3 has been released which incorporates this pull request.:tada:

Handy links:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Helper method converting PSObject to string may fail

6 participants