如何在 .net 框架内的方法上设置断点 [英] How to set a breakpoint on a method within the .net framework

查看:25
本文介绍了如何在 .net 框架内的方法上设置断点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望在 System.Threading 上设置断点.SynchronizationContext::SetSynchronizationContext 静态方法,以便我可以找出何时设置同步上下文.

I wish to set a breakpoint on the System.Threading.SynchronizationContext::SetSynchronizationContext static method so I can find out when the synchronization context is being set.

但是我找不到如何在没有源代码的方法中设置断点.

However I can’t find how to set a breakpoint in a method I don’t have the source code to.

(这应该很容易!,但是当我尝试在断点窗口中的方法上设置断点时,它确实识别了该方法.)

(This should be easy!, but when I try to set the breakpoint on a method from the breakpoints window it does recognise the method.)

推荐答案

点击Debug、Windows、Breakpoints,点击New、Break at function,输入System.Threading.SynchronizationContext.SetSynchronizationContext,点击OK.

Click Debug, Windows, Breakpoints, click New, Break at function, enter System.Threading.SynchronizationContext.SetSynchronizationContext, and click OK.

它会给你一个警告,你应该忽略它.我试过了,确实有效.

It will give you a warning, which you should ignore. I tried it, and it does work.

伊恩·林罗斯编辑

我还必须关闭调试配置中的仅启用我的代码"设置.

I also had to turn off the "Enable Just My Code" setting in the Debugging configuration.

启动 Visual Studio 2008 并打开工具">选项">调试">常规".如果您在 Visual Basic 配置文件下运行,则需要在继续之前选中选项对话框左下方标记为显示所有设置"的框(其他配置文件没有此选项).设置以下设置:关闭仅启用我的代码"设置

这篇关于如何在 .net 框架内的方法上设置断点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆