-
Notifications
You must be signed in to change notification settings - Fork 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
Compiler emits incorrect EnC closure data to PDB for nested switch expressions #37232
Closed
Tracked by
#43099
Comments
tmat
added a commit
to tmat/roslyn
that referenced
this issue
Jul 15, 2019
Update calculation of syntax offset to account for a new case when a node (a switch expression) that is associated with a variable, closure or lambda may share start offset with other node of the same kind (`expr switch { … } switch { … }`). Use the offset of the `switch` keyword instead of the starting offset of the expression to disambiguate. Assign ordinals to variables synthesized for storing pattern values across cases. This is required to support complex patterns since we can no longer rely on the type of these variables to be distinct. This will require follow up in the IDE to disallow updating/adding/reordering the case clauses of switch expression which there an active statement is present within the switch statement. If the cases are unmodified the compiler guarantees that the order in which the synthesized variables are generated remains the same, so we can map the variables using their ordinal. Mark all variables synthesized during lowering of switch expression as short-lived. Their lifespan is limited to the switch expression, which does not include a sequence point. Disallow editing methods that contain switch expression. This is necessary until bugs dotnet#37232, dotnet#37237 are fixed.
tmat
added a commit
that referenced
this issue
Jul 16, 2019
* Fix EnC debug information emitted for patterns Update calculation of syntax offset to account for a new case when a node (a switch expression) that is associated with a variable, closure or lambda may share start offset with other node of the same kind (`expr switch { … } switch { … }`). Use the offset of the `switch` keyword instead of the starting offset of the expression to disambiguate. Assign ordinals to variables synthesized for storing pattern values across cases. This is required to support complex patterns since we can no longer rely on the type of these variables to be distinct. This will require follow up in the IDE to disallow updating/adding/reordering the case clauses of switch expression which there an active statement is present within the switch statement. If the cases are unmodified the compiler guarantees that the order in which the synthesized variables are generated remains the same, so we can map the variables using their ordinal. Mark all variables synthesized during lowering of switch expression as short-lived. Their lifespan is limited to the switch expression, which does not include a sequence point. Disallow editing methods that contain switch expression. This is necessary until bugs #37232, #37237 are fixed. * Feedback * Update tests
8 tasks
gafter
added a commit
to gafter/roslyn
that referenced
this issue
Aug 21, 2019
…ion instruction in expression context Fixes dotnet#37237 Compiler emits incorrect EnC closure data to PDB for nested switch expressions Fixes dotnet#37232 Expression bodied method whose expression is a switch expression is missing debug info Fixes dotnet#37261
5 tasks
This issue was closed.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A display class is emitted for each switch expression:
pdb2xml
output:The
offset
attribute ofclosure
identifies the syntax node that's associated with the closure. This offset must be unique, but in this case the compiler emits the same value - the offset of the outer switch expression node.The lowering creates a spill sequence with locals defined in the switch expression. The spill sequence node is correctly associated with the switch expression syntax at this point.
Later on
SpillSequenceSpiller.VisitSpillSequence
takes these locals and puts them inBoundSpillSequenceBuilder
. Finally,SpillSequenceSpiller.UpdateStatement
creates a newBoundBlock
with these locals. TheBoundBlock
is however no longer associated with the right switch expression syntax node.See test See test
PDBTests.Patterns_SwitchExpression_Closures
.The text was updated successfully, but these errors were encountered: