Open mogrodniczak opened 3 years ago
Same issue seems to occur with other extensions such as <PackageReference Include="Microsoft.Extensions.Http" Version="3.1.15" />
that also has a dependency to Microsoft.Extensions.Logging.Abstractions
.
(as long as you are injecting ILogger
in your HttpTrigger functions).
A workaround seems to be using constructor-based injection for ILogger
instead (though this is likely dependent on using IoC based functions)
Hi @Skovvart, thank you for your suggestion. Your workaround works well If you are not using the OpenApiSecurity attribute. If I have it in my function decoration I get this error:
Exception has been thrown by the target of an invocation.
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean wrapExceptions, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& hasNoDefaultCtor)
at System.RuntimeType.CreateInstanceDefaultCtorSlow(Boolean publicOnly, Boolean wrapExceptions, Boolean fillCache)
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, Boolean wrapExceptions)
at System.Activator.CreateInstance(Type type, Boolean nonPublic, Boolean wrapExceptions)
at System.Activator.CreateInstance(Type type)
at Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.DocumentHelper.GetSecurityOAuthFlows(OpenApiSecurityAttribute attr)
at Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.DocumentHelper.GetOpenApiSecurityRequirement(MethodInfo element, NamingStrategy namingStrategy)
at Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Document.Build(Assembly assembly, OpenApiVersionType version)
at Microsoft.Azure.WebJobs.Extensions.OpenApi.OpenApiTriggerFunctionProvider.RenderOpenApiDocument(HttpRequest req, String version, String extension, ExecutionContext ctx, ILogger log)```
I am guessing that the the above is a separate issue, where your OpenApiSecurityAttribute
implementation lacks a parameterless constructor (see #168 for some more context).
Not sure if this is still relevant, I was able to work around this issue by downgrading EF Core to 3.1.13
I'm facing the same issues, could it be related to #281?
Hi all,
Today I faced an issue when I started to use EF Core in my function app.
Error:
Steps to reproduce:
so EF Core 3.1.16 requires Microsoft.Extensions.Logging.Abstractions >= 3.1.16
It seems that the OpenAPI extension can work only when it is < 3.0.
Do you have any insight into it?