Search code examples
c#visual-studiodebuggingbreakpointsvisual-studio-debugging

VS Breakpoint overjump


There is a strange problem I'm stuck with about breaking into code. The structure where this happens for me looks as following:

public partial class TopClass : SomeBaseClass
{
    protected override void ShowDetail(ResultItem resultitem)
    {
        // Trying to break here without success
        string test = "should be able to break here, shouldnt it?";
    }
}


public partial class SomeBaseClass : ...
{
    protected virtual void ExecutionIncomingHere()
    {
        // .. some stuff going on
        ShowDetail(resItem);
    }

    protected virtual void ShowDetail(ResultItem resultitem)
    {   // empty
    }
}

The problem I've got is easier to just show off. Check this:

Breakpoint is set.

VS only breaks inside my base (why ever)

I guess this arrow indicates, that I'm currently inside that method. By why cant I debug inside ShowDetail()? When going for F11 it continues inside the base class. So my TopClass is never entered step-by-step.

I tried searching on google for at least 1 hour without any success. I hope some of you can clear that out.

Appreciate your help, thanks!


Solution

  • It sounds like you have "Optimize code" checked. To remove this go to the properties of you project, then click on the "Build" tab on the left hand side. There you should see the "Optimize code" check box. If this is checked, uncheck it. That should fix your issue.