WinForms app gets messy
We are creating a WinForms based application (using .NET 3.5)
I recently encountered the problem that while executing one of the main workflows of our application, the application becomes unresponsive in a matter of seconds, unable to display the user interface correctly (shows the message "The program is not responding").
We've reduced the issue to a suspicious line of code that adds a tooltip to the label control:
ToolTip tooltip = new ToolTip(); tooltip.SetTooltip(label, "something");
I've spent the last 2 days figuring out that this code can encode any UI thread issues, but failed to do so.
My question is, is it possible to use a performance profiler to collect information about code like this? Note that the ToolTip class is owned by WinForms and I don't have the source code for it.
Removing those lines seems to completely solve the problem. I would like to reduce my debugging effort in the future, as this problem may show up elsewhere in our codebase.
EDIT: The only similar problem I could find was this: WinForm ToolTip.SetToolTip is my application freezing :(
source to share
I have the same problem, except that I am using a ToolTip object placed with the constructor and then in the ToolTip popup I am setting the text for the tooltip.
The problem only occurs on Windows 7 64-bit (I have no way to test Win7 32-bit), on Windows XP 32-bit this works fine.
edit: I am assuming that the popup event was called again because when I moved the tolltip parameter elsewhere in my code, it works fine.
source to share