Base solution for your next web application
Open Closed

Swagger exception / Duplicate Element #7752


User avatar
0
rafalpiotrowski created

Hi I have just recently updated to version 7.2.2 from 6.5 and when starting Web.Host I am getting Swagger exception. It say that Element with the same key already exists! How can I debug/findout which Element it is?

INFO  2019-09-28 22:14:32,691 [9    ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 GET http://localhost:22742/Ui  
WARN  2019-09-28 22:14:32,696 [9    ] calization.RequestLocalizationMiddleware - AbpUserRequestCultureProvider returned the following unsupported cultures 'null'.
WARN  2019-09-28 22:14:32,696 [9    ] calization.RequestLocalizationMiddleware - AbpUserRequestCultureProvider returned the following unsupported UI Cultures 'null'.
INFO  2019-09-28 22:14:32,697 [9    ] ft.AspNetCore.Routing.EndpointMiddleware - Executing endpoint 'MyAspNetZeroApplication.Web.Controllers.UiController.Index (MyAspNetZeroApplication.Web.Host)'
INFO  2019-09-28 22:14:32,704 [9    ] ore.Mvc.Internal.ControllerActionInvoker - Route matched with {action = "Index", controller = "Ui", area = ""}. Executing action MyAspNetZeroApplication.Web.Controllers.UiController.Index (MyAspNetZeroApplication.Web.Host)
INFO  2019-09-28 22:14:33,746 [9    ] ore.Mvc.Internal.ControllerActionInvoker - Executing action method MyAspNetZeroApplication.Web.Controllers.UiController.Index (MyAspNetZeroApplication.Web.Host) - Validation state: Valid
INFO  2019-09-28 22:14:34,204 [3    ] ore.Mvc.Internal.ControllerActionInvoker - Executed action method MyAspNetZeroApplication.Web.Controllers.UiController.Index (MyAspNetZeroApplication.Web.Host), returned result Microsoft.AspNetCore.Mvc.ViewResult in 458.5404ms.
INFO  2019-09-28 22:14:34,253 [3    ] Core.Mvc.ViewFeatures.ViewResultExecutor - Executing ViewResult, running view Index.
INFO  2019-09-28 22:14:34,356 [3    ] Core.Mvc.ViewFeatures.ViewResultExecutor - Executed ViewResult - view Index executed in 144.4864ms.
INFO  2019-09-28 22:14:34,356 [3    ] ore.Mvc.Internal.ControllerActionInvoker - Executed action MyAspNetZeroApplication.Web.Controllers.UiController.Index (MyAspNetZeroApplication.Web.Host) in 1652.133ms
INFO  2019-09-28 22:14:34,356 [3    ] ft.AspNetCore.Routing.EndpointMiddleware - Executed endpoint 'MyAspNetZeroApplication.Web.Controllers.UiController.Index (MyAspNetZeroApplication.Web.Host)'
INFO  2019-09-28 22:14:34,359 [3    ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 1667.7219ms 200 text/html; charset=utf-8
INFO  2019-09-28 22:14:37,323 [12   ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 GET http://localhost:22742/swagger/index.html  
WARN  2019-09-28 22:14:37,329 [12   ] calization.RequestLocalizationMiddleware - AbpUserRequestCultureProvider returned the following unsupported cultures 'null'.
WARN  2019-09-28 22:14:37,329 [12   ] calization.RequestLocalizationMiddleware - AbpUserRequestCultureProvider returned the following unsupported UI Cultures 'null'.
INFO  2019-09-28 22:14:37,501 [12   ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 178.4679ms 200 text/html
INFO  2019-09-28 22:14:37,729 [3    ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 GET http://localhost:22742/swagger/v1/swagger.json  
WARN  2019-09-28 22:14:37,733 [3    ] calization.RequestLocalizationMiddleware - AbpUserRequestCultureProvider returned the following unsupported cultures 'null'.
WARN  2019-09-28 22:14:37,733 [3    ] calization.RequestLocalizationMiddleware - AbpUserRequestCultureProvider returned the following unsupported UI Cultures 'null'.
ERROR 2019-09-28 22:14:38,330 [3    ] nostics.DeveloperExceptionPageMiddleware - An unhandled exception has occurred while executing the request.
System.ArgumentException: Element o tym samym kluczu zosta³ ju¿ dodany.
   at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
   at MyAspNetZeroApplication.Web.Swagger.SwaggerOperationFilter.Apply(Operation operation, OperationFilterContext context)
   at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.CreateOperation(ApiDescription apiDescription, ISchemaRegistry schemaRegistry)
   at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.CreatePathItem(IEnumerable`1 apiDescriptions, ISchemaRegistry schemaRegistry)
   at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.<>c__DisplayClass6_0.<CreatePathItems>b__2(IGrouping`2 group)
   at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
   at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.CreatePathItems(IEnumerable`1 apiDescriptions, ISchemaRegistry schemaRegistry)
   at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.GetSwagger(String documentName, String host, String basePath, String[] schemes)
   at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.<Invoke>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware.<Invoke>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Builder.RouterMiddleware.<Invoke>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.<Invoke>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.<Invoke>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Abp.AspNetZeroCore.Web.Authentication.JwtBearer.JwtTokenMiddleware.<>c__DisplayClass0_0.<<UseJwtTokenMiddleware>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.<Invoke>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.<Invoke>d__7.MoveNext()
INFO  2019-09-28 22:14:38,454 [3    ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 725.5123ms 500 text/html; charset=utf-8

1 Answer(s)
  • User Avatar
    0
    rafalpiotrowski created

    I just found this related issue: https://support.aspnetzero.com/QA/Questions/7490

    it worked for me!