Visual Studio Debugger skips over breakpoints

后端 未结 13 2129
耶瑟儿~
耶瑟儿~ 2020-11-30 09:20

My Visual Studio 2008 IDE is behaving in a very bizarre fashion while debugging a unit test: I have a breakpoint and when I hit it and then try to step with F10 the test con

13条回答
  •  没有蜡笔的小新
    2020-11-30 09:45

    Are you putting your breakpoints inside code that is part of a generated class?

    I have experienced this problem on the client site of a service reference. The generated classes are partial classes with the

        [System.Diagnostics.DebuggerStepThroughAttribute()]
    

    attribute applied. Even when my breakpoint was in a different file, but still part of the attributed class, the breakpoint would be skipped.

    I removed that attribute from the generated Reference.cs file and the debugger worked as I expected.

    Of course, this isn't a permanent solution because if the Reference.cs file gets regenerated, the attribute comes back.

提交回复
热议问题