question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error in SpotifyWebClient.cs when trying to fetch PlaybackState

See original GitHub issue

Hi,

I have the code working perfectly, but occasionally I get an error which freezes the software (I’m writing a plugin for other software), and just hangs.

image

System.InvalidOperationException HResult=0x80131509 Message=Collection was modified; enumeration operation may not execute. Source=mscorlib StackTrace: at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource) at System.Collections.Generic.Dictionary2.Enumerator.MoveNext() at System.Net.Http.Headers.HttpHeaders.AddHeaders(HttpHeaders sourceHeaders) at System.Net.Http.Headers.HttpRequestHeaders.AddHeaders(HttpHeaders sourceHeaders) at System.Net.Http.HttpClient.PrepareRequestMessage(HttpRequestMessage request) at System.Net.Http.HttpClient.SendAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken) at System.Net.Http.HttpClient.GetAsync(Uri requestUri, HttpCompletionOption completionOption, CancellationToken cancellationToken) at System.Net.Http.HttpClient.GetAsync(String requestUri) at SpotifyAPI.Web.SpotifyWebClient.<>c__DisplayClass10_0.<DownloadRaw>b__0() in E:\Downloads\SpotifyAPI-NET-master\SpotifyAPI.Web\SpotifyWebClient.cs:line 45 at System.Threading.Tasks.Task1.InnerInvoke() at System.Threading.Tasks.Task.Execute()

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
JohnnyCrazycommented, Jun 4, 2020

In v6 we switched from the DefaultHeaders to having a seperated HttpRequestMessage for each request. This error thus should not occur in the latest version.

If you have more feedback/problems/suggestions, feel free to reply here or open another issue!

1reaction
MorGuuxcommented, May 20, 2019

Yeah no worries, just reinstalled Windows 10, so gotta get Visual Studio up and running 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

PlaybackState
Playback state for a MediaSession . This includes a state like PlaybackState#STATE_PLAYING , the current playback position, and the current control ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found