nameof for record Constructor Parameter not working
Open
Area-Compilers
- Dominant language
- C#
- Stars
- 20.7k
- Forks
- 4.3k
- PR merge metrics
- PR metrics pending
Description
**Version Used**: .net9 latest
**Steps to Reproduce**:
i have this record and want to tell the compiler that TestString is not null when the boolean is true.
I get an error that TestString does not exist in the current context
```c#
public record Test(string? TestString, [property: MemberNotNullWhen(true, nameof(TestString))]bool IsTestString);
```
switchting to
```c#
public record Test(string? TestString, [property: MemberNotNullWhen(true, "TestString"))]bool IsTestString);
```
works as expected
Contributor guide
Assessment
This issue has not been assessed yet.