Menu

#337 assembly code security attribute hides [TestFixture] attrib

open
nobody
framework (182)
5
2005-01-18
2005-01-18
Rob Locher
No

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).

Discussion

  • Rob Locher

    Rob Locher - 2005-01-18

    a minimal VS2003 C# solution demonstrating the bug

     
  • Robert Bullen

    Robert Bullen - 2005-02-17

    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.

     
  • Charlie Poole

    Charlie Poole - 2005-02-17

    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.

     

Log in to post a comment.