diff options
author | Matt Ward <matt.ward@microsoft.com> | 2019-08-06 14:21:07 +0300 |
---|---|---|
committer | monojenkins <jo.shields+jenkins@xamarin.com> | 2019-08-06 14:33:24 +0300 |
commit | 3146c65e4bd98032fef92c8372caab70d3e50554 (patch) | |
tree | 18a8c77e507ad4c3acb45ff796814b6112163ced /main | |
parent | 3e9f20c34e9ef5f5cdd7369701492e218719dbf3 (diff) |
[Ide] Fix unobserved task exception in CustomToolService
If an exception is thrown by a custom tool then this may result in
an unobserved task exception. The exception is set on a task
completion source whose task is only observed if a build is waiting
for custom tools to complete or another custom tool is run again for
the same file.
There does not seem to be any need to set the exception on the task
completion source since all errors are reported in the IDE and
callers of the CustomToolService Update or UpdateAsync do not get
access to this task. Now the task completion source has its result
set instead of setting the exception since the only thing needed is
to ensure the task is completed.
Fixes VSTS #958223 - System.Threading.Tasks.TaskCanceledException exception
in System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess()
Diffstat (limited to 'main')
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CustomTools/CustomToolService.cs | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CustomTools/CustomToolService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CustomTools/CustomToolService.cs index b3ebc6f454..b8f24ce35d 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CustomTools/CustomToolService.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CustomTools/CustomToolService.cs @@ -316,8 +316,6 @@ namespace MonoDevelop.Ide.CustomTools // Execute the generator - Exception error = null; - // Share the one pad for all Tool output. Pad pad = null; @@ -343,7 +341,6 @@ namespace MonoDevelop.Ide.CustomTools try { await tool.Generate (monitor, project, file, result); } catch (Exception ex) { - error = ex; result.UnhandledException = ex; } @@ -366,11 +363,7 @@ namespace MonoDevelop.Ide.CustomTools UpdateCompleted (monitor, file, genFile, result, false); } finally { FileService.ThawEvents (); - if (error == null) - newTask.SetResult (true); - else { - newTask.SetException (error); - } + newTask.TrySetResult (true); } } |