-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Rename GenerateReferenceAssemblySources -> GenerateReferenceAssemblySource #6157
Conversation
…ource When #6141 updated from Microsoft.DotNet.BuildTools.GenAPI to Microsoft.DotNet.GenAPI our reference assembly source generation logic stopped working. Turns out the new NuGet package targets relies on singular spelling to insert itself after PrepareForRun: <PrepareForRunDependsOn Condition="'$(GenerateReferenceAssemblySource)' == 'true'"> Update our spelling to singular everywhere now that we're using the new package.
The command-line options for the GenAPI tool must have changed. The tool is running now (good) but fails:
@benvillalobos mind taking over this PR and fixing this up? Thanks! |
The args that need to be updated are: |
private readonly object _dummy; | ||
private readonly int _dummyPrimitive; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any idea why it's now adding these dummy fields?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great question, I have no idea! @epananth any ideas why this might happen 🙂? I believe this source generator is owned by arcade.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are added here for compile-time compat. This is added to structs that have private fields that need to be initialized.
If we don't include these it is observable, and potentially dangerous, impact on project that consume them:
- Allows pointers to be created for structs with fields of a reference type.
- Prevents the compiler from catching cyclic struct layout problems.
- Breaks C# definite assignment checking.
- Allows structs using [FieldOffset] to verify when they should not.
- Prevents developers from correctly planning for interop scenarios.
Here is the issue that made us add this: dotnet/runtime#16402
When #6141 updated from Microsoft.DotNet.BuildTools.GenAPI to Microsoft.DotNet.GenAPI our reference assembly source generation logic stopped working.
Turns out the new NuGet package targets relies on singular spelling to insert itself after PrepareForRun:
Update our spelling to singular everywhere now that we're using the new package.