diff options
author | Eric Maupin <me@ermau.com> | 2018-10-11 20:18:11 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-11 20:18:11 +0300 |
commit | 5e75201231027688847d873ee50dd5eb7296c771 (patch) | |
tree | 1d9d7b23c63156faaaceb8f558453077b2d79f14 /Xamarin.PropertyEditing | |
parent | 4ce83daf1db1b0f5d4574dab4d797210048e8291 (diff) | |
parent | 927fd1e9f10aa58ce110281039c7500f08c5a4ee (diff) |
Merge pull request #415 from xamarin/propagate-exceptions
[Tests] Ensure async void exceptions propagate correctly
Diffstat (limited to 'Xamarin.PropertyEditing')
-rw-r--r-- | Xamarin.PropertyEditing/ViewModels/CollectionPropertyViewModel.cs | 4 | ||||
-rw-r--r-- | Xamarin.PropertyEditing/ViewModels/PropertyViewModel.cs | 11 |
2 files changed, 9 insertions, 6 deletions
diff --git a/Xamarin.PropertyEditing/ViewModels/CollectionPropertyViewModel.cs b/Xamarin.PropertyEditing/ViewModels/CollectionPropertyViewModel.cs index 080a93a..0803061 100644 --- a/Xamarin.PropertyEditing/ViewModels/CollectionPropertyViewModel.cs +++ b/Xamarin.PropertyEditing/ViewModels/CollectionPropertyViewModel.cs @@ -61,8 +61,6 @@ namespace Xamarin.PropertyEditing.ViewModels if (this.cachedProvider == null) this.cachedProvider = new CachedEditorProvider (platform.EditorProvider); - RequestTypes (); - Panel = new PanelViewModel (platform.WithProvider (this.cachedProvider)) { ArrangeMode = PropertyArrangeMode.Category, AutoExpand = true @@ -75,6 +73,8 @@ namespace Xamarin.PropertyEditing.ViewModels CommitCommand = new RelayCommand (OnCommitCommand); CancelCommand = new RelayCommand(RequestCurrentValueUpdate); + RequestTypes (); + this.collectionView.CollectionChanged += OnCollectionViewContentsChanged; } diff --git a/Xamarin.PropertyEditing/ViewModels/PropertyViewModel.cs b/Xamarin.PropertyEditing/ViewModels/PropertyViewModel.cs index 372ac91..817319f 100644 --- a/Xamarin.PropertyEditing/ViewModels/PropertyViewModel.cs +++ b/Xamarin.PropertyEditing/ViewModels/PropertyViewModel.cs @@ -468,7 +468,6 @@ namespace Xamarin.PropertyEditing.ViewModels CancellationToken cancel = this.autocompleteCancel.Token; try { - HashSet<string> common = null; List<Task<IReadOnlyList<string>>> tasks = new List<Task<IReadOnlyList<string>>> (); foreach (IObjectEditor editor in Editors) { @@ -478,18 +477,22 @@ namespace Xamarin.PropertyEditing.ViewModels tasks.Add (complete.GetCompletionsAsync (Property, value, cancel)); } + HashSet<string> common = null; + IReadOnlyList<string> list = null; do { - Task<IReadOnlyList<string>> results = await Task.WhenAny (tasks); + var results = await Task.WhenAny (tasks); tasks.Remove (results); if (list == null) { - list = results.Result; + list = await results; common = new HashSet<string> (list); } else - common.IntersectWith (results.Result); + common.IntersectWith (await results); + } while (tasks.Count > 0 && !cancel.IsCancellationRequested); + cancel.ThrowIfCancellationRequested (); this.autocomplete.Reset (list.Where (common.Contains)); } catch (OperationCanceledException) { } |