Skip to content

[Backport] Request to backport PR #12063 (Remove regex from compiler) to .NET 8.0 #12723

@sam9191

Description

@sam9191

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

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

  1. .NET 8.0 is an LTS release - Supported until November 2026, with many production workloads depending on it
  2. Severity: This causes complete request failures in production
  3. Low risk change - PR Remove regex from the compiler #12063 is a straightforward algorithm replacement (regex → loop) with comprehensive test coverage
  4. Performance improvement - The fix also improves performance
  5. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions