azure-webjobs-sdk: Cannot build functions with .NET 6 on macOS
Hi,
I’m getting this fatal error at build time when using the .NET 6 previews:
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]
Not sure if it’s on your end or the .NET SDK team…?
OS: macOS .NET SDK : .NET 6 Preview 7 ( 6.0.100-preview.7.21379.14 ) TFM: netcoreapp3.1 Microsoft.NET.Sdk.Functions Version 3.0.13
csproj:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AzureFunctionsVersion>v3</AzureFunctionsVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.13" />
</ItemGroup>
...
$ dotnet --info
.NET SDK (reflecting any global.json):
Version: 6.0.100-preview.7.21379.14
Commit: 22d70b47bc
Runtime Environment:
OS Name: Mac OS X
OS Version: 11.5
OS Platform: Darwin
RID: osx.11.0-x64
Base Path: /usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/
Host (useful for support):
Version: 6.0.0-preview.7.21377.19
Commit: 91ba01788d
.NET SDKs installed:
2.1.806 [/usr/local/share/dotnet/sdk]
3.1.103 [/usr/local/share/dotnet/sdk]
3.1.300 [/usr/local/share/dotnet/sdk]
5.0.100 [/usr/local/share/dotnet/sdk]
5.0.102 [/usr/local/share/dotnet/sdk]
5.0.200 [/usr/local/share/dotnet/sdk]
6.0.100-preview.5.21302.13 [/usr/local/share/dotnet/sdk]
6.0.100-preview.6.21355.2 [/usr/local/share/dotnet/sdk]
6.0.100-preview.7.21379.14 [/usr/local/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.All 2.1.18 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.18 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.3 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.4 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.0-rc.2.20475.17 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.3 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.0-preview.5.21301.17 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.0-preview.6.21355.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.0-preview.7.21378.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.18 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.3 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.4 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.2 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.3 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.0-preview.7.21377.19 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
About this issue
- Original URL
- State: open
- Created 5 years ago
- Reactions: 7
- Comments: 39 (4 by maintainers)
Yep, this is still an issue with RTM, not only previews / RCs. Updated to title of this ticket to reflect it. The only 2 possible resolutions I’ve found:
sudo rm -rf /usr/local/share/dotnet/). Then install .NET 6 (NB! Only works 100% if you are on the latestMicrosoft.Azure.Functions.*nugets, which it looks like you are)So I ran a trace on this:
And in the trace I saw that it was using dotnet 2.1.23 (the oldest I have). Which seemed strange since I thought netstandard2.0 was supported by newer dotnet versions. So I removed dotnet 2.1.23 using:
Building again then succeed and building my original fn app project also succeeded (looks like it used 2.2.8).
So either my dotnet 2.1.23 runtime was broken somehow or it had a problem with
Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator.Console.dll. Either way, removing it worked.I see most of the above
dotnet --infolists contain a 2.1.* version. So I wonder if this applies to anyone else or just me?Also, it seems strange that dotnet seems to prefer the oldest compatible version of the runtime when targeting netstandard2.0?
It’s actually not that easy to reproduce. I even tried with a macOS agent in a GitHub action with the exact same SDKs, and it built fine.
The only common denominator I found is with the sequence in which you install which SDK version matters (which I could not work out how to in a GitHub action).
The installer team looked at it here: https://github.com/dotnet/installer/issues/11951
Recommend reading what their take on it is.
I’m really unsure if this is with the functions SDK or with the installer in general, but finally just accepted it as a odd error with the 2 workarounds provided above.
And a +1 on @RichMercer comment. The same issue of “Failed to initialize CoreCLR, HRESULT: 0x80004005’” applies to
Microsoft.NET.Sdk.Functions.Worker.Sdkas well.