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 then debug through break point.

On 2/17/09, Nacho108 <[email protected]> wrote:
>
> Hi everyone,
>
> I'm starting to use threading in 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 to debug where 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
> people debug programs with threading. Is there a "standard" way of
> doing this? is there a better way to do this?
>
> Thanks !
>
>
>

Reply via email to