rbeauchamp / Swashbuckle.OData

Extends Swashbuckle with OData v4 support!
Other
129 stars 96 forks source link

Exploring different version at the same time throw an error. #190

Closed maubin-kl closed 4 years ago

maubin-kl commented 6 years ago

In an application with multiple OData versions, configure Swashbuckle.OData to display multiple api versions.

In two separate browser, select two different version and click Explore on both (as fast as possible).

It generates the error below:

500 : {"Message":"An error has occurred.","ExceptionMessage":"Collection was modified; enumeration operation may not execute.","ExceptionType":"System.InvalidOperationException","StackTrace":" at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)\r\n at System.Collections.Generic.List1.Enumerator.MoveNextRare()\r\n at System.Collections.Generic.List1.Enumerator.MoveNext()\r\n at System.Linq.Enumerable.WhereSelectListIterator2.MoveNext()\r\n at System.Linq.Enumerable.d59`1.MoveNext()\r\n at Swashbuckle.OData.ODataSwaggerProvider.GenerateSwagger(String rootUrl, String apiVersion)\r\n at Swashbuckle.OData.ODataSwaggerProvider.<>cDisplayClass4_0.b__1()\r\n at System.Lazy1.CreateValue()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Lazy1.get_Value()\r\n at Swashbuckle.OData.ODataSwaggerProvider.GetSwagger(String rootUrl, String apiVersion)\r\n at Swashbuckle.Application.SwaggerDocsHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)\r\n at System.Net.Http.HttpMessageInvoker.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)\r\n at System.Web.Http.Dispatcher.HttpRoutingDispatcher.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)\r\n at System.Net.Http.DelegatingHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)\r\n at System.Web.Http.Cors.CorsMessageHandler.d0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.HttpServer.d0.MoveNext()"} http://localhost:62670/swagger/docs/v12`