Skip to content

Bug: narrow-fileio2-retryable-exception-set #707

Description

@drmoisan
  • Work Mode: full-bug

Summary

FileIO2.WriteTextFileAsync retries on every IOException. DirectoryNotFoundException derives from IOException, so an absent target folder consumes the full 100-attempt, 100-millisecond retry window even though no attempt in that window can succeed.

Environment

  • OS/version: Windows 11, .NET Framework 4.8.1
  • Python version: not applicable
  • Command/flags used: not applicable; reached through any caller of UtilitiesCS.FileIO2.WriteTextFileAsync
  • Data source or fixture: UtilitiesCS/To Depricate/FileIO2.cs

Steps to Reproduce

  1. Call FileIO2.WriteTextFileAsync with a folderpath that does not exist on disk.
  2. Observe that the writer factory throws DirectoryNotFoundException on every attempt.
  3. Observe that the method spends roughly ten seconds in the retry loop before returning false.

Expected Behavior

A failure that cannot be resolved by waiting should not consume the retry budget. The method should distinguish transient contention failures, for which retrying is the correct response, from structural failures such as a missing directory, and should return promptly on the latter.

Actual Behavior

The catch clause is catch (IOException ex). DirectoryNotFoundException is an IOException, so the loop performs all 100 attempts and awaits 99 delays before reporting failure.

Logs / Screenshots

  • Attached minimal logs or snippet
  • Snippet: the retry-exhaustion log line reads after {attempts} attempts. with attempts equal to 100, once per call against a missing directory.

Impact / Severity

  • Blocker
  • High
  • Medium
  • Low

Severity is Low because the one production caller that could reach the case guards against it: QuickFiler/Controllers/QfcHomeController.Metrics.cs calls Globals.FS.SpecialFolders.TryGetValue("MyDocuments", ...) before writing. The stall is therefore latent rather than observed.

Source

From: docs/features/potential/2026-08-31-narrow-fileio2-retryable-exception-set.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions