Results 1 to 10 of 10

Thread: Stepping through the IDE

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2002
    Posts
    258

    Stepping through the IDE

    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 tvw_source_AfterCheck(object sender, System.Windows.Forms.TreeViewEventArgs e)
    {
    MessageBox.Show(e.Node.ToString());
    SetCheck(e.Node,e.Node.Checked);
    }

    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

    Thanks in advance.

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2002
    Posts
    258

    Re: Stepping through the IDE

    Sorry to be a bore, but is it only me that's experiencing/experienced this?

    I may try and package up the source and attach it so one of you considerate souls can confirm the failure for me.

  3. #3
    Fanatic Member
    Join Date
    May 2005
    Posts
    898

    Re: Stepping through the IDE

    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

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2002
    Posts
    258

    Re: Stepping through the IDE

    Yes. As I said, the code runs... my point is when I single step through it, the stepping doesn't go to the code.

  5. #5
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Stepping through the IDE

    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.

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2002
    Posts
    258

    Re: Stepping through the IDE

    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.

  7. #7
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Stepping through the IDE

    Can you zip and post the project?

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2002
    Posts
    258

    Re: Stepping through the IDE

    Attached, mate.
    Attached Files Attached Files

  9. #9
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Stepping through the IDE

    It steps through the handler fine, but you have to place a breakpoint on the first line. It seems that '03 only steps through the current method.

  10. #10

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2002
    Posts
    258

    Re: Stepping through the IDE

    Ugh!

    Yeah, I noticed it was ok when I put a breakpoint there... but assumed I could step through the whole execution path once broken at a point.

    That's really sucky, especially when dealing with handlers that may not have an immediately identifiable execution path.

    At least it's not just me.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width