title: C# Directory Security SetAccessControl not taking effect?
body: <p>I'm trying to change the permissions for a directory.  To do this I am running an elevated process that actually performs the SetAccessControl.</p>
  
  <pre><code>    static void Main(string[] args)
      {
          var options = new Options();
          if (!CommandLine.Parser.Default.ParseArguments(args, options)) return;
  
          var myDirectoryInfo = new DirectoryInfo(options.folder);
          var myDirectorySecurity = myDirectoryInfo.GetAccessControl();
          var usr = options.user;
  
          myDirectorySecurity.AddAccessRule(new FileSystemAccessRule(usr, FileSystemRights.FullControl, InheritanceFlags.ContainerInherit, PropagationFlags.InheritOnly, AccessControlType.Allow));
  
          try
          {
              myDirectoryInfo.SetAccessControl(myDirectorySecurity);
          }
          catch (Exception ex)
          {               
             Console.WriteLine(ex.Message);
          }
  
      }
  </code></pre>
  
  <p>When I run this as administrator there are no errors, but the folder access permissions remain unchanged.  Any ideas what is wrong?</p>