Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RCS1223 does not work with new no-braces feature #1551

Closed
RenderMichael opened this issue Oct 7, 2024 · 0 comments · Fixed by #1552
Closed

RCS1223 does not work with new no-braces feature #1551

RenderMichael opened this issue Oct 7, 2024 · 0 comments · Fixed by #1552
Assignees

Comments

@RenderMichael
Copy link

RenderMichael commented Oct 7, 2024

Product and Version Used:

4.12.7

Steps to Reproduce:

Use the new no-braces feature, which was expanded from records to any type in C# 12

public readonly ref struct Dummy;

Then invoke the Add DebuggerDisplay attribute fixer.

Actual Behavior:

[DebuggerDisplay("{DebuggerDisplay,nq}")]
public readonly ref struct Dummy [DebuggerBrowsable(DebuggerBrowsableState.Never)]
private string DebuggerDisplay
{
    get
    {
        return ToString();
    }
};

does not compile.

Expected Behavior:

[DebuggerDisplay("{DebuggerDisplay,nq}")]
public readonly ref struct Dummy
{
    [DebuggerBrowsable(DebuggerBrowsableState.Never)]
    private string DebuggerDisplay
    {
        get
        {
            return ToString();
        }
    }
}

The expected I'm putting here is what you get if you add braces to the type before invoking the fixer.

(technically it doesn't compile because ref-structs cannot call ToStrings that are not defined. Maybe that's a good compilation failure, or maybe that's a bug. Either way, unrelated).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants