From 20c3e16e33073de8425c247375f4b0c963b30ddf Mon Sep 17 00:00:00 2001 From: Merijn Geurts Date: Mon, 6 Mar 2023 18:26:14 +0100 Subject: [PATCH] ReplaceFirst: StackAllock till 1KB --- framework/src/Volo.Abp.Core/System/AbpStringExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/src/Volo.Abp.Core/System/AbpStringExtensions.cs b/framework/src/Volo.Abp.Core/System/AbpStringExtensions.cs index a77458f78c..57f2c59d57 100644 --- a/framework/src/Volo.Abp.Core/System/AbpStringExtensions.cs +++ b/framework/src/Volo.Abp.Core/System/AbpStringExtensions.cs @@ -213,7 +213,7 @@ public static class AbpStringExtensions var replaceLength = replace.Length; var newLength = str.Length - searchLength + replaceLength; - Span buffer = stackalloc char[newLength]; + Span buffer = newLength <= 1024 ? stackalloc char[newLength] : new char[newLength]; // Copy the part of the original string before the search term str.AsSpan(0, pos).CopyTo(buffer);