Binding CollectionView/CarouselView to lists of primitive types doesn't work on Release Builds #16021
Labels
area-controls-collectionview
CollectionView, CarouselView, IndicatorView
fixed-in-8.0.80
fixed-in-9.0.0-preview.7.24407.4
linker
issues with objects being trimmed inappropriately (sub: perf)
platform/android 🤖
platform/windows 🪟
s/triaged
Issue has been reviewed
s/verified
Verified / Reproducible Issue ready for Engineering Triage
t/bug
Something isn't working
Milestone
Description
A CollectionView/CarouselView bound to an IList with primitive types doesn't render items on release builds.
Tested on Windows and Android, both don't work.
Debug:
Release:
Steps to Reproduce
Create a new .NET MAUI project
Add a view model with a list property of type List and some elements:
` internal class MainPageViewModel : BindableObject
{
private IList _items = new List { "first value", "second value", "third value" };
}`
Bind the view model to MainPage.xaml.cs:
` public partial class MainPage : ContentPage
{
MainPageViewModel viewModel = new MainPageViewModel();
}`
Add a CollectionView to MainPage.xaml, bound to the list in MainPageViewModel:
<CollectionView ItemsSource="{Binding Items}"> <CollectionView.ItemTemplate> <DataTemplate> <Label Text="{Binding}" /> </DataTemplate> </CollectionView.ItemTemplate> </CollectionView>
Do a release build, observe that nothing is rendered.
Link to public reproduction project repository
https://github.com/stefanpirkl/bugreport-maui-collectionview-primitive-list-on-release
Version with bug
8.0.0-preview.5.8529
Last version that worked well
Unknown/Other
Affected platforms
Android, Windows, I was not able test on other platforms
Affected platform versions
Windows 10, Android 9 and up
Did you find any workaround?
Changing the List to a custom model class with a single string property in it.
Relevant log output
No response
The text was updated successfully, but these errors were encountered: