Azure / Azure/azure-functions-openapi-extension

OpenAPI extension does not work when using EF Core >= 3.0

Open
#173 5 comments 1 reaction 0 assignees View on GitHub
Dominant language
C#
Stars
388
Forks
202
PR merge metrics
No merged PRs in 30d

Description

Hi all,

Today I faced an issue when I started to use EF Core in my function app.

Error:
```
Could not load file or assembly 'Microsoft.Extensions.Logging.Abstractions, Version=3.1.16.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.

at System.Signature.GetSignature(Void* pCorSig, Int32 cCorSig, RuntimeFieldHandleInternal fieldHandle, IRuntimeMethodInfo methodHandle, RuntimeType declaringType)
at System.Reflection.RuntimeMethodInfo.FetchNonReturnParameters()
at System.Reflection.RuntimeMethodInfo.GetParameters()
at Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.DocumentHelper.<>c.b__3_4(MethodInfo p)
at System.Linq.Utilities.<>c__DisplayClass1_0`1.b__0(TSource x)
at System.Linq.Enumerable.WhereEnumerableIterator`1.ToList()
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.DocumentHelper.GetHttpTriggerMethods(Assembly assembly)
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)
```

Steps to reproduce:

1. Create brand new Function App project in VS - .NET Core 3.1 / Function App v3
2. Install OpenAPI Extension
3. Run function app
4. Open http://localhost:7071/api/openapi/1.0 in the web browser - it does work
5. Install EF Core 3.1.6
6. Run function app
7. Open http://localhost:7071/api/openapi/1.0 in the web browser - returns an error

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?

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the failure with a .NET Core 3.1 Function App, EF Core 3.1.6, and the OpenAPI extension, then inspect DocumentHelper.GetHttpTriggerMethods and OpenApiTriggerFunctionProvider.RenderOpenApiDocument from the stack trace. Done means the /api/openapi/1.0 endpoint generates its document without the Microsoft.Extensions.Logging.Abstractions assembly-load error when EF Core is installed.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, csharp, openapi
Domain
api, backend, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.