AutoFitMode DynamicHeight

Hello,

in my code I have used SflistView with this property

AutoFitMode="DynamicHeight"

In the UWP project, in debug, I haven't any problem, but in release the property written above throws an exception "System null exception".  If I remove the property " AutoFitMode="DynamicHeight" , from the xaml, also in release mode, it works fine.

I have tried to upgrade Nuget Syncfusion package at the last version, but it doesn't work.

Can you suggest me a tip?

Best regards

This is my xaml


                    <syncfusion:SfListView

                        x:Name="tipoRiga"

                        ItemsSource="{Binding Results}"

                        SelectedItem="{Binding SelectedItem, Mode=TwoWay}"

                        ItemTemplate="{StaticResource TipoRigaTemplateSelector}"

                        Grid.Row="1"

                        AutoFitMode="DynamicHeight"

                         VerticalOptions="FillAndExpand"

                        SelectionMode="Single"

                        Loaded="tipoRiga_Loaded"

                        PropertyChanged="tipoRiga_PropertyChanged"

                        LoadMoreOption="AutoOnScroll"

                        LayoutManager="{Binding IlMioLayout}"

                        LoadMoreCommand="{Binding LoadMoreCommand}"

                        BackgroundColor="White">

                    </syncfusion:SfListView>


   at Syncfusion.ListView.XForms.LayoutBase.GetAutoFitItemSize(ListViewItemInfoBase itemInfo, Double& itemSize, Double itemSpacing, Int32 spanCount)

   at Syncfusion.ListView.XForms.LinearLayout.SetRowHeight(ListViewItemInfo itemInfo, Int32 index, Double& size, Double itemSpacing)

   at Syncfusion.ListView.XForms.LinearLayout.SetRowHeight(ListViewItemInfo itemInfo, Double itemSpacing)

   at Syncfusion.ListView.XForms.LinearLayout.EnsureItems(VisibleLinesCollection visibleLines)

   at Syncfusion.ListView.XForms.VisualContainer.EnsureItems()

   at Syncfusion.ListView.XForms.VisualContainer.OnSizeAllocated(Double width, Double height)

   at Syncfusion.ListView.XForms.LinearLayout.OnItemsCollectionChanged(NotifyCollectionChangedEventArgs e)

   at Syncfusion.ListView.XForms.SfListView.DisplayItems_CollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)

   at System.Func`3.Invoke(T1 arg1, T2 arg2)

   at Xamarin.Forms.Internals.TemplatedItemsList`2.ShortNamesProxy.OnCollectionChanged(NotifyCollectionChangedEventArgs e) in D:\a\1\s\Xamarin.Forms.Core\Items\MarshalingObservableCollection.cs:line 44

   at Syncfusion.DataSource.DataSource.UpdateCollectionView(Object sender, NotifyCollectionChangedEventArgs e, Boolean isPropertyChanged)

   at Syncfusion.DataSource.DataSource.OnSourceCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)

   at System.Func`3.Invoke(T1 arg1, T2 arg2)

   at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e) in C:\A\1\5\s\corefx\src\System.ObjectModel\src\System\Collections\ObjectModel\ObservableCollection.cs:line 261

   at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedAction action, Object item, Int32 index) in C:\A\1\5\s\corefx\src\System.ObjectModel\src\System\Collections\ObjectModel\ObservableCollection.cs:line 336

   at System.Collections.ObjectModel.ObservableCollection`1.InsertItem(Int32 index, T item) in C:\A\1\5\s\corefx\src\System.ObjectModel\src\System\Collections\ObjectModel\ObservableCollection.cs:line 194

   at MyMB.Forms.OrdineMvvm.RicercaArticoliViewModel.<LoadArticoliFromFacetCommandMethod>d__411.MoveNext()


Unhandled exception at 0x00007FFC76E5DB22 (KernelBase.dll) in MyMB.Forms.UWP.exe: 0xC000027B: Si è verificata un'eccezione interna all'applicazione (parameters: 0x000002204E9642E0, 0x0000000000000006).


2 Replies

SY Suthi Yuvaraj Syncfusion Team January 4, 2024 02:04 PM UTC

Hi massimo pasquali,

As we mentioned in this (#132137) update , we are able to reproduce the reported issue in release mode in UWP platform , we are currently validating the issue at source and update with further details on or before January 8, 2024. We will appreciate your patience until then.



SY Suthi Yuvaraj Syncfusion Team January 8, 2024 04:14 PM UTC

Massimo Pasquali,


The reported issue is a known issue in the UWP platform. The problem can be resolved by initializing the SfListView assemblies in App.xaml.cs in the UWP project. Please make the following changes in your App.xaml.cs file:


protected override void OnLaunched(LaunchActivatedEventArgs e)

{

    …

 

    rootFrame.NavigationFailed += OnNavigationFailed;

       

    // you'll need to add `using System.Reflection;`

    List<Assembly> assembliesToInclude = new List<Assembly>();

 

    //Now, add all the assemblies your app uses

    assembliesToInclude.Add(typeof(SfListViewRenderer).GetTypeInfo().Assembly);

 

    // replaces Xamarin.Forms.Forms.Init(e);       

    Xamarin.Forms.Forms.Init(e, assembliesToInclude);

       

    …    

}


For further details, please refer to the following guideline: https://help.syncfusion.com/xamarin/listview/getting-started#releasemode-issue-in-uwp-platform



Loader.
Up arrow icon