Alxandr / SpotiFire

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

Access Violation when trying to start the server #12

Closed kivle closed 12 years ago

kivle commented 12 years ago

Hi,

I've been meaning to start a Spotify project of my own in C#, and from the looks of it you have the most up to date libspotify-wrapper available. I'm running on Windows 7 Professional 64-bit, with VS 2010. When I try to start your server application from VS, I immediately get an access violation in libspotify. I've also tried to create a small console test application of my own, but still get the same issue.

Googeling around it seems that many others are having problems with access violations when wrapping the library for either Java or .NET. Have you found a way around this or is this just something that randomly happens on some machines?

kivle commented 12 years ago

Ok, doing some more google-work I found a tip that enabling debugging of unmanaged code should do the trick. It seems this actually works for both my console application, and your server application. It does not, however, work with a winforms-application. Seems like libspotify generally is quite tricky to work with, and that I will have to use your solution to use a service to do the actual interaction, and then create a WPF/WinForms application to interact with it. Is this the reason why you originally went for this model?

Alxandr commented 12 years ago

Both yes and no. I've never been able to make libspotify run from a GUI-thread, and I think that have something to do with STA or something, but I do not know. However, I also picked a service model to be able to remote the application. Oh, and one more thing; try to create the spotify-server on a separate thread in a winform/wpf application. That might work. Though you might need to set some settings on the thread. I don't know (sorry).

kivle commented 12 years ago

Very interesting. I will try to use a seperate background thread. If that doesn't help I'll use your approach with a service. I guess it's quite handy anyway to have the possibility to control Spotify remotely from a laptop for instance.

Thanks a lot for answering. I guess the issue can be closed now.

Alxandr commented 12 years ago

Please let me know if it worked or not.