Alxandr / SpotiFire

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

Access violation when creating session #48

Open eloekset opened 10 years ago

eloekset commented 10 years ago

Every call to Spotify.CreateSession throws an exception and the application crashes with the output 'Access violation'. I've found two closed issues that are similar to this one, but the difference here is that it happens every time I start the WpfTest, WinFormsTest or TestClient projects.

I've tried to turn on "Use Managed Compability Mode" to debug it, but I'm not able to see anything when debugging. I'm just thrown out of the application after the C++ Task::Factory->StartNew(...) has returned.

The output of the console app is:

Enter username and password (a line for each)

Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
   at sp_session_create(sp_session_config* , sp_session** )
   at SpotiFire.Session..ctor(Byte[] applicationKey, String cacheLocation, String settingsLocation, String userAgent) in d:\github\spotifire\spotifire.libspotify\session.cpp:line 230
   at $session$create.run() in d:\github\spotifire\spotifire.libspotify\session.cpp:line 275
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
   at System.Threading.Tasks.Task.ExecutionContextCallback(Object obj)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
   at System.Threading.Tasks.Task.ExecuteEntry(Boolean bPreventDoubleExecution)
   at System.Threading.Tasks.Task.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
Alxandr commented 10 years ago

I'm unable to reproduce this issue. I just downloaded a clean copy of the GitHub repository, opened it up in Visual Studio (2013), compiled and ran the TestClient, and it ran without any problems (except for the fact that the music stopped playing after a few seconds, but that turned out to be due to an aggressive garbage-collector).

eloekset commented 10 years ago

The Source code I tested is from monday. I'll try to update the Source code, rebuild and test again. Maybe the issue is related to a difference in the environment.

Alxandr commented 10 years ago

Yes, I'm guessing it's environmental too. Which makes it a bit hard for me to debug since it's working on all my systems. What version of windows/.NET are you using? x64 or i386? etc.