IndicatorView with DataTemplate - improvements#24776
IndicatorView with DataTemplate - improvements#24776kubaflo wants to merge 3 commits intodotnet:mainfrom
Conversation
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
|
||
| [Test] | ||
| [Category(UITestCategories.IndicatorView)] | ||
| public void IndicatorViewShouldRenderCorrectly() |
There was a problem hiding this comment.
I am going to trigger a build of the test on Windows again. But, could be crashing.
From the test output:
The app was expected to be running still, investigate as possible crash
There was a problem hiding this comment.
Hi! Unfortunately, I have no way of investigating it on Windows. Could you maybe look at this, if this PR makes sense in general?
There was a problem hiding this comment.
Once rebased, I can try to run the test.
There was a problem hiding this comment.
When I click "Change source" button like this:
... then the exception: System.Runtime.InteropServices.COMException: 'No installed components were detected. is thrown on line https://github.com/kubaflo/maui/blob/ed0c4eb85ccadb0506233c2884ab75ce0f88fa85/src/Core/src/Platform/Windows/WrapperView.cs#L57
Stacktrace is:
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode)
at WinRT.DelegateExtensions.DynamicInvokeAbi(Delegate del, Object[] invoke_params)
at ABI.System.Collections.Generic.IListMethods`2.AppendDynamic(IObjectReference obj, T value)
at ABI.System.Collections.Generic.IVectorMethods`1.Append(IObjectReference obj, T value)
at ABI.System.Collections.Generic.IListMethods`1.Add(IObjectReference obj, T item)
at Microsoft.UI.Xaml.Controls.UIElementCollection.Add(UIElement item)
at Microsoft.Maui.Platform.WrapperView.set_Child(FrameworkElement value) in Z:\maui\src\Core\src\Platform\Windows\WrapperView.cs:line 57
at Microsoft.Maui.Handlers.ViewHandler`2.SetupContainer() in Z:\maui\src\Core\src\Handlers\View\ViewHandlerOfT.Windows.cs:line 28
at Microsoft.Maui.Handlers.ImageHandler.SetupContainer() in Z:\maui\src\Core\src\Handlers\Image\ImageHandler.Windows.cs:line 40
at Microsoft.Maui.Handlers.ViewHandler.set_HasContainer(Boolean value) in Z:\maui\src\Core\src\Handlers\View\ViewHandler.cs:line 121
at Microsoft.Maui.Handlers.ViewHandler.MapContainerView(IViewHandler handler, IView view) in Z:\maui\src\Core\src\Handlers\View\ViewHandler.cs:line 421
at Microsoft.Maui.PropertyMapper`2.<>c__DisplayClass5_0.<Add>b__0(IElementHandler h, IElement v) in Z:\maui\src\Core\src\PropertyMapper.cs:line 172
at Microsoft.Maui.PropertyMapperExtensions.<>c__DisplayClass4_0`2.<AppendToMapping>b__0(IElementHandler handler, IElement view, Action`2 action) in Z:\maui\src\Core\src\PropertyMapperExtensions.cs:line 102
at Microsoft.Maui.PropertyMapperExtensions.<>c__DisplayClass0_0`2.<ModifyMapping>g__newMethod|0(TViewHandler handler, TVirtualView view) in Z:\maui\src\Core\src\PropertyMapperExtensions.cs:line 23
at Microsoft.Maui.PropertyMapper`2.<>c__DisplayClass5_0.<Add>b__0(IElementHandler h, IElement v) in Z:\maui\src\Core\src\PropertyMapper.cs:line 172
at Microsoft.Maui.PropertyMapper.UpdatePropertyCore(String key, IElementHandler viewHandler, IElement virtualView) in Z:\maui\src\Core\src\PropertyMapper.cs:line 47
at Microsoft.Maui.PropertyMapper.UpdateProperty(IElementHandler viewHandler, IElement virtualView, String property) in Z:\maui\src\Core\src\PropertyMapper.cs:line 72
at Microsoft.Maui.Handlers.ElementHandler.UpdateValue(String property) in Z:\maui\src\Core\src\Handlers\Element\ElementHandler.cs:line 87
at Microsoft.Maui.Handlers.ImageHandler.MapBackground(IImageHandler handler, IImage image) in Z:\maui\src\Core\src\Handlers\Image\ImageHandler.Windows.cs:line 102
at Microsoft.Maui.PropertyMapper`2.<>c__DisplayClass5_0.<Add>b__0(IElementHandler h, IElement v) in Z:\maui\src\Core\src\PropertyMapper.cs:line 172
at Microsoft.Maui.PropertyMapper.UpdatePropertyCore(String key, IElementHandler viewHandler, IElement virtualView) in Z:\maui\src\Core\src\PropertyMapper.cs:line 47
at Microsoft.Maui.PropertyMapper.UpdateProperty(IElementHandler viewHandler, IElement virtualView, String property) in Z:\maui\src\Core\src\PropertyMapper.cs:line 72
at Microsoft.Maui.Handlers.ElementHandler.UpdateValue(String property) in Z:\maui\src\Core\src\Handlers\Element\ElementHandler.cs:line 87
at Microsoft.Maui.Controls.VisualElement.MapBackgroundColor(IViewHandler handler, IView view) in Z:\maui\src\Controls\src\Core\VisualElement\VisualElement.Mapper.cs:line 38
at Microsoft.Maui.PropertyMapperExtensions.<>c__DisplayClass2_0`2.<ReplaceMapping>b__0(TViewHandler h, TVirtualView v, Action`2 p) in Z:\maui\src\Core\src\PropertyMapperExtensions.cs:line 66
at Microsoft.Maui.PropertyMapperExtensions.<>c__DisplayClass1_0`2.<ModifyMapping>g__newMethod|0(IElementHandler handler, IElement view) in Z:\maui\src\Core\src\PropertyMapperExtensions.cs:line 46
at Microsoft.Maui.PropertyMapper`2.<>c__DisplayClass5_0.<Add>b__0(IElementHandler h, IElement v) in Z:\maui\src\Core\src\PropertyMapper.cs:line 172
at Microsoft.Maui.PropertyMapper.UpdatePropertyCore(String key, IElementHandler viewHandler, IElement virtualView) in Z:\maui\src\Core\src\PropertyMapper.cs:line 47
at Microsoft.Maui.PropertyMapper.UpdateProperty(IElementHandler viewHandler, IElement virtualView, String property) in Z:\maui\src\Core\src\PropertyMapper.cs:line 72
at Microsoft.Maui.Handlers.ElementHandler.UpdateValue(String property) in Z:\maui\src\Core\src\Handlers\Element\ElementHandler.cs:line 87
at Microsoft.Maui.Controls.Element.UpdateHandlerValue(String property, Boolean valueChanged) in Z:\maui\src\Controls\src\Core\Element\Element.cs:line 686
at Microsoft.Maui.Controls.VisualElement.UpdateHandlerValue(String property, Boolean valueChanged) in Z:\maui\src\Controls\src\Core\VisualElement\VisualElement.cs:line 1998
at Microsoft.Maui.Controls.Element.OnBindablePropertySet(BindableProperty property, Object original, Object value, Boolean changed, Boolean willFirePropertyChanged) in Z:\maui\src\Controls\src\Core\Element\Element.cs:line 644
at Microsoft.Maui.Controls.BindableObject.SetValueActual(BindableProperty property, BindablePropertyContext context, Object value, Boolean currentlyApplying, SetValueFlags attributes, SetterSpecificity specificity, Boolean silent) in Z:\maui\src\Controls\src\Core\BindableObject.cs:line 662
at Microsoft.Maui.Controls.BindableObject.SetValueCore(BindableProperty property, Object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes, SetterSpecificity specificity) in Z:\maui\src\Controls\src\Core\BindableObject.cs:line 590
at Microsoft.Maui.Controls.BindableObject.SetValue(BindableProperty property, Object value) in Z:\maui\src\Controls\src\Core\BindableObject.cs:line 495
at Microsoft.Maui.Controls.VisualElement.set_BackgroundColor(Color value) in Z:\maui\src\Controls\src\Core\VisualElement\VisualElement.cs:line 550
at Microsoft.Maui.Controls.IndicatorStackLayout.ResetIndicatorStylesNonBatch() in Z:\maui\src\Controls\src\Core\IndicatorView\IndicatorStackLayout.cs:line 142
at Microsoft.Maui.Controls.IndicatorStackLayout.ResetIndicatorCount(Int32 oldCount) in Z:\maui\src\Controls\src\Core\IndicatorView\IndicatorStackLayout.cs:line 120
at Microsoft.Maui.Controls.IndicatorStackLayout.ResetIndicatorCount(Int32 oldCount) in Z:\maui\src\Controls\src\Core\IndicatorView\IndicatorStackLayout.cs:line 123
at Microsoft.Maui.Controls.IndicatorView.<>c.<.cctor>b__65_0(BindableObject bindable, Object oldValue, Object newValue) in Z:\maui\src\Controls\src\Core\IndicatorView\IndicatorView.cs:line 28
at Microsoft.Maui.Controls.BindableObject.OnBindablePropertySet(BindableProperty property, Object original, Object value, Boolean didChange, Boolean willFirePropertyChanged) in Z:\maui\src\Controls\src\Core\BindableObject.cs:line 675
at Microsoft.Maui.Controls.Element.OnBindablePropertySet(BindableProperty property, Object original, Object value, Boolean changed, Boolean willFirePropertyChanged) in Z:\maui\src\Controls\src\Core\Element\Element.cs:line 642
at Microsoft.Maui.Controls.BindableObject.SetValueActual(BindableProperty property, BindablePropertyContext context, Object value, Boolean currentlyApplying, SetValueFlags attributes, SetterSpecificity specificity, Boolean silent) in Z:\maui\src\Controls\src\Core\BindableObject.cs:line 662
at Microsoft.Maui.Controls.BindableObject.SetValueCore(BindableProperty property, Object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes, SetterSpecificity specificity) in Z:\maui\src\Controls\src\Core\BindableObject.cs:line 590
at Microsoft.Maui.Controls.BindableObject.SetValue(BindableProperty property, Object value) in Z:\maui\src\Controls\src\Core\BindableObject.cs:line 495
at Microsoft.Maui.Controls.IndicatorView.set_Count(Int32 value) in Z:\maui\src\Controls\src\Core\IndicatorView\IndicatorView.cs:line 84
at Microsoft.Maui.Controls.IndicatorView.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e) in Z:\maui\src\Controls\src\Core\IndicatorView\IndicatorView.cs:line 197
at Microsoft.Maui.Controls.IndicatorView.ResetItemsSource(IEnumerable oldItemsSource) in Z:\maui\src\Controls\src\Core\IndicatorView\IndicatorView.cs:line 188
at Microsoft.Maui.Controls.IndicatorView.<>c.<.cctor>b__65_3(BindableObject bindable, Object oldValue, Object newValue) in Z:\maui\src\Controls\src\Core\IndicatorView\IndicatorView.cs:line 52
at Microsoft.Maui.Controls.BindableObject.OnBindablePropertySet(BindableProperty property, Object original, Object value, Boolean didChange, Boolean willFirePropertyChanged) in Z:\maui\src\Controls\src\Core\BindableObject.cs:line 675
at Microsoft.Maui.Controls.Element.OnBindablePropertySet(BindableProperty property, Object original, Object value, Boolean changed, Boolean willFirePropertyChanged) in Z:\maui\src\Controls\src\Core\Element\Element.cs:line 642
at Microsoft.Maui.Controls.BindableObject.SetValueActual(BindableProperty property, BindablePropertyContext context, Object value, Boolean currentlyApplying, SetValueFlags attributes, SetterSpecificity specificity, Boolean silent) in Z:\maui\src\Controls\src\Core\BindableObject.cs:line 662
at Microsoft.Maui.Controls.BindableObject.SetValueCore(BindableProperty property, Object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes, SetterSpecificity specificity) in Z:\maui\src\Controls\src\Core\BindableObject.cs:line 590
at Microsoft.Maui.Controls.Internals.TypedBinding`2.ApplyCore(Object sourceObject, BindableObject target, BindableProperty property, Boolean fromTarget, SetterSpecificity specificity) in Z:\maui\src\Controls\src\Core\TypedBinding.cs:line 325
at Microsoft.Maui.Controls.Internals.TypedBinding`2.Apply(Boolean fromTarget) in Z:\maui\src\Controls\src\Core\TypedBinding.cs:line 167
at Microsoft.Maui.Controls.Internals.TypedBinding`2.PropertyChangedProxy.<OnPropertyChanged>b__16_0() in Z:\maui\src\Controls\src\Core\TypedBinding.cs:line 506
at Microsoft.Maui.Controls.DispatcherExtensions.DispatchIfRequired(IDispatcher dispatcher, Action action) in Z:\maui\src\Controls\src\Core\DispatcherExtensions.cs:line 59
at Microsoft.Maui.Controls.Internals.TypedBinding`2.PropertyChangedProxy.OnPropertyChanged(Object sender, PropertyChangedEventArgs e) in Z:\maui\src\Controls\src\Core\TypedBinding.cs:line 506
at Microsoft.Maui.Controls.BindingExpression.WeakPropertyChangedProxy.OnPropertyChanged(Object sender, PropertyChangedEventArgs e) in Z:\maui\src\Controls\src\Core\BindingExpression.cs:line 599
at Microsoft.Maui.Controls.BindableObject.OnPropertyChanged(String propertyName) in Z:\maui\src\Controls\src\Core\BindableObject.cs:line 408
at Microsoft.Maui.Controls.Element.OnPropertyChanged(String propertyName) in Z:\maui\src\Controls\src\Core\Element\Element.cs:line 665
at Microsoft.Maui.Controls.BindableObject.OnBindablePropertySet(BindableProperty property, Object original, Object value, Boolean didChange, Boolean willFirePropertyChanged) in Z:\maui\src\Controls\src\Core\BindableObject.cs:line 674
at Microsoft.Maui.Controls.Element.OnBindablePropertySet(BindableProperty property, Object original, Object value, Boolean changed, Boolean willFirePropertyChanged) in Z:\maui\src\Controls\src\Core\Element\Element.cs:line 642
at Microsoft.Maui.Controls.BindableObject.SetValueActual(BindableProperty property, BindablePropertyContext context, Object value, Boolean currentlyApplying, SetValueFlags attributes, SetterSpecificity specificity, Boolean silent) in Z:\maui\src\Controls\src\Core\BindableObject.cs:line 662
at Microsoft.Maui.Controls.BindableObject.SetValueCore(BindableProperty property, Object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes, SetterSpecificity specificity) in Z:\maui\src\Controls\src\Core\BindableObject.cs:line 590
at Microsoft.Maui.Controls.BindingExpression.ApplyCore(Object sourceObject, BindableObject target, BindableProperty property, Boolean fromTarget, SetterSpecificity specificity) in Z:\maui\src\Controls\src\Core\BindingExpression.cs:line 165
at Microsoft.Maui.Controls.BindingExpression.Apply(Boolean fromTarget) in Z:\maui\src\Controls\src\Core\BindingExpression.cs:line 60
at Microsoft.Maui.Controls.BindingExpression.BindingExpressionPart.<PropertyChanged>b__50_0() in Z:\maui\src\Controls\src\Core\BindingExpression.cs:line 698
at Microsoft.Maui.Controls.DispatcherExtensions.DispatchIfRequired(IDispatcher dispatcher, Action action) in Z:\maui\src\Controls\src\Core\DispatcherExtensions.cs:line 59
at Microsoft.Maui.Controls.BindingExpression.BindingExpressionPart.PropertyChanged(Object sender, PropertyChangedEventArgs args) in Z:\maui\src\Controls\src\Core\BindingExpression.cs:line 698
at Microsoft.Maui.Controls.BindingExpression.WeakPropertyChangedProxy.OnPropertyChanged(Object sender, PropertyChangedEventArgs e) in Z:\maui\src\Controls\src\Core\BindingExpression.cs:line 599
at Maui.Controls.Sample.Issues.Issue21980ViewModel.OnPropertyChanged(String propertyName) in Z:\maui\src\Controls\tests\TestCases.HostApp\Issues\Issue21980.xaml.cs:line 55
at Maui.Controls.Sample.Issues.Issue21980ViewModel.set_Images(IReadOnlyList`1 value) in Z:\maui\src\Controls\tests\TestCases.HostApp\Issues\Issue21980.xaml.cs:line 40
at Maui.Controls.Sample.Issues.Issue21980ViewModel.<.ctor>b__10_0() in Z:\maui\src\Controls\tests\TestCases.HostApp\Issues\Issue21980.xaml.cs:line 49
at Microsoft.Maui.Controls.Command.<>c__DisplayClass4_0.<.ctor>b__0(Object o) in Z:\maui\src\Controls\src\Core\Command.cs:line 80
at Microsoft.Maui.Controls.Command.Execute(Object parameter) in Z:\maui\src\Controls\src\Core\Command.cs:line 122
at Microsoft.Maui.Controls.ButtonElement.ElementClicked(VisualElement visualElement, IButtonElement ButtonElementManager) in Z:\maui\src\Controls\src\Core\Button\ButtonElement.cs:line 39
at Microsoft.Maui.Controls.Button.SendClicked() in Z:\maui\src\Controls\src\Core\Button\Button.cs:line 250
at Microsoft.Maui.Controls.Button.Microsoft.Maui.IButton.Clicked() in Z:\maui\src\Controls\src\Core\Button\Button.cs:line 484
at Microsoft.Maui.Handlers.ButtonHandler.OnClick(Object sender, RoutedEventArgs e) in Z:\maui\src\Core\src\Handlers\Button\ButtonHandler.Windows.cs:line 95
at ABI.Microsoft.UI.Xaml.RoutedEventHandler.Do_Abi_Invoke(IntPtr thisPtr, IntPtr sender, IntPtr e)
There was a problem hiding this comment.
Commenting out this BackgroundColor assignment:
prevents the crash:
Intuitively, the issue seems to be caused by the interaction with WrapperView when setting this but I'm not sure. The exception is not really helpful.
There was a problem hiding this comment.
btw: @mattleibow mentions the exception here: #8997 (comment). Perhaps it's relevant here. IDK.
edit: https://github.com/microsoft/microsoft-ui-xaml/discussions?discussions_q=is%3Aopen+no+installed+components+were+detected. (No clear reason mentioned, it seems to be a "blanket exception".)
There was a problem hiding this comment.
@jsuarezruiz that would be great! I have no Windows machine
|
@kubaflo Could you rebase to fix the conflicts? Thanks in advance. |
a206dc8 to
556c819
Compare
|
@jsuarezruiz rebased and fixed conflicts |
556c819 to
ed0c4eb
Compare
|
/rebase |
ed0c4eb to
72fa9a1
Compare
| StrokeShape="RoundRectangle 12" | ||
| StrokeThickness="0" | ||
| Grid.Row="0"> | ||
| <IndicatorView |
There was a problem hiding this comment.
The IndicatorView behavior seems wrong on Android, it is not sync with the CV position.
There was a problem hiding this comment.
I've also stumbled upon this, but I think it is an unrelated pre-existing bug that happens only when image sources are the same.
| The same images | Different images |
|---|---|
Screen.Recording.2024-11-13.at.01.16.35.mov |
Screen.Recording.2024-11-13.at.01.19.00.mov |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
72fa9a1 to
f6233d2
Compare
|
@rmarinho I see, this is a screenshot from 2 months ago, I just reuploaded a new one :) Unfortunately,, I cannot fix this problem: #24776 (comment), because I don't have Windows |
Thanks! |
bdcbd4e to
38c3fa8
Compare
38c3fa8 to
d03ced5
Compare
I've checked, and the issue happens when we have the same images in carousel view. It appears to be already existing bug. I've updated the sample in the UI test. Can you have a look if it works for you? |
|
@rmarinho This is what happens on main, but I'd rather fix it in a separate PR
|
|
@rmarinho it happens because all of the items have a bindingContext="dotnet_bot.png", so in CarouselViewOnScrollListener.cs returns the same index for all the elements |



Issues Fixed
Fixes #21980
Fixes #24739
Closes #24717
Screen.Recording.2024-09-15.at.15.18.43.mov
Screen.Recording.2024-09-15.at.15.17.04.mov
Simulator.Screen.Recording.-.iPhone.15.Pro.Max.-.2024-09-15.at.15.38.21.mp4
Simulator.Screen.Recording.-.iPhone.15.Pro.Max.-.2024-09-15.at.15.36.58.mp4