https://github.com/kzu/backingfieldrecordsymbolmissing
https://github.com/kzu/backingfieldrecordsymbolmissing
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/kzu/backingfieldrecordsymbolmissing
- Owner: kzu
- License: mit
- Created: 2024-08-01T23:02:19.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-02T14:30:16.000Z (almost 2 years ago)
- Last Synced: 2025-03-17T18:56:14.917Z (over 1 year ago)
- Language: C#
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# Repro for missing backing field in referenced project record with primary constructor
See [reported issue](https://github.com/dotnet/roslyn/issues/74634).
## Steps to reproduce
Run the project setting a breakpoint in the generator.
Alternatively, just compile the solution and inspect the generated
code in `\Library\obj\Debug\net8.0\generated\Analyzer\Generator\RecordMembers.cs`
which looks like the following and showcases the missing field symbol:
```
// Local External
// --------------------------------------------------------------------------------
// .ctor .ctor
// .ctor .ctor
// k__BackingField
// $ $
// Amount Amount
// Deconstruct Deconstruct
// EqualityContract EqualityContract
// Equals Equals
// Equals Equals
// get_Amount get_Amount
// get_EqualityContract get_EqualityContract
// GetHashCode GetHashCode
// op_Equality op_Equality
// op_Inequality op_Inequality
// PrintMembers PrintMembers
// set_Amount set_Amount
// ToString ToString
```
Both record definitions are the same except for the name:
```csharp
// Library
public record Local(int Amount);
// External
public record External(int Amount);
```