Example

using System;
using System.Security;
using System.Security.Permissions;

[assembly: PermissionSetAttribute(
             SecurityAction.RequestRefuse,
             Name="SkipVerification")]

namespace Samples
{
  public class VerificationExceptionSample
  {
    unsafe public static void Main(string[] args)
    {
      string s = "damien";
      fixed(char *ptr = s)
      {
        for(int i = 0; i < s.Length; i++)
          Console.WriteLine(ptr[i]);
      }
    }
  }
}
The output is
UnhandledException: System.Security.VerificationException: Operation could 
destabilize the runtime.
   at Samples.VerificationExceptionSample.Main(String[] args) in C:\Books\BCL\
Samples\System.Security\VerificationException\VerificationException.cs:line 15

Get .NET Framework Standard Library Annotated Reference, Volume 1: Base Class Library and Extended Numerics Library now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.