创建新的 dotnet 项目时如何修复“分段错误(核心转储)”?

Osk*_*Zyg 10 c# segmentation-fault .net-core dotnetcorecli

我正在关注https://dotnet.microsoft.com/learn/dotnet/hello-world-tutorial/create

\n

当我尝试创建项目时,我得到以下信息:

\n
oskar@oskarslaptop:~/Programming/Resorvoir-CLI$ dotnet new console -o MyApp\nSegmentation fault (core dumped)\n
Run Code Online (Sandbox Code Playgroud)\n

我已经使用以下命令通过 snap 安装了 dotnet 5.0:

\n
sudo snap install dotnet-sdk --classic --channel=5.0\nsudo snap alias dotnet-sdk.dotnet dotnet\n
Run Code Online (Sandbox Code Playgroud)\n

快照信息:

\n
oskar@oskarslaptop:~/Programming/Resorvoir-CLI$ sudo snap info dotnet-sdk \nname:      dotnet-sdk\nsummary:   Develop high performance applications in less time, on any platform.\npublisher: Microsoft .NET Core (dotnetcore\xe2\x9c\x93)\nstore-url: https://snapcraft.io/dotnet-sdk\ncontact:   https://dot.net/core\nlicense:   unset\ndescription: |\n  .NET Core is the modular and high performance implementation of .NET for creating web applications\n  and services that run on Windows, Linux and Mac. It is open source and it can share the same code\n  with .NET Framework and Xamarin apps.\n  \n  .NET Core is a .NET Foundation project. https://dotnetfoundation.org/\ncommands:\n  - dotnet-sdk.dotnet\nsnap-id:      uHc4y9lWxyqYfxsqcr4xILzAai4L1BHs\ntracking:     5.0/stable\nrefresh-date: today at 13:36 BST\nchannels:\n  latest/stable:    5.0.302                   2021-07-13 (132) 139MB classic\n  latest/candidate: \xe2\x86\x91                                                \n  latest/beta:      \xe2\x86\x91                                                \n  latest/edge:      5.0.202                   2021-04-16 (120) 137MB classic\n  lts/stable:       3.1.411                   2021-07-13 (133) 123MB classic\n  lts/candidate:    \xe2\x86\x91                                                \n  lts/beta:         \xe2\x86\x91                                                \n  lts/edge:         \xe2\x86\x91                                                \n  6.0/stable:       \xe2\x80\x93                                                \n  6.0/candidate:    \xe2\x80\x93                                                \n  6.0/beta:         6.0.100-preview.6.21355.2 2021-07-14 (134) 144MB classic\n  6.0/edge:         \xe2\x86\x91                                                \n  5.0/stable:       5.0.302                   2021-07-13 (132) 139MB classic\n  5.0/candidate:    \xe2\x86\x91                                                \n  5.0/beta:         5.0.100                   2020-11-10 (105) 267MB classic\n  5.0/edge:         \xe2\x86\x91                                                \n  3.1/stable:       3.1.411                   2021-07-13 (133) 123MB classic\n  3.1/candidate:    \xe2\x86\x91                                                \n  3.1/beta:         \xe2\x86\x91                                                \n  3.1/edge:         \xe2\x86\x91                                                \n  2.1/stable:       2.1.816                   2021-05-11 (124) 245MB classic\n  2.1/candidate:    \xe2\x86\x91                                                \n  2.1/beta:         \xe2\x86\x91                                                \n  2.1/edge:         2.1.808                   2020-07-14  (91) 245MB classic\ninstalled:          5.0.302                              (132) 139MB classic\n
Run Code Online (Sandbox Code Playgroud)\n

我的系统(我无法嵌入图像)

\n

Dan*_*ica 12

POP 操作系统基于 Ubuntu。如果您通过 snap install 安装了 dotnet 运行时,则只能通过“sudo dotnet ...”访问它。我在 VS Code 中遇到了同样的问题,它在没有 sudo 的情况下运行 dotnet 命令,并且收到了“分段错误(核心转储)”错误。我通过 apt-get 安装 dotnet 运行时来解决(现在安装在“/usr/bin ...”中并且无需 sudo 即可工作(请参阅: https: //learn.microsoft.com/en-us/dotnet/core/安装/linux-ubuntu#2004- ))


小智 8

我认为这就是快照本身的问题。使用 pacman 代替 snap

sudo snap remove dotnet-sdk
sudo pacman -S dotnet-sdk
Run Code Online (Sandbox Code Playgroud)

有关此问题的更多信息请参见 https://github.com/dotnet/sdk/issues/11639