3
votes

It's very simple to describe:

  • Create a new solution using the "Azure Functions" template from Visual Studio 2019 (16.4.1).
  • Change the TargetFramework to ".NET Core 3.1".
  • It will be created with Microsoft.NET.Sdk.Functions (1.0.29).
  • Update it to the latest version (3.0.1).
  • It will not work, because now we will need some other nuget packages:
    • Microsoft.Azure.WebJobs.Core (3.0.14)
    • Microsoft.Azure.WebJobs.Extensions.Http (3.0.2)
  • At this moment, the application runs in the emulator. Just start the debugger, and the console window shows that everything is fine and working.

  • Now add the Microsoft.EntityFrameworkCore (3.1.0) package

At this point, we didn't touch any line of code, and we just added the latest versions of the given nuget packages, also setting the latest target framework. Nonetheless, the Azure Functions application doesn't work anymore, throwing this error, when starting the emulator with or without the debugger:

Microsoft.Azure.WebJobs.Host: Error indexing method 'Function1'.
Microsoft.Azure.WebJobs.Host: Cannot bind parameter 'log' to type ILogger. Make sure the parameter Type is supported by the binding. If you're using binding extensions (e.g. Azure Storage, ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. builder.AddAzureStorage(), builder.AddServiceBus(), builder.AddTimers(), etc.).

1
The problem appears also if you just refer a different project (class library) that includes Entity Framework Core: that was my situation giving the problem. - Andrea
Looking at the inner dependencies, I see that all the nuget packages refer to Microsoft.Extensions.Logging(3.1.0), Microsoft.Extensions.Logging.Abstractions(3.1.0), Microsoft.Extensions.Logging.Configuration(2.1.0), so they shouldn't conflict each other. - Andrea
.NET Core 3 support for Azure Functions is still (Dec 2019) in preview - maybe let the Azure Functions team know about this problem? - marc_s
Good point, marc_s: but I just tried using .NET Core 3.0 and .NET Core 2.2, and the error(s) is exactly the same... - Andrea
marc_s: see a comment below. Using .NET Core 2.2 and EF Core 2.2.6 it works, still maintaining the other packages over version 3... It looks weird, to me, anyway... :-) - Andrea

1 Answers

2
votes

Update: Just tested and pushed an update for 3.1.0 - I'd check out my project and try to figure out if you are pulling in some other conflicting dependencies - but that is working with 3.1.0 and netcoreapp3.1

https://github.com/jeffhollan/functions-chsarp-entitycore-3

-- Original Answer

Had this working with entity core 3.0.1. Haven’t yet tried with 3.1.0 but can check out later. For now this should work