dotnet / sdk

Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
https://dot.net/core
MIT License
2.6k stars 1.04k forks source link

`dotnet publish` fails intermittently on macOS with "error code -10" and no additional information #37472

Open jorgenpt opened 7 months ago

jorgenpt commented 7 months ago

Describe the bug

As a part of our build pipeline, we build a dotnet project on macOS using a vendored dotnet 6.0.302 installation (from Unreal Engine 5.2). Intermittently (maybe 1 out of 150 builds), when there are no changes to any part of the project, when doing an incremental dotnet publish on the project, it fails with error code -10 and no error messages.

To Reproduce

Seemingly, run a dotnet publish --self-contained /p:PublishSingleFile:true repeatedly on macOS on M2 (happens less than 1% of the time).

Exceptions (if any)

We run this same command with the same frequency on Windows and Linux, and have not seemingly encountered it there.

Further technical details

Command output:

/Volumes/Build/ws/1b06a75fab1cf42c/ProjectDir> "/Volumes/Build/ws/1b06a75fab1cf42c/Engine/Binaries/ThirdParty/DotNet/6.0.302/mac-arm64/dotnet" "publish" "./Source/Project.csproj" "-o" "/Volumes/Build/ws/1b06a75fab1cf42c/Binaries/macOS" "-r" "osx-x64" "--self-contained" "true" "/p:PublishSingleFile=true" "-c" "Release" "/p:DefineConstants=CRASH_REPORTING"
Microsoft (R) Build Engine version 17.2.0+41abc5629 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

  Determining projects to restore...
ERROR: Command returned error code -10: "/Volumes/Build/ws/1b06a75fab1cf42c/Engine/Binaries/ThirdParty/DotNet/6.0.302/mac-arm64/dotnet" "publish" "./Source/Project.csproj" "-o" "/Volumes/Build/ws/1b06a75fab1cf42c/Binaries/macOS" "-r" "osx-x64" "--self-contained" "true" "/p:PublishSingleFile=true" "-c" "Release" "/p:DefineConstants=CRASH_REPORTING"

dotnet --info:

.NET SDK (reflecting any global.json):
 Version:   
 Commit:    N/A

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  13.4
 OS Platform: Darwin
 RID:         
 Base Path:   /Volumes/Build/ws/1b06a75fab1cf42c/Engine/Binaries/ThirdParty/DotNet/6.0.302/mac-arm64/sdk/6.0.302/

global.json file:
  Not found

Host:
  Version:      6.0.7
  Architecture: arm64
  Commit:       0ec02c8c96

.NET SDKs installed:
  6.0.302 [/Volumes/Build/ws/1b06a75fab1cf42c/Engine/Binaries/ThirdParty/DotNet/6.0.302/mac-arm64/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.7 [/Volumes/Build/ws/1b06a75fab1cf42c/Engine/Binaries/ThirdParty/DotNet/6.0.302/mac-arm64/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.7 [/Volumes/Build/ws/1b06a75fab1cf42c/Engine/Binaries/ThirdParty/DotNet/6.0.302/mac-arm64/shared/Microsoft.NETCore.App]

Download .NET:
  https://aka.ms/dotnet-download

Learn about .NET Runtimes and SDKs:
  https://aka.ms/dotnet/runtimes-sdk-info
dotnet-issue-labeler[bot] commented 7 months ago

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

nagilson commented 3 months ago

This appears to be a native crash, given it exits immediately after 'Determining Projects to Restore...' without any output. Maybe this is a seg fault. Not sure what the -10 is for either, MS Build would only file 0 or 1.

@agocke Do you think this would be improved in later versions, and is there anything the customer can do to collect a dump for this the next time it occurs?

agocke commented 3 months ago

No great ideas. The Mac Console might give you more info on the error. Otherwise you’ll need to setup core dumps.