title: SecurityManager.IsGranted() behaviour
body: <p>can anybody please explain the following c# behaviour? I have written a small console application just to learn about CAS, but I can not seem to understand why the following lines of code work like they do:</p>
  
  <pre><code>string[] myRoles = new string[] { "role1", "role2", "role3" };
  GenericIdentity myIdentity = new GenericIdentity("myUsername", "customAuthType");
  GenericPrincipal myPrincipal = new GenericPrincipal(myIdentity, myRoles);
  
  System.Threading.Thread.CurrentPrincipal = myPrincipal;
  
  Console.WriteLine(SecurityManager.IsGranted(new PrincipalPermission(null, "role1")));
  Console.WriteLine(SecurityManager.IsGranted(new PrincipalPermission(null, "roleX")));
  </code></pre>
  
  <p>The output is "true" for both SecurityManager.IsGranted() calls.</p>
  
  <p>If I then add the following lines:</p>
  
  <pre><code> new PrincipalPermission(null, "role1").Demand();
   new PrincipalPermission(null, "roleX").Demand();
  </code></pre>
  
  <p>the first demand call passes, but the second one (as expected) causes a SecurityException. </p>
  
  <p>Why does not the SecurityManager.IsGranted()-call return false for the "roleX" permission?</p>