Remember all those posts about good exception handling practices? Well, it seems even the best of us can fall into that trap.

I've been working on putting the finishing touches on a socket server for one of our clients, and I've happy as to the results I've had so far and how the design ended up. I've also got good coverage of the code using NUnit, including all the socket manipulation. However, I noticed something weird today while testing again:

Every single test passes with no issues. When I run the tests for each TestFixture (class) individually, they run perfectly. However, when I run the full tests in the entire test assembly, I started getting an unhandled exception somewhere in a background thread (all tests are still green, though). Hey, no problem, let's just look at where the exception was generated and fix it! Or maybe not:

Tomas Restrepo

Software developer located in Colombia. Sr. PFE at Microsoft.