tntwist / NL.Serverless.AspNetCore

Hosting an AspNet Core App inside an Azure Function V3 HTTP Trigger
MIT License
20 stars 3 forks source link

Unable to resolve service for type 'System.Diagnostics.DiagnosticListener' while attempting to activate 'Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware' #30

Closed sirgamut closed 3 years ago

sirgamut commented 4 years ago

Having some trouble whenever EntityFrameworkCore is referenced to the Web App project.

After some testing it appears to throw the exception when any middleware is attempting to retrieve a service during the ApplicationBuilder.Build call. I was able to replicate this on the sample and on a new solution.

Thought that perhaps something was getting lost amongst method invocation calls on the WebApp Startup class in the FunctionsHostStartup<>.BuildFunctionsRequestHandler handler but after stepping through the code I can't see anything.

Any help would be appreciated with this.

EntityFrameworkCore 3.1.8 NL.Serverless.AspNetCore.AzureFunctionsHost 3.0.9

tntwist commented 4 years ago

Hi, I can reproduce this behavior. It seems that there is an incompatible dependencie in EF Core >= 3.1.4

As you can see the Version of "System.Diagnostics.DiagnosticSource" was increased from 4.7.0 to 4.7.1 with EF Core 3.1.4

3.1.3 image

3.1.4 image

It seems that versions from EF Core > 3.1.4 are incompatible at the moment. Sorry for now the workaround will be to use EF Core 3.1.3 😞

sirgamut commented 4 years ago

@tntwist thanks for looking into this. Following on from your findings I found an issue over at Azure/Azure-Functions#1613 which mentions this problem also. Hopefully this gets picked up and sorted soon.

tntwist commented 4 years ago

@stipdav Nice. I think its good to leave this issue open till it is fixed in the function runtime.

tntwist commented 3 years ago

Hi, I just released a new version with support for the new isolated function worker. You could use this version in order to fix this problem. See here.

tntwist commented 3 years ago

Just released the nuget Package. You can upgrade now and this issue should be fixed.