Commit 5297b88
Fix JsonSourceGenerator verbatim identifier handling in property initializers
Fix #116507: C# verbatim identifiers like @else are now correctly handled
when generating property initializers for init-only properties. The fix
changes PropertyInitializerGenerationSpec.Name to use NameSpecifiedInSourceCode
(which includes the @ prefix for reserved keywords) instead of MemberName.
Also added a unit test to verify this scenario works correctly.
Co-authored-by: stephentoub <[email protected]>1 parent a00aac9 commit 5297b88
File tree
2 files changed
+28
-1
lines changed- src/libraries/System.Text.Json
- gen
- tests/System.Text.Json.SourceGeneration.Unit.Tests
2 files changed
+28
-1
lines changedLines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1572 | 1572 | | |
1573 | 1573 | | |
1574 | 1574 | | |
1575 | | - | |
| 1575 | + | |
1576 | 1576 | | |
1577 | 1577 | | |
1578 | 1578 | | |
| |||
Lines changed: 27 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
861 | 861 | | |
862 | 862 | | |
863 | 863 | | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
864 | 891 | | |
865 | 892 | | |
866 | 893 | | |
| |||
0 commit comments