Alxandr / SpotiFire

A project to make a SpotifyClient in C#
http://nudoc.azurewebsites.net/SpotiFire
40 stars 19 forks source link

await Playlist never returns #50

Closed NQuirmbach closed 10 years ago

NQuirmbach commented 10 years ago

Hey,

first of all i would like to thank you for this library, it's exactly what i was looking for.

But i have one issue:

            PlaylistContainer playlistContainer = await session.PlaylistContainer;

            for (int i = 0; i < playlistContainer.Playlists.Count; i++)
            {
                Playlist playlist = await playlistContainer.Playlists[i];
            }

The line await playlistContainer.Playlists[i] never returns. Do you have any idea what might be the problem here?

Alxandr commented 10 years ago

It's a bit hard to say without any more context/testing. What version of SpotiFire are you using? The source-code or the one from NuGet?

NQuirmbach commented 10 years ago

At first i tried it with the source-code and then created a version with the nugget-package (v. 0.1.41.0).

Unfortunately both versions dont work. Here is my code so far, just a simple console-application for testing purpose.

I'm using VS 2012 with .NET Framework 4.5.

    static void Main(string[] args)
    {
        DoWork().Wait();
    }

    static async Task DoWork()
    {
        try
        {
            Session session = await Spotify.CreateSession(applicationKey, cache, settings, "SpotifyRemote");

            Error error = await session.Login("*****************", "*******************", false);

            if (error != Error.OK)
            {
                return;
            }

            PlaylistContainer playlistContainer = await session.PlaylistContainer;

            for (int i = 0; i < playlistContainer.Playlists.Count; i++)
            {
                Playlist playlist = await playlistContainer.Playlists[i];

            }
        }
        catch (Exception ex)
        {
            ConsoleExt.WriteLine("An Error occured! {0}", ConsoleColor.Red, ex);
        }
    }
}

image

Alxandr commented 10 years ago

Does it not return for all the playlists?

NQuirmbach commented 10 years ago

No, it just freezes the code and never returns a value. I noticed a weird thing: I can load the starred playlist.

            Playlist starred = await session.Starred;

But the line

                Playlist playlist = await playlistContainer.Playlists[i];

just freezes the code.

ChrisBrandhorst commented 10 years ago

@NQuirmbach Some more question to answer:

ChrisBrandhorst commented 10 years ago

Closing this because of no further feedback from the issuer.