I am able to upload files all day long using the following code, so I know it works.
try
{
var uploaded = await dbx.Files.UploadAsync(
folder + "/" + fileName,
//.WriteMode.Overwrite.Instance,
body: mem);
sharedLinkArg = new Dropbox.Api.Sharing.CreateSharedLinkArg(folder + "/" + fileName);
var link = await dbx.Sharing.CreateSharedLinkAsync(sharedLinkArg);
sharedLink = link.Url;
}
catch (AggregateException ex)
{
SessionHelper.LogErrors("attachhelpers", ex.ToString(), "UploadFile", "system");
return sharedLink;
}
However, if I call it from a webAPI, it fails silently. This means it won't work from our mobile app, which uses the webAPI. It's working for website users.
I can't catch any errors using 'catch (AggregateException ex).' I have been trying different ways of calling it all day long (async/await, task/task.Result).
I have tried different ways to log errors. I know logging from an async method has issues, so what works?
From my logging that does work, everything seems to be fine all the way up until that Try/Catch block, then it fails with no way of knowing what happened. Nothing ever worked locally, so I'm trying to debug from a live server, which doesn't help.
Searching, it looks like there used to be error logs on the Dropbox side. I am not able to locate these anywhere.
Does anyone have any tidbit here that might point me in the right direction? What's different about the webAPI than if a user is on the website pressing a button?
Failing that, anyone want to suggest a better way for me to catch errors from that Try/Catch block. I'm getting nothing.
Thanks,