Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ protected static string GetNamedPipeServerStreamName()

const int MinUdsPathLength = 104; // required min is 92, but every platform we currently target is at least 104
const int MinAvailableForSufficientRandomness = 5; // we want enough randomness in the name to avoid conflicts between concurrent tests
string prefix = Path.Combine(Path.GetTempPath(), "CoreFxPipe_");
string prefix = Path.GetTempPath();
int availableLength = MinUdsPathLength - prefix.Length - 1; // 1 - for possible null terminator
Assert.True(availableLength >= MinAvailableForSufficientRandomness, $"UDS prefix {prefix} length {prefix.Length} is too long");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public abstract partial class PipeStream : Stream
private static readonly char[] s_invalidPathNameChars = Path.GetInvalidPathChars();

/// <summary>Prefix to prepend to all pipe names.</summary>
private static readonly string s_pipePrefix = Path.Combine(Path.GetTempPath(), "CoreFxPipe_");
private static readonly string s_pipePrefix = Path.GetTempPath();

public override int Read(byte[] buffer, int offset, int count)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using System.Threading.Tasks;
using Microsoft.DotNet.XUnitExtensions;
using Xunit;
using System.Runtime.InteropServices;

namespace System.IO.Tests
{
Expand Down Expand Up @@ -556,7 +557,6 @@ public async Task ReadBlockAsync_RepeatsReadsUntilReadDesiredAmount()
[InlineData(1, true)]
[SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser.")]
[SkipOnPlatform(TestPlatforms.LinuxBionic, "SElinux blocks UNIX sockets")]
[ActiveIssue("https://github.com/dotnet/runtime/issues/51390", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
public async Task ReadAsync_Canceled_ThrowsException(int method, bool precanceled)
{
Func<StreamReader, CancellationToken, Task<int>> func = method switch
Expand All @@ -565,8 +565,7 @@ public async Task ReadAsync_Canceled_ThrowsException(int method, bool precancele
1 => (sr, ct) => sr.ReadBlockAsync(new char[1], ct).AsTask(),
_ => throw new Exception("unknown mode")
};

string pipeName = Guid.NewGuid().ToString("N");
string pipeName = GetNamedPipeServerStreamName();
using (var serverStream = new NamedPipeServerStream(pipeName, PipeDirection.Out, 1, PipeTransmissionMode.Byte, PipeOptions.Asynchronous))
using (var clientStream = new NamedPipeClientStream(".", pipeName, PipeDirection.In, PipeOptions.Asynchronous))
{
Expand Down