从其他应用程序调试到 C# 代码 [英] Debugging into C# code from other application

查看:42
本文介绍了从其他应用程序调试到 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.

推荐答案

是的,您可以调试到 dll 中,但是您需要源代码(除非您想查看反汇编)并且您还需要 PDB(调试符号)用于程序集.设置起来很容易...

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

  1. 启动 QTP 应用程序
  2. 启动视觉工作室
  3. 打开源代码并确保 pdb 与 dll 位于同一目录中
  4. 在 VS 中转到调试菜单并选择附加到进程
  5. 在进程列表中,选择QTP进程并点击附加"
  6. 在代码中设置断点
  7. 开始执行代码的测试,如果一切正常,您应该点击断点

注意:如果断点未命中,VS 可能找不到 PDB,您要么需要在 VS 的选项中添加路径(或其他东西以便它可以找到它们).

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

更新: 回答评论...如果您转到工具->选项...在左侧列表中选择调试"并展开它,然后选择您可以添加的符号"VS 搜索符号的路径.此外,如果您没有确切的符号,您可以右键单击断点并选择位置并选中允许符号不同步的选项.

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.

希望这会有所帮助!

这篇关于从其他应用程序调试到 C# 代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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