Crash in iOS when assigning ContentViews to ItemsSource in Xaml
See original GitHub issueHi, I encountered a strange fault with CarouselView running on iOS, which crashes the app when it runs on a physical device but not when it runs on the iOS simulator. Android is OK in both cases. The error occurs when I populate ItemsSource of CarouselView within XAML with a number of ContentView controls. When I assign the list using code-behind then the error does not occur.
This is what I do in XAML:
<cards:CarouselView x:Name="CarouselVw">
<cards:CarouselView.ItemsSource>
<x:Array Type="{x:Type ContentView}">
<views:Intro1View Margin="0,0,0,48"/>
<views:Intro2View Margin="0,0,0,48"/>
<views:Intro3View Margin="0,0,0,48"/>
</x:Array>
</cards:CarouselView.ItemsSource>
<cardsctrls:IndicatorsControl SelectedIndicatorStyle="{StaticResource ActiveIndicator}"
UnselectedIndicatorStyle="{StaticResource InactiveIndicator}" />
</cards:CarouselView>
The 3 ContentViews are simple XAML-defined views with each having an image and a couple of labels.
When I do the assignment in code-behind, everything works fine, like in:
public AppTourPage(AppTourViewModel viewModel)
{
this.BindingContext = viewModel;
InitializeComponent();
if (viewModel.IsInitialAppTour)
{
NavigationPage.SetHasNavigationBar(this, false);
}
CarouselVw.ItemsSource = new ContentView []
{
new Intro1View(),
new Intro2View(),
new Intro3View()
};
}
Have to say also that the iOS device I have been testing on runs ios 11.4.1.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Setting ItemSource for ListView crashes on iOS, works fine ...
1 Answer 1 ... I'm not exactly sure why, but when I removed the GroupShortNameBinding="{Binding ShortName}" line from my XAML it now works....
Read more >[Bug] Clear ItemSource in CollectionView will crash iOS App
Description Clear ItemSource in CollectionView will crash iOS App Steps to Reproduce XAML has a CollectionView named MyCollectionView ...
Read more >List view crashes on ios when pull to refresh in UI for Xamarin
Following list view I am implementing pull to refresh and set the Itemsource by adding more items to the current list when the...
Read more >App Crashing in IOS : r/dotnetMAUI
Created a app using .NET MAUI works fine in the Android but those same build is continuously crashing in IOS, not getting the...
Read more >Spiffy.Plugins.CarouselView 1.0.0 on NuGet
Assign this property before assigning ItemsSource at startup. ... [iOS] Crash due to disposed objects when jumping back and forth #143 (removing version ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for the prompt reply. I am afraid I can’t provide more information (like console output or stacktrace) since I am developing using Mac-In-Cloud. I don’t have a physical Mac and so are left with just trying to make ipa files and try to pinpoint the problem using trial and error methods.
I can of course try to come up with a simple “Hello Xamarin” app, add your plugin and my ContentViews and see if the problem still occurs on my device. Give me some time for this.
hope it helped