lastfm icon indicating copy to clipboard operation
lastfm copied to clipboard

Scrobbler.ScrobbleAsync() sometimes throws "StackOverflowException: Value was either too large or too small for an Int32"

Open Reyth3 opened this issue 7 years ago • 2 comments

As I mentioned in the title, sometimes when I'm scrobbling some data to last.FM I get this exception. Here is the stack trace:

 at System.Convert.ToInt32(Double value)
 at IF.Lastfm.Core.Api.Commands.Track.ScrobbleCommand.SetParameters()
 at IF.Lastfm.Core.Api.Commands.PostAsyncCommandBase`1.<ExecuteAsyncInternal>d__3.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 IF.Lastfm.Core.Scrobblers.ScrobblerBase.<ScrobbleAsyncInternal>d__15.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 MusicBoxComponents.BackgroundScrobbler.<Run>d__1.MoveNext()

I'm using the SQLiteScrobbler with an SQLite file to store my cache.

Here's the data I tried to scrobble:

{
    "IgnoredReason":null,
    "Artist":"ALI PROJECT",
    "AlbumArtist":null,
    "Album":"卑弥呼外伝",
    "Track":"卑弥呼外伝",
    "TimePlayed":"2017-10-06T23:17:30.1612461+02:00",
   "ChosenByUser":true,
   "Duration":"00:07:03"
}

Am I setting some value incorrectly?

Thank you!

Edit: Is this because of the ChosenByUser value? It seems to be the only parameter being set directly using Convert.ToInt32.

Reyth3 avatar Oct 06 '17 21:10 Reyth3

Thanks for the report @Reyth3 , I will investigate this soon. #105 and #107 is the priority right now however.

rikkit avatar Nov 15 '17 13:11 rikkit

@rikkit actually, turned out it was my out-of-process background task having trouble with parsing the JSON into a scrobble object.

Still, it would be great if you could add some sort of an indicator that the scrobble data is incorrect (throw specific exception when the scrobble or any of the required values is null or something to that effect).

Cheers!

Reyth3 avatar Nov 16 '17 16:11 Reyth3