diff --git a/src/System.IO.Pipes/src/Resources/Strings.resx b/src/System.IO.Pipes/src/Resources/Strings.resx index 7b6c88b2c60d..4316ce959f75 100644 --- a/src/System.IO.Pipes/src/Resources/Strings.resx +++ b/src/System.IO.Pipes/src/Resources/Strings.resx @@ -286,6 +286,6 @@ Could not connect to the pipe because it was not owned by the current user. - Client connection refused because it was not owned by the current user. + Client connection (user id {0}) was refused because it was not owned by the current user (id {1}). \ No newline at end of file diff --git a/src/System.IO.Pipes/src/System/IO/Pipes/NamedPipeServerStream.Unix.cs b/src/System.IO.Pipes/src/System/IO/Pipes/NamedPipeServerStream.Unix.cs index 4fde5372dae9..25c8d8a5d684 100644 --- a/src/System.IO.Pipes/src/System/IO/Pipes/NamedPipeServerStream.Unix.cs +++ b/src/System.IO.Pipes/src/System/IO/Pipes/NamedPipeServerStream.Unix.cs @@ -98,7 +98,7 @@ private void HandleAcceptedSocket(Socket acceptedSocket) if (serverEUID != peerID) { - throw new UnauthorizedAccessException(SR.UnauthorizedAccess_ClientIsNotCurrentUser); + throw new UnauthorizedAccessException(string.Format(SR.UnauthorizedAccess_ClientIsNotCurrentUser, peerID, serverEUID)); } } diff --git a/src/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.CurrentUserOnly.netcoreapp.cs b/src/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.CurrentUserOnly.netcoreapp.cs index 9bbca8fddef1..f02976511e4b 100644 --- a/src/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.CurrentUserOnly.netcoreapp.cs +++ b/src/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.CurrentUserOnly.netcoreapp.cs @@ -30,7 +30,7 @@ public static void CreateServer_CurrentUserOnly() [Fact] public static void CreateServer_ConnectClient() { - var name = GetUniquePipeName(); + string name = GetUniquePipeName(); using (var server = new NamedPipeServerStream(name, PipeDirection.InOut, 1, PipeTransmissionMode.Byte, PipeOptions.CurrentUserOnly)) { using (var client = new NamedPipeClientStream(".", name, PipeDirection.InOut, PipeOptions.CurrentUserOnly)) @@ -45,7 +45,7 @@ public static void CreateServer_ConnectClient() [PlatformSpecific(TestPlatforms.AnyUnix)] // On Unix domain socket should have different location in this case. public static void CreateServerNotCurrentUserOnly_ClientCurrentUserOnly_ThrowsTimeout_OnUnix() { - var name = GetUniquePipeName(); + string name = GetUniquePipeName(); using (var server = new NamedPipeServerStream(name, PipeDirection.InOut, 1, PipeTransmissionMode.Byte)) { using (var client = new NamedPipeClientStream(".", name, PipeDirection.InOut, PipeOptions.CurrentUserOnly)) @@ -58,9 +58,9 @@ public static void CreateServerNotCurrentUserOnly_ClientCurrentUserOnly_ThrowsTi [Fact] public static void CreateMultipleServers_ConnectMultipleClients() { - var name1 = GetUniquePipeName(); - var name2 = GetUniquePipeName(); - var name3 = GetUniquePipeName(); + string name1 = GetUniquePipeName(); + string name2 = GetUniquePipeName(); + string name3 = GetUniquePipeName(); using (var server1 = new NamedPipeServerStream(name1, PipeDirection.InOut, 1, PipeTransmissionMode.Byte, PipeOptions.CurrentUserOnly)) using (var server2 = new NamedPipeServerStream(name2, PipeDirection.InOut, 1, PipeTransmissionMode.Byte, PipeOptions.CurrentUserOnly)) using (var server3 = new NamedPipeServerStream(name3, PipeDirection.InOut, 1, PipeTransmissionMode.Byte, PipeOptions.CurrentUserOnly))