await UserAsync.GetLoggedUser() returning null

Jun 26, 2015 at 2:09 PM
Edited Jun 26, 2015 at 2:25 PM

Some times I get null when calling:
UserFriends = await UserAsync.GetFriends(await UserAsync.GetLoggedUser())
Here the ex:
at Microsoft.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at Microsoft.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(Task task)
at Tweetinvi.UserAsync.<GetFriends>d__10.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at TwitterClient.MainPage.<OnNavigatedTo>d__0.MoveNext() in <FILE_PATH_HERE>\\View\\MainPage.xaml.cs:line 80
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<ThrowAsync>b__3(Object state)
at System.Threading.WinRTSynchronizationContext.Invoker.InvokeCore()

Message "User cannot be null"
Can be the nested await?

Will update when I find a test case to reproduce, if able.
Jun 26, 2015 at 3:26 PM

You need to be aware that Tweetinvi is executing a WebRequest each time you invoke User.GetLoggedUser.
This can be executed only 15 times in a 15 minutes timeframe. If you invoke this operation more than 15 times, twitter will throw an exception and tweetivni will return null by default.

If you want to learn more about Rate Limits, please visit this page.
If you want to learn more about Exception Handling, please visit this page.

Let me know if this is of any help.