Fix broken logging when -Message array includes a format operation. #102
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.
After the recent changes to Write-Log, logging was broken for specific cases where -Message was an arrayband included a format operation. The issue was our misunderstanding of the functionality of the format operator. The operator can operate with an array on the left-hand side. In this case, the elements of the array are joined and each string in the array may be formatted. When using the format operation while trying to create an array, we were inadvertently joining the contents of the array into a single string when we actually intended the format operation to be restricted to one line of the array.
The fix is to wrap the format operation in parentheses, to make the expression explicit. In the future, we should be more diligent about using parentheses for the same effect.