Fix maxNumberOfServerInstances==1 implying first-instance semantics on Unix for NamedPipeServerStream#131258
Draft
adamsitnik with Copilot wants to merge 1 commit into
Draft
Fix maxNumberOfServerInstances==1 implying first-instance semantics on Unix for NamedPipeServerStream#131258adamsitnik with Copilot wants to merge 1 commit into
adamsitnik with Copilot wants to merge 1 commit into
Conversation
… Unix, add cross-process test Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>
|
Azure Pipelines: Successfully started running 3 pipeline(s). 13 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Copilot
AI
changed the title
Fix #131203: maxNumberOfServerInstances==1 implies first-instance semantics on Unix
Fix maxNumberOfServerInstances==1 implying first-instance semantics on Unix for NamedPipeServerStream
Jul 23, 2026
Copilot created this pull request from a session on behalf of
adamsitnik
July 23, 2026 12:02
View session
Contributor
|
Tagging subscribers to this area: @dotnet/area-system-io |
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.
On Windows,
maxNumberOfServerInstances: 1automatically setsFILE_FLAG_FIRST_PIPE_INSTANCE, so a second process attempting to bind the same pipe name getsUnauthorizedAccessException. On Unix, first-instance semantics were only applied whenPipeOptions.FirstPipeInstancewas explicitly set -- a second process withmaxNumberOfServerInstances: 1would silentlyUnlink()the existing socket and rebind, hijacking the pipe.Root cause: In
SharedServer.Get,isFirstPipeInstancewas derived solely fromPipeOptions.FirstPipeInstance, ignoringmaxCount.Fix: One-line change in
NamedPipeServerStream.Unix.cs-- treatmaxCount == 1as first-instance, matching Windows behavior:With this change, when a cross-process second server creation is attempted with
maxNumberOfServerInstances: 1,socket.Bind()fails against the existing socket (no pre-unlink), and the existingSocketExceptioncatch converts it toUnauthorizedAccessException.Test added:
NamedPipe_MaxOneInstance_Throws_WhenNameIsUsedAcrossProcessesinNamedPipeTest.CrossProcess.cs-- usesRemoteExecutorto verify cross-process enforcement.