From db6cd7b7d72e97872bb177838c548688dafcd652 Mon Sep 17 00:00:00 2001 From: Robert Holt Date: Fri, 26 Apr 2019 14:44:28 +1000 Subject: [PATCH] Fix ConvertFrom-PSCompatibilityJson for loop --- .../Commands/ConvertJsonCommands.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/PSCompatibilityCollector/Microsoft.PowerShell.CrossCompatibility/Commands/ConvertJsonCommands.cs b/PSCompatibilityCollector/Microsoft.PowerShell.CrossCompatibility/Commands/ConvertJsonCommands.cs index 07d2489df..39a20c96a 100644 --- a/PSCompatibilityCollector/Microsoft.PowerShell.CrossCompatibility/Commands/ConvertJsonCommands.cs +++ b/PSCompatibilityCollector/Microsoft.PowerShell.CrossCompatibility/Commands/ConvertJsonCommands.cs @@ -96,18 +96,22 @@ protected override void ProcessRecord() { case string jsonString: WriteObject(_serializer.Deserialize(jsonString)); - return; + continue; case FileInfo jsonFile: WriteObject(_serializer.Deserialize(jsonFile)); - return; + continue; case TextReader jsonReader: WriteObject(_serializer.Deserialize(jsonReader)); - return; + continue; default: - throw new ArgumentException($"Unsupported type for {nameof(JsonSource)} parameter. Should be a string, FileInfo or TextReader object."); + this.WriteExceptionAsError( + new ArgumentException($"Unsupported type for {nameof(JsonSource)} parameter. Should be a string, FileInfo or TextReader object."), + errorId: "InvalidArgument", + errorCategory: ErrorCategory.InvalidArgument); + continue; } } }