Repository navigation
Description
Follow-up to #10305, which completed the Directory.* arm of SharedFileSystemPathInTestAnalyzer's mutating allowlist (CreateDirectory, CreateSymbolicLink, Delete, Move, and all six Set*Time* members) plus the [DoNotParallelize] opt-out branch. That issue deliberately scoped item 2 to Directory.*, so the File.* arm is still only partially pinned.
What is covered today
SharedFileSystemPathInTestAnalyzerTests covers these File.* members: WriteAllText, Copy (both path roles), Move, Replace (backup role), Delete, OpenWrite — plus the negative pins for File.ReadAllText/File.Exists/File.Open.
What is not covered
IsMutatingFileSystemMethod's file arm lists many more entries that have no test:
-
The exact mirrors of what Complete MSTEST0077 test coverage: [DoNotParallelize] opt-out and remaining Directory.* allowlist entries #10305 just added on the
Directory.*side, and therefore the cheapest to add:File.CreateSymbolicLink— same(path, pathToTarget)shape asDirectory.CreateSymbolicLink; the "pathToTargetis only read, so a constant target must not be flagged" behavior is unpinned on theFileside.File.SetCreationTime(Utc),File.SetLastAccessTime(Utc),File.SetLastWriteTime(Utc)— the identical six-member family. TheDirectoryequivalent is a[DataRow]-driven test that can be mirrored almost verbatim.
-
The write/append/create family, which has a few distinct signature shapes so it does not templatize as cleanly:
WriteAllTextAsync,WriteAllBytes(Async),WriteAllLines(Async),AppendAllText(Async),AppendAllLines(Async),AppendText,Create,CreateText. -
The attribute/encryption members:
Encrypt,Decrypt,SetAttributes,SetUnixFileMode.
Notes for whoever picks this up
[ResourceLock]is not an opt-out for MSTEST0077 — the analyzer never callsHasResourceLockFor/HasAnyResourceLock, unlikeCurrentDirectoryMutation…/CultureMutation…. Do not copy aWhenResourceLockDeclared_NoDiagnostictest over from those files.- The
[DoNotParallelize]opt-out is already covered by Complete MSTEST0077 test coverage: [DoNotParallelize] opt-out and remaining Directory.* allowlist entries #10305 (class-level, method-level, and the fixture-method negative that pins theIsTestMethodrestriction); there is no need to repeat it per API. File.Openis intentionally excluded from the allowlist and already has a negative test — do not "fix" that.- The analyzer test harness resolves against
ReferenceAssemblies.Net.Net80on both thenet472andnet8.0legs, so .NET 6+ APIs such asFile.CreateSymbolicLinkandFile.SetUnixFileModecompile fine in the snippets without any#ifguard.
Re-verified against current main (2026-08-23): all File.* allowlist entries listed in this issue are present in SharedFileSystemPathInTestAnalyzerTests.cs (WhenTestMethodCallsMutatingFileMethodWithConstantPath_Diagnostic DataRow list covers CreateSymbolicLink, SetCreationTime(Utc), SetLastAccessTime(Utc), SetLastWriteTime(Utc), Encrypt, Decrypt, SetAttributes, SetUnixFileMode, AppendText, CreateText, Create; the write/append/create async family is covered by WhenTestMethodCallsAsyncMutatingFileMethodWithConstantPath_Diagnostic; the CreateSymbolicLink pathToTarget-not-flagged negative case is covered by WhenTestMethodCreatesFileSymbolicLinkToConstantTarget_NoDiagnostic). This is the 4th independent confirmation this coverage is complete — closing for good.> 🤖 Automated content by GitHub Copilot. Generated by the Test Improver workflow. · auto · 91.8 AIC · ⌖ 5.43 AIC · ⊞ 19.4K · [◷]( · ◷)
Comment /test-assist to run again
Add this agentic workflow to your repo
To install this agentic workflow, run
gh aw add githubnext/agentics/workflows/test-improver.md@main
Activity
test: cover File.CreateSymbolicLink pathToTarget for SharedFileSystem…
github-actions commentedon Aug 10, 2026
github-actions commentedon Aug 16, 2026
Re-verified against current
main(2026-08-16): all File.* allowlist entries listed in this issue are already covered inSharedFileSystemPathInTestAnalyzerTests.cs:WhenTestMethodCallsMutatingFileMethodWithConstantPath_Diagnostic(DataRow-driven) coversAppendAllText,AppendAllLines,WriteAllBytes,WriteAllLines,Create,SetAttributes,SetUnixFileMode, all sixSet*Time*members,Encrypt,Decrypt,AppendText,CreateText, andCreateSymbolicLink.WhenTestMethodCallsAsyncMutatingFileMethodWithConstantPath_DiagnosticcoversAppendAllTextAsync,AppendAllLinesAsync,WriteAllBytesAsync,WriteAllLinesAsync,WriteAllTextAsync.WhenTestMethodCreatesFileSymbolicLinkToConstantTarget_NoDiagnosticcovers thepathToTarget-is-not-flagged negative forFile.CreateSymbolicLink.Full
MSTest.Analyzers.UnitTestssuite: 1782/1782 passed locally. No remaining gap — recommend closing this issue as complete.Warning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
southcentralus0.in.applicationinsights.azure.comTo allow these domains, add them to the
network.allowedlist in your workflow frontmatter:See Network Configuration for more information.
Add this agentic workflow to your repo
To install this agentic workflow, run