Skip to main content
  1. Posts/

Segmentation fault and .NET on Linux

·383 words·2 mins
Image

Segmentation fault and .NET on Linux #

For some time I have re-enabled one of my PC with a good Linux Manjaro, it’s very convenient to run tens of services continuously without having to leave my Mac on or at home.

And I wanted to experience .NET development with VSCode (to do Blazor I admit it) all on my Linux.

Of course I follow the Microsoft tutorials to set up the environment and I start here: https://docs.microsoft.com/en-us/dotnet/core/install/linux-snap

When I get to the “Install SDK” step, we are asked to use this command:

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

Nothing more normal on my Linux (well from my short experience), we use the snap utility to download, install and manage the .NET SDK. I continue with the runtime. So far so good. I end up installing VSCode, still from snap.

And finally comes the long awaited moment to start a new project. As I use VSCode and not Visual Studio it is necessary to create the projects via command line and not via the graphical interface :

dotnet new blazorserver -o BlazorApp --no-https

And then it’s drama! 😭 :

Segmentation fault (core dumped)

Impossible to create projects. The tool crashes no matter what type of project I want to create. So I start looking for a solution on the Internet. After several ten minutes of research I end up on this link: https://github.com/dotnet/sdk/issues/11639

They talk about the DOTNET_CLI_TELEMETRY_OPTOUT variable which is the cause of the problem. After an attempt on my side the behavior persists. No solution seems to work until I see the comment of Wowo10 :

Image

And there to the miracle it works! 🎉

Here are the commands if you need them:

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

Other comments suggest that downloading .NET via pacman and apt-get works but not via snap. So if you also have the problem, I invite you to use these commands to get your .NET SDK working properly.

What is quite strange is that nothing is specified on the Microsoft website and that it seems to come from Snap. However, the problem seems to be present since 2019 even if the ticket is closed only since yesterday. Maybe we’ll get to the bottom of this one day.

Until then, have fun with .NET on Linux!