Fix correctness and perf issues across the lookup and extraction paths#221
Merged
SimonCropp merged 1 commit intoJul 5, 2026
Conversation
SimonCropp
commented
Jul 5, 2026
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+
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.