Error in SpotifyWebClient.cs when trying to fetch PlaybackState
See original GitHub issueHi,
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.
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.Dictionary
2.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.Task
1.InnerInvoke() at System.Threading.Tasks.Task.Execute()
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
In v6 we switched from the
DefaultHeaders
to having a seperatedHttpRequestMessage
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!
Yeah no worries, just reinstalled Windows 10, so gotta get Visual Studio up and running 😄