[英]Visual Studio: Real time method call trace?
This is what I'm looking for: I'd like to be able to get a real time method call listing when I am debugging my program. 这就是我要寻找的:在调试程序时,我希望能够获得实时方法调用清单。 So for example, say I run my program via the debugger if I press a button or do anything in my program I'd like for it to spit out, say on a visual studio plugin, in real time, all the methods it went through when I pressed this button or did some kind of user action with my program. 例如,假设我按下某个按钮或在程序中执行任何我想让其吐出的程序(例如,在Visual Studio插件上实时运行),则通过调试器运行我的程序,当我按下此按钮或对程序执行某种用户操作时。
I actually once wrote a visual studio plugin that does that by using the visual studio profiler api (I had to write a c++ com server dll that receives this information and pipes it back into my c# plugin). 实际上,我曾经编写了一个Visual Studio插件,该插件通过使用Visual Studio Profiler api来做到这一点(我必须编写一个c ++ com服务器dll来接收此信息,并将其通过管道传送回我的c#插件中)。 I did this a few years back and I have no idea where I put it. 几年前我做了这个,我不知道该放在哪里。 But I'm wondering if Microsoft did something like this in visual studio 2010 or if you know of any third party plugins like this because it is a very handy debugging utility. 但是我想知道微软是否在Visual Studio 2010中做了类似的事情,或者您是否知道这样的第三方插件,因为它是一个非常方便的调试实用程序。
Thanks 谢谢
查看Visual Studio 2010的Intellitrace功能-它可能为您提供所需的东西: http : //msdn.microsoft.com/zh-cn/library/dd264915.aspx
您应该在Visual Studio 2010中检查IntelliTrace调试。尽管它仅适用于x86
它不是免费的,甚至也不便宜,但是RedGate的ANTS Performance Profiler可以提供这些数据以及更多数据。
I think you could achieve that using AOP, eg PostSharp and an implementation of it's OnMethodBoundaryAspect and a MultiCastAttribute to apply your aspect to every method of your program. 我认为您可以使用AOP(例如PostSharp)及其OnMethodBoundaryAspect和MultiCastAttribute的实现将其方面应用到程序的每个方法来实现。 They even have an example for something quite similar to what you want on their site. 他们甚至提供了一个与您所希望的网站非常相似的示例 。
Updated link as of 8/15/2018: IntelliTrace 截至2018年8月15日更新的链接: IntelliTrace
Note that this feature is in Enterprise edition only 请注意,此功能仅在企业版中
From the linked page: 从链接页面:
You can spend less time debugging your application when you use IntelliTrace to record and trace your code's execution history. 使用IntelliTrace记录和跟踪代码的执行历史记录时,可以花更少的时间调试应用程序。 You can find bugs easily because IntelliTrace lets you: 您可以轻松发现错误,因为IntelliTrace可以让您:
Record specific events 记录特定事件
Examine related code, data that appears in the Locals window during debugger events, and function call information 检查相关代码,调试器事件期间在“本地”窗口中显示的数据以及函数调用信息
Debug errors that are hard to reproduce or that happen in deployment 调试难以重现或在部署中发生的错误
You can use IntelliTrace in Visual Studio Enterprise edition (but not the Professional or Community editions) . 您可以在Visual Studio Enterprise版本(而不是Professional版本或Community版本)中使用IntelliTrace 。
My Runtime Flow extension shows method call listing when you press a button or do anything in a program. 当您按下按钮或在程序中执行任何操作时,“我的运行时流程”扩展程序将显示方法调用清单。 It works outside Visual Studio debugger. 它可以在Visual Studio调试器之外运行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.