Facebook sdk for Windows Phone The LoginAsync method throws a Facebook.WebExceptionWrapper exception

I am making a Windows Phone 8 application and it uses facebook username to identify users. When they first log in, they see the facebook login dialog, but the next time the user starts the application registration, it happens in the background. This works very well when the phone is connected to the Internet, but if I close the network and try to start the application FacebookSessionClient.LoginAsync methdod returns my session normally, and the application continues to flow normally. But all of a sudden, I get an unhandled exception in my App.cs class.


Here is my stack trace:

$exception {System.Reflection.TargetInvocationException: An exception occurred during the operation, making the result invalid. Check InnerException for exception details. ---> Facebook.WebExceptionWrapper: The remote server returned an error: NotFound. ---> System.Net.WebException: The remote server returned an error: NotFound. at System.Net.Browser.ClientHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult) at System.Net.Browser.ClientHttpWebRequest.<>c__DisplayClasse.<EndGetResponse>b__d(Object sendState) at System.Net.Browser.AsyncHelper.<>c__DisplayClass1.<BeginOnUI>b__0(Object sendState) --- End of inner exception stack trace --- --- End of inner exception stack trace --- at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary() at Facebook.OpenReadCompletedEventArgs.get_Result() at Facebook.Client.FacebookSessionClient.<SendAnalytics>b__0(Object o, OpenReadCompletedEventArgs e) at Facebook.HttpHelper.OnOpenReadCompleted(OpenReadCompletedEventArgs args) at Facebook.HttpHelper.ResponseCallback(IAsyncResult asyncResult, Object userToken) at Facebook.HttpHelper.<>c__DisplayClass2.<OpenReadAsync>b__0(IAsyncResult ar) at System.Net.Browser.ClientHttpWebRequest.<>c__DisplayClass1d.<InvokeGetResponseCallback>b__1b(Object state2)} System.Exception {System.Reflection.TargetInvocationException 

I tried try catch catch many places in my code, but I do not stop there. Also, when it breaks down on app.cs, it shows that the error is coming from another thread.

This is how I call facebook login if user is registered before

  FacebookSession facebookSession = await App.FacebookSessionClient.LoginAsync(); 

And he immediately returns and gives the current session. But after about 10 seconds, the application crashes. Can someone give me a hint how can I handle this error correctly or how can I prevent this? I am using the 0.8 version of facebook sdk.

+4
source share
1 answer

Check this question: Facebook Wrap Wrap

This is the same bug that has already been fixed in the GitHub repository, but is not yet available through NuGet. The solution to your problem is to create Facebook.Client from the source, and not download it using NuGet.

0
source

Source: https://habr.com/ru/post/1492346/


All Articles