【问题标题】:How to fix "Segmentation fault (core dumped)" when creating new dotnet project?创建新的 dotnet 项目时如何修复“分段错误(核心转储)”?
【发布时间】:2021-07-25 14:28:51
【问题描述】:

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

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

oskar@oskarslaptop:~/Programming/Resorvoir-CLI$ dotnet new console -o MyApp
Segmentation fault (core dumped)

我已经通过 snap 安装了 dotnet 5.0:

sudo snap install dotnet-sdk --classic --channel=5.0
sudo snap alias dotnet-sdk.dotnet dotnet

快照信息:

oskar@oskarslaptop:~/Programming/Resorvoir-CLI$ sudo snap info dotnet-sdk 
name:      dotnet-sdk
summary:   Develop high performance applications in less time, on any platform.
publisher: Microsoft .NET Core (dotnetcore✓)
store-url: https://snapcraft.io/dotnet-sdk
contact:   https://dot.net/core
license:   unset
description: |
  .NET Core is the modular and high performance implementation of .NET for creating web applications
  and services that run on Windows, Linux and Mac. It is open source and it can share the same code
  with .NET Framework and Xamarin apps.
  
  .NET Core is a .NET Foundation project. https://dotnetfoundation.org/
commands:
  - dotnet-sdk.dotnet
snap-id:      uHc4y9lWxyqYfxsqcr4xILzAai4L1BHs
tracking:     5.0/stable
refresh-date: today at 13:36 BST
channels:
  latest/stable:    5.0.302                   2021-07-13 (132) 139MB classic
  latest/candidate: ↑                                                
  latest/beta:      ↑                                                
  latest/edge:      5.0.202                   2021-04-16 (120) 137MB classic
  lts/stable:       3.1.411                   2021-07-13 (133) 123MB classic
  lts/candidate:    ↑                                                
  lts/beta:         ↑                                                
  lts/edge:         ↑                                                
  6.0/stable:       –                                                
  6.0/candidate:    –                                                
  6.0/beta:         6.0.100-preview.6.21355.2 2021-07-14 (134) 144MB classic
  6.0/edge:         ↑                                                
  5.0/stable:       5.0.302                   2021-07-13 (132) 139MB classic
  5.0/candidate:    ↑                                                
  5.0/beta:         5.0.100                   2020-11-10 (105) 267MB classic
  5.0/edge:         ↑                                                
  3.1/stable:       3.1.411                   2021-07-13 (133) 123MB classic
  3.1/candidate:    ↑                                                
  3.1/beta:         ↑                                                
  3.1/edge:         ↑                                                
  2.1/stable:       2.1.816                   2021-05-11 (124) 245MB classic
  2.1/candidate:    ↑                                                
  2.1/beta:         ↑                                                
  2.1/edge:         2.1.808                   2020-07-14  (91) 245MB classic
installed:          5.0.302                              (132) 139MB classic

【问题讨论】:

    标签: c# .net-core segmentation-fault dotnetcorecli


    【解决方案1】:

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

    sudo snap remove dotnet-sdk
    sudo pacman -S dotnet-sdk
    

    这里有更多关于这个问题的信息 https://github.com/dotnet/sdk/issues/11639

    【讨论】:

    • Pop OS 不是基于 Arch 的发行版,它位于 debain-ubuntu 区域。我认为我不应该在这里使用 pacman?
    【解决方案2】:

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

    【讨论】:

      猜你喜欢
      • 2021-06-23
      • 1970-01-01
      • 1970-01-01
      • 2016-03-13
      • 2017-04-05
      • 2019-09-03
      • 1970-01-01
      • 2017-07-24
      • 2020-02-04
      相关资源
      最近更新 更多