Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我知道如何让 Visual Studio 中断异常,并且只中断某些类型的异常。我也已经知道“只有我的代码”
有没有办法将其配置为仅在某些代码块(块或特定类/函数内?)可能是某种编译指示指令?
注意:这是关于打破例外。不是断点
您可以右键单击断点并设置条件。例如,如果我想设置一个函数在调用者方法是 Main 时停止的条件,您可以使用:
new StackFrame(1, true).GetMethod().Name == "Main"
根据您希望断点停止的特定条件,您可以使用它。