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

The command "dotnet paket restore" excited with code -532462766 on a fresh SAFE template #621

Closed
Freymaurer opened this issue Jul 2, 2024 · 14 comments

Comments

@Freymaurer
Copy link

Hey guys, i never encountered this error before, but we wanted to setup a SAFE project for a new colleague and we got an error The command "dotnet paket restore" excited with code -532462766. We tested this also for a fresh SAFE stack and still the issue persists. I have no idea why this issue happens. We "solved" it by removing paket and using simple dotnet dependencies but this is obviously no real solution.

This is not my machine, but i will try to answer asap if you want more information on this. But i do not expect you to solve this obscure issue. Just wanted to let you know.

We also tried running dotnet watch run src/Server/Server.fsproj without fake with the same result and tried building the projects which worked just fine.

The machine uses:

  • Win 11
  • .net8.0, node 20 and npm 9

image

@jwthomson
Copy link
Contributor

jwthomson commented Jul 5, 2024

I've definitely seen this error code before. Last time it was to do with missing paket.references from the Shared directory causing Paket to use the wrong version of FSharp - this is now fixed as of 8 months ago.

Maybe these will help diagnose the issue:

  • What version of the SAFE template is being used?
  • What is the output of dotnet --list-sdks?
  • What is the output of dotnet build -v:d? (from the src/Server directory)

@Freymaurer
Copy link
Author

Hello! Thanks for the quick response!

What version of the SAFE template is being used?

The newest version v5.0.6

What is the output of dotnet --list-sdks?

image

What is the output of dotnet build -v:d? (from the src/Server directory)

image

@Larocceau
Copy link
Contributor

Larocceau commented Jul 12, 2024

Duplicate of #612, thanks for your report @Freymaurer! the other issue has a workaround in the discussion

@Larocceau Larocceau marked this as a duplicate of #612 Jul 12, 2024
@Larocceau Larocceau closed this as not planned Won't fix, can't repro, duplicate, stale Jul 12, 2024
@isaacabraham isaacabraham reopened this Aug 15, 2024
@isaacabraham
Copy link
Member

isaacabraham commented Aug 15, 2024

@baronfel ok. I've found some more information on this.

TLDR: If you dotnet watch build from the folder of the project, and you're using Paket, and a version of .NET 8 post 8.0.206, things go wrong. If you dotnet watch build from outside of the folder of the fsproj e.g. dotnet watch build src/server, then it works.

I suspect it's something that's changed since 8.0.206 that has somehow broken Paket. Here are some steps to reproduce:

  1. Install a version of .NET after 8.0.206 (I'm using 8.0.304).
  2. dotnet new SAFE (I'm using 5.0.7).
  3. dotnet watch build src/server - works ✅
  4. cd src/server
  5. dotnet watch build - pops ❌
  6. dotnet build - works ✅
  7. Change global.json to pin to 8.0.206.
  8. dotnet watch build - works ✅
  9. Revert change to global.json.
  10. Clear out everything in Server.fs to just e.g
module Server
[<EntryPoint>]
let main _ = 0
  1. In Server.fsproj, remove the reference to Shared and the Import of Paket.Restore.targets.
  2. dotnet watch build - works ✅

I don't always get a stack trace but when I do, it's this:

dotnet watch � Started
  Determining projects to restore...
  Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=6.0.0.0, Culture=neut
  ral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
  File name: 'System.Runtime, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
     at System.Reflection.RuntimeAssembly.GetType(QCallAssembly assembly, String name, Boolean throwOnError, Boolean ignoreCase, Objec
  tHandleOnStack type, ObjectHandleOnStack keepAlive, ObjectHandleOnStack assemblyLoadContext)
     at System.Reflection.RuntimeAssembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase)
     at System.Reflection.Assembly.GetType(String name, Boolean throwOnError)
     at System.StartupHookProvider.CallStartupHook(StartupHookNameOrPath startupHook)
     at System.StartupHookProvider.ProcessStartupHooks()


C:\Users\IsaacAbraham\code\safeFoo\.paket\Paket.Restore.targets(171,3): error MSB3073: The command "dotnet paket restore" exited with 
code -532462766. [C:\Users\IsaacAbraham\code\safeFoo\src\Server\Server.fsproj]

Also tagging @forki as it could relate to Paket.

Update 1

I've just observed that the "workaround" of calling it from a different folder does not work for dotnet watch run. It only works for dotnet watch build.

@Ryan-Palmer
Copy link

Hello there - just went to update my Mortgage app and hit exactly this! Great timing haha

@Ryan-Palmer
Copy link

FYI my temp workaround was to just add --no-restore to the dotnet watch run command

@isaacabraham
Copy link
Member

ooooh that's interesting

@isaacabraham
Copy link
Member

I was even thinking to add that to the template anyway because it's rarely needed anyway as part of watch run.

@awostenberg
Copy link

experiencing the same error on mac os/x

.paket/Paket.Restore.targets(171,3): error MSB3073: The command "dotnet paket restore" exited with code 134. [src/Shared/Shared.fsproj]

and the @isaacabraham workaround above of pinning the .net sdk in global.json to 8.0.204 works.

@baronfel
Copy link

I've rerun the failing test thread above and both .NET SDK 8.0.400 and 9.0.100-rc.1 work like a charm - I'd highly suggest moving to those feature bands. As it is, this is a regression only on the 8.0.3xx branch from what I can see.

@isaacabraham
Copy link
Member

I'm on 401 and still seeing it. I've also determined that the issue ONLY occurs with the Sdk.Web SDK, not the "regular" one.

@sydsutton
Copy link

sydsutton commented Oct 18, 2024

I came across this error when trying to upgrade .NET6 and .NET7 Safe stack apps to .NET8. With the help of an old Senior Dev., these are the steps that I have been taking to successfully upgrade to .NET8:

  1. Change net6.0 (or net7.0) to net8.0 in all .fsproj files, paket.dependencies, and paket.lock
  2. Change sdk version in global.json to 8.0.303 (or whatever newest version you have downloaded)
  3. Replace "server", dotnet "watch run" serverPath with "server", dotnet "watch run --no-restore" serverPath in the Run target in Build.fs
  4. Remove all version pins in paket.dependencies
  5. Update all tools individually with dotnet tool update {tool}
  6. If the Shared folder doesn't have a paket.references file, add one. (You may need to dotnet paket add FSharp.Core and FsToolkit.Errorhandling to this paket.references file depending on the build errors you get)
  7. dotnet restore from both the Server and Shared folders
  8. dotnet paket install from root
  9. dotnet paket update from root
  10. dotnet run Clean
  11. Delete bin and obj folders
  12. dotnet run
  13. Fix any build/compilation errors that may have popped up because of the updated dependencies

These are the steps that have worked for me at least. Yours might look slightly different.

@kevkov
Copy link

kevkov commented Oct 25, 2024

This worked for me dotnet/sdk#43468 (comment)

@Larocceau
Copy link
Contributor

this issue is resolved by #634

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants