diff options
author | Lluis Sanchez <lluis@xamarin.com> | 2019-07-08 11:05:23 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-08 11:05:23 +0300 |
commit | 4634324154d13466ef60145f25a37c8d28f96ed9 (patch) | |
tree | 4dbecff7818d6f4a2423650aff1f5c4477699e7c | |
parent | 0448409d5cea4c424f1d1c3184eedb600f35a325 (diff) | |
parent | d72cb733157ac4eb7622b4a0f857a3027e0dc83f (diff) |
Merge pull request #8148 from mono/backport-pr-8034-to-release-8.2
[release-8.2] [Debugger] Fix regression introduced when optimizing handlers
-rw-r--r-- | main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValueTreeView.cs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValueTreeView.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValueTreeView.cs index afceba6802..1a54b30564 100644 --- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValueTreeView.cs +++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValueTreeView.cs @@ -947,15 +947,20 @@ namespace MonoDevelop.Debugger } int numberOfChildren = store.IterNChildren (iter); - Task.Run (() => { + + var token = cancellationTokenSource.Token; + Runtime.RunInMainThread (() => { + if (token.IsCancellationRequested) + return Array.Empty<ObjectValue> (); + try { return value.GetRangeOfChildren (numberOfChildren - 1, 20); } catch (Exception ex) { // Note: this should only happen if someone breaks ObjectValue.GetAllChildren() LoggingService.LogError ("Failed to get ObjectValue children.", ex); - return new ObjectValue[0]; + return Array.Empty<ObjectValue> (); } - }, cancellationTokenSource.Token).ContinueWith (t => { + }).ContinueWith (t => { TreeIter it; if (disposed) return; @@ -975,7 +980,7 @@ namespace MonoDevelop.Debugger if (compact) RecalculateWidth (); enumerableLoading.Remove (value); - }, cancellationTokenSource.Token, TaskContinuationOptions.NotOnCanceled, Runtime.MainTaskScheduler).Ignore (); + }, token, TaskContinuationOptions.OnlyOnRanToCompletion, Runtime.MainTaskScheduler).Ignore (); } void RefreshRow (TreeIter iter, ObjectValue val) |