I don't believe I'm calling any task returning methods without await their result.
Below is the code from the view model for a command that is bound to the view using data binding. Note that the code below is 'simplified' so that is sufficiently illustrative of what I'm trying to achieve.
There are no warnings in the build about non-awaited tasks.
I have verified that exceptions are caught by putting a throw new Exception() inside of the second SubmitEditsAsync(Map map), and the error is caught and handled. It looks like the error is occurring outside of the call stack (on a separate thread) in the ArcGIS Runtime.
private async void SubmitEditsAsync(OfflineArea offlineArea)
{
try
{
await SubmitEditsAsync(offlineArea.Map);
}
catch (Exception e)
{
await _dialogHandler.ShowAlertAsync(e);
}
}
private async Task SubmitEditsAsync(Map map)
{
var syncTask = await OfflineMapSyncTask.CreateAsync(map);
syncTask.SyncOfflineMap(new OfflineMapSyncParameters() { SyncDirection = SyncDirection.Upload });
var job = syncTask.SyncOfflineMap(new OfflineMapSyncParameters()
{
RollbackOnFailure = true,
SyncDirection = SyncDirection.Upload
});
var result = await job.GetResultAsync();
}