This project is read-only.

User.GetPlaylists() NullReferenceException

Apr 16, 2015 at 12:53 PM
Edited Apr 16, 2015 at 12:56 PM
Hey there!
First of all, you've done a great job, this library is really well structured! :)

However I ran into a little error. In my code I have this section:
var user = await User.GetCurrentUserProfile(AuthenticationToken);
var playlists = await user.GetPlaylists(AuthenticationToken);
Unfortunatly user.GetPlaylists() throws a NullReferenceException.

Here's an excerpt of the call stack:
   at Microsoft.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at Microsoft.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(Task task)
   at Microsoft.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at Microsoft.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at SpotifyWebAPI.User.<GetPlaylists>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at MediaAlarm.PlaylistBrowser.<InitPlaylistView>d__e.MoveNext()
I don't know if this is related to your code, because no one else seems to get this error, but maybe you could help me out anyways?

P.S.: Everything else works just fine, getting saved tracks for example is no problem.

Edit: Does this have something to do with the scope-setting? I currently use "playlist-read-private" only, and not playlist-write-... etc.
Apr 16, 2015 at 3:55 PM
Edited Apr 16, 2015 at 4:17 PM
Edit: Thought I solved it, but I was wrong, still getting the error, but only if access token is "fresh" (not expired) and
playlists are (or would be) returned.
Edit2: Sometimes it's working, sometimes not.

Be sure to have a look at my issue-ticket, though :D