Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
lgp1985 opened this issue Nov 21, 2023 · 2 comments

Comments

@lgp1985
Copy link

lgp1985 commented Nov 21, 2023

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 added a commit to lgp1985/azure-functions-openapi-extension that referenced this issue Nov 21, 2023
@lgp1985
Copy link
Author

lgp1985 commented Nov 22, 2023

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

@davidpetric
Copy link

Hi,

Is this project deprecated?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants