Navigation.PopAsync() is giving Java.Lang.IllegalArgumentException: 'No destination with ID 57 is on the NavController's back stack. The current destination is Destination(0x6) class=crc6452ffdc5b34af3a0f.NavigationViewFragment'

dedeepya yarlagadda 40 Reputation points
2024-07-22T10:11:21.8366667+00:00

Hi,

I have pushed a page into navigation stack using

private async void OnAddDeviceTapped(object sender, EventArgs e)

{

Devices = new ObservableCollection<Test.Model.DeviceInfo>(_dbContext.GetAllDevices());

var addDevicePage = new AddDevicePage(this, Devices);

addDevicePage.DeviceAdded += (s, deviceInfo) =>

{

    AddDevice(deviceInfo.Item1, deviceInfo.Item2, deviceInfo.Item3);

};

await Navigation.PushAsync(addDevicePage);
} and when user taps OK I want to move to previous page and tried private async void OnCancelClicked(object sender, EventArgs e)

{

await Navigation.PopAsync();


OnAddDeviceTapped is inside a tabbedpage, OnCancelClicked is in a content page.

Please help us here.

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,231 questions
{count} votes