Skip to content

System.ArgumentException: An item with the same key has already been added. Key: limit #567

@smfields

Description

@smfields

Getting this error when trying to make a call to Client.Browse.GetCategoryPlaylists and passing a CategoriesPlaylistsRequest. The CategoriesPlaylistsRequest is

{
    Country = null,
    Limit = 1,
    Offset = null
}

Here's the full stack trace:

System.ArgumentException: An item with the same key has already been added. Key: limit
   at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
   at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
   at SpotifyAPI.Web.RequestParams.AddQueryParam(Dictionary`2 queryParams, PropertyInfo prop, QueryParamAttribute attribute) in D:\Documents\GitHub\SpotifyAPI-NET\SpotifyAPI.Web\Models\Request\RequestParams.cs:line 149
   at SpotifyAPI.Web.RequestParams.BuildQueryParams() in D:\Documents\GitHub\SpotifyAPI-NET\SpotifyAPI.Web\Models\Request\RequestParams.cs:line 76
   at SpotifyAPI.Web.BrowseClient.GetCategoryPlaylists(String categoryId, CategoriesPlaylistsRequest request) in D:\Documents\GitHub\SpotifyAPI-NET\SpotifyAPI.Web\Clients\BrowseClient.cs:line 51
   at MusicPlatform.Spotify.SpotifyPlatform.GetPlaylistsByGenre(Genre genre, PlaylistsGetRequest request) in C:\Users\54962\source\repos\smfields\Boogie\Boogie\MusicPlatform\Models\Implementations\Spotify\SpotifyPlatform.cs:line 141
   at MorseCode.ITask.TaskAwaiterWrapper`1.MorseCode.ITask.IAwaiter<TResult>.GetResult()
   at Groovy.Controllers.PlaylistController.GetPlaylistsByGenre(Platform platform, Genre genre, Nullable`1 limit, Nullable`1 offset) in C:\Users\54962\source\repos\smfields\Boogie\Boogie\Boogie\Controllers\PlaylistController.cs:line 129
   at lambda_method73(Closure , Object )
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions