fsprojects / fsprojects/Paket

DependencyManager Win32Exception on non windows

Open
#3,992 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
F#
Stars
2.1k
Forks
528
Avg merge
1d 12m
Merged PRs (30d)
54

Description

Description

Didn't found how to add private nuget sources in F# scripts. So tried to install paket as a package manager.
Followed instructions at https://fsprojects.github.io/Paket/fsi-integration.html
But this throws Win32Exception on Macos

Repro steps
  1. downloaded the FSharp.DependencyManager.Paket nuget sending the line to F# interactive
#r "nuget: FSharp.DependencyManager.Paket"
  1. Copy the manager dll to the folder where current sdk is installed
cp ~/.nuget/packages/fsharp.dependencymanager.paket/6.0.0-beta8/lib/netstandard2.0/FSharp.DependencyManager.Paket.dll \
    /usr/local/share/dotnet/sdk/5.0.103/FSharp/
  1. Created a script, referencing a package using paket
#r "paket: nuget FParsec"

open FParsec
  1. runned the script
$ dotnet fsi paketdeps.fsx
Expected behavior

Expected it would add a package to the script

Actual behavior
❯ dotnet fsi paketdeps.fsx
:paket> using /Users/username/.nuget/packages/paket/5.257.0/tools/paket.exe
exception while resolving dependencies: System.ComponentModel.Win32Exception (8): Exec format error
   at System.Diagnostics.Process.ForkAndExecProcess(String filename, String[] argv, String[] envp, String cwd, Boolean redirectStdin, Boolean redirectStdout, Boolean redirectStderr, Boolean setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec)
   at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
   at System.Diagnostics.Process.Start()
   at ReferenceLoading.PaketHandler.ResolveDependenciesForLanguage$cont@176(String targetFramework, String scriptDir, IEnumerable`1 prioritizedSearchPaths, String fileType, String workingDir, FileInfo workingDirSpecFile, String rootDir, FSharpList`1 packageManagerTextLines, String loadScript, Unit unitVar)
   at ReferenceLoading.PaketHandler.ResolveDependenciesForLanguage(String fileType, String targetFramework, IEnumerable`1 prioritizedSearchPaths, String scriptDir, String scriptName, IEnumerable`1 packageManagerTextLinesFromScript)
   at ReferenceLoading.PaketHandler.ResolveDependencies(String targetFramework, String scriptDir, String scriptName, IEnumerable`1 packageManagerTextLinesFromScript)
   at Microsoft.FSharp.DependencyManager.Paket.PaketDependencyManagerProvider.ResolveDependencies(String scriptDir, String mainScriptName, String scriptName, IEnumerable`1 packageManagerTextLines, String targetFramework)


/Users/username/Projects/fsharp/paketdeps.fsx(3,6): error FS0039: The namespace or module 'FParsec' is not defined.
Known workarounds

use nuget instead of paket as a package manager

#r "nuget: FParsec"

open FParsec
Additional info
  • macos catalina,
  • .net sdk. 5.0.103
  • paket cli tool - tried both latest stable 5.257.0 and latest prerelease 6.0.0-beta8
    in both cases is shown the usage of 5.257.0 version

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the ReferenceLoading.PaketHandler.ResolveDependenciesForLanguage stack-trace entry point and reproduce the failure using the shown F# script on macOS. Compare how the Paket dependency manager invokes paket.exe with the documented non-Windows setup. Done means the Paket reference resolves on macOS without the Win32Exception and FParsec becomes available.

Written by the indexing model from the issue text.

Assessment

Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.