Skip to content

Fix correctness and perf issues across the lookup and extraction paths#221

Merged
SimonCropp merged 1 commit into
mainfrom
Fix-correctness-and-perf-issues-across-the-lookup-and-extraction-paths
Jul 5, 2026
Merged

Fix correctness and perf issues across the lookup and extraction paths#221
SimonCropp merged 1 commit into
mainfrom
Fix-correctness-and-perf-issues-across-the-lookup-and-extraction-paths

Conversation

@SimonCropp

Copy link
Copy Markdown
Member
  • UseFile: rebuild the merged Files dictionary so GetPathFor, TryCreateFile, IsEmptyFile and Files see registered files again (regression from the Frozen refactor)
  • TryCreateFile: return false for extensionless paths instead of throwing ArgumentNullException
  • ContentTypes: map image/heic to "heic" (drop stray leading dot)
  • Extraction: key the temp directory on InformationalVersion instead of the pinned AssemblyVersion/FileVersion (1.0.0), so templates are isolated per release
  • Extraction: write to a unique temp file then move into place, so parallel processes sharing the temp dir cannot race File.Create
  • OpenRead reads user-registered files from disk; WriteAllTo enumerates EmptyFile instances so custom registrations extract correctly
  • Extension lookups now use OrdinalIgnoreCase, matching ContentTypes
  • TryGetPathFor normalizes dotless extensions like GetPathFor
  • Guard.FileExists: pass arguments in the correct order
  • IsTextExtension: back with a FrozenSet plus a dotless companion set to avoid per-call allocation on the dotless hot path; use GetAlternateLookup on the span overload for net9+

- UseFile: rebuild the merged Files dictionary so GetPathFor,
  TryCreateFile, IsEmptyFile and Files see registered files again
  (regression from the Frozen refactor)
- TryCreateFile: return false for extensionless paths instead of
  throwing ArgumentNullException
- ContentTypes: map image/heic to "heic" (drop stray leading dot)
- Extraction: key the temp directory on InformationalVersion instead
  of the pinned AssemblyVersion/FileVersion (1.0.0), so templates are
  isolated per release
- Extraction: write to a unique temp file then move into place, so
  parallel processes sharing the temp dir cannot race File.Create
- OpenRead reads user-registered files from disk; WriteAllTo enumerates
  EmptyFile instances so custom registrations extract correctly
- Extension lookups now use OrdinalIgnoreCase, matching ContentTypes
- TryGetPathFor normalizes dotless extensions like GetPathFor
- Guard.FileExists: pass arguments in the correct order
- IsTextExtension: back with a FrozenSet plus a dotless companion set to
  avoid per-call allocation on the dotless hot path; use GetAlternateLookup
  on the span overload for net9+
@SimonCropp SimonCropp added this to the 8.18.2 milestone Jul 5, 2026
@SimonCropp SimonCropp merged commit cb62cb7 into main Jul 5, 2026
4 of 6 checks passed
@SimonCropp SimonCropp deleted the Fix-correctness-and-perf-issues-across-the-lookup-and-extraction-paths branch July 5, 2026 05:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant