从其他应用程序调试 C# 代码
我正在从 QTP 加载 dll (c#)。 qtp测试开始时是否可以调试c#代码。
I'm loading a dll (c#) from QTP. Is it possible to debug the c# code when the qtp test starts.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,您可以调试 dll,但是您将需要源代码(除非您想查看反汇编),并且您还需要程序集的 PDB(调试符号)。设置非常简单...
注意:如果未命中断点,VS可能找不到 PDB,您需要在 VS 的选项中添加路径(或其他内容以便它可以找到它们)。
另外,如果“工具”->“选项”->“调试”选项页面中的“仅启用我的代码”仍然无法正常工作,请尝试关闭它(主要是如果您正在查看发布构建的代码)。
更新:回答评论...如果您转到“工具”->“选项”...选择左侧列表中的“调试”并展开它,然后选择“符号”,您可以在其中添加路径让 VS 搜索符号。另外,如果您没有确切的符号,您可以右键单击断点并选择位置,然后选中允许符号不同步的选项。
希望这有帮助!
Yes you can debug into the dll's you can, but you will need source (unless you want to look at the disassembly) and you will also need the PDBs (debug symbols) for the assembly. It is pretty easy to setup...
NOTE: if the breakpoint is not hit, VS probably can't find the PDB's and you either need to add a path in options in VS (or something so it can find them).
Also, try turning off "Enable just my code" in the Tools->Options->Debugging options page if it is still not working (mostly if you are looking at release built code).
Update: Answering comment... If you go to Tools->Options... Select "Debugging" on the list on the left and expand that, then select "Symbols" you can add paths there for VS to search for symbols. Also, if you don't have the exact symbols you can right-click the breakpoint and select location and check the option that will allow the symbols to be out of sync.
Hope this helps!
您可以插入对 Debugger.Break() 的调用并运行外部应用程序,当到达断点时,Windows 将提供您调试异常的功能。
选择调试将使您能够在 Visual Studio 中中断后运行代码,并在代码中设置断点。
如果您使用的是 Vista/Win7,您可能需要启用调试 - 请查看 这篇文章 了解如何操作。
You can insert a call to
Debugger.Break()
and run the external application, when the break point will be reached Windows will offer you to debug the exception.Choosing debug will enable you to run the code after the break inside Visual Studio and set break points inside your code.
In case you're using Vista/Win7 you might need to enable debugging - have a look at this post to learn how.