Application causes freeze/slowness after using for some time

We have migrated our app into MAUI.
In Android devices or even in emulator release mode if I use the application for some time it starts getting slow and eventually freezes or crashes. It generally happens when I click on a button, and some operation happens and redirects to another screen.
I tried GC.Collect which prevents application crash but make it app slow.

    private async Task ProcesRecord()
{
    Stopwatch watch = new Stopwatch();
    try
    {
        watch.Start();
        if (_qtyRemain > 0)
        {
            Reset();
            return;
        }
        IsBusy = true;
        var dtSave = new DataTable("item_loc");
        dtSave.Columns.Add("id", typeof(string));       

        if (_isInd)
        {
            dtSave.Columns.Add("code", typeof(string));
            
        }

        var dtHold = new List<Test>();
        if (!_isInd)
        {
            foreach (var lvItem in Results)
            {
                if (!(lvItem.qty > 0)) continue;
                var dr = dtSave.NewRow();
                dr["id"] = _itemId; 
                dtSave.Rows.Add(dr);
            }
        }
        else
        {
            var results = (string.IsNullOrEmpty(_Id)) ? Results.ToList() : ItemList;
            foreach (var lvItem in results ?? [])
            {
                if (string.IsNullOrEmpty(Id) && !(lvItem.qty_assigned > 0)) continue;
                var dr = dtSave.NewRow();
                dr["id"] = lvItem.item_id.Trim();
               
             }
        var dsSave = new DataSet("item_loc");
        dsSave.Tables.Add(dtSave);
        dsSave.AcceptChanges();    
        
        dsSave.Dispose();
        dtSave.Dispose();
        dsSave = null;
        dtSave = null;
        var msg = await new ApiController().UpdateItem(model); 
        if (msg?.ToLowerInvariant() != "true")
        {
            string? errorMesg = msg?.Substring(msg.IndexOf("Message:")).Replace("Message:", "");
            if (errorMesg != null)
                await DisplayAlert("Item", errorMesg.Trim(), "Ok");
        }
        else
        {

            switch (_itemType)
            {
                case Type.Item:
                    {
                        var frm = new ItemTabbedPage(_itemType);
                        await GoTo(frm);
                        break;
                    }

                case Type.Accepted:
                    {
                        if (_parentForm != null && _parentForm == "Receive")
                        {
                            var frm = new ReceivePage();
                            await GoTo(frm);
                        }
                        else
                        {
                            var navigation = Application.Current?.MainPage?.Navigation;
                            if (navigation?.NavigationStack[navigation.NavigationStack.Count - 2] is AssignPage previousPage)
                            {
                                navigation.RemovePage(previousPage);
                            }

                            var tabbedPage = new CVAwayPage();
                            if (tabbedPage.Children[0] is CVReadyPage cvReadyPage)
                            {
                                if (_sendSeaBack)
                                {
                                    tabbedPage.Children[0] = new CVReadyPage(_itemId);  
                                }
                                else
                                {
                                    tabbedPage.Children[0] = new CVReadyPage();
                                }
                            }
                            await Application.Current!.MainPage!.Navigation.PushAsync(tabbedPage);                  
                        }

                        break;
                    }
               
                default:
                    throw new ArgumentOutOfRangeException();
            }
        }
    }
    catch (Exception ex)
    {
        await DisplayErrorAlert(ex.Message);
        ReportError("Items: Failed.", ex);
    }
    finally
    {
        if (watch.IsRunning)
        {
          
            watch.Stop();
            string paramvalue = "Test";
            string count = Results != null ? Results.Count.ToString() : "0";
            int success = await InsertExecutionLogDetails("Items", paramvalue, count, watch.ElapsedMilliseconds.ToString());
           
        }
    }
}

And OnAppearing of the next page where it should redirects having this below code

protected override void OnAppearing()
  {
      try
      {
          base.OnAppearing();
          ViewModel?.OnAppearing();
          SetupListeners();
          GC.Collect();
          GC.WaitForPendingFinalizers();
      }
      catch (Exception ex)
      {
          ReportError("AssignItemPage.OnAppearing: Failed.", ex);
          DisplayErrorAlert(ex.Message);
      }
  }

Data grid usage in screen

    <StackLayout Grid.Row="7" Orientation="Vertical" Margin="0,0,0,0">
     <dg:DataGrid x:Name="Grid" ItemsSource="{Binding Results}" HeightRequest="230">
         <dg:DataGrid.NoDataView>
             <Label Text="No item locations found, please setup new item location(s)." TextColor="Crimson" HorizontalTextAlignment="Center" />
         </dg:DataGrid.NoDataView>
         <dg:DataGrid.Columns>
             <helpers:DataGridColumn Title="Location" Width="100" PropertyName="location_label"/>
             <helpers:DataGridColumn Title="Cur.Qty" Width="80" PropertyName="total_qty" />
             <helpers:DataGridColumn Title="Asnd." Width="80" PropertyName="qty_assigned"/>
             <helpers:DataGridColumn Title="Status" Width="100" PropertyName="inventory_loc_status"/>
             <helpers:DataGridColumn Title="MaxQty" Width="80" PropertyName="item_loc_max_qty" />
             <helpers:DataGridColumn Title="Type" Width="160" PropertyName="location_type"/>
             <helpers:DataGridColumn Title="Size" Width="110" PropertyName="location_size"/>
         </dg:DataGrid.Columns>
     </dg:DataGrid>
 </StackLayout>

DataGrid.xaml file

    <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="*"/>
    </Grid.RowDefinitions>
    <ScrollView Orientation="Horizontal" Grid.Row="0" HorizontalScrollBarVisibility="Never">
        <Grid x:Name="HeaderView" RowSpacing="0" Padding="0,0,0,0">
            <Grid.Resources>
                <ResourceDictionary>
                    <!--Default Header Style-->
                    <Style x:Key="HeaderDefaultStyle" TargetType="Label">
                        <Setter Property="FontSize" Value="12"/>
                        <Setter Property="FontAttributes" Value="Bold"/>
                        <Setter Property="HorizontalOptions" Value="Start"/>
                        <Setter Property="VerticalOptions" Value="Center"/>
                        <Setter Property="HorizontalTextAlignment" Value="Start"/>
                        <Setter Property="LineBreakMode" Value="TailTruncation"/>
                    </Style>
                    <Style TargetType="Grid">
                        <Setter Property="BackgroundColor" Value="{Binding HeaderBackground,Source={x:Reference Self}}"/>
                    </Style>
                    <Style x:Key="ImageStyleBase" TargetType="Image">
                        <Setter Property="Aspect" Value="AspectFill"/>
                        <Setter Property="VerticalOptions" Value="Center"/>
                        <Setter Property="HorizontalOptions" Value="Center"/>
                        <Setter Property="HeightRequest" Value="5"/>
                        <Setter Property="WidthRequest" Value="9"/>
                        <!--<Setter Property="Margin" Value="0,0,4,0"/>-->
                    </Style>
                    <Style x:Key="AscendingIconStyle" TargetType="Image" BasedOn="{StaticResource ImageStyleBase}">
                        <Setter Property="Source" Value="{Binding AscendingIcon, Source={x:Reference Self}}"/>
                    </Style>
                    <Style x:Key="DescendingIconStyle" TargetType="Image" BasedOn="{StaticResource ImageStyleBase}">
                        <Setter Property="Source" Value="{Binding DescendingIcon, Source={x:Reference Self}}"/>
                    </Style>
                </ResourceDictionary>
            </Grid.Resources>
        </Grid>
    </ScrollView>
    <AbsoluteLayout Grid.Row="1">
        <ScrollView x:Name="Sv" Orientation="Horizontal" AbsoluteLayout.LayoutFlags="All" AbsoluteLayout.LayoutBounds="0,0,1,1">
            <helpers:DataGridListView x:Name="ListView" HeightRequest="190" VerticalOptions="Start"></helpers:DataGridListView>
        </ScrollView>
        <helpers:DataGridVertScrollBar IsVisible="{Binding EnableCustomScroll}" VerticalOptions="Start" HorizontalOptions="End" x:Name="ssv" HeightRequest="190" WidthRequest="10" AbsoluteLayout.LayoutFlags="HeightProportional,YProportional,XProportional"
                 AbsoluteLayout.LayoutBounds="1,1,8,1"></helpers:DataGridVertScrollBar>
    </AbsoluteLayout>
    <ContentView x:Name="NoDataViewElement" Grid.Row="0" Grid.RowSpan="2" VerticalOptions="Center" IsVisible="False"/>
</Grid>

checked in Appcenter also but it does not capture this crash or freeze

Can some help to fix
Thanks

21

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật