From aa9d36db96e23018859469055a2f5bff223988b2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 19 Jun 2025 20:00:37 +0000 Subject: [PATCH 1/4] Initial plan for issue From 1269d72b169a6444c5a442d2b1a46e922adff242 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 19 Jun 2025 20:08:15 +0000 Subject: [PATCH 2/4] Fix Docker Platform property deserialization for Docker Desktop v4.42.0 Added PlatformConverter to handle both old string format and new object format with os/architecture properties Co-authored-by: WardenGnaw <3953714+WardenGnaw@users.noreply.github.com> --- .../Docker/DockerContainerInstance.cs | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/SSHDebugPS/Docker/DockerContainerInstance.cs b/src/SSHDebugPS/Docker/DockerContainerInstance.cs index 61b95713f..7868c5f79 100644 --- a/src/SSHDebugPS/Docker/DockerContainerInstance.cs +++ b/src/SSHDebugPS/Docker/DockerContainerInstance.cs @@ -11,6 +11,31 @@ namespace Microsoft.SSHDebugPS.Docker { + public class PlatformConverter : JsonConverter + { + public override string ReadJson(JsonReader reader, Type objectType, string existingValue, bool hasExistingValue, JsonSerializer serializer) + { + if (reader.TokenType == JsonToken.String) + { + // Old format: Platform is a string + return reader.Value?.ToString(); + } + else if (reader.TokenType == JsonToken.StartObject) + { + // New format: Platform is an object with "os" and "architecture" properties + var obj = JObject.Load(reader); + return obj["os"]?.ToString(); + } + + return null; + } + + public override void WriteJson(JsonWriter writer, string value, JsonSerializer serializer) + { + writer.WriteValue(value); + } + } + public class DockerContainerInstance : ContainerInstance { /// @@ -62,6 +87,8 @@ private DockerContainerInstance() { } [JsonProperty("CreatedAt")] public string Created { get; private set; } + [JsonProperty("Platform")] + [JsonConverter(typeof(PlatformConverter))] public string Platform { get; set; } #endregion From 4eef24dc112aab5b44dd4b4d5f139abff49854e0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 19 Jun 2025 20:21:42 +0000 Subject: [PATCH 3/4] Remove Platform property from JSON deserialization to fix Docker Desktop v4.42.0 compatibility Co-authored-by: WardenGnaw <3953714+WardenGnaw@users.noreply.github.com> --- .../Docker/DockerContainerInstance.cs | 27 ------------------- 1 file changed, 27 deletions(-) diff --git a/src/SSHDebugPS/Docker/DockerContainerInstance.cs b/src/SSHDebugPS/Docker/DockerContainerInstance.cs index 7868c5f79..61b95713f 100644 --- a/src/SSHDebugPS/Docker/DockerContainerInstance.cs +++ b/src/SSHDebugPS/Docker/DockerContainerInstance.cs @@ -11,31 +11,6 @@ namespace Microsoft.SSHDebugPS.Docker { - public class PlatformConverter : JsonConverter - { - public override string ReadJson(JsonReader reader, Type objectType, string existingValue, bool hasExistingValue, JsonSerializer serializer) - { - if (reader.TokenType == JsonToken.String) - { - // Old format: Platform is a string - return reader.Value?.ToString(); - } - else if (reader.TokenType == JsonToken.StartObject) - { - // New format: Platform is an object with "os" and "architecture" properties - var obj = JObject.Load(reader); - return obj["os"]?.ToString(); - } - - return null; - } - - public override void WriteJson(JsonWriter writer, string value, JsonSerializer serializer) - { - writer.WriteValue(value); - } - } - public class DockerContainerInstance : ContainerInstance { /// @@ -87,8 +62,6 @@ private DockerContainerInstance() { } [JsonProperty("CreatedAt")] public string Created { get; private set; } - [JsonProperty("Platform")] - [JsonConverter(typeof(PlatformConverter))] public string Platform { get; set; } #endregion From bccae8392c194c99dd72335885aa363fe65bbfab Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 19 Jun 2025 20:27:21 +0000 Subject: [PATCH 4/4] Add JsonIgnore attribute to Platform property to prevent deserialization Co-authored-by: WardenGnaw <3953714+WardenGnaw@users.noreply.github.com> --- src/SSHDebugPS/Docker/DockerContainerInstance.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/SSHDebugPS/Docker/DockerContainerInstance.cs b/src/SSHDebugPS/Docker/DockerContainerInstance.cs index 61b95713f..810975773 100644 --- a/src/SSHDebugPS/Docker/DockerContainerInstance.cs +++ b/src/SSHDebugPS/Docker/DockerContainerInstance.cs @@ -62,6 +62,7 @@ private DockerContainerInstance() { } [JsonProperty("CreatedAt")] public string Created { get; private set; } + [JsonIgnore] public string Platform { get; set; } #endregion