0

When I start my C# application I occasionally get a single warning from visual studio. It is not an exception, because the catch is not released and the program works fine afterwards. It seems to be timing related as the problem comes and goes depending on how much I log. Is this a bug in libspotify?

Here is a screenshot:

Screenshot of error and context

paddy
  • 60,864
  • 6
  • 61
  • 103
bes51659
  • 28
  • 4
  • I don't think you've given us enough information to answer that. It *could* be a bug in libspotify. But it could also be a mistake in the P/Invoke bindings, or a mistake in your usage. Maybe you've passed a pointer to libspotify and then deallocated the memory while libspotify still had the pointer. Maybe you've accidentally called other libspotify functions on other threads without appropriate locks. What platform are you running on? What C# bindings are you using (e.g. your own or some wrapper library)? What does your program do? Have you got a minimal reproduction? – Weeble May 09 '14 at 10:19
  • My declaration is as follows: (sp_error being an enum) public static extern sp_error sp_session_process_events(IntPtr sessionPtr, out Int32 next_timeout); I do not think it is a missuse as I only seen it happen once per boot. I think I should have seen it again and again if it was a missues. – bes51659 May 09 '14 at 18:54
  • All calls to the lib, including this one, is done on the same thread. (I plan not to use mutex eventually) my (static) session is ok, as I am logged-in when this happens. (even if state is IS_LOADING for some reason) I am running win7, and I started with Jonas Larson's wrapper from 2009 and changed it carefully as libspotify has been updated since. No minimal reproduction as problem seems to come and go when I change the smalles thing, which does suggest to me that there is a "wild write" or timing issue – bes51659 May 09 '14 at 18:54
  • How are you setting the session pointer, and what callbacks are set? I use the C API, not C#, so I can only speculate... But you do get a `notify_main_thread` event when you create the session, before `sp_session_create` returns. If you're processing that event and using a pointer stored in your class, it might not yet be valid. Just a thought... – paddy May 19 '14 at 12:55
  • I have found one 100% way of getting a violation like this. If I try to create a session with an invalid key (11,0,0,0,0,0,0,....) I get this violation and in this case I cannot recover from it. The application crashes. Bug report? – bes51659 Jun 22 '14 at 19:00

0 Answers0