Skip to content

Source Generator generated wrong code for regex (?<=(abc)+?123)a in .NET10 #120882

@longxya

Description

@longxya

Description

visual studio 2026 Insiders given an error No such label 'LazyLoopBacktrack' within the scope of the goto statement for generated regex (?<=(abc)+?123)a and xxx(?<=(abc)+?123)a.

But work normally for generated regex (?<=(abc)+?123) and (?<=(abc)+?)a.

Reproduction Steps

internal partial class RegexTester
{
	[GeneratedRegex(@"(?<=(abc)+?123)a")]
	internal static partial Regex regexTestGenerate();
}

Expected behavior

Generate executable code.

Actual behavior

No such label 'LazyLoopBacktrack' within the scope of the goto statement.
Because in the source generated code, the LazyLoopBacktrack: and goto LazyLoopBacktrack; are separated by two layers of curly braces

Regression?

No response

Known Workarounds

No response

Configuration

No response

Other information

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions