Persist directory security through the modern directory API

Proprietary

Opt-in Windows port of resolved Directory.SetAccessControl(string, DirectorySecurity) calls to a private helper using DirectoryInfo and FileSystemAclExtensions.SetAccessControl. Preserve both argument evaluations before path normalization, the same security object, and the Framework null-security check/parameter name before path validation. Retain existing rules, owner, inheritance and catch policy; do not create directories or choose permissions. Skip named/commented/unresolved calls, other ACL APIs, partial/generic owners, lambda/query contexts and snapshots. Requires Windows ACL support; no Framework CAS, path-policy, localization or native-failure emulation. Standalone modern-.NET recipe, not in version composites.

OpenRewrite.Recipes.CSharp.Migration.Dotnet.Net6.UseDirectoryInfoForDirectorySecurityWrites
mod run . --recipe=OpenRewrite.Recipes.CSharp.Migration.Dotnet.Net6.UseDirectoryInfoForDirectorySecurityWrites

Install it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.