Code Coverage Security Problem

M

Michael Schöller

Hi,

Well I get this error if I enable Code Coverage in my UnitTests in VS 2005
System.Security.VerificationException: Operation could destabilize the
runtime.

Well what I figured out is that its reated to the
[assembly: PermissionSet(SecurityAction.RequestOptional, Unrestricted =
false)]

line in the AsseblyInfo.cs of my Project.


Well there are 2 solutions to prevent that error but none of them makes me
realy happy.
Solution 1: Disable Code Coverage *out of question*
Solution 2: Add
[assembly: SecurityPermission(SecurityAction.RequestMinimum, UnmanagedCode =
true, SkipVerification = true)] to the AssemblyInfo.cs *works but....*

I looking for an Solution that will let me make Code Coverage and uses no
additional security settings.



Any ideas?

Michael
 
B

Ben Voigt

Michael Schöller said:
Hi,

Well I get this error if I enable Code Coverage in my UnitTests in VS 2005
System.Security.VerificationException: Operation could destabilize the
runtime.

Well what I figured out is that its reated to the
[assembly: PermissionSet(SecurityAction.RequestOptional, Unrestricted =
false)]

line in the AsseblyInfo.cs of my Project.


Well there are 2 solutions to prevent that error but none of them makes me
realy happy.
Solution 1: Disable Code Coverage *out of question*
Solution 2: Add
[assembly: SecurityPermission(SecurityAction.RequestMinimum, UnmanagedCode
= true, SkipVerification = true)] to the AssemblyInfo.cs *works but....*

Can't you use this with #if to only loosen security while compiling for code
coverage? As long as you never include/exclude executable code that way
your code coverage results should apply to the release build.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top