azure-functions-openapi-extension icon indicating copy to clipboard operation
azure-functions-openapi-extension copied to clipboard

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

Open lgp1985 opened this issue 1 year ago • 2 comments

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

  • OS: Windows 11 Pro Versão 23H2 (Compilação do Sistema Operacional 22631.2715)
  • Browser Edge
  • Version 119.0.2151.72 (Compilação oficial) (64 bits)

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 avatar Nov 21 '23 14:11 lgp1985

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

lgp1985 avatar Nov 22 '23 16:11 lgp1985

Hi,

Is this project deprecated?

davidpetric avatar Nov 28 '23 16:11 davidpetric