Beware: Watch Window creates threading problem when debugging

I just came across a problem debugging a windows .net app that I have never seen before. I would hit my break point and then I did not have control of the app to step to the next line. After about 10 seconds control came back. If I tried to view a value in the Quick Watch window most of the values just had “error: cannot obtain value” in them. When I pushed the debugger and just kept trying to step through I eventually received a Threading Exception with the message “thread was being stopped”. Naturally I googled to see if I could figure this out – but google did not return anything for this phrase.  Eventually I came across this sample chapter from John Robbin’s Debugging Microsoft .NET book, searched on the word “obtain” and before I actually read anything, the phrase “watch window” popped out at me. So I went back to my app, deleted the contents of the watch window which were hanging around from many previous debugging sessions, and voila, the problem was gone. I’ll have to go back and read that chapter at some point!!

  Sign up for my newsletter so you don't miss my conference & Pluralsight course announcements!  

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.