Re: Odd StrongNameIdentityPermission failure during an NUnit run

From: Dmitriy Lapshin [C# / .NET MVP] (
Date: 10/07/03

Date: Tue, 7 Oct 2003 17:06:04 +0300

Hi Joannes,

This exception should have nothing to do with NTFS security. It is usually
raised when calling code does not have sufficient permissions to call some
method. Sounds odd? Yes, it does indeed in the beginning but as I have gone
through with it already, I'll try to explain in plain English (while it is
not my mother tongue, he-he :-)

So this type of security is intended to protect your code from unathorized
calls. There's an attribute you can apply to a method, and after that an
assembly calling this method will have to have certain strong name
(specified in the attribute's constructor), or the assembly won't be allowed
to call your method and the exception you have seen will be thrown.

What's strange indeed the exception is raised only once. What you can to is
have the debugger break once this exception has been thrown and see whether
it is thrown from your code or from inside the NUnit runtime. If the latter
is the case, you should probably contact the NUnit development team. And if
your own code is the culprit, you probably know what to do with it :-)

Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
Bring the power of unit testing to VS .NET IDE
"Joannes Vermorel" <> wrote in message
> I am currently writing a C# library. The library incorporates its own
> testing suite.
> When I run the NUnit Gui ( for the first on time on the
> library (after starting the NUnit Gui), I got the following error:
> > MyMethodName: Request for the permission of the type
> > System.SecurityPermission.StrongNameIdentityPermission, mscorlib, [..
> skipped ..] failed
> >
> > at System.Xml.XmlTextReader..ctor(String url, XmlNameTable nt)
> > at System.Xml.XmlTextReader..ctor(String url)
> > at MyMethodName()
> When I run the tests again (1x, 2x, 10x, ...), everything works fine, and
> more security permission fails (until I restart NUnit). This behavior
> very strange to me. I understand that a disk access could fail depending
> the security settings, but I don't see any reason why an access that was
> first denied could be granted the second time ???
> Does someone has an explanation for this ?
> Thanks for the help,
> Joannes Vermorel

Relevant Pages

  • Installing a SharePoint Site breaks OMA
    ... At our organisation we use OMA heavily and we recently purchased SharePoint ... It appears to have changed some security settings. ... To grant this application the required permission ... Exception Details: System.Security.SecurityException: Request for the ...
  • Security Exception on 1&1 with SQL Server
    ... I have put the bin directory in the /gallerox folder as I have a re-director ... However, when I try to access the default.aspx page, I get back a security ... exception which is detailed at the bottom of this post. ... To grant this application the required permission ...
  • How to publish ASPNET web application locating the app files on shared folder
    ... Security Exception ... permission of type 'System.Web.AspNetHostingPermission, System, ... System.Reflection.Assembly.GetType(String name, Boolean ...
  • How to publish web application locating the app files on shared fo
    ... Security Exception ... To grant this application the required permission ... System.Reflection.Assembly.GetType(String name, Boolean throwOnError, ...
  • Misinformation in Security Advisories (ASN.1)
    ... It seems that misinformation is included in security ... process heap. ... When this unhandled exception ...