I'm a former VB programmer now leaning some C#, and I've noticed that when I step through my code using F11 (Step into) the debug trace does follow the actually executed code all the time, for instance:
private void SetCheck(TreeNode node, bool check)
{
// find all the child nodes from this node
foreach (TreeNode n in node.Nodes)
{
n.Checked = check; // check the node - recursive call back to AfterCheck
}
}
If I click on the Root node and place a break at n.Checked = check and then step through, the stepping never goes to the AfterCheck delegate, but it executes the code as verified by the MessageBox ... ... is there an issue with Debug in .NET 2003 - or am I doing something wrong... I'm very perplexed as VS6 never did this. :S
Did you create the Eventhandler for the Aftercheck Event?
Code:
this.treeView1.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.treeView1_AfterCheck);
"so just keep in mind that fantasy is not the same as realtiy and make sure u remember that wii sports may be fun but u cant count on it as exercise ok cool bye" - HungarianHuman
It is probably because a delegate is a method instance and so you are not actually executing the method itself, but an instance of it. Logical, but it should step through it anyway. VC# 2005 (Express) does, so it may have been an issue with 2003 that was fixed in '05.
If you're right, it's a very big issue as far as debugging is concerned. :S It's still an executed area of code whether it be part of an instance or class.