Azure/azure-functions-dotnet-extensions

Azure function v3 fails to start up in Visual Studio 2019 for Mac when using Microsoft.Azure.Functions.Extensions.DependencyInjection

Arash-Sabet opened this issue · 8 comments

The issue is perfectly reproducible by cloning this repository and running the solution in Visual Studio 2019 for Mac.

When the function starts up the following information is displayed on Terminal:

Azure Functions Core Tools (3.0.2358 Commit hash: d6d66f19ea30fda5fbfe068fc22bc126f0a74168)
Function Runtime Version: 3.0.13159.0

System.Private.CoreLib: Could not load type 'Microsoft.Azure.WebJobs.Hosting.IWebJobsStartup2' from assembly 'Microsoft.Azure.WebJobs.Host, Version=3.0.17.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

Further system info:

Operating system: Mac OS Catalina version 10.15.7

=== Visual Studio Community 2019 for Mac ===

Version 8.7.8 (build 4)
Installation UUID: 67aa6aa9-9d70-4bc6-b948-6340f369c763
GTK+ 2.24.23 (Raleigh theme)
Xamarin.Mac 6.18.0.23 (d16-6 / 088c73638)

Package version: 612000093

=== Mono Framework MDK ===

Runtime:
Mono 6.12.0.93 (2020-02/620cf538206) (64-bit)
Package version: 612000093

=== Roslyn (Language Service) ===

3.7.0-6.20427.1+18ede13943b0bfae1b44ef078b2f3923159bcd32

=== NuGet ===

Version: 5.7.0.6702

=== .NET Core SDK ===

SDK: /usr/local/share/dotnet/sdk/3.1.402/Sdks
SDK Versions:
3.1.402
3.1.401
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/msbuild/Current/bin/Sdks

=== .NET Core Runtime ===

Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
3.1.8
3.1.7
2.1.22
2.1.21

=== Xamarin.Profiler ===

'/Applications/Xamarin Profiler.app' not found

=== Updater ===

Version: 11

=== Apple Developer Tools ===

A valid Xcode installation was not found at the configured location: '/Applications/Xcode.app'

=== Xamarin.Mac ===

Xamarin.Mac not installed. Can't find /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/Version.

=== Xamarin.iOS ===

Xamarin.iOS not installed.
Can't find mtouch or the Version file at /Library/Frameworks/Xamarin.iOS.framework/Versions/Current.

=== Xamarin Designer ===

Version: 16.7.0.495
Hash: 03d50a221
Branch: remotes/origin/d16-7-vsmac
Build date: 2020-08-28 13:12:52 UTC

=== Xamarin.Android ===

Not Installed

=== Microsoft OpenJDK for Mobile ===

Java SDK: Not Found

Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Android SDK Manager ===

Version: 16.7.0.13
Hash: 8380518
Branch: remotes/origin/d16-7~2
Build date: 2020-09-16 05:12:24 UTC

=== Android Device Manager ===

Version: 16.7.0.24
Hash: bb090a3
Branch: remotes/origin/d16-7
Build date: 2020-09-16 05:12:46 UTC

=== Build Information ===

Release ID: 807080004
Git revision: 9ea7bef96d65cdc3f4288014a799026ccb1993bc
Build date: 2020-09-16 17:22:54-04
Build branch: release-8.7
Xamarin extensions: 9ea7bef96d65cdc3f4288014a799026ccb1993bc

=== Operating System ===

Mac OS X 10.15.7
Darwin 19.6.0 Darwin Kernel Version 19.6.0
Mon Aug 31 22:12:52 PDT 2020
root:xnu-6153.141.2~1/RELEASE_X86_64 x86_64

@anthonychu Could you please have this issue looked into? It's a kind of blocker for Mac users. Thanks.

Does func start in the terminal work?

@anthonychu No, it doesn't.

You need to be on a newer version of core tools to be able to use the DI feature. Ideally you would be running on core tools version 3.0.2931 but instead you're on 3.0.2358, which is from March. I confirmed this is the problem by downloading your version of core tools and running the functon app - it gave me the same error.

I am not sure how core tools updates are managed in the VS for Mac case. I vaguely recall that a few years ago, it wasn't checking our update feed.. maybe that is still the case? If so, you might want to consider switching to VS code for your functions development as that will definitely prompt you to install updates for the tools as they become available. Otherwise you might need to update the tools yourself. If the tools are managed through brew, then perhaps brew upgrade azure-functions-core-tools@3 will do it?

Update: see answer from @mrward below.

@paulbatum Apparently the issue resides in VS 2019 for Mac because I installed VS on a fresh Mac OS without running brew. I think it makes perfect sense to involve the team who takes care of Visual Studio Mac. Are they on github to CC them?

I am not sure. You might need to go through the technical support option available here:
https://visualstudio.microsoft.com/vs/support/mac/

I'll close this issue as we've confirmed its not a problem with the Microsoft.Azure.Functions.Extensions NuGet package (this repo).

@paulbatum Yes, closing this issue makes sense. I will be reporting it to the technical support team.

Visual Studio for Mac will use brew installed Azure Functions if it is later than the one it ships itself.

Also you can update the Azure Functions sdk (from the feed) from the New Project dialog - Cloud - General - Azure Functions, by clicking the Updated templates available button. Both these require a restart.

image