Fix issue with nint/nuint formatting (#3871)
authorLee Culver <leculver@microsoft.com>
Wed, 10 May 2023 16:41:20 +0000 (09:41 -0700)
committerGitHub <noreply@github.com>
Wed, 10 May 2023 16:41:20 +0000 (09:41 -0700)
* Fix integer formatting

StringBuilder.Format doesn't respect "x" when with nint/nuint.

* Update Formats.cs

src/Microsoft.Diagnostics.ExtensionCommands/Output/Formats.cs

index 2ef5090eea85d3fcc81409e90e4888df306c2879..1fdc488e69ba3cd6ab72c67ea0f8b31f6d9f3ec2 100644 (file)
@@ -58,6 +58,17 @@ namespace Microsoft.Diagnostics.ExtensionCommands.Output
                     case null:
                         break;
 
+                    case nuint nui:
+                        result.AppendFormat(_format, (ulong)nui);
+                        break;
+
+                    case nint ni:
+                        unchecked
+                        {
+                            result.AppendFormat(_format, (ulong)ni);
+                        }
+                        break;
+
                     default:
                         result.AppendFormat(_format, value);
                         break;