core icon indicating copy to clipboard operation
core copied to clipboard

.NET 7 RC1 dotnet build fails without errors on MAC M1

Open esskar opened this issue 3 years ago • 19 comments

Description

I was switching from .NET 7 Preview 7 to .NET 7 RC1 yesterday. Everything runs ok, but after some builds and runs, dotnet stops building my project.

╰─ dotnet build                                                        ─╯
MSBuild version 17.4.0-preview-22428-01+14c24b2d3 for .NET

Build FAILED.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:00.00

It's the second time this happens. I need to restart the machine to get it working again. Deleting obj and/or bin folder does not help.

Configuration

MSBuild version 17.4.0-preview-22428-01+14c24b2d3 for .NET Tye version 0.11.0-alpha.22111.1+3edef5428949c518c078844d6438e5ba86fce600

.NET SDK: Version: 7.0.100-rc.1.22431.12 Commit: f1cf61e1c0

Runtime Environment: OS Name: Mac OS X OS Version: 12.6 OS Platform: Darwin RID: osx.12-arm64 Base Path: /usr/local/share/dotnet/sdk/7.0.100-rc.1.22431.12/

Host: Version: 7.0.0-rc.1.22426.10 Architecture: arm64 Commit: 06aceb7015

.NET SDKs installed: 6.0.400 [/usr/local/share/dotnet/sdk] 7.0.100-preview.7.22377.5 [/usr/local/share/dotnet/sdk] 7.0.100-rc.1.22431.12 [/usr/local/share/dotnet/sdk]

.NET runtimes installed: Microsoft.AspNetCore.App 6.0.8 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.0-preview.7.22376.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.0-rc.1.22427.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 6.0.8 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.0-preview.7.22375.6 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.0-rc.1.22426.10 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

Other architectures found: None

Environment variables: Not set

global.json file: Not found

Information

When this happens, vs code is not finding any references. Everything is signaled as red and unknown in vs code.

esskar avatar Sep 29 '22 20:09 esskar

This is also happening on 4.2 GHz Quad-Core Intel Core i7 iMAC.

wickedw avatar Oct 01 '22 18:10 wickedw

Can you please let us know how I can remove the .Net 7 version ? the dotnet-core-uninstall does not work and VS preivew automtically installed this version

livehop avatar Oct 02 '22 22:10 livehop

I'm having the same issue, passing --disable-build-servers to dotnet build seems to get it to build again.

GabrielCappelli avatar Oct 02 '22 23:10 GabrielCappelli

Thanks! -- for now I just ran :

dotnet new globaljson

and then changd the globaljson of my project to

{ "sdk": { "version": "6.0.401" } }


Good to know you have the option you provided as well!

livehop avatar Oct 03 '22 00:10 livehop

We're experiencing w/Intel CPUs like @wickedw. May be helpful to correct the title.

Is there an env var for disabling build servers? Would be helpful for cross compile.

jburnett avatar Oct 04 '22 17:10 jburnett

@rainersigwald is this related to msbuild?

michaelgsharp avatar Oct 10 '22 16:10 michaelgsharp

Very plausibly. dotnet/sdk#28369 disables MSBuild Server for GA. Please try setting the environment variable DOTNET_CLI_DO_NOT_USE_MSBUILD_SERVER=1--if that resolves the issue the GA change will also take care of it.

cc @rokonec

rainersigwald avatar Oct 10 '22 16:10 rainersigwald

Reproed consistently for me in Ubuntu. After setting the env variable and building once, it seems like things are working again, even after unsetting the environment variable. This might involve some sort of state corruption.

agocke avatar Oct 11 '22 06:10 agocke

@agocke Can you please share with me repro steps? I would like to verify that it is known bug to us.

rokonec avatar Oct 11 '22 07:10 rokonec

I downloaded the rc-1 tar.gz, extracted it to a local directory (over my preview 5 copy), then simply went to a directory and did dotnet build. Every invocation of MSBuild failed in the same way. I tried deleting a bunch of files -- I even wiped the files I extracted and re-extracted them. That didn't help.

Interestingly enough, if I extracted the files to a different directory, and tried again, that worked.

After I found this thread, I then set the environment variable and rebuilt and the problem went away immediately. I then removed the environment variable and tried building again. That also worked.

There must be some sort of cached information that causes this issue.

agocke avatar Oct 11 '22 20:10 agocke

And just to confirm, did you download the Arm64 version since you mentioned you're on Mac M1?

mairaw avatar Oct 12 '22 03:10 mairaw

I use the DOTNET_CLI_DO_NOT_USE_MSBUILD_SERVER=1 and it works, then I removed the env it failed again. The env is mandatory for a successful build. I'm on archlinux x64.

sep2 avatar Oct 12 '22 06:10 sep2

@sep2 Great. That workaround will no longer be required with the final 7.0.100 SDK (but is still needed for RC2). Sorry for the inconvenience!

rainersigwald avatar Oct 12 '22 14:10 rainersigwald

Yup I downloaded arm64

agocke avatar Oct 12 '22 16:10 agocke

Just an FYI— I've been working with .NET Core since its 1.0 days and haven't encountered this issue until now. However, with .NET 8 RC2, the problem surfaced for the first time. Fortunately, setting the DOTNET_CLI_DO_NOT_USE_MSBUILD_SERVER environment variable did the trick and resolved the issue.

devmobasa avatar Nov 02 '23 14:11 devmobasa

@rokonec is @Ibro's experience expected? I thought server was off by default still.

rainersigwald avatar Nov 02 '23 14:11 rainersigwald

I'm uncertain whether the DOTNET_CLI_DO_NOT_USE_MSBUILD_SERVER environment variable is still relevant to my issue. It seemed to resolve the issue temporarily, but the fix has been hit-or-miss lately.

devmobasa avatar Nov 09 '23 09:11 devmobasa

@Ibro This is highly unexpected, env var DOTNET_CLI_DO_NOT_USE_MSBUILD_SERVER has been deprecated in net8 see https://github.com/dotnet/sdk/blob/62aa4b7c6c2f6fcf673ec2d9aacc8ca07f51913b/src/Cli/Microsoft.DotNet.Cli.Utils/MSBuildForwardingAppWithoutLogging.cs#L19 and is no longer in our codebase at all. Please verify that given build is configured for net8 rc2 and if so please provide us with aka.ms/binlog I have tested it on net8 rc2 Windows and msbuild server is still off by default - as designed.

rokonec avatar Nov 09 '23 15:11 rokonec

Seems to be fine with .NET 8.

devmobasa avatar Nov 20 '23 10:11 devmobasa