Re: NUnit and StrongnameIdentityPermission

From: David W. Griffin (Griffin_at_discussions.microsoft.com)
Date: 08/30/04


Date: Mon, 30 Aug 2004 10:33:07 -0700

I'm pretty new to .NET and C# but I'm having a problem whose title could have
been identicial to this one. Basically, In .NET I have a NUnit test which
calls a function that loads an XML file. It works fine in .NET. Called from
NUnit on my desktop computer (XP Pro, but a Lockheed version of XP Pro) it
fails with the following error:

CommonTests.FlightDataProcessingTests.TestHistoricalTrendData.TestCreateHistoricalTrendDataItem
: System.Security.SecurityException : Request for the permission of type
System.Security.Permissions.StrongNameIdentityPermission, mscorlib,
Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.

Called from two other computers, one running vanilla XP Home and another
running vanilla XP Pro it works fine. Does anyone have any idea of what this
could be a result of? Is there some security measure I need to disable to fix
to get rid of this?

"Nicole Calinoiu" wrote:

> Carel,
>
> If you are using link demands instead of full stack demands, this shouldn't
> be an issue if you sign your test assembly with the same signing key. If
> you're using full demands, either one of the following might be an option:
>
> 1. Re-compile NUnit from its source (available in the NUnit install
> directory) after signing it with your own key.
> 2. Instead of using full demands, test that each caller in the stack is
> signed with any one of multiple acceptable keys from your own code. An
> example of this approach is available at
> http://blogs.msdn.com/Eugene_Bobukh/archive/2004/03/10/87603.aspx.
>
> #1 would probably be a lot less work if you're already well into
> implementing your project.
>
> HTH,
> Nicole
>
>
> "Carel Lotz" <CarelLotz@discussions.microsoft.com> wrote in message
> news:32CEAAE9-8055-4C73-ADD2-1993693009E4@microsoft.com...
> > Hi
> >
> > We have created a framework of components for use only within our company
> > and have therefore added StrongNameIdentityPermission with LinkDemands to
> > our company's key on the public interfaces of some of the assemblies.
> > This all works fine however we have run into a problem when executing the
> > unit tests for the assemblies as a caller within the call chain is now
> > NUnit itself. This brings about the permission error.
> >
> > How do I get our assemblies to automatically trust NUnit as a caller?
> >
> > Thanks
> > --
> > Carel Lotz
> > "I want to code till I die" - Robert C. Martin
>
>
>



Relevant Pages

  • Re: Why doesnt C# allow incremental compilation like Java?
    ... On the NUnit list, it seems other's are ... It sounds pretty inconvenient if you have ... I usually work on one layer at a time anyway, ... assemblies, once I tell vs to load the module and point it to a pdb ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: How to lock the use of assembly by other assemblies.
    ... You can use the StrongNameIdentityPermision to ensure that the caller is has ... In this outline, you will build 2 assemblies, one will be the caller and the ... The caller will be signed with your key and the callee ...
    (microsoft.public.dotnet.security)
  • Re: Why doesnt C# allow incremental compilation like Java?
    ... On the NUnit list, it seems other's are ... doesn't NUnit load the tests and tested assemblie ... The point is that in a world without "large" assemblies, ... I usually work on one layer at a time anyway, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Protecting .NET assemblies (runtime)
    ... you can try to do your best - like checking the SN of the caller - but it all boils down to: if you hand out your code a skilled person can do to it whatever he wants... ... Developing More Secure Microsoft ASP.NET 2.0 Applications ... assemblies are distributed to end user systems (they are not installed ... aspect as developers/end users reusing my .NET assemblies in their own ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: NUnit versions...
    ... because they've made some design changes and you need to reference to new nunit assembly and rebuilt your test project ... PK> These assemblies are to be included in an application with other ... PK> How can we fix this (without having to all compile against the same ...
    (microsoft.public.dotnet.general)