-
Notifications
You must be signed in to change notification settings - Fork 128
Description
This a blanket issue for analyzing compiler generated code, like async/iterator state machines and nested functions (lambdas, local functions).
The first task is to design the expected user behavior. For instance, if you call a method annotated with RequiresUnreferencedCode in a local function, does placing RequiresUnreferencedCode on the containing method suppress the warning? Or do you need to place RequiresUnreferencedCode on the local function? The C# compiler is somewhat inconsistent about requirements here -- if you place unsafe on a method, the local function is considered unsafe as well. However, if you use await in a local function, making the parent method async is not sufficient; the local function must also be declared async.
It's up to us to decide the expected user experience.
For data flow analysis, we need to decide if the user experience should be closer to the source code representation, or to the behavior between methods. The linker doesn't normally do interprocedural analysis, and neither does the C# compiler, but for local functions C# does do interprocedural flow analysis for definite assignment. If we want the experience of captured variables to be closer to the experience of local variables, we likely need to do interprocedural analysis. If we think the experience of fields is sufficient, then we don't.
Once we decide on a user experience then need to examine technical requirements: do we think that attributes can be propagated automatically? Or do we want to try to rebuild some of the knowledge of source code from the IL? If we do need to rebuild some knowledge of source code, is there something we need or want from the C# compiler?
We also need to plan what's necessary for 6.0 vs later. We may want a short and long term solution.
Metadata
Metadata
Labels
Type
Projects
Status