Forum Discussion

donaldp's avatar
donaldp
Collaborator | Level 9
4 years ago

Running into an odd problem when using UploadAsync

Hi,

 

    Same program as I've discussed before (.net running on UWP and Android) I'm having an issue when it runs on Android (works as expected on UWP. In fact I haven't even touched this particular code in months, but has only just stopped working on Android). In this case I've over-ridden the app settings with a hard-coded path so that it really is the exact same file in the exact same location on both devices. 😉

   Trying to get the metadata for the file I'm uploading, Visual Studio is saying that my "metadata" variable, which is the output of the operation, is null! It's an output variable, so it's taking the output of the operation and having that assigned to it. It starts out null, and then (hopefully) ends up not null. Normally only get Null exception for an input file, not an output file!

   I'm not getting any messages from Dropbox - errors or otherwise - so I can't be sure if UploadAsync is actually running or not. i.e. is VS throwing the exception at the start or the end of the operation? Is there a way to get UploadAsync to display some output either way so that I can see if it's executing? Or do you have any ideas on what's happenning here? I'm thinking it's not getting that far, cos if it ran and failed then the code should then go to the catch statement. See screenshot of code (VS is stopping at line 305, but only on Android, not UWP).

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

    The Dropbox SDK doesn't offer a way to enable more verbose output, such as for UploadAsync to offer more information about the operation. It's unclear exactly what's occurring here, or why you'd get a NullReferenceException on the variable being used as output, if that is what's happening. Can you print out the full stack trace for the exception? That may offer some insight.

    • donaldp's avatar
      donaldp
      Collaborator | Level 9

      Hi Greg,

         The call stack just shows that the method is being called and is at line 305. See screenshot.

      • Greg-DB's avatar
        Greg-DB
        Icon for Dropbox Staff rankDropbox Staff

        Thanks, looking at that line then, is it possible DxClient itself is null? The screenshot is cut off, but I presume there aren't any other variables referenced that I can't see. The Locals pane shows stream and commitInfo as defined, but DxClient isn't shown.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.5,948 PostsLatest Activity: 6 hours ago
351 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!