unchase / Unchase.Swashbuckle.AspNetCore.Extensions

:hammer: A library contains a bunch of extensions (filters) for Swashbuckle.AspNetCore.
https://www.nuget.org/packages/Unchase.Swashbuckle.AspNetCore.Extensions
Apache License 2.0
115 stars 16 forks source link

IncludeXmlCommentsFromInheritDocs with shared project produces 'ArgumentException: An item with the same key has already been added' #28

Closed icnocop closed 1 year ago

icnocop commented 2 years ago

Hi.

Thank you for Unchase.Swashbuckle.AspNetCore.Extensions.

Given a shared project which is referenced by my web application and another referenced assembly, and IncludeXmlComments was called for those two assembly's XML documentation files, when IncludeXmlCommentsFromInheritDocs is called, then the following exception occurs:

System.ArgumentException: An item with the same key has already been added. Key: P:MySharedProject.MyClass.MyPropertyName
   at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
   at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
   at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector)
   at Unchase.Swashbuckle.AspNetCore.Extensions.Extensions.SwaggerGenOptionsExtensions.IncludeXmlCommentsFromInheritDocs(SwaggerGenOptions swaggerGenOptions, Boolean includeRemarks, Type[] excludedTypes)
   at MyWebApplication.Startup.<>c.<ConfigureServices>b__5_28(SwaggerGenOptions options)
   ...

ASP.NET Core 3.1 Unchase.Swashbuckle.AspNetCore.Extensions 2.6.12