views:

266

answers:

4

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.

A: 

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.

nbolton
@Nick Bolton - Nope ... app is not multi-threaded. Thanks!!
Scott Vercuski
+1  A: 

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.

John MacIntyre
A: 

Why not use a logging tool like log4net?

Si
+2  A: 

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.

JeffH
@JeffH - Thank you ! Spy++ allowed me to see an event infinite loop that was being called that I didn't realize was in place.
Scott Vercuski
I'm glad it got you what you needed!
JeffH
Just tried Managed Spy, that tool works great too! And it's a little more user-friendly and .NET-oriented than Spy++, which is nice.
Andy White