核心 .NET 运行时中的断点?

发布于 2024-07-04 19:27:46 字数 474 浏览 6 评论 0原文

我有一个在内部构造和使用 SqlConnection 类的第三方库。 我可以从该类继承,但它有大量重载,到目前为止我一直无法找到合适的重载。 我想要的是将参数添加到正在使用的连接字符串中。

有没有办法让我在 .NET 库核心本身中设置断点? 特别是在 SqlConnection 类的构造函数中,以便我可以查看堆栈跟踪并了解它实际上是在哪里构造的?

除此之外,我还有其他方法可以做到这一点吗?

具体来说,我想要做的是添加应用程序名称参数,以便在查看连接时在服务器上更容易识别我们的应用程序。


编辑:嗯,看来我需要更多帮助。 我想我已经启用了与符号服务器支持相关的所有内容,并且我注意到我配置的目录已填满包含 .pdb 文件的目录。 尽管如此,我仍无法获得 SqlConnection 类的实际源代码。

有没有一些明确的指南来指导如何成功地做到这一点?

I have a third party library that internally constructs and uses the SqlConnection class. I can inherit from the class, but it has a ton of overloads, and so far I have been unable to find the right one. What I'd like is to tack on a parameter to the connection string being used.

Is there a way for me to put a breakpoint in the .NET library core itself? Specifically in the constructors of the SqlConnection class, so that I can look at the stack trace and see where it is actually being constructed?

Barring that, is there some other way I can do this?

Specifically, what I want to do is to tack on the Application Name parameter, so that our application is more easily identified on the server when looking at connections.


Edit: Well, it appears I need more help. I think I've enabled everything related to symbol server support, and I've noticed that the directory I configured has filled up with directories that contain .pdb files. Still, I can't get the actual source to the SqlConnection class to become available.

Is there some definite guide to how to do this successfully?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

娜些时光,永不杰束 2024-07-11 19:27:46

如果您无法使用 Microsoft 提供的 .Net Framework 源代码进行源代码级调试,您可以尝试其他调试器。 就像 mdbg 甚至 Windbg 一样。

编辑

详细解释了获取.Net框架的已发布部分以及如何设置断点。 NetMassDownloader 将在一次下载中为您提供所有内容(pdb 和源代码)。 但并非.Net框架的所有源代码都可用。 如果你的 SqlConnection 不是,你总是可以使用 IL 调试器,就像我提到的那样。 并且不要忘记 Lutz 的 Reflector 可以让您查看源代码。

And if you can't use source level debugging with the .Net framework source code Microsoft supplied, you could try a different debugger. Like mdbg or even windbg.

edit

This explains getting the released parts of .Net framework and how to set breakpoints in great detail. The NetMassDownloader will give you everything (pdb and source) in one download. But not all source code of the .Net framework is available. If your SqlConnection is not you can always use IL debuggers like the ones I mentioned. And don't forget Lutz's Reflector to give you a look at the source code anyway.

他不在意 2024-07-11 19:27:46

好的,如果您想要明确的指南,这里是:

配置 Visual Studio 来调试 .NET Framework 源代码

如果您需要帮助,请继续告诉用户您执行了哪些步骤?

OK, if you want definitive guide, here it is:

Configuring Visual Studio to Debug .NET Framework Source Code

If you want some help, go ahead and tell use which steps did you perform?

狼亦尘 2024-07-11 19:27:46

虽然源调试肯定更好,但您不需要 VS 调试器的 pdb 或源来为所需的函数设置 bp。

确保转到“工具/选项/调试器”并关闭名为“Just My Code”的选项。 由于框架不是“您的代码”,调试器无助地阻止您在那里设置断点。

接下来,您需要元数据中显示的方法的全名。 这包括它嵌套的任何命名空间。如果您需要查找名称,我建议使用 ILDasm 或 Reflector。

在断点窗口的左上角有一个“new bp”菜单按钮。 选择之一是在函数名称上设置 bp。 当对话框出现时,取消选中让智能感知检查名称,因为您没有项目。 我希望这有帮助。

While source debugging is defintely better, you don't need pdbs or source for the VS debugger to set a bp on the function you want.

Make sure you go to Tools/Options/Debugger and turn off the option called "Just My Code". Since the framework is not 'your code' the debugger unhelpfully prevents you from setting breakpoints there.

Next you need the full name of the method as it appears in the metadata. This includes any namespaces it is nested in. I'd recommend ILDasm or Reflector if you need to find the name.

On the breakpoints window in the upper left corner is a "new bp" menu button. One of the choices is to set a bp on function name. When the dialog comes up uncheck having intellisense check the name since you don't have a project. I hope that helps.

メ斷腸人バ 2024-07-11 19:27:46

根据这篇文章,您可以下载.NET框架的源代码,然后使用Visual Studio进行调试:

http://weblogs.asp.net/scottgu/archive/2007/10/03/releasing-the-source -代码

According to this article you can download the source code for the .NET framework and then debug it using visual studio:

http://weblogs.asp.net/scottgu/archive/2007/10/03/releasing-the-source-code

陌路黄昏 2024-07-11 19:27:46

我差点忘了提及 Deblector - 它是一个 Reflector 插件,允许您调试几乎任何 .net 应用程序没有源代码:)

I almost forgot to mention Deblector - it's a Reflector plugin, that allows you to debug almost any .net app without source codes :)

人生戏 2024-07-11 19:27:46

您可以 下载.NET源代码并在.NET固件源代码中设置断点。

您可以使用 NetMassDownloader 快速获取 .NET 源。

You can download .NET source code and set break point right in .NET FW source code.

You can use NetMassDownloader to grab .NET sources quickly.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文