I am posting this question anew at the behest of the distinguished Mr. John Skeet, who suggested I devise a simple test program that isolates and demonstrates the issue I am
What actually happens is that Assert.Throws
does catch your exception, however Visual Studio stops on the first-chance exception anyway. You can check this by just pressing F5; Visual Studio will happily carry on executing.
As the exception helper tells you, the exception was unhandled by user code. So we know that Visual Studio doesn’t consider NUnit to be user code for some reason.
Visual Studio actually tells you this in plain text, if you know where to look:
There is also evidence of this fact in the stack trace:
Solution 1: Use a debug build of NUnit with debugging symbols. That will get Visual Studio to regard NUnit as user code, and thus stop treating your exceptions as "unhandled by user code". This isn’t trivial, but might work better in the long term.
Solution 2: Turn off the "Enable Just My Code" checkbox in Visual Studio’s debugging settings:
P.S. I’m not considering work-arounds whereby you avoid the use of Assert.Throws<T>
altogether, but there are of course ways of doing that.