   [.net] Error Handling
  When errors are thrown during debugging in my application they are thrown in the Static void Main() @ Application.Run(...);The exception that is always thrown (regardless of what error occured) is the TargetInvocationException.How can I prevent this error from being thrown, and instead have the actual exception thrown, at its actual location, not at Application.Run().Btw, Im using the BackgroundWorker, Im suspecting that this might have something to do with it.Any ideas?   
Quote:Original post by phb5000When errors are thrown during debugging in my application they are thrown in the Static void Main() @ Application.Run(...);The exception that is always thrown (regardless of what error occured) is the TargetInvocationException.What's the InnerException property of this object?Quote:Original post by phb5000How can I prevent this error from being thrown, and instead have the actual exception thrown, at its actual location, not at Application.Run().Umm, add Try...Catch code to your code?