Software to monitor events fired from code

怎甘沉沦 提交于 2019-12-12 17:16:04

问题


I'm having trouble within a block of code that I believe is related to a mouse click event but I cannot seem to capture the exact event within my code. I've used the C# debugger to step through my code and after the end of one of my events the code simply locks up.

The purpose of my post is to ask if there is any software that will watch my process and let me know the events that are firing off after I hit the F11 key and the code freezes up. I've tried SysInternals' procmon.exe but that isn't telling me which events are firing off.


回答1:


Have you tried Spy++ ? It's a tool that comes with Visual Studio (at least 2003 & 2005). On my default 2003 and 2005 installs, Spy++ is at: Start | Program Files | Microsoft Visual Studio 200X | Visual Studio Tools | Spy++

After you run Spy++, select Find Window... from the Search menu. Drag the "Finder Tool" to the window or control you want to watch events on and click OK. Right-click on the item selected in the tree and select "Messages". This will bring up a window that shows the messages as they hit your window of interest.

If Spy++ doesn't get what you need, what about Managed Spy? It appears to be like Spy++ but specifically for managed code. I haven't tried it.

[It] displays a treeview of controls in your .NET-based client application. You can select any control and get or set any property on it. You can also log a filtered set of events that the control raises.




回答2:


Are you using multi-threading? If so, try to avoid passing controls and other Windows Forms objects out side of the forms thread, as the debugger will try to access the object's value, which will cause the debugger to freeze for some time.




回答3:


CLRProfiler might do what you want.

The tool overview states

The CLR Profiler includes a number of very useful views of the allocation profile, including a histogram of allocated types, allocation and call graphs, a time line showing GCs of various generations and the resulting state of the managed heap after those collections, and a call tree showing per-method allocations and assembly loads.

The memory use is really sold in this description, but it does mention the 'call tree', and this link on how to use it, mentions

Call Tree View Provides a text-based, chronological, hierarchical view of your application's execution.

Good luck.




回答4:


Why not use a logging tool like log4net?



来源:https://stackoverflow.com/questions/663489/software-to-monitor-events-fired-from-code

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!