Tuesday, February 15, 2005
NUnit Dislikes Optional Security Permissions
I recently encountered problems while using NUnit 2.2 on assemblies that specify a security permission set. The problem manifested itself in two different ways for two different assemblies:
- NUnit was reporting no test fixtures for assembly A.
SecurityException
s were being thrown when executing test cases in assembly B for test fixtures derived from classes in assembly A.
Thankfully a Google search led me to another developer who recently had similar troubles. Jason Olson blogged about this issue here.
Jason was having trouble with this permission request:
[assembly: FileIOPermission(SecurityAction.RequestOptional, Write=@"C:\")]
As Jason points out, either commenting out this request altogether or upping the security action to SecurityAction.RequestMinimum
solved the problem.
The culprit in my case was:
[assembly: SecurityPermission(SecurityAction.RequestOptional, Flags=SecurityPermissionFlag.UnmanagedCode)]
.
Sure enough, the same workarounds that Jason discovered solved my problems, too.
These two permission requests seem unrelated to each other and to what NUnit would require to discover unit tests within an assembly. Further, why would NUnit work when these permission requests were either absent or not optional? And therein lies the common thread; they both specify SecurityAction.RequestOptional
.
My hypothesis is that NUnit mishandles assemblies that specify optional permission requests. I have notified the NUnit developers of this problem.
[url=http://cltbfnol.com/geqf/amfl.html]My homepage[/url] | [url=http://zppomfwj.com/fjue/eowo.html]Cool site[/url]
[url=http://sntrrwbc.com/edna/oruq.html]My homepage[/url] | [url=http://nihprqgd.com/imvq/nqmk.html]Cool site[/url]
<< Home
Subscribe to Posts [Atom]