You may want to look into using the Threads window (Debug -> Windows - > Threads) for this purpose. Note that it is always helpful to identify the threads in that window, if you actually assign names to them when creating using the Name property.
On Feb 18, 1:32 pm, Nacho108 <[email protected]> wrote: > Thanks for the ansnwer Bhargav, I've actually found a better way of > debugging multi-threading app, which is to have the output window > opened continuously, in that window I can follow all the information > related to the program and there I can see where the exception > actually happened. > Another great way I found is to use the debug class in which you can > print some information the time you need it in this same output > window. > > Maybe all these methods are already know by all users, but for me .. > I'm just starting to know them. > > On Feb 17, 8:21 pm, Bhargav Patel <[email protected]> wrote: > > > > > try catch must have to work im already using it in my threaded application. > > Plz try to print excaption.Tostring method. I thing it will suggest > > the proper line of code and thendebugthrough break point. > > > On 2/17/09, Nacho108 <[email protected]> wrote: > > > > Hi everyone, > > > > I'm starting to usethreadingin order to avoid the interface to > > > freeze whenever I'm accesing the database and for this I'm using the > > > backgroundworker class, which I found very useful at least in this > > > period I'm starting. > > > The problem I'm having is that after I've started to use it , the > > > visual studio is not handling the exceptions normally anymore. With > > > this I'm NOT meaning the try-catch structure inside a program, but the > > > normal debugging feature of visual studio, which stops the program and > > > gives back a window with the exception it arised, for example some bad > > > assignament, a null reference, etc. > > > It ALWASY shows me that the exception is on the same line in the > > > program.cs: > > > > Application.Run(new Form1()); > > > > And the exception is ALWAYS the same: "Exception has been thrown by > > > the target of an invocation." > > > > I was trying to read about this and it seems to be common problem when > > > the exception is not in the main thread, i.e. the windows forms > > > handling thread. But in this case the exception is being made on the > > > RunWorkerCompleted event handler, which belongs to the MAIN thread ... > > > I'm not getting what's going on here. > > > > I want to clarify that I'm able todebugwhere the problem is using > > > another ways like flag variables, counters to see where the program > > > stoped working, etc; but it would be very nice to KNOW how usually > > > peopledebugprograms withthreading. Is there a "standard" way of > > > doing this? is there a better way to do this? > > > > Thanks !- Hide quoted text - > > - Show quoted text -
