I updated the code, change the null references and the issue seemed to be fixed: -
using MauiPopup.Views;
using SampleApp.Model;
using SampleApp.ViewModels;
using System;
namespace SampleApp.Views;
public partial class CalendarRangePickerPopupSelectedDates : BasePopupPage
{
#pragma warning disable CS8632 // The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
private readonly Action<CalendarRangePickerResult>? _onClosedPopup;
public CalendarRangePickerPopupSelectedDates()
{
}
#pragma warning restore CS8632 // The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
public CalendarRangePickerPopupSelectedDates(Action<CalendarRangePickerResult> onClosedPopup)
{
_onClosedPopup = onClosedPopup;
InitializeComponent();
}
protected override void OnAppearing()
{
base.OnAppearing();
if (BindingContext is CalendarRangePickerPopupSelectedDatesViewModel vm)
vm.Closed += _onClosedPopup;
}
protected override void OnDisappearing()
{
if (BindingContext is CalendarRangePickerPopupSelectedDatesViewModel vm)
vm.Closed -= _onClosedPopup;
base.OnDisappearing();
}
}