JNickVA1
JNickVA1

Reputation: 416

CollectionView causes render exception in Xamarin Forms

I have an existing Xamarin Forms app and am trying to add a XAML page that contains a very simple CollectionView. The page throws exceptions in the Visual Studio renderer but displays just fine in the emulator. Here is the code (taken directly from the CollectionView documentation):

    <ContentPage.Content>
        <StackLayout>
            <CollectionView>
                <CollectionView.ItemsSource>
                    <x:Array Type="{x:Type x:String}">
                        <x:String>Baboon</x:String>
                        <x:String>Capuchin Monkey</x:String>
                        <x:String>Blue Monkey</x:String>
                        <x:String>Squirrel Monkey</x:String>
                        <x:String>Golden Lion Tamarin</x:String>
                        <x:String>Howler Monkey</x:String>
                        <x:String>Japanese Macaque</x:String>
                    </x:Array>
                </CollectionView.ItemsSource>
            </CollectionView>
        </StackLayout>
    </ContentPage.Content>
</ContentPage>

Here is the exception that is thrown when I try to view the XAML page in the renderer: Exception General

The exception that appears to be relevant is in the CollectionViewRenderer.

I am using the latest update to Visual Studio 2019 VS 2019 Version

And these are the installed Xamarin-related products:

Xamarin products installed

No other XAML page throws exceptions in the renderer. It is only when I have added a CollectionView to the page.

Upvotes: 0

Views: 149

Answers (1)

Kevin Strathdee
Kevin Strathdee

Reputation: 11

I would recommend avoiding the preview tool in visual studio and instead use the Hot Reload feature while running the app in the emulator to help build your UI's. Preview tool is notoriously buggy and generally will only work on very simple pages.

Upvotes: 1

Related Questions