FBService.GetUserInfo current thread is not in a single-threaded apartment

Nov 1, 2007 at 5:33 AM
Based on CanvasIFrameBasePage sample code, whenever we make a call like this:

Private FBUser As Facebook.Entity.User = FBService.GetUserInfo

we get this error:

ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' cannot be instantiated because the current thread is not in a single-threaded apartment.

Any hints?

Tahnks, Crile
Nov 1, 2007 at 3:30 PM
Edited Nov 1, 2007 at 3:31 PM
Sounds like you're trying to use the FacebookService from a different thread than the one it was instantiated on (the UI thread), which will cause problems since it's a COM component. Unfortunately, I'm not too familiar with multi-threading in ASP.NET, so maybe someone else can give you some advice on how to access it from the point you're at.

I'm thinking about splitting up the FacebookService used in web pages and the one used in desktop apps in a future version of the toolkit, because of some of the problems like this. It seems the current version was mostly developed for the desktop, so there may be a better way to do this than what there is right now. Anyway, it's something I'll keep in mind for the future.