你可以调试一个.NET应用程序,只有一个文件的源代码? [英] Can you debug a .NET app with ONLY the source code of one file?

查看:116
本文介绍了你可以调试一个.NET应用程序,只有一个文件的源代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Visual Studio中调试一个应用程序,但是我只有一个源代码。我只需要在该文件中单独执行一个功能,但是我不明白我需要做什么。我认为步骤通常是这样的:


  1. 在VS中打开一个文件

  2. 加载符号(.PDB文件)

  3. 附加到正在运行的过程

我知道如何做#1和#3,但我不怎么做#2没有.PDB文件。是否可以生成.PDB文件以使其工作?谢谢!

解决方案

您需要* .pdb文件(您的帖子中的第2步)这些文件包含源代码和编译程序集之间的映射。所以你的步骤是正确的。如果您的源文件与原始文件有差异,请在BP属性对话框中设置复选标记允许源代码与原始版本不同。



Visual Studio中的断点和跟踪点



如果您没有PDB文件,您可以尝试使用 Reflector.FileDisassembler 来反编译项目或 FileGenerator For Reflector 。他们可以重新编译这些文件以获取PDB



另外,请查看 Deblector - 为Reflector调试插件。


I want to debug an application in Visual Studio but I ONLY have the source code for 1 class. I only need to step through a single function in that file, but I don't understand what I need to do it. I think the steps are normally something like this:

  1. Open a file in VS
  2. Load in the "symbols" (.PDB file)
  3. Attach to the running process

I know how to do #1 and #3, but I don't how to do #2 without the .PDB file. Is it possible to generate the .PDB file for this to make it work? Thanks!

解决方案

You need *.pdb files (step 2 from your post) These files contain mapping between source code and compiled assembly. So your step are correct. If your source file has differences with original file, set check mark "Allow the source code to be different from the original version" in BP's properties dialog.

Breakpoints and Tracepoints in Visual Studio

If you don't have PDB files you can try to decompile your project using Reflector.FileDisassembler or FileGenerator For Reflector. They you can recompile these files to get PDBs

Also take a look at Deblector - debugging addin for Reflector.

这篇关于你可以调试一个.NET应用程序,只有一个文件的源代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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