File Browser: Adding async task exception handling (#504)

* Replacing Dictionary with ConcurrentDictionary since values are accessed in async contexts

* Adding new method to allow async tasks to be executed in the exception continuation

* Adding unit tests for the aforementioned

* Adding exception handling to async tasks in file browser service

* Updating query execution async handling to use the async version

* Removing unnecesary send result from continuewithonfaulted
This commit is contained in:
Benjamin Russell
2017-10-19 11:25:29 -07:00
committed by GitHub
parent 4b66203dfc
commit 9600125186
5 changed files with 220 additions and 107 deletions

View File

@@ -277,9 +277,12 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution
public void Execute()
{
ExecutionTask = Task.Run(ExecuteInternal)
.ContinueWithOnFaulted(t =>
.ContinueWithOnFaulted(async t =>
{
QueryFailed?.Invoke(this, t.Exception).Wait();
if (QueryFailed != null)
{
await QueryFailed(this, t.Exception);
}
});
}