How to throw the InnerException of a TargetInvocationException without loosing stack details? I’ve been plagued by this problem for some time. There are a few common solutions to this: Option #1 – just leave it alone. The downfall here is that specific types of exceptions cannot be caught easily in calling code. In some instances [...]

 

My last post reguarding “Deadlocks and other issues with Invoke / BeginInvoke” was something of a rant on the subject of WinForms and multi-threading. I thought I’d post on the useage of the solution that was presented originally on the stackoverflow article. The following defines the interface portion of the class: public class EventHandlerForControl<TEventArgs> where [...]

 

For the past few days I’ve been working on a solution to a problem in WinForms. Most people are not aware of the following: The “threading api” methods of the Control class are not thread safe. This includes calls to InvokeRequired, Invoke, BeginInvoke, and even EndInvoke. What do I mean by “not thread safe”? The [...]