Why Starting a New Task in the Task Parallel Library (TPL) Doesn’t Always Start a New Thread

The Task Parallel Library in .Net is a wonderful resource.  However, one thing that is a little confusing is that it is actually possible to start a task that runs on the same thread as the current code.  That is, we can do Task.StartNew and it still runs on the same thread.  This isn't the … Continue reading Why Starting a New Task in the Task Parallel Library (TPL) Doesn’t Always Start a New Thread

Top-level Exception Handling in Windows Forms Applications

Introduction In .NET exception handling has become a much simpler issue than in previous programming languages. For example, in many older languages it was considered good practice to put an exception handler in every routine, and also to return a value to indicate success or failure from each routine. In .NET Windows Forms applications these … Continue reading Top-level Exception Handling in Windows Forms Applications

Top-level Exception Handling in Windows Forms Applications – Code Listing 1

  This code listing is available for download.    This is a very basic code example of how to use the ThreadException event to handle exceptions occurring anywhere on the main GUI thread in a Windows Forms application.  My blog article 'Top-level Exception Handling in Windows Forms Applications' discusses this in more detail.   From … Continue reading Top-level Exception Handling in Windows Forms Applications – Code Listing 1