Repository navigation
Avoid filesystem dependencies in pathless Unix errno mapping - #137072
Open
MichalStrehovsky wants to merge 2 commits into
Open
MichalStrehovsky wants to merge 2 commits into
MichalStrehovsky wants to merge 2 commits into
Conversation
Select parent-directory handling through a static-abstract interface and sealed policy classes so pathless callers do not retain filesystem APIs. Preserve existing exception mappings and path-aware behavior. This provides a 1.84% size saving for the size-optimized WASI NativeAOT Release Hello World: 823,214 to 808,084 bytes, saving 15,130 bytes. Validated WASI Release/Checked errno mappings against the original implementation, filesystem error paths, Sleep, Preinitialization, and Hello World. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 9bc3dfee-1040-4648-bdad-86922a749613
|
Azure Pipelines: Successfully started running 3 pipeline(s). 12 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @dotnet/area-system-io |
jkotas
reviewed
Nov 6, 2026
| // For Windows compatibility, throw DirectoryNotFoundException instead of FileNotFoundException | ||
| // when the parent folder does not exist. | ||
| if (!isDirError && (path is null || ParentDirectoryExists(path))) | ||
| if (!isDirError && (path is null || TPathHandling.ParentDirectoryExists(path))) |
Member
There was a problem hiding this comment.
Instead of duplicating the native code for the whole implementation using generic tricks, can we just check for ENOENT in the overload that may need the special path handling and forward the rest to the common impl?
Member
There was a problem hiding this comment.
duplicating the native code
Ok - it is not duplicating the native code, but creating shared generic structures instead. Still, I think it would be better without generics.
Handle the ENOENT parent-directory check in the path-aware overload and share exception mapping through GetExceptionForIoErrnoCore. Document the separation needed for better trimming of pathless callers. Validated WASI Release and Checked errno mappings, filesystem checks, Sleep, and Preinitialization. Matching-toolchain stripped Hello World saves 15,635 bytes (1.83%) versus the original mapper. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: a33cda55-cbd2-452e-9a41-5aa6a1c97aca
jkotas
approved these changes
Nov 7, 2026
This branch has not been deployed
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.
I wondered why Hello World needs to use Path APIs and check directory existence. This is the reason.
This provides a 1.84% size saving for the size-optimized WASI NativeAOT Release Hello World: 823,214 to 808,084 bytes, saving 15,130 bytes.