Skip to content

Balanced Source Generator mode does not work on saving #75586

@Dreamescaper

Description

@Dreamescaper

Based on the description, source generators should be invoked on document Save. However, this doesn't happen.

Version Used:
Visual Studio 2022 v17.12 Preview 4

Steps to Reproduce:
Paste the snippet to Visual Studio:

using System.Text.RegularExpressions;

var regex = MyTestRegex();
regex.Match("1234");

partial class Program
{
    [GeneratedRegex(@"\w+")]
    private static partial Regex MyTestRegex();
}

Click Save / Press Ctrl+S.

Expected Behavior:
Method implemenation is generated, and the error is not displayed.

Actual Behavior:
Method implementation is not generated until build.

CS8795 Partial method 'Program.MyTestRegex()' must have an implementation part because it has accessibility modifiers.

Error disappears after build.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions