-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Picker ItemsSource fixes #19728
Picker ItemsSource fixes #19728
Conversation
…ng update of SelectedIndex
…gLights/maui into picker-items-source-fixes
Hey there @BurningLights! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
@@ -682,7 +682,7 @@ public async Task AbsoluteRoutingToPage() | |||
|
|||
Routing.RegisterRoute("catdetails", typeof(ContentPage)); | |||
|
|||
Assert.ThrowsAnyAsync<Exception>(async () => await shell.GoToAsync($"//catdetails")); | |||
await Assert.ThrowsAnyAsync<Exception>(async () => await shell.GoToAsync($"//catdetails")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is interesting. Is there no CS4014 warning when await
is missing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW: The regex ^[ \t]+Assert\.ThrowsAsync
seems to discover similar cases:
9 results - 6 files
src\Controls\tests\Core.UnitTests\DeviceUnitTests.cs:
110 async Task MethodThatThrows() => await task;
111: Assert.ThrowsAsync<ApplicationException>(MethodThatThrows);
112 });
146 async Task MethodThatThrows() => await task;
147: Assert.ThrowsAsync<ApplicationException>(MethodThatThrows);
148 });
src\Controls\tests\Core.UnitTests\NavigationUnitTest.cs:
838 var navigationPage = new TestNavigationPage(true, contentPage1);
839: Assert.ThrowsAsync<InvalidOperationException>(() => window.Navigation.PopModalAsync());
840 }
src\Controls\tests\Core.UnitTests\ScrollViewUnitTests.cs:
273
274: Assert.ThrowsAsync<ArgumentException>(() => scrollView.ScrollToAsync(new VisualElement(), ScrollToPosition.Center, true));
275: Assert.ThrowsAsync<ArgumentException>(() => scrollView.ScrollToAsync(null, (ScrollToPosition)500, true));
276 }
src\Essentials\test\UnitTests\AppActions_Tests.cs:
10 public void AppActions_SetActions() =>
11: Assert.ThrowsAsync<NotImplementedInReferenceAssemblyException>(() => AppActions.SetAsync(new List<AppAction>()));
12
14 public void AppActions_GetActions() =>
15: Assert.ThrowsAsync<NotImplementedInReferenceAssemblyException>(() => AppActions.GetAsync());
16
src\Essentials\test\UnitTests\Sms_Tests.cs:
11 public Task Sms_Fail_On_NetStandard() =>
12: Assert.ThrowsAsync<NotImplementedInReferenceAssemblyException>(() => Sms.ComposeAsync());
13 }
src\Essentials\test\UnitTests\TextToSpeech_Tests.cs:
10 public void TextToSpeech_Speak_Fail_On_NetStandard() =>
11: Assert.ThrowsAsync<NotImplementedInReferenceAssemblyException>(() => TextToSpeech.SpeakAsync("Xamarin Essentials!"));
12
Edit: regex ^[ \t]+Assert\.Throws[a-zA-Z]*Async
seems to be better.
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
Can you rebase on main please? |
@dotnet-policy-service agree |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
I am experiencing this too. Picker behave very weirdly when inside collection view. |
@@ -267,12 +267,12 @@ public void TestScrollToElementNotAnimated() | |||
} | |||
|
|||
[Fact] | |||
public void TestScrollToInvalid() | |||
public async void TestScrollToInvalid() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
async Task
/azp run |
Commenter does not have sufficient privileges for PR 19728 in repo dotnet/maui |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
Looks fine to me! Maybe a UI test would be useful, but I can add it in this PR: #22353 |
Description of Change
Fixes the Picker getting stuck in an infinite loop when the ItemsSource is assigned as an ObservableCollection and the collection is modified during a change handler when the SelectedIndex changes.
Issues Fixed
Fixes #19702