cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox 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: 

C# api freeze on any api method.

C# api freeze on any api method.

Ch_P
Explorer | Level 3

Hey!
My program gets stucked on any dbx.Files method, for example:

  var x = await dbx.Files.DownloadAsync(folder + "/" + file);

File is very small, 5 bytes, but it gets stuck anyways.
On upload it gets stuck as well, but data get's uploaded, I found uploaded file using dropbox web browser. What problem it can be?

8 Replies 8

Greg-DB
Dropbox Staff

I just tried this line of code and it returned successfully for me. What version number of the SDK do you have installed? Update to the latest, currently v4.9.3, if you're not on that already.

Can you elaborate on what you're seeing? Do you get any error or output at all? How are you seeing it get "stuck"? I recommend stepping through with a debugger, if you haven't already, to see where it hangs.

Also, is there anything that may be interfering with or delaying your connection to content.dropboxapi.com?

Ch_p1
Explorer | Level 3
Hi Grek! Thanks for your reply.
By stuck I mean is doesnt return or executes forever. I have latest Dropbox.api version installed. I see it hangs on awaiting this function and I cant step inside to see where exactly it hangs. Do you have any suggestions?

Greg-DB
Dropbox Staff

What do you mean when you say you "cant step inside to see where exactly it hangs"? Did you connect a debugger, and if so, what happened?

Are there any potential issues with your network connection? E.g., is there any firewall, proxy, or other piece of software that may be interfering? It may be worth trying this on another computer/server on a different network connection to see if that may be the issue.

Ch_p1
Explorer | Level 3
There is no problem with connection because as i said before when I am try to upload file it gets upload, just this function never returns.

Greg-DB
Dropbox Staff

Unfortunately I don't know what may be causing this and I can't reproduce this using the code you shared. Please share a sample project that demonstrates the issue so we can reproduce it here and investigate.

Ch_p1
Explorer | Level 3

Hi Greg!
I returned with piece of code. Can u please point out what is wrong. My application stuck on awaiting download.

class Program
    {
        static void Main(string[] args)
        {
            NotMain();
        }
        static async void NotMain()
        {
            var dbx = new Dropbox.Api.DropboxClient("mysecrettoken");
            var x = await dbx.Files.DownloadAsync("/Folder/File"); // Exits here with code 0.
            System.Diagnostics.Debug.Write(await x.GetContentAsStringAsync()); // Never outputs nothing
        }
    }

Greg-DB
Dropbox Staff

Thanks! I just gave this a try though, and it successfully downloads the file and outputs the file content for me and then exits the program. It doesn't hang for me, so it does sound like there is something about your environment causing the issue. 

(For reference, NotMain is async but your call to it isn't awaited so I added a System.Console.ReadLine(); to Main after the NotMain(); call in order to wait for it to complete. Without that, the program completed execution before the API call did.)

weerasinghe4
New member | Level 2

Just use this code 

 

var dbx = new DropboxClient(AccessToken);
var response = dbx.Files.GetTemporaryLinkAsync(File).Result;
return response.Link;

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    weerasinghe4 New member | Level 2
  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    Ch_p1 Explorer | Level 3
What do Dropbox user levels mean?