Primary constructor properties have sequence points but breakpoints can't be placed #63299
Labels
Area-Compilers
Area-Interactive
Interactive-Debugging
Interactive-EnC
New Language Feature - Records
Records
untriaged
Issues and PRs which have not yet been triaged by a lead
Milestone
Currently the emitted metadata/pdb for primary constructors are incompatible with the implementation of several IDE features (breakpoint placement, EnC, code coverage):
A sequence point is emitted for the entire constructor and additional sequence point is emitted for each backing field assignment.
Stepping into
new C(1,2)
makes 3 steps in the constructor:Step 1:
Step 2:
Step 3:
If the record declaration has a body the entire declaration is active, which is odd:
The accessors generated for properties specified in primary constructors have sequence points and are not marked by
[CompilerGenerated]
attribute. When debugging the debugger allows to step into to property accessor and the active statement (yellow span) is displayed over the parameter syntax (note: the user may have stepping into properties disabled:).
This causes code coverage tools to report uncovered code (see https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1567458).
The IDE does not allow placing breakpoints on the syntax of the parameters.
I think we should consider:
This would also fix https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1567458.
[CompilerGenerated]
.Related:
dotnet/csharplang#5999
UPDATE
Current plan:
remove sequence point from init accessor (unnecessary since we have [1] and [4])We keep the sequence points in both accessors. The debugger does not step into properties by default, so unless the user opts into doing so or places explicit breakpoint on the property these sequence points will have no effect.The span for the copy-ctor sequence point would cover the type name, but not parameters (since they are not "in-scope" within copy-ctor).
A breakpoint placed on the type name would bind to both copy and primary ctors.
The text was updated successfully, but these errors were encountered: