473,398 Members | 2,212 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

TargetInvokationException

Hi,
Ive got a multithreaded app, which uses bgWorker.RunWorkerAsync() to run
the 2nd, 3rd, ..., nth threads.

I keep getting exceptions thrown by various parts of the
bgWorker.ProgressChanged event. These errors are probably just because
I've done something silly, but thats not what I'm asking for help with...

When these exceptions occur, why do i get a TargetInvokationException
thrown around Application.Run(new frmMain()); in program.cs?

I can view the innerexception to get some details but its a bit of a pain.

What can i do to make the exception in innerexception be thrown at the
actual location where the error occurs?

I'm not using any try catches.

If you need any more code to help troubleshoot this just say :)
Hope someone can help,

Thanks

Andrew
Apr 16 '06 #1
1 2915
Andrew,

I believe this is because the actuall exception is thrown inside the worker
thread. The exceptions are not marshaled between threads, so in the main
thread you get some exception caused as a side effect of the real one.
Try to try/catch the code that might throw an exception.

Other solution is in debug to set the debuger to stop on exception as soon
as they are thrown. Hopefully it will stop on the line where the first
exception happens. This settings you can find under Debug|Exceptions... menu
in VS
--
HTH
Stoitcho Goutsev (100)

"Andrew Bullock" <an*********************@ANDntlworldTHIS.com> wrote in
message news:ZN******************@newsfe6-win.ntli.net...
Hi,
Ive got a multithreaded app, which uses bgWorker.RunWorkerAsync() to run
the 2nd, 3rd, ..., nth threads.

I keep getting exceptions thrown by various parts of the
bgWorker.ProgressChanged event. These errors are probably just because
I've done something silly, but thats not what I'm asking for help with...

When these exceptions occur, why do i get a TargetInvokationException
thrown around Application.Run(new frmMain()); in program.cs?

I can view the innerexception to get some details but its a bit of a pain.

What can i do to make the exception in innerexception be thrown at the
actual location where the error occurs?

I'm not using any try catches.

If you need any more code to help troubleshoot this just say :)
Hope someone can help,

Thanks

Andrew

Apr 17 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Chuck | last post by:
I used VS C# to create an image list in the form designer. I then used the list in a toolbar control. When I run the app, the ilToolBar.ImageStream line (see code) throws a...
0
by: =?Utf-8?B?aXdkdTE1?= | last post by:
hi, im getting a TargetInvokationException at Aplication.run(new Form1()); this started happening after i created two BackgroundWorkers. no errors are thrown when these are running (both download...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.