You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.

Forum Discussion

Edmara's avatar
Edmara
Explorer | Level 3
8 years ago

TaskCanceledException in call ListFolderAsync("/Image/") with app xamarin portable

Code:

 

var list = await client.Files.ListFolderAsync("/Image/");

 

Error:

 

{System.Threading.Tasks.TaskCanceledException: A task was canceled.
at Microsoft.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00031] in <1c7d529d87ec4bdcbde02e9494f3b5ae>:0
at Microsoft.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess (System.Threading.Tasks.Task task) [0x0001c] in <1c7d529d87ec4bdcbde02e9494f3b5ae>:0
at Microsoft.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00009] in <1c7d529d87ec4bdcbde02e9494f3b5ae>:0
at Microsoft.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <1c7d529d87ec4bdcbde02e9494f3b5ae>:0
at Dropbox.Api.DropboxRequestHandler+SendRpcRequestAsync>d__5`3[TRequest,TResponse,TError].MoveNext () [0x000ba] in <392dfbede5b444369f15cf1eb1323eed>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/3511/501e63ce/source/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00027] in /Users/builder/data/lanes/3511/501e63ce/source/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:176
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /Users/builder/data/lanes/3511/501e63ce/source/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /Users/builder/data/lanes/3511/501e63ce/source/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128
at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in /Users/builder/data/lanes/3511/501e63ce/source/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:357
at POC_DropBox.App+<OnDownloadListaClicked>d__3.MoveNext () [0x00063] in C:\POC\POC_DropBox\POC_DropBox\POC_DropBox\App.cs:62 }
  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff
    I can't seem to reproduce this using that code, but a TaskCanceledException can occur of the connection times out. How long does it take before this exception occurs for you? Is there anything that may be interfering with your connection to api.dropboxapi.com?
    • Edmara's avatar
      Edmara
      Explorer | Level 3

      Below is the code, in project ConsoleApplication works perfectly, but cross platform occurs the error.
      I would like to know if someone has already used the ListFolderAsync api in poject portable (cross platform) with Xamarin Android?

        

      Code:

       

      private async void OnDownloadListaClicked()
      {
      var _accessKey = "<REDACTED>";
      using (DropboxClient client = new DropboxClient(_accessKey))
      {
      //this.ListRootFolder(client);
      try
      {
      bool more = true;
      var list = await client.Files.ListFolderAsync("/Image/");
      while (more)
      {
      foreach (var item in list.Entries.Where(i => i.IsFile))
      {
      // Process the file
      }
      more = list.HasMore;
      if (more)
      {
      list = client.Files.ListFolderContinueAsync(list.Cursor).Result;
      }
      }
      }
      catch (Exception ex)
      {
      // Process the exception
      }
      }
      }

       

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,910 PostsLatest Activity: 3 days ago
333 Following

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!