We're making changes to the Community, so you may have received some notifications - thanks for your patience and welcome back. Learn more here.
Forum Discussion
NetSecCSU3
6 years agoNew member | Level 2
Dropbox Asynchronous API Calls Throwing "ArgumentOutOfRangeException"
I am building a Unity game that needs to utilize file storage of some sort. Because of its examples, documentation, and support, I decided to go with Dropbox API 2.0.
I am using the code from Dropb...
Greg-DB
6 years agoDropbox Staff
[ Cross-linking for reference: https://stackoverflow.com/questions/58399992/unity-netcore-dropbox-api-2-0-throwing-argumentoutofrangeexception-on-async-d ]
I'm afraid we probably can't offer much support on this particular issue, as we don't officially support Unity, and the error appears to be occurring deeper in the stack, outside of Dropbox code anyway.
It looks like this exception is occurring during the TLS connection with content.dropboxapi.com, inside Mono.Unity.UnityTlsContext.ProcessHandshake.
The reference to 'TrustFailure' would seem to indicate an issue with the certificate verification, but the Dropbox API content servers are being served with a valid certificate though.
The top exception seems to be a generic index exception anyway though, so it may just be a bug in ProcessHandshake.
I'd try eliminating the use of `InitializeCertPinning`, as well as the use of the custom `HttpClient` (the SDK will use a default one if you don't supply one).
- NetSecCSU36 years agoNew member | Level 2
Getting rid of the custom client and IntializeCertPinning does get rid of the Exception, however, no file is ever uploaded, which means the Certificate issue likely still applies. My next question then would be: is there any way to provide Unity with a static dropbox certificate beforehand like such?: Unity - Manual - Networking Issues
- Greg-DB6 years agoDropbox Staff
Thanks for trying that and letting me know. I'm glad to hear that cleared up that exception.
There are other ways for uploads like this to fail, so it may not still be a certificate issue. The file would be committed by the `UploadSessionFinishAsync` method. What does that method return for you now? Or, does code execution even reach there? I recommend adding some logging and/or stepping through with a debugger to see what's happening, since you don't currently seem to be checking the return value for the upload session calls.
Anyway, I'd also try adding back each of the `InitializeCertPinning` and the custom HTTP client individually to see which one is causing the issue (if it is just one of them). If it's just the custom client, you may still be able to use `InitializeCertPinning`. Otherwise, I can't offer much guidance on how to configuring Unity to pin the certificate. You can find the certificate information and code here though, in case it helps. In any case, the Dropbox API servers aren't self-signed, and the certificate pinning isn't strictly necessary. All Dropbox API calls require TLS, and the pinning would just be an additional security measure.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,875 PostsLatest Activity: 2 months agoIf 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!