diff --git a/src/benchmarks/micro/libraries/System.IO.FileSystem/Perf.File.cs b/src/benchmarks/micro/libraries/System.IO.FileSystem/Perf.File.cs index e242f834bc8..ded2a0470b6 100644 --- a/src/benchmarks/micro/libraries/System.IO.FileSystem/Perf.File.cs +++ b/src/benchmarks/micro/libraries/System.IO.FileSystem/Perf.File.cs @@ -94,7 +94,7 @@ public void SetupReadAllBytes() { // use non-temp file path to ensure that we don't test some unusal File System on Unix string baseDir = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); - File.WriteAllBytes(_testFilePath = Path.Combine(baseDir, Path.GetTempFileName()), Array.Empty()); + File.WriteAllBytes(_testFilePath = Path.Combine(baseDir, Path.GetRandomFileName()), Array.Empty()); _filesToRead = new Dictionary() { { HalfKibibyte, WriteBytes(HalfKibibyte) }, @@ -106,7 +106,7 @@ public void SetupReadAllBytes() string WriteBytes(int fileSize) { - string filePath = Path.Combine(baseDir, Path.GetTempFileName()); + string filePath = Path.Combine(baseDir, Path.GetRandomFileName()); File.WriteAllBytes(filePath, ValuesGenerator.Array(fileSize)); return filePath; }