当前在 C# 中跟踪程序流程的可能性?
几年前,我曾使用 Postsharp 在执行期间跟踪程序流程无需手动向方法添加跟踪语句。
是否有其他新方法可以跟踪执行以以类似的方式调试输出?
(最好是一种不需要对构建的组件进行检测的方法。也许不可能?)
I have used Postsharp a few years ago to trace program flow during execution without needing to manually add trace statements to the methods.
Is there any other new ways to trace execution to to debug output in a similar way?
(Preferably a way that doesn't need to instrument the built assemblies. Maybe not possible?)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您只想在调试时使用此功能,可以使用 Microsoft IntelliTrace Visual Studio 2010 Ultimate 的一部分,还有 Sergey Vlasov 的 运行时流程。前者使你的程序运行速度非常慢。没有尝试过后者。
If you only want this ability at debug time, there's Microsoft IntelliTrace that's a part of Visual Studio 2010 Ultimate, and there's Sergey Vlasov's RunTime Flow. The former makes your program run very slow. Haven't tried the latter.
Gibraltar 使用 PostSharp,但为您提供了一个非常强大的客户端来可视化您的程序流程。您还可以比较快照、查看统计信息等。不幸的是它不是免费的:)
此外,大多数依赖注入框架(Unity、Windsor、Ninject 等)都提供方法拦截。在大多数情况下,您可以在 app.config 文件中定义跟踪方法。不过,我更喜欢 PostSharp :)
Gibraltar uses PostSharp, but provides you with a very powerful client for visualizing your program flow. You can also compare snapshots, view statistics, etc.. Unfortunately it's not free :)
Moreover, most dependency injection frameworks (Unity, Windsor, Ninject, ...) provide method interception. In most cases, you can define traced methods within the app.config file. However, I prefer PostSharp :)