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.

Process.Start() fails when a directory exists in the working directory with the same name as the executable

See original GitHub issue

Steps to reproduce

  1. Clone corefxlab repo https://github.com/dotnet/corefxlab
  2. Run ./build.sh
  3. Observe failure to restore pacakges (only on OSX and Ubuntu, package restore works fine on Windows).

From: https://github.com/dotnet/corefxlab/pull/1787 https://ci.dot.net/job/dotnet_corefxlab/job/master/job/ubuntu16.04_release_prtest/807/consoleFull#7440085258bb52e59-de52-4f1c-b131-470db4c594cd

echo "Restoring all packages"
  ./$dotnetExePath restore $myFile /p:VersionSuffix="$BuildVersion"
  ret=$?
  if [ $ret -ne 0 ]; then
    echo "Failed to restore packages."
    exit -1
  fi

Expected behavior

Package restore succeeds on all configurations.

Previous CLI version (2.1.0-preview1-007191) was working as expected.

Actual behavior

Package restore failing with System.ComponentModel.Win32Exception.

18:50:13 System.ComponentModel.Win32Exception (0x80004005): The FileName property should not be a directory unless UseShellExecute is set. 18:50:13 at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo) 18:50:13 at System.Diagnostics.Process.Start() 18:50:13 at Microsoft.DotNet.Cli.Utils.ProcessStartInfoExtensions.Execute(ProcessStartInfo startInfo) 18:50:13 at Microsoft.DotNet.Tools.MSBuild.MSBuildForwardingApp.Execute() 18:50:13 at Microsoft.DotNet.Tools.Restore.RestoreCommand.Run(String[] args) 18:50:13 at Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, ITelemetry telemetryClient) 18:50:13 at Microsoft.DotNet.Cli.Program.Main(String[] args) 18:50:13

Environment data

dotnet cli version 2.1.0-preview1-007228

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
livarcocccommented, Oct 7, 2017

Because you also need to change how you are invoking dotnet:

17:18:12 dotnet-install: Installation finished successfully.
17:18:12 Restoring all packages
17:18:12 ./build.sh: line 66: ./dotnet/dotnetcli: No such file or directory
17:18:12 

This time it failed because it could not find a the file under ./dotnet/dotnetcli. And it won’t because you renamed that folder.

0reactions
ahsonkhancommented, Oct 7, 2017

Ah yes. Good catch. Tyvm.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Process.Start() fails when a directory exists in the working ...
Process.Start() fails when a directory exists in the working directory with the same name as the executable #23720.
Read more >
Process.Start fails and claims "The directory name is invalid."
EXE " - the value is retrieved from the registry beforehand (see GetWordExePathFromWindowsRegistry method in the code below). Since we moved from ...
Read more >
Process.Start Method (System.Diagnostics)
Starts the process resource that is specified by the parameter containing process start information (for example, the file name of the process to...
Read more >
15.2 Filesystem
'init-file — the file loaded at start-up by the Racket executable. The directory part of the path is the same path as returned...
Read more >
Project Import and Build errors in CCS
Error : A project with name 'xyz' already exists in the workspace! This means that another project with the same name already exists...
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