assembly code security attribute hides [TestFixture] attrib
Unit testing for .NET
Brought to you by:
charliepoole
Adding the declarative code security attribute
[assembly:FileIOPermission(SecurityAction.
RequestOptional, Unrestricted=true)]
to a simple assembly (DLL) makes nunit-gui.exe unable to
see the [TestFixture] attribute on a public class in the
test assembly. nunit-gui.exe then reports "Has no
TestFixtures".
Changing the attribute to request SecurityAction.
RequestMinimum allows nunit-gui.exe to see the
[TestFixture] attribute, and the tests are recognized and
run properly.
I have NUnit version 2.2.0 running on Windows 2000
Professional Service Pack 4 (5.00.2195). I use Visual
Studio 2003 (7.1.3088) and the .NET Framework 1.1 (1.1.
4322).
a minimal VS2003 C# solution demonstrating the bug
Logged In: YES
user_id=382298
I have also seen this happen with the following code security
attribute:
[assembly: SecurityPermission
(SecurityAction.RequestOptional,
Flags=SecurityPermissionFlag.UnmanagedCode)]
Change the security action to SecurityAction.
RequestMinimum allows nunit-gui.exe to discover the test
fixtures in this case as well.
Logged In: YES
user_id=586918
The general pattern, noted on several blogs, is that
SecurityAction.RequestOptional is the source of the issue.
Until we fix this, a workaround is to use RequestMinimum.