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

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

问题描述

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

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.)

推荐答案

单击调试,Windows,断点,单击新建,断开功能,输入 System.Threading.SynchronizationContext.SetSynchronizationContext ,然后单击确定。

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.

由Ian Ringrose编辑

Edit by Ian Ringrose

我也必须关闭调试配置中的启用我的代码设置。

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天全站免登陆