Azure / azure-functions-openapi-extension

This extension provides an Azure Functions app with Open API capability for better discoverability to consuming parties
https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.OpenApi/
MIT License
373 stars 195 forks source link

Microsoft.Azure.Functions.Worker.Extensions.OpenApi throws System.IO.FileNotFoundException #626

Open lgp1985 opened 11 months ago

lgp1985 commented 11 months ago

Describe the issue I migrated a function app from .net 6.0 to 8.0 with the Upgrade wizard on Visual Studio 2022, on doing so, I changed the model from utilizing Microsoft.Azure.WebJobs.Extensions.OpenApi to Microsoft.Azure.Functions.Worker.Extensions.OpenApi. My project relies on third party libraries that are outdated, but still usable for referencing models.

To Reproduce Steps to reproduce the behavior:

  1. Run function app
  2. Open link for 'RenderSwaggerUI'
  3. See error

Expected behavior Should be able to see Swagger loading properly, as it's seen with Microsoft.Azure.WebJobs.Extensions.OpenApi, skipping any unused types custom attributes. Feels the code traverses all types regardless of those being used in any parts of swagger.

Screenshots

image

Environment (please complete the following information, if applicable):

Additional context Add any other context about the problem here.

Stack Trace

   at System.ModuleHandle.ResolveType(QCallModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type)
   at System.ModuleHandle.ResolveTypeHandle(Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext) in /_/src/coreclr/System.Private.CoreLib/src/System/RuntimeHandles.cs:line 1341
   at System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) in /_/src/coreclr/System.Private.CoreLib/src/System/Reflection/RuntimeModule.cs:line 261
   at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(MetadataToken caCtorToken, MetadataImport& scope, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, ListBuilder`1& derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctorWithParameters, Boolean& isVarArg) in /_/src/coreclr/System.Private.CoreLib/src/System/Reflection/RuntimeCustomAttributeData.cs:line 1389
   at System.Reflection.CustomAttribute.AddCustomAttributes(ListBuilder`1& attributes, RuntimeModule decoratedModule, Int32 decoratedMetadataToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, ListBuilder`1 derivedAttributes) in /_/src/coreclr/System.Private.CoreLib/src/System/Reflection/RuntimeCustomAttributeData.cs:line 1284
   at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType) in /_/src/coreclr/System.Private.CoreLib/src/System/Reflection/RuntimeCustomAttributeData.cs:line 1151
   at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeMethodInfo method, RuntimeType caType, Boolean inherit) in /_/src/coreclr/System.Private.CoreLib/src/System/Reflection/RuntimeCustomAttributeData.cs:line 998
   at System.Attribute.GetCustomAttributes(MemberInfo element, Type attributeType, Boolean inherit) in /_/src/coreclr/System.Private.CoreLib/src/System/Attribute.CoreCLR.cs:line 463
   at System.Attribute.GetCustomAttribute(MemberInfo element, Type attributeType, Boolean inherit) in /_/src/coreclr/System.Private.CoreLib/src/System/Attribute.CoreCLR.cs:line 522
   at System.Reflection.CustomAttributeExtensions.GetCustomAttribute[T](MemberInfo element, Boolean inherit) in /_/src/libraries/System.Private.CoreLib/src/System/Reflection/CustomAttributeExtensions.cs:line 56
   at Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Extensions.MemberInfoExtensions.ExistsCustomAttribute[T](MemberInfo element, Boolean inherit) in D:\source\azure-functions-openapi-extension\src\Microsoft.Azure.WebJobs.Extensions.OpenApi.Core\Extensions\MemberInfoExtensions.cs:line 27
lgp1985 commented 11 months ago

Hey guys, this is a small fix, and I even proposed a PR for that, can someone look into it?

davidpetric commented 11 months ago

Hi,

Is this project deprecated?