title: How to troubleshoot exit code 139 in dotnet core 3.1 container on a Mac M1?
body: <p>I recently got an M1 Mac powerbook, thinking that I could code in C# on dotnet core 3.1. My previous development environment was Windows 10 where we used linux containers.</p>
  <p>I can build and start my containers without issue. But when I use them the main api host dies with error 139. The docker community says this is a segmentation fault.</p>
  <p>Based on the log, the code is making a rest call to Google for Recaptcha.</p>
  <pre><code>_logger.LogInformation(&quot;About to call rest api on {RecaptchaVerificationEndpointV2}&quot;);
  var response = await _restClient.ExecuteAsync(request);
  _logger.LogInformation(&quot;Called rest api&quot;);          
  </code></pre>
  <p>The log has &quot;About to call...&quot; but not &quot;Called...&quot;. This is the first call outside the container's network.</p>
  <p>My question is - how can I troubleshoot this?</p>
  <p>I guess that either there is some incompatibility with the platform (e.g. that dotnet 3.1 has a limitation on arm64) OR a firewall is blocking the call.</p>
  <p>The only information I have is the code 139. Which is shown both in docker and in rider:
  <a href="https://i.stack.imgur.com/YYt4U.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YYt4U.png" alt="enter image description here" /></a></p>
  <p>As background, I have dotnet 6.0.1 installed. Docker is current -
  4.4.2 (73305).</p>
  <p>The container that dies is based on this image:</p>
  <pre><code>FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 AS base
  </code></pre>
  <p>I got the same result with <code>mcr.microsoft.com/dotnet/core/aspnet:3.1.416-bullseye-arm64v8</code>.</p>
  <p>Everything I've read from MS says this should be supported. Based on <a href="https://docs.microsoft.com/en-us/dotnet/core/install/macos" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/dotnet/core/install/macos</a> I tried installing libgdiplus.</p>
  <p>When i try building for platform=linux/amd64, i get a different error:</p>
  <pre><code>#23 13.60 qemu: uncaught target signal 11 (Segmentation fault) - core dumped
  ------
  failed to solve: rpc error: code = Unknown desc = executor failed running [/bin/sh -c dotnet restore ./********.csproj]: exit code: 139
  </code></pre>
  <p>(project name removed).</p>