如何在 Visual Studio 2010 中调试筛选器程序?
我正在尝试调试作为 C# 控制台应用程序编写的 filter 程序。该程序的用法类似于(从cmd.exe
执行):
C:\MyDir\>type inputfile.txt | myfilter.exe
我已经尝试了显而易见的方法:附加到cmd.exe
进程并在我的 Main
函数。软件运行,符号未加载,调试器未闯入,开发人员不高兴。
在项目属性中的调试
下,可以设置命令行参数。我没有令人讨厌的命令行参数。我想要一个文件通过管道输入到 STDIN
。这有多难?
I'm trying to debug a filter program written as a C# console application. The usage of the program would be something like (executed from cmd.exe
):
C:\MyDir\>type inputfile.txt | myfilter.exe
I have tried the obvious: Attach to the cmd.exe
process and set a break point in my Main
function. Software runs, Symbols aren't loaded, Debugger doesn't break into, Developer unhappy.
In the project properties, under Debug
, it is possible to set Command line arguments. I don't have no stinking command line arguments. I want to have a file piped in to STDIN
. How hard can that be?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
没关系,我今天只是不思考...
您只需向您的
Main
方法添加一个Debugger.Launch()
调用即可:Windows 会很好并让你调试你的程序。我知道这一点 - 这是如何在安装项目中调试自定义操作......
Nevermind, I'm just not thinking today...
You just need to add a
Debugger.Launch()
call to yourMain
method:And Windows will be nice and let you debug your program. I knew this - this is how to debug custom actions in setup projects...
您需要附加到 myfilter.exe,它是从命令行启动的这一事实并不重要。但是,如果您在 Visual Studio 中打开该项目,您只需开始调试,它就会自动附加。是的,您可以传入命令行参数,或者使用相关参数启动 exe,然后附加或直接从 Visual Studio 转到控制台应用程序项目属性,在调试部分有一个命令行参数框。
You need to attach to myfilter.exe, the fact that it is launched from the command line is not important. However if you have the project open in visual studio you just start debugging and it will attach automatically. Yes you can pass in command line arguments, either start the exe with the relevant arguments and then atatch or do it straight from visual studio go to the console application project properties and there is a command line arguments box in the debug section.