I have a winform application. Every few seconds I check some log files, read in any new data and insert any new data into a DB.
When I run the application for around an hour 1/2, I get a StackOverflowException
. There was no new data in the log files for that entire period, so nothing new was added to the DB.
The code errored here...
if (pictureBox == null)
{
continue;
}
if (pictureBox.InvokeRequired)
{
var toolTip = new ToolTip();
GameServer tempGameFile = gameServer;
pictureBox.Invoke(new MethodInvoker(
() => toolTip.SetToolTip(pictureBox,
string.Format(
"{0} : Last Checked: {1}; Last Updated: {2}",
tempGameFile.Name,
tempGameFile.CheckedOn.ToLongTimeString(),
tempGameFile.UpdatedOn.HasValue
?
tempGameFile.UpdatedOn.Value.ToLongTimeString()
: "-No Date Set-"))));
}
pictureBox.Image = Resources.RedButton;
and the pictureBox.Invoke(..)
is throwing that error.
So .. i'm not sure how I can bebug this to figure out what is going on? Any suggestions?
UPDATE
Trying the suggestions of Dmitry I've started an ANTS profiler memory profile .. and having a quick look at things .. there seems to be a lot of instances of ToolTip controls.
This is a class list summary after 20 mins.
Lots of EventHandlers (am I not releasing something?)
And there's a few ToolTips also...
Here is a screenshot of all the instances and here is a screenshot of a single ToolTip control graph/map .. which I don't know how to read blush