-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
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.
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" };public IList<string> Items { get { return _items; } set { _items = value; OnPropertyChanged(nameof(Items)); } }}`
-
Bind the view model to MainPage.xaml.cs:
` public partial class MainPage : ContentPage
{
MainPageViewModel viewModel = new MainPageViewModel();public MainPage() { InitializeComponent(); BindingContext = viewModel; }}`
-
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

