Request for debug team - always stepping in to a call
See original GitHub issueI’ve been looking at debugging issues for computation expressions as part of #13339 . It’s ultimately a request for the .NET debugger team but I’ll write it up here first. cc @gregg-miskelly who the .NET team suggested as a contact in the Visual Studio debugger.
I believe we should look into a new attribute DebuggerStepIntoAttribute (or something similar) to partner DebuggerStepThroughAttribute, where putting the new attribute on a method has the effect of changing a F10 “Step Over” into a “Step Into”.
This would have use in debugging for F# computation expressions, for expressing the “calling the continuation that gives the rest of the computation” part of a bind operation. It would also have many other uses in F# code, where “the rest of the method” is sometimes compiled as a separate method (this is an optimization F# sometimes performs for large methods).
We actually also need this to somehow apply to an indirect call. For example, the typical situation is that
let f() =
cancellable {
print "hello"
let! res1 = SomeOtherCancellable() <--- F10 Step Over here
print "world"
}
From the user’s point of view the sequence points are:
let f() =
cancellable {
// Sequence Point 1
print "hello"
// Sequence Point 2 <--- F10 Step Over here
let! res1 = SomeOtherCancellable()
// Sequence Point 3
print "world"
}
And “Step Over” should go through these three sequence points. However the code gets compiled as follows - each chunk becomes a function that gets called, and these are then stitched together.
let f() =
cancellable.Delay(fun () ->
print "hello"
cancellable.Bind( SomeOtherCancellable(), fun() ->
print "world"
)
)
After inlining and some flattening of cancellable.Bind
becomes
let f() =
Cancellable(fun ct ->
// Sequence Point 1
print "hello"
// Sequence Point 2
let computation1 = SomeOtherCancellable()
let res1 = computation1.Invoke(ct)
let computation2 =
Cancellable(fun ct ->
// Sequence Point 3
print "world")
computation2.Invoke(ct) <--- need to step into here to reach Sequence Point 3
)
The effect we want is that a Step Over at Sequence Point 2 would step over al the invocations and then actially Step Into computation2.Invoke(ct)
. Exactly how we achieve that I’m not sure. Somehow we need to mark that call as “always step into”.
Issue Analytics
- State:
- Created a year ago
- Comments:6 (4 by maintainers)
Top GitHub Comments
@vzarytovskii How did you input that ? I tried typing
> Note
as suggested in the “Quote reply” but it does not display like that.Edit: Thanks @baronfel for replying through Discord that
> **Note**
and> **Warning**
now have new formats. https://github.com/orgs/github-community/discussions/16925Question resolved.
Let me check my understanding of what was said about the
cancellable
example: My understanding is that this is an example of using the computation expression feature, and we aren’t trying to solvecancelable
in particular but any of these cases were the compiler emits a call to some sort ofInvoke
method that will call back into a delegate (or at least the cases where this happens synchronously).Is that right?
For the
match
example: I am assuming this is a more straightforward case where the ‘real’ method is directly calling the ‘outlined’ method?