Skip to content
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

GenAPI doesn't generate private fields correctly #3891

Closed
safern opened this issue Sep 6, 2019 · 0 comments · Fixed by #3912
Closed

GenAPI doesn't generate private fields correctly #3891

safern opened this issue Sep 6, 2019 · 0 comments · Fixed by #3912
Assignees
Labels
area-Infrastructure-libraries Area maintained by .NET libraries team: APICompat, AsmDiff, GenAPI, GenFacades, PkgProj, etc

Comments

@safern
Copy link
Member

safern commented Sep 6, 2019

GenAPI should follow the struct layout rules as follow:

  1. If there is a reference type field in the struct or within the fields' type closure, it should emit a reference type and a value type dummy field.

    The reference type dummy field is needed in order to inform the compiler to block taking
    pointers to this struct because the GC will not track updating those references

    The value type dummy field is needed in order for the compiler to error correctly on definite
    assignment checks in all scenarios. Currently if the strict flag is not passed and the value type
    dummy field is missing, it will not error when trying to use the referenced unassigned struct. [Strict] Do not ignore private reference fields of structs for definite assignment roslyn#30194

  2. If there are no reference type fields, but there are value type fields in the struct field closure, and at least one of these fields is a nonempty struct, then we should emit a value type dummy field.

  3. If the type is generic, then for every type parameter of the type, if there are any private or internal fields that are or contain any members whose type is that type parameter, we add a direct private field of that type.

cc: @ahsonkhan @ericstj

@safern safern self-assigned this Sep 6, 2019
@ericstj ericstj added the area-Infrastructure-libraries Area maintained by .NET libraries team: APICompat, AsmDiff, GenAPI, GenFacades, PkgProj, etc label Mar 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Infrastructure-libraries Area maintained by .NET libraries team: APICompat, AsmDiff, GenAPI, GenFacades, PkgProj, etc
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants