cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Musicians, convert your MuseScore files to PDF to play music on the go! Learn more here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Code is stuck on await Methods

Code is stuck on await Methods

Leopold_
New member | Level 2

I am trying to implement a Dropbox support in my Maui application on Windows and Android. I have set everything up according to the documentation and basic stuff like getting the email address of my account works well. 

Sadly, anything related to the data on my drive doesn't work. For example, when I call this task from the documentation, the code is stuck on the await method and never responses. No exception is thrown. This happens with every async method regarding the data on my drive, like downloading a file or reading the files. 

What did I do wrong? 

 

async Task Upload(DropboxClient dbx, string folder, string file, string content)
{
    using (var mem = new MemoryStream(Encoding.UTF8.GetBytes(content)))
    {
         var updated = await dbx.Files.UploadAsync(                            <-- a breakpoint here is called
            folder + "/" + file,
            WriteMode.Overwrite.Instance,
            body: mem); //Code does never respond after this breakpoint
        Console.WriteLine("Saved {0}/{1} rev {2}", folder, file, updated.Rev); <-- but the breakpoint here never gets called
    }
}

 

 

1 Reply 1

Greg-DB
Dropbox Staff

I don't see anything wrong in this snippet of code, and it runs successfully for me.

 

When you say "basic stuff like getting the email address of my account works well", it sounds like you're referring to the GetCurrentAccountAsync method. For comparison, that method calls api.dropboxapi.com, whereas methods that interact with file data, such as UploadAsync, call content.dropboxapi.com.

 

Is there anything on your network connection, such as a firewall, VPN, proxy, anti-virus, etc., that may be interfering with the connection to content.dropboxapi.com in particular?

 

Otherwise, it may be due to how you're handling async operations in your app. That would be a more about programming in C#/.NET itself and outside the scope of Dropbox API support, but there are some similar questions here that may be helpful:

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?