diff --git a/src/Http/Headers/src/HeaderUtilities.cs b/src/Http/Headers/src/HeaderUtilities.cs index ff5bb5400c..ac193c0c38 100644 --- a/src/Http/Headers/src/HeaderUtilities.cs +++ b/src/Http/Headers/src/HeaderUtilities.cs @@ -562,6 +562,11 @@ namespace Microsoft.Net.Http.Headers throw new ArgumentOutOfRangeException(nameof(value), value, "The value to be formatted must be non-negative."); } + if (value == 0) + { + return "0"; + } + var position = _int64MaxStringLength; char* charBuffer = stackalloc char[_int64MaxStringLength];