diff --git a/src/Hosting/Hosting/src/GenericHost/GenericWebHostedService.cs b/src/Hosting/Hosting/src/GenericHost/GenericWebHostedService.cs index ef7688e153..d259f769e1 100644 --- a/src/Hosting/Hosting/src/GenericHost/GenericWebHostedService.cs +++ b/src/Hosting/Hosting/src/GenericHost/GenericWebHostedService.cs @@ -180,7 +180,7 @@ namespace Microsoft.AspNetCore.Hosting } else { - model.ErrorDetails = new ExceptionDetails[0]; + model.ErrorDetails = Array.Empty(); } var errorPage = new ErrorPage(model); diff --git a/src/Shared/WebEncoders/WebEncoders.cs b/src/Shared/WebEncoders/WebEncoders.cs index 7ce03ec1a4..244453e0b5 100644 --- a/src/Shared/WebEncoders/WebEncoders.cs +++ b/src/Shared/WebEncoders/WebEncoders.cs @@ -26,8 +26,6 @@ namespace Microsoft.Extensions.Internal #endif static class WebEncoders { - private static readonly byte[] EmptyBytes = new byte[0]; - /// /// Decodes a base64url-encoded string. /// @@ -70,7 +68,7 @@ namespace Microsoft.Extensions.Internal // Special-case empty input if (count == 0) { - return EmptyBytes; + return Array.Empty(); } // Create array large enough for the Base64 characters, not just shorter Base64-URL-encoded form. @@ -117,7 +115,7 @@ namespace Microsoft.Extensions.Internal if (count == 0) { - return EmptyBytes; + return Array.Empty(); } // Assumption: input is base64url encoded without padding and contains no whitespace.