Add byte[] to SerializePayloadArgument (#2748)
authorDavid Mason <davmason@microsoft.com>
Mon, 15 Nov 2021 22:42:31 +0000 (14:42 -0800)
committerGitHub <noreply@github.com>
Mon, 15 Nov 2021 22:42:31 +0000 (14:42 -0800)
src/Microsoft.Diagnostics.NETCore.Client/DiagnosticsClient/DiagnosticsClient.cs

index 30f912f4f2913c2a27e87d2df3287f21544aef9f..e928aaea0c214554c3ffc37b4b6f268f1e43c5d8 100644 (file)
@@ -434,6 +434,17 @@ namespace Microsoft.Diagnostics.NETCore.Client
                 Guid guidVal = (Guid)((object)obj);
                 writer.Write(guidVal.ToByteArray());
             }
+            else if (typeof(T) == typeof(byte[]))
+            {
+                byte[] byteArray = (byte[])((object)obj);
+                uint length = byteArray == null ? 0U : (uint)byteArray.Length;
+                writer.Write(length);
+
+                if (length > 0)
+                {
+                    writer.Write(byteArray);
+                }
+            }
             else
             {
                 throw new ArgumentException($"Type {obj.GetType()} is not supported in SerializePayloadArgument, please add it.");