Skip to content
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

Fix failure to print test results #33513

Merged
merged 1 commit into from
Feb 20, 2019
Merged

Conversation

sharwell
Copy link
Member

@sharwell sharwell commented Feb 20, 2019

Fixes this message following a failed integration test run:

Unhandled Exception: System.NotSupportedException: The given path's format is not supported.
   at System.Security.Permissions.FileIOPermission.EmulateFileIOPermissionChecks(String fullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.StreamWriter.CreateFile(String path, Boolean append, Boolean checkHost)
   at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize, Boolean checkHost)
   at System.IO.File.InternalWriteAllText(String path, String contents, Encoding encoding, Boolean checkHost)
   at RunTests.TestRunner.PrintFailedTestResult(TestResult testResult) in /_/src/Tools/Source/RunTests/TestRunner.cs:line 166
   at RunTests.TestRunner.Print(List`1 testResults) in /_/src/Tools/Source/RunTests/TestRunner.cs:line 130
   at RunTests.TestRunner.<RunAllAsync>d__3.MoveNext() in /_/src/Tools/Source/RunTests/TestRunner.cs:line 117
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at RunTests.Program.<RunCore>d__5.MoveNext() in /_/src/Tools/Source/RunTests/Program.cs:line 107
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at RunTests.Program.<Run>d__4.MoveNext() in /_/src/Tools/Source/RunTests/Program.cs:line 88
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at RunTests.Program.Main(String[] args) in /_/src/Tools/Source/RunTests/Program.cs:line 47

@sharwell sharwell requested a review from a team as a code owner February 20, 2019 12:38
@sharwell sharwell requested review from a team as code owners February 20, 2019 12:46
@sharwell sharwell changed the base branch from master to dev16.0 February 20, 2019 12:46
@@ -170,6 +169,8 @@ private void PrintFailedTestResult(TestResult testResult)
ConsoleUtil.WriteLine($"Command: {testResult.CommandLine}");
ConsoleUtil.WriteLine($"xUnit output log: {outputLogPath}");

File.WriteAllText(outputLogPath, testResult.StandardOutput ?? "");
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 This was moved after console output, so error writing to the file does not prevent writing to the build log.

@@ -160,8 +160,7 @@ private void Print(List<TestResult> testResults)
private void PrintFailedTestResult(TestResult testResult)
{
// Save out the error output for easy artifact inspecting
var outputLogPath = Path.Combine(_options.LogFilesOutputDirectory, $"xUnit Failure: {testResult.DisplayName}.log");
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 The source of the error was the use of a : in the file name.

@sharwell sharwell merged commit 35c8818 into dotnet:dev16.0 Feb 20, 2019
@sharwell sharwell deleted the print-test-results branch February 20, 2019 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants