azure-functions-core-tools
azure-functions-core-tools copied to clipboard
Dotnet 6.0 Azure function v4 build error - Visual Studio for Mac
Build Error
/Users/user2/.nuget/packages/microsoft.azure.webjobs.script.extensionsmetadatagenerator/4.0.1/build/Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator.targets(37,5): error : Metadata generation failed. Exit code: '137' Error: 'Failed to initialize CoreCLR, HRESULT: 0x80004005'
Done building target "_GenerateFunctionsExtensionsMetadataPostBuild" in project "testfunc.csproj" -- FAILED.
Done building project "testfunc.csproj" -- FAILED.
Build FAILED.
/Users/user2/.nuget/packages/microsoft.azure.webjobs.script.extensionsmetadatagenerator/4.0.1/build/Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator.targets(37,5): warning : Failed to initialize CoreCLR, HRESULT: 0x80004005
/Users/user2/.nuget/packages/microsoft.azure.webjobs.script.extensionsmetadatagenerator/4.0.1/build/Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator.targets(37,5): error : Metadata generation failed. Exit code: '137' Error: 'Failed to initialize CoreCLR, HRESULT: 0x80004005'
1 Warning(s)
1 Error(s)
func version
4.0.3971
Visual Studio Enterprise 2022 for Mac Preview
Version 17.0 Preview (17.0 build 5186)
Azure function .csProj config
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.0.1" />
</ItemGroup>
<ItemGroup>
<None Update="host.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="local.settings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</None>
</ItemGroup>
</Project>
Hi there, it seems a .NET 6 install breaks your Function app builds from what I can tell by reading this useful thread on it: https://issueexplorer.com/issue/dotnet/installer/11951. They're talking about reinstalling .NET 5. I also got this issue but was able to get around it another way by doing some clean up with my SDK and Runtimes currently installed.
I'd recommend downloading the .net uninstaller from here: https://github.com/dotnet/cli-lab/releases
Once it's running use the following command to see what you currently have installed, as a bonus it will also tell you which SDKs and runtimes are being used by Visual Studio - don't remove these.
./dotnet-core-uninstall list
I decided on what to remove by using dotnet sdk check
and removed anything that said there's an update available (as long as that update was already in the list).
Then use the command line to delete your sdk --sdk
or runtime --runtime
e.g.
sudo ./dotnet-core-uninstall remove 5.0.401 --sdk
Here's what my current SDK/Runtime setup in case you want to copy mine:
andrewbenson@Andrews-MacBook-Pro-2 ~ % dotnet sdk check
.NET SDKs:
Version Status
------------------------
3.1.416 Up to date.
5.0.404 Up to date.
6.0.101 Up to date.
.NET Runtimes:
Name Version Status
------------------------------------------------------
Microsoft.AspNetCore.App 3.1.22 Up to date.
Microsoft.NETCore.App 3.1.22 Up to date.
Microsoft.AspNetCore.App 5.0.13 Up to date.
Microsoft.NETCore.App 5.0.13 Up to date.
Microsoft.AspNetCore.App 6.0.1 Up to date.
Microsoft.NETCore.App 6.0.1 Up to date.
hope this helps
Thank you I have cleaned and kept only 6.0, now i am getting other error and it seems related to https://github.com/Azure/azure-functions-core-tools/issues/2873
Azure Functions Core Tools
Core Tools Version: 3.0.3904 Commit hash: c345f7140a8f968c5dbc621f8a8374d8e3234206 (64-bit)
Function Runtime Version: 3.3.1.0
[2021-12-16T19:06:41.567Z] Found /Users/sowmyan/Projects/testfun2/testfun2/testfun2.csproj. Using for user secrets file configuration.
[2021-12-16T19:06:43.064Z] Cannot create directory for shared memory usage: /dev/shm/AzureFunctions
[2021-12-16T19:06:43.064Z] System.IO.FileSystem: Access to the path '/dev/shm/AzureFunctions' is denied. Operation not permitted.
VS 2022 for mac trying to load the function 3 instead of 4
dotnet sdk check
.NET SDKs:
Version Status
------------------------
6.0.101 Up to date.
.NET Runtimes:
Name Version Status
------------------------------------------------------
Microsoft.AspNetCore.App 6.0.1 Up to date.
Microsoft.NETCore.App 6.0.1 Up to date.
When I created my v4 function app, I did it from vscode using the Azure Functions extention. That seemed to install the necessary v4 core tool for me (that's what I got a glimpse of in the output window), perhaps give that a try then. Hope VS Code can help solve your issue: https://docs.microsoft.com/en-us/azure/azure-functions/create-first-function-vs-code-csharp?tabs=in-process
Thanks Andrew. Yes VS code works , issue is with VS 2022 for Mac
@toklive Brill. However I haven't been able to get the debugger to attach in VSCode, so I'm unable to hit any breakpoints in my HttpTrigger function - I am using...
Azure Functions Core Tools
Core Tools Version: 4.0.3971 Commit hash: d0775d487c93ebd49e9c1166d5c3c01f3c76eaaf (64-bit)
Function Runtime Version: 4.0.1.16815
Debugger attaches fine on a console app though so seems that it's just a problem for Function apps then. For now I'm not sure how to fix this issue but may open it up in a new ticket.
Edit: So I got it to work finally, not really sure what I did to get it to fix - closed vscode, cleaned project, started new function project from scratch and all of a sudden 'Attach to NET Funcions' worked.
Thanks for the update @andrew-benson
I was able to fix it with the uninstaller, but after a visual studio (for Mac) update it broke again. Uninstalling doesn't seem to do the trick anymore.
Reinstalling .NET 5 SDK does resolve the issue
Thanks Johnny - reinstall fixed it for me too
When I am trying to start my function app with this command "func start". It throws error "Failed to initialize CoreCL". This problem occurs when creating a new project with command line in Mac
Reinstalling .Net SDK 5.0 does resolve the issue.
Ok, upgraded .Net SDK 6 to latest, my V4 isolated function failed with above. Had to install latest .Net 5 SDK and then it started working again.
Same, had to reinstall 5.0.408 (latest) even if it was already installed
Once I removed all the unnecessary runtimes and sdks as well as
Microsoft.NETCore.App 2.1.23 .NET 2.1 is out of support.
Mine started working
EXCEPT I'm still not able to run a .NET 6 isolated Azure Function project locally - just build and publish
.
Thank you @andrew-benson your solution worked for me, I had the same error: JetBrains Rider and Azure Function, Mac Os 12.5
I updated .net 6 SDK version 6.0.401, it working fine.
macOS Monterey 12.6 dotnet sdk 6.0.401 azure-functions-core-tools@4 4.0.4785
Project is .Net 6.0 isolated process function
I am seeing this issue when building with the command line and with VS Code.
Installing dotnet 5 also worked for me(to run a dotnet 6 isolated v4 azure function)
Context & Problem I installed .NET 7.0 RC2 (.NET 7.0.100-rc.2.22477.23
) recently.
And I got this error, when building my Azure Functions project:
Error: Metadata generation failed. Exit code: '137'
Solution johnkors wrote (2021):
What I've found so far, is that after any install of .NET 6 preview/rc, I have to re-install .NET 5 to fix it. I don't really have to uninstall .NET 6 at all. As long as i run the .NET 5 installer after the .NET 6 installer, all is good.
Due to timing of .NET 7.0 just coming out, I didn't expect that reinstalling .NET 5.0 would help. But this worked:
- Install .NET 7.0 RC2
- Installed .NET 5.0
.NET 5.0 SDK (v5.0.408) - macOS x64 Installer! - GUI
Weird!
I wiped out my system and installed dotnet 7 and that seems to have resolved the build issue for me.
Had same issue, reinstalling SDK v5 solved it.