Search code examples
visual-studio-2010debuggingbreakpointsfluent-interfacemethod-chaining

Is it possible to set a breakpoint in a method chain in VS, and if so how?


Given the code

    [Test]
    public void Test1()
    {
        var a = new A();
        a
            .Method1()
            .Method2();
    }

is it possible to set a breakpoint so that execution pauses after Method1() has executed, but before Method2 without going to the definition of Method2 and putting a breakpoint there? When I do it, the breakpoint appears at the 'a'.


Solution

  • No, the debugger's unit of executable code is a statement. There are only two in the method body in your snippet. Post feature requests to connect.microsoft.com. It's going to be a hard sell, it is not technically impossible but a potentially heavy re-engineering effort.