runtime: Segmentation Fault on .NET 5 build for standalone for ARM

Description

This bug is reproduceable on any version of .NET 5 after preview 6.

  1. Build a standalone executable for Linux ARM, and use the produce single file option
  2. It will give segmentation fault at the point on your code you instantiate a new TcpListener class. It works fine if you try on windows x64.

This is the line at where you will see it:

_listener = new TcpListener(address, port);

If you use the TRIM within the produce single file, it misses some assemblies that are used for webclient (given the same settings from before). This won’t work even when trying on windows x64.

Configuration

  • Which version of .NET is the code running on? .NET 5 Preview 8 (can use any version after Preview 6)

  • What OS and version, and what distro if applicable? Archlinux latest version

  • What is the architecture (x64, x86, ARM, ARM64)? ARM

  • Do you know whether it is specific to that configuration? It won’t work on ARM but works fine on Windows x64 (but will fail if TRIM is used)

Regression?

  • Did this work in a previous build or release of .NET Core, or from .NET Framework? Yes it worked on all versions before preview 7.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 33 (24 by maintainers)

Most upvoted comments

oh well… got #SegmentationFault when running ‘dotnet new’ using the latest #dotnet 5 linux arm64 sdk … reverting back to dotnet_v5.0.100-preview.1.20111.5 … will try again when a new arm64 version is released

If I understood correctly, the TypeLoadException only happens when they decide to trim their application given that we are likely missing an annotation somewhere causing the linker to strip out a method that is required at runtime. The segfault problem seems to be the one that happens only when they decide to publish as a single file, but seems to not happen when unchecking that, which is what we probably want to take a look at. @HKunogi to confirm if what I understood is correct.

Yes, exactly that, about the version, its: 5.0.100-preview.8.20417.9

unknown (1) unknown (2) unknown unknown (3) If unmark the Produce single file, it stops giving the issue and works fine. Also, if trim unused assemblies is marked, gives this issue: Untitled

I don’t think so, in dotnet 5 we formed a v-team that has been working on making sure our framework is linker-friendly so we’ve been adding annotations on the framework and I just want to make sure that this issue doesn’t mean that we missed one. We can take a look.