question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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.<GetHttpTriggerMethods>b__3_4(MethodInfo p)
   at System.Linq.Utilities.<>c__DisplayClass1_0`1.<CombinePredicates>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?

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

1reaction
Skovvartcommented, Aug 5, 2021

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).

0reactions
DanielHeadcommented, Nov 29, 2021

I’m facing the same issues, could it be related to #281?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Enriched Web API Documentation using Swagger/OpenAPI in ...
Search and select the "ASP.NET Core Web API" template and click "Next". Name the new project (e.g. as "TutorialWebApiDocumentation"), select the ...
Read more >
Using OpenAPI with .NET Core
OpenAPI is a specification for describing RESTful APIs. First, I'll show you how to use OpenAPI to describe the APIs provided by an...
Read more >
c# - services.AddSwaggerGen() giving error
I had problem, that. IServiceCollection does not contain a definition for 'AddSwaggerGen'. I turnes out, that I installed Swashbuckle.
Read more >
Swagger OpenAPI Configurations in ASP.NET Core Web API
In this tutorial we learned about Swagger OpenAPI specification and how can we integrate our ASP.NET Core Web API to define and configure...
Read more >
Get started with Swashbuckle and ASP.NET Core
Learn how to add Swashbuckle to your ASP.NET Core web API project to integrate the Swagger UI.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found