question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

dotnet test log results issue with a filename that includes a space - Can't escape the space

See original GitHub issue

I know spaces in file paths are a terrible idea, but I need to deal with this due to the CI system I am using which clones repos into a path that includes a directory with a space in its name I also want all of the test results for multiple projects in a single output directory

I have used a simplistic scenario to illustrate

What I would like to know is if i can escape a space in the path ?

Steps to reproduce

Using powershell on windows

cd /tmp
mkdir test-issue
cd ./test-issue
ls
dotnet new xunit
dotnet test
dotnet test --logger 'trx;logfilename=res.trx'

# Now lets try to use a log file name with a space - Failure !
dotnet test --logger 'trx;logfilename=test res.trx'
> Microsoft (R) Test Execution Command Line Tool Version 15.3.0-preview-20170628-02
> Copyright (c) Microsoft Corporation.  All rights reserved.

> The test source file "C:\tmp\test-issue\res.trx" provided was not found.
> The test source file "C:\tmp\test-issue\res.trx" provided was not found.

# Tried the following escaping all failed
dotnet test --logger 'trx;logfilename="test res.trx"'
dotnet test --logger "trx;logfilename='test res.trx'"

Expected behavior

Would like to be able to escape the logfilename path

Actual behavior

Can’t escape the logfilename path

Environment data

.NET Command Line Tools (2.0.0)

Product Information: Version: 2.0.0 Commit SHA-1 hash: cdcd1928c9

Runtime Environment: OS Name: Windows OS Version: 10.0.15063 OS Platform: Windows RID: win10-x64 Base Path: C:\utilities\dotnet-core-sdks\sdk\2.0.0\

Microsoft .NET Core Shared Framework Host

Version : 2.0.0 Build : e8b8861ac7faf042c87a5c2f9f2d04c98b69f28d

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
peterhuenecommented, Dec 2, 2017

Hi @pmcgrath. Thanks for reporting this issue!

With the latest build out of the master branch, I’m unable to reproduce the problem.

With PowerShell (as it supports both ' and " for arguments):

dotnet test --logger 'trx;logfilename=test res.trx'
...
Results File: ...\test res.trx

With cmd.exe (supports only " for arguments):

dotnet test --logger "trx;logfilename=test res.trx"
...
Results File: ...\test res.trx

I am able to reproduce the issue with 2.0.0, however.

I’m looking into tracking down what might have changed to fix this issue. From the error you’re seeing, I suspect argument wasn’t being properly quoted in 2.0.0, resulting in “res.trx” being interpreted as a separate argument to vstest.

0reactions
livarcocccommented, Dec 5, 2017

Thanks @peterhuene for following through on this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - how to handle spaces in file path if the folder contains ...
By escaping the back slashes you do not have to use the @ symbol. Just another alternative.
Read more >
dotnet test command - .NET CLI
The dotnet test command is used to execute unit tests in a given project.
Read more >
How do I escape spaces in command line in Windows ...
This batch file will output the first argument which cmd passes us. Now, try and run test.bat , setting the value of %1...
Read more >
Is space not allowed in a filename?
Spaces, and indeed every character except / and NUL, are allowed in filenames. The recommendation to not use spaces in filenames comes from ......
Read more >
Chapter 23. Viewing and Managing Log Files
Log files are files that contain messages about the system, including the kernel, services, and applications running on it. There are different log...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found