I am creating an GUI using winforms in C#, all the controls have numerous events. I would like to know which of these events are being fired and when. One way would be to put debug statements on each of the event handlers but that would require too much work. Is there any way of doing this in Visual Studio 2008/2010 or are there any tools that can help?
views:
62answers:
4You could write a logging class that subscribes to these events and write the event plus the time stamp into a log file.
It still requires that you write some code, but it's independent of your production code and shouldn't affect it any way.
If you don't mind some information overload, you could use Spy++ (\Common7\Tools\Spyxx.exe) to see all the windows messages generated by the application.
Some of the window messages translates more or less directly to .net events...
Managed Spy has possibility to log all events of chosen control. See this article where you can read about this tool and download it.
Runtime Flow with the monitoring filter "Module == System.Windows.Forms.dll && Function == On*" will show what events are firing for all winforms controls.