- Create a test class
- Initialize a new instance of a Mutex in the ctor of the test class
Attempt to release the Mutex in the test
Actual: Fails with an exception stating you don't own the mutex
The problem is that, when using a Timeout, the TimeoutCommand executes the test on a new thread so that it can watch for success or failure on the main testing thread, and return as soon as the timeout has been reached. Since TimeoutCommand is late in the delegated command cycle, everything else has already been run (including the object's constructor and the before/after attributes).
Moving the TimeoutCommand to the front of the stack should fix the issue, but then the timer will already be running while we do object creation and executing the before/after attributes, which may give an unnecessarily skewed view of how long the test took to run.