question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Request for debug team - always stepping in to a call

See original GitHub issue

I’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:open
  • Created a year ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Happypig375commented, Jun 22, 2022

@vzarytovskii How did you input that image ? I tried typing > Note as suggested in the “Quote reply” but it does not display like that.

Note

Edit: Thanks @baronfel for replying through Discord that > **Note** and > **Warning** now have new formats. https://github.com/orgs/github-community/discussions/16925

Note

Warning

Question resolved.

0reactions
gregg-miskellycommented, Jun 22, 2022

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 solve cancelable in particular but any of these cases were the compiler emits a call to some sort of Invoke 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?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Stepping in C++ debugger with moderately deep call stack ...
When stepping in the debugger in our team's code base, next takes several seconds. I'm able to reproduce with a trivial project where...
Read more >
IntelliJ debugger gets stuck - java
I'm debugging a normal Java application, no GUI, just a lot of computations and ~5 calls in the stack for the main thread...
Read more >
Debugging best practices for REST API consumers
For API consumers, debugging means identifying and fixing issues with a single API call or sequence of calls.
Read more >
JavaScript debugging reference - Chrome Developers
Discover new debugging workflows in this comprehensive reference of Chrome DevTools debugging features.
Read more >
General, Debugging, Options Dialog Box - Visual Studio ...
Set Visual Studio debugger options to meet your debugging needs. You can configure break behavior, debugging levels, display behavior, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found