Paket icon indicating copy to clipboard operation
Paket copied to clipboard

Error -1073740791 when running paket.exe in a Windows Docker image from dotnet/msbuild

Open Dirk-Kuypers opened this issue 10 months ago • 4 comments

I am trying to build my software in a Windows Server ltsc2022 image with a full Visual Studio 2022 installation (version 17.12). When I run .paket/paket.exe restore it just does apparently nothing, running it from 'dotnet restore' fails with code -1073740791.

...paket\Paket.Restore.targets(171,3): error MSB3073: The command ""C:\git\MyProject.paket\paket.exe" restore" exited with code -1073740791.

Any idea how to debug this? Is there a runtime missing somehow in the Docker image? Running the stuff locally on Win 11 just works.

Dirk-Kuypers avatar Jan 30 '25 16:01 Dirk-Kuypers

@Dirk-Kuypers normally, if this occurs, you should be able to see the full paket invocation in the error message.

Can you try to look for it and then, issue the reported command itself, to see the actual output?

Maybe the command output could be reported, but that involve implementing the logic in MSBuild target file that is shipped with paket.

@chethusk, any idea / hints how to tackle this?

smoothdeveloper avatar Jan 30 '25 17:01 smoothdeveloper

I extracted the individual commands from the msbuild file and executed them directly, but unfortunately this does not give any hint. When invoking paket.exe (the dotnet tool wrapper), there isn't any output -- just the exit code. This output here is directly from a GitLab-CI job running a windows container (Windows Server ltsc2022 image with a full Visual Studio 2022 installation (version 17.14))

$ dotnet --info
.NET SDK:
 Version:           9.0.300
 Commit:            15606fe0a8
 Workload version:  9.0.300-manifests.af4147de
 MSBuild version:   17.14.5+edd3bbf37
Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.20348
 OS Platform: Windows
 RID:         win-x64
 Base Path:   C:\Program Files\dotnet\sdk\9.0.300\
.NET workloads installed:
There are no installed workloads to display.
Configured to use loose manifests when installing new manifests.
Host:
  Version:      9.0.5
  Architecture: x64
  Commit:       e36e4d1a8f
.NET SDKs installed:
  9.0.300 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
  Microsoft.AspNetCore.All 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.16 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 9.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 9.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 8.0.16 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 9.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found:
  x86   [C:\Program Files (x86)\dotnet]
    registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
Environment variables:
  Not set
global.json file:
  Not found
Learn more:
  https://aka.ms/dotnet/info
Download .NET:
  https://aka.ms/dotnet/download
$ dotnet tool install paket --tool-path ".\.paket" --version "[9.0.2]"
Welcome to .NET 9.0!
---------------------
SDK Version: 9.0.300
----------------
Installed an ASP.NET Core HTTPS development certificate.
To trust the certificate, run 'dotnet dev-certs https --trust'
Learn about HTTPS: https://aka.ms/dotnet-https
----------------
Write your first app: https://aka.ms/dotnet-hello-world
Find out what's new: https://aka.ms/dotnet-whats-new
Explore documentation: https://aka.ms/dotnet-docs
Report issues and find source on GitHub: https://github.com/dotnet/core
Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli
--------------------------------------------------------------------------------------
You can invoke the tool using the following command: paket
Tool 'paket' (version '9.0.2') was successfully installed.
$ dotnet tool list --tool-path ".\.paket"
Package Id      Version      Commands
-------------------------------------
paket           9.0.2        paket   
$ .paket\paket.exe --version

No further output, just the message "ERROR: Job failed: command terminated with exit code -1073740791".

Maybe this exit code "-1073740791" is directly liked to the Fail Fast Exception "0xC0000409" (same number in hex). So something very early went terribly wrong. Maybe some important runtime is missing in the image.

jbaehr avatar Jul 11 '25 15:07 jbaehr

This really seems to be paket specific. I tried another dotnet tool written in F#, Fantomas, and it just works.

$ dotnet tool install fantomas --tool-path ".\.paket" --version 7.0.3
You can invoke the tool using the following command: fantomas
Tool 'fantomas' (version '7.0.3') was successfully installed.
$ .paket\fantomas --version
Fantomas v7.0.3+fab1bd8fbb2023eeab53efbacff1ed93a1346597

jbaehr avatar Jul 11 '25 16:07 jbaehr

It looks like there is "only" an issue with the generated tool shim, generated by the dotnet tool install --tool-path command. Executing the IL-merged paket.exe included in the package works:

$ .paket/.store/paket/9.0.2/paket/9.0.2/tools/paket.exe --version
Paket version 9.0.2+a9b12aaeb8d8d5e47a415a3442b7920ed04e98e0

And running the entry point directly using dotnet works as well:

$ dotnet .paket/.store/paket/9.0.2/paket/9.0.2/tools/netcoreapp3.1/any/paket.dll --version
Paket version 9.0.2+a9b12aaeb8d8d5e47a415a3442b7920ed04e98e0

I can also exclude an issue with the folder naming. Installing fantomas into .fantomas/ just works and installing paket into .fantomas/ just crashes.

jbaehr avatar Jul 14 '25 12:07 jbaehr