DVD
DVD

Reputation: 1784

Facebook SDK for Windows Phone: InvalidOperationException: Operation is not valid due to the current state of the object

I'm getting this exception when awaiting LoginAsync:

await fb.LoginAsync("user_about_me");

The full stack trace is the following:

{System.InvalidOperationException: Operation is not valid due to the current state of the object.
   at Microsoft.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at Microsoft.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(Task task)
   at Microsoft.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at Microsoft.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at FacebookServiceClient.FbServiceClient.<Login>d__0.MoveNext()}

I'm using Facebook Client 0.5.0.

The strange thing is that this error doesn't always occur, usually when I start a coding session everything is just fine, but then (after a few debug sessions) this exception popups every time. Any thoughts?

Edit: I have this problem even on the SDK github sample

Upvotes: 2

Views: 640

Answers (1)

DVD
DVD

Reputation: 1784

The problem is not anything to do with the operation itself after browsing the code I found out that the problem is when the browser fails to connect to facebook this exception is thrown.

Upvotes: 1

Related Questions