Recently we have /refreshed/ data on our Development Environment/Database. After data refresh, ALL API calls fail with following Error:
Type: System.ArgumentException
Message: An item with the same key has already been added.
StackTrace:
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at System.Collections.ObjectModel.KeyedCollection`2.AddKey(TKey key, TItem item)
at System.Collections.ObjectModel.KeyedCollection`2.InsertItem(Int32 index, TItem item)
at Microsoft.Dynamics.Nav.Service.OData.Modeling.NavEdmModel.AddComplexType(String name, IMetaComplexType metadata)
at Microsoft.Dynamics.Nav.Service.OData.V4.MetaComplexTypesExtensions.AddToModel(IEnumerable`1 complexTypes, INavEdmModel model)
at Microsoft.Dynamics.Nav.Service.Api.ApiBetaModelBuilder.Build(IEnumerable`1 complexTypes, IEnumerable`1 services)
at Microsoft.Dynamics.Nav.Service.OData.NavService.Execute[TResult](HttpRequestMessage request, NavSession session, Func`2 operation, String companyName, Boolean isCompanyContext)
at Microsoft.Dynamics.Nav.Service.OData.NavService.Execute[TResult](Func`2 operation)
at Microsoft.Dynamics.Nav.Service.Api.CachedModelBuilder.Build(INavServiceEnvironment serviceEnvironment, String routeName)
at lambda_method(Closure , ServiceProvider )
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
at Microsoft.AspNet.OData.Routing.DefaultODataPathHandler.Parse(String serviceRoot, String odataPath, IServiceProvider requestContainer, Boolean template)
at Microsoft.AspNet.OData.Routing.DefaultODataPathHandler.Parse(String serviceRoot, String odataPath, IServiceProvider requestContainer)
at Microsoft.Dynamics.Nav.Service.OData.V4.PathHandler.Parse(String serviceRoot, String odataPath, IServiceProvider requestContainer)
at Microsoft.Dynamics.Nav.Service.OData.V4.RouteConstraint.Match(HttpRequestMessage request, IHttpRoute route, String parameterName, IDictionary`2 values, HttpRouteDirection routeDirection)
at System.Web.Http.Routing.HttpRoute.ProcessConstraint(HttpRequestMessage request, Object constraint, String parameterName, HttpRouteValueDictionary values, HttpRouteDirection routeDirection)
at System.Web.Http.Routing.HttpRoute.ProcessConstraints(HttpRequestMessage request, HttpRouteValueDictionary values, HttpRouteDirection routeDirection)
at System.Web.Http.Routing.HttpRoute.GetRouteData(String virtualPathRoot, HttpRequestMessage request)
at System.Web.Http.HttpRouteCollection.GetRouteData(HttpRequestMessage request)
at System.Web.Http.Dispatcher.HttpRoutingDispatcher.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.DelegatingHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Web.Http.HttpServer.<SendAsync>d__0.MoveNext()
Source: mscorlib
HResult: -2147024809
StackTrace:
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at System.Collections.ObjectModel.KeyedCollection`2.AddKey(TKey key, TItem item)
at System.Collections.ObjectModel.KeyedCollection`2.InsertItem(Int32 index, TItem item)
at Microsoft.Dynamics.Nav.Service.OData.Modeling.NavEdmModel.AddComplexType(String name, IMetaComplexType metadata)
at Microsoft.Dynamics.Nav.Service.OData.V4.MetaComplexTypesExtensions.AddToModel(IEnumerable`1 complexTypes, INavEdmModel model)
at Microsoft.Dynamics.Nav.Service.Api.ApiBetaModelBuilder.Build(IEnumerable`1 complexTypes, IEnumerable`1 services)
at Microsoft.Dynamics.Nav.Service.OData.NavService.Execute[TResult](HttpRequestMessage request, NavSession session, Func`2 operation, String companyName, Boolean isCompanyContext)
at Microsoft.Dynamics.Nav.Service.OData.NavService.Execute[TResult](Func`2 operation)
at Microsoft.Dynamics.Nav.Service.Api.CachedModelBuilder.Build(INavServiceEnvironment serviceEnvironment, String routeName)
at lambda_method(Closure , ServiceProvider )
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
at Microsoft.AspNet.OData.Routing.DefaultODataPathHandler.Parse(String serviceRoot, String odataPath, IServiceProvider requestContainer, Boolean template)
at Microsoft.AspNet.OData.Routing.DefaultODataPathHandler.Parse(String serviceRoot, String odataPath, IServiceProvider requestContainer)
at Microsoft.Dynamics.Nav.Service.OData.V4.PathHandler.Parse(String serviceRoot, String odataPath, IServiceProvider requestContainer)
at Microsoft.Dynamics.Nav.Service.OData.V4.RouteConstraint.Match(HttpRequestMessage request, IHttpRoute route, String parameterName, IDictionary`2 values, HttpRouteDirection routeDirection)
at System.Web.Http.Routing.HttpRoute.ProcessConstraint(HttpRequestMessage request, Object constraint, String parameterName, HttpRouteValueDictionary values, HttpRouteDirection routeDirection)
at System.Web.Http.Routing.HttpRoute.ProcessConstraints(HttpRequestMessage request, HttpRouteValueDictionary values, HttpRouteDirection routeDirection)
at System.Web.Http.Routing.HttpRoute.GetRouteData(String virtualPathRoot, HttpRequestMessage request)
at System.Web.Http.HttpRouteCollection.GetRouteData(HttpRequestMessage request)
at System.Web.Http.Dispatcher.HttpRoutingDispatcher.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.DelegatingHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Web.Http.HttpServer.<SendAsync>d__0.MoveNext()
Appreciate any help/insight with this issue.