installer: .NET 6 installer fails builds of Azure Function projects on macOS
Hi,
this is an odd case first registered here: https://github.com/Azure/azure-webjobs-sdk/issues/2755.
It only happens on macOS on a dev machine, and is not possible to reproduce using the GitHub Actions macOS-11 host.
- On a macOS machine, using .NET 5 + .NET 3.1 - building an Azure Functions project works fine.
- Downloading and installing the .NET 6 Preview installer( via https://download.visualstudio.microsoft.com/download/pr/9e02abfd-b421-4c43-8541-482f037ed19c/f61bd4f35c444710016db8b5a7206a97/dotnet-sdk-6.0.100-preview.7.21379.14-osx-x64.pkg ), and building using the .NET 6 preview 7 SDK I get the error :
Metadata generation failed. Exit code: '137' Error: 'Failed to initialize CoreCLR, HRESULT: 0x80004005:
/Users/johnkors/.nuget/packages/microsoft.azure.webjobs.script.extensionsmetadatagenerator/1.2.0/build/Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator.targets(37,5): warning : Failed to initialize CoreCLR, HRESULT: 0x80004005 [/Users/johnkors/kode/blank/fplbot-org/fplbot/src/FplBot.Functions/FplBot.Functions.csproj] /Users/johnkors/.nuget/packages/microsoft.azure.webjobs.script.extensionsmetadatagenerator/1.2.0/build/Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator.targets(37,5): error : Metadata generation failed. Exit code: ‘137’ Error: ‘Failed to initialize CoreCLR, HRESULT: 0x80004005’ [/Users/johnkors/kode/blank/fplbot-org/fplbot/src/FplBot.Functions/FplBot.Functions.csproj]
- Uninstalling .NET 6 previews and re-building with .NET 5 SDK still fails with the same error, even when specifying to build with the .NET 5 SDK in a global.json
The only fix I’ve found, is to first uninstall .NET 6 completely, then re-run the .NET 5 installer. So something is off in the .NET 6 installer package, as I suspect as mentioned in the linked issue. That, or somehow uninstalling .NET 6 is incomplete when following the recommended guidelines.
My dev machine is running macOS 11.15 BigSur (x64)
About this issue
- Original URL
- State: open
- Created 3 years ago
- Comments: 43 (16 by maintainers)
We found a reliable repro using the scripts (and a workaround) but it’s possible pkg installation would hit the same issue. I believe this bug would explain the situation you observed. If anyone is in this state, then running the above workaround should confirm that the problem is not with the binary/host itself, but with the operating system / file system. We did also file an issue with Apple on this, but I don’t have a ticket to link.
@vitek-karas I did confirm your theory that old installers will overwrite the host. https://github.com/dotnet/runtime/issues/61526
That could explain why reinstalling 5.0 is fixing this. Not sure what
Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator.targetsmight be observing in the dotnet shared host though. As @vitek-karas mentioned@johnkors @badgerowluke – just to confirm, you’re not on an M1 machine, right?
For anyone being hit by this, here are the possible workarounds to be unblocked.
Re-installing .NET 5 after .NET 6 resolves the issue again:
[installing .NET 5 after .NET 6]
☝️ Now the .NET 5 executable/launcher is in use instead of the .NET 6 one.
My machine:
@johnkors I didn’t meant to say this issue was wrong. I just was addressing @vitek-karas side assertion about installer behavior which may not be the root cause of this issue you filed. I was spelling out that it would be clearly wrong if the SDK’s installer didn’t honor version of the host. That would be something that could easily be tested and and very specific bug could be opened to address it (and separate that entire issue from this thread).
I don’t think that’s the root cause here, since you mentioned that 6.0 broke you, so it’s not like you have an older SDK overwriting a newer one. If I had to guess, there is something about the 6.0 fxr that broke 5.0, or possibly the 6.0 host (which is expected to overwrite the older version).