Skip to content

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

@lgp1985

Description

@lgp1985

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions