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

How to perform definite assignment for methods marked SkipLocalsInit #46488

Closed
gafter opened this issue Jul 31, 2020 · 4 comments
Closed

How to perform definite assignment for methods marked SkipLocalsInit #46488

gafter opened this issue Jul 31, 2020 · 4 comments
Assignees
Milestone

Comments

@gafter
Copy link
Member

gafter commented Jul 31, 2020

Methods under the attribute SkipLocalsInit do not clear the frame's locals before running the code.

This interacts poorly with #30194

It has been suggested that for such methods we should run the strong version of definite assignment, treating even private variables in other assemblies as significant.

Once a decision is made about what we should do, this issue should be edited to describe that decision and the compiler should be adjusted to implement it.

@gafter
Copy link
Member Author

gafter commented Sep 1, 2020

The latest decision is recorded in https://github.com/dotnet/csharplang/blob/master/meetings/2020/LDM-2020-07-20.md#private-fields-in-structs-with-skiplocalsinit and requires we run the strong version of analysis when the method is marked SkipLocalsInit.

@gafter gafter removed their assignment Sep 1, 2020
@jaredpar jaredpar modified the milestones: 16.8, 16.9 Oct 12, 2020
@333fred 333fred modified the milestones: 16.9, 16.10 Jan 29, 2021
@jinujoseph jinujoseph modified the milestones: 16.10, 17.0 Jul 16, 2021
@333fred
Copy link
Member

333fred commented Aug 2, 2021

Current behavior has shipped in C# 9 for some time now, we won't be making any more changes.

@333fred 333fred closed this as completed Aug 2, 2021
@gafter
Copy link
Member Author

gafter commented Aug 17, 2021

Are you asserting that the documented behavior is what is implemented?

@333fred
Copy link
Member

333fred commented Aug 17, 2021

No, I'm asserting that we never went and changed it when we first did warning waves, and it would now be a breaking change to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants