Results 1 to 2 of 2

Thread: breakpointing a separate thread?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Sep 2005
    Posts
    1,547

    breakpointing a separate thread?

    Code:
    void Main()
    {
        Thread t = new Thread(Test);
        t.Start();
    }
    
    void Test()
    {
        int i = 0;
        i++;
        i++;
    }
    If I put a breakpoint inside of "Test", when it breaks it freezes VS2005 for 5-10 seconds and then when I try stepping over it just resumes the thread.

    Does anyone else have this problem? I also tried VS2008.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: breakpointing a separate thread?

    Just did a quick test in VS 2008 and it worked fine for me.
    Code:
    using System.Threading;
    
    namespace ConsoleApplication1
    {
        class Program
        {
            static void Main()
            {
                Thread t = new Thread(Test);
                t.Start();
            }
    
            static void Test()
            {
                int i = 0;
                i++;
                i++;
            }
        }
    }
    I put a breakpoint on the red line.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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