RefSource generator generates setter instead of `init`
- Dominant language
- C#
- Stars
- 729
- Forks
- 397
- Avg merge
- 3d 15m
- Merged PRs (30d)
- 149
Description
- [ ] This issue is blocking
- [ ] This issue is causing unreasonable pain
Generated Ref source from System.Net.Quic src for the new API in https://github.com/dotnet/runtime/issues/101534 (using `dotnet msbuild /t:GenerateReferenceAssemblySource`).
Source:
```C#
public readonly struct QuicStreamCapacityChangedArgs
{
public int BidirectionalIncrement { get; init; }
public int UnidirectionalIncrement { get; init; }
}
```
Generated Ref:
```C#
public readonly partial struct QuicStreamCapacityChangedArgs
{
private readonly int _dummyPrimitive;
public int BidirectionalIncrement { get { throw null; } set { } }
public int UnidirectionalIncrement { get { throw null; } set { } }
}
```
Expected Ref:
```C#
public readonly partial struct QuicStreamCapacityChangedArgs
{
public int BidirectionalIncrement { get { throw null; } init { } }
public int UnidirectionalIncrement { get { throw null; } init { } }
}
```
Contributor guide
Research direction
Start with the GenerateReferenceAssemblySource target invoked by `dotnet msbuild /t:GenerateReferenceAssemblySource`, using the System.Net.Quic example and the source and generated Ref snippets as the reproduction. Done means generated properties preserve `init` accessors instead of emitting setters, matching the expected Ref output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100