facebook-csharp-sdk / facebook-winclient-sdk

Facebook SDK for Windows & Windows Phone
http://facebooksdk.net
Apache License 2.0
61 stars 139 forks source link

WP8 LoginAsync() throws System.UnauthorizedAccessException: Invalid cross-thread access #52

Closed BDash2014 closed 9 years ago

BDash2014 commented 9 years ago

I saw this issue should be solved now, but it is not. In AuthenticateAsync method of WebAuthenticationBroker class , there is try-catch for obtaining root frame (rootFrame = Application.Current.RootVisual as PhoneApplicationFrame;). When obtaining fails it should be delegate to UI thread which is correct, but problem is that root frame is probably not null but still it needs to use dispatcher for UI navigation. I quickly fixed it in my code by forcing delegateToUI to true because I know it will be my case and it's working, but please fix it in nuget :). Some better way of detecting UI thread, something like Deployment.Current.Dispatcher.CheckAccess().

sanjeevdwivedi commented 9 years ago

@BDash2014 I rewrote the login mechanism and this function is not available anymore in the SDK albeit multiple ways of logging in have been made available. Closing the issue since it is not valid anymore.