I was rather surprised when I ran into this issue earlier this evening and wasn't able to find anything on Google about it. So, I'm going to post this on my blog in case it happens for anyone else or in case it happens to me again and I forget about it.
After I installed XP SP2 last night on my development machine here at home, I decided to get back to development on my projects for Managed World. Well, when I went to write some more unit tests (I'm using test-driven development for a good number of my personal projects), TestDriven.NET was simply reporting “----Done----” without running tests. When I opened my testing assembly in the NUnit GUI, NUnit was reporting that the assembly contained no TestFixtures. Neither NUnit or TestDriven.NET was reporting any errors.
After some investigation, I discovered the issue had nothing to do with the upgrade to Windows XP. The issue had to deal with the default security permissions I had configured for the assembly. Most of you out there that use FxCop are aware that there is a rule where you need to specify the minimum required permissions for an assembly. Well, for my testing assembly I had declared that the FileIOPermission for write access to the C:\ drive was optional, not required, as such:
[assembly: FileIOPermission(SecurityAction.RequestOptional, Write="C:\\")]
Well, that was the primary cause of my problem. When I commented out the permission set or changed it from RequestOptional to RequestMinimum, than NUnit worked again. What surprised me was that NUnit did not throw an error or providing any sort of clue that there was a permissions error. Interesting.
So, note to self: investigate the minimum permissions required for assemblies being analyzed by certain .NET tools like FxCop and NUnit.