-
Notifications
You must be signed in to change notification settings - Fork 233
Description
Summary
Requesting a backport of PR #12063 to the .NET 8.0 LTS branch. We are experiencing the exact RegexMatchTimeoutException in production that this PR fixes.
Related Issues/PRs
- Original issue: RegexMatchTimeoutException when rendering ViewComponent #12062
- Fix PR: Remove regex from the compiler #12063 (merged to main on July 30, 2025)
Environment
- .NET Version: 8.0 (LTS)
- Umbraco CMS: 13.7.2
- Hosting: Azure App Service (Linux)
Stack Trace from Production
System.Text.RegularExpressions.RegexMatchTimeoutException: The Regex engine has timed out while trying to match a pattern to an input string. This can occur for many reasons, including very large inputs or excessive backtracking caused by nested quantifiers, back-references and other factors.
at System.Text.RegularExpressions.RegexRunner.g__ThrowRegexTimeout|25_0()
at System.Text.RegularExpressions.RegexInterpreter.Scan(ReadOnlySpan`1 text)
at System.Text.RegularExpressions.Regex.RunAllMatchesWithCallbackTState
at System.Text.RegularExpressions.RegexReplacement.ReplaceNonSimpleText(...)
at System.Text.RegularExpressions.Regex.Replace(String input, String replacement)
at Microsoft.AspNetCore.Razor.Language.HtmlConventions.ToHtmlCase(String name)
at Microsoft.AspNetCore.Mvc.Razor.Extensions.ViewComponentTagHelperDescriptorFactory.CreateDescriptor(INamedTypeSymbol type)
at Microsoft.AspNetCore.Mvc.Razor.Extensions.ViewComponentTagHelperDescriptorProvider.Execute(TagHelperDescriptorProviderContext context)
at Microsoft.CodeAnalysis.Razor.CompilationTagHelperFeature.GetDescriptors()
at Microsoft.AspNetCore.Razor.Language.DefaultRazorTagHelperBinderPhase.ExecuteCore(RazorCodeDocument codeDocument)
...
Impact
- Frequency: Intermittent, affects production users
- User Impact: Complete page failure when rendering BlockGrid components
Justification for Backport
- .NET 8.0 is an LTS release - Supported until November 2026, with many production workloads depending on it
- Severity: This causes complete request failures in production
- Low risk change - PR Remove regex from the compiler #12063 is a straightforward algorithm replacement (regex → loop) with comprehensive test coverage
- Performance improvement - The fix also improves performance
- No workaround - There is no configuration option to disable the regex or increase timeout in
HtmlConventions.ToHtmlCase
Request
Please consider backporting PR #12063 to .NET 8 LTS so users can benefit from this critical fix.
Thank you for your consideration.
/cc @davidwengier