Skip to content

New dotnet test experience should create the directory of the trace file if not present #5205

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Youssef1313 opened this issue Mar 10, 2025 · 0 comments · Fixed by dotnet/sdk#47411
Assignees
Labels
External: dotnet test `dotnet test` integration sprint
Milestone

Comments

@Youssef1313
Copy link
Member

Setting DOTNET_CLI_TEST_TRACEFILE to artifacts\TestResults\dotnet-test-trace-logs.txt will fail if artifacts\TestResults directory doesn't exist. I think it's a good idea if dotnet test creates the directory instead of failing.

2025-03-10T14:22:48.8265690Z [dotnet test - 03/10/2025 14:22:48.820]System.IO.DirectoryNotFoundException: Could not find a part of the path 'D:\a\_work\1\s\artifacts\TestResults\dotnet-test-trace-logs.txt'.
2025-03-10T14:22:48.8266204Z    at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options)
2025-03-10T14:22:48.8266505Z    at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
2025-03-10T14:22:48.8267030Z    at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
2025-03-10T14:22:48.8267600Z    at System.IO.Strategies.FileStreamHelpers.ChooseStrategyCore(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
2025-03-10T14:22:48.8268021Z    at System.IO.StreamWriter.ValidateArgsAndOpenPath(String path, Boolean append, Int32 bufferSize)
2025-03-10T14:22:48.8268276Z    at System.IO.File.AppendText(String path)
2025-03-10T14:22:48.8268511Z    at Microsoft.DotNet.Tools.Test.Logger.LogTrace(Func`1 messageLog)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
External: dotnet test `dotnet test` integration sprint
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants