diff options
author | therzok <marius.ungureanu@xamarin.com> | 2019-06-27 04:43:51 +0300 |
---|---|---|
committer | therzok <marius.ungureanu@xamarin.com> | 2019-07-06 22:17:15 +0300 |
commit | 02396b8b524f3e30a4e895cdf3d5567da8a33037 (patch) | |
tree | bc4225adc6812a30d969f736c33ee751b3be29e9 /main/src/core/MonoDevelop.Core/MonoDevelop.Projects/CompiledAssemblyProject.cs | |
parent | 5bf153161256f11d909ca58da7beeb4d3177bbf2 (diff) |
[Ide] Ensure we properly dispose of cancellationtokensource when we can or it's a timer
Diffstat (limited to 'main/src/core/MonoDevelop.Core/MonoDevelop.Projects/CompiledAssemblyProject.cs')
-rw-r--r-- | main/src/core/MonoDevelop.Core/MonoDevelop.Projects/CompiledAssemblyProject.cs | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/CompiledAssemblyProject.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/CompiledAssemblyProject.cs index 669109ebda..ffaaef930f 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/CompiledAssemblyProject.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/CompiledAssemblyProject.cs @@ -164,11 +164,9 @@ namespace MonoDevelop.Projects } ProcessAsyncOperation asyncOp = context.ExecutionHandler.Execute (executionCommand, console); - var stopper = monitor.CancellationToken.Register (asyncOp.Cancel); - - await asyncOp.Task; - - stopper.Dispose (); + using (var stopper = monitor.CancellationToken.Register (asyncOp.Cancel)) { + await asyncOp.Task; + } monitor.Log.WriteLine (GettextCatalog.GetString ("The application exited with code: {0}", asyncOp.ExitCode)); } finally { |