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'
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
-
Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) 41,601 Reputation points • Microsoft Vendor
2024-07-23T03:14:26.54+00:00 For further investigation, could you please provide the following information?
- The MAUI version.
- On which platform does this problem occur and what is its API level?
Your prompt reply will be highly appreciated.
-
dedeepya yarlagadda 45 Reputation points
2024-07-23T05:52:16.3433333+00:00 Hi Yonglun Liu,
Thanks for your response.
The MAUI Version is 8 and platform used is Android and targetsdk version is 34
please find the cs proj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFrameworks>net8.0-ios;net8.0-android34.0</TargetFrameworks> <TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.19041.0</TargetFrameworks> <!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET --> <!-- <TargetFrameworks>$(TargetFrameworks);net8.0-tizen</TargetFrameworks> --> <!-- Note for MacCatalyst: The default runtime is maccatalyst-x64, except in Release config, in which case the default is maccatalyst-x64;maccatalyst-arm64. When specifying both architectures, use the plural <RuntimeIdentifiers> instead of the singular <RuntimeIdentifier>. The Mac App Store will NOT accept apps with ONLY maccatalyst-arm64 indicated; either BOTH runtimes must be indicated or ONLY macatalyst-x64. --> <!-- For example: <RuntimeIdentifiers>maccatalyst-x64;maccatalyst-arm64</RuntimeIdentifiers> --> <OutputType>Exe</OutputType> <RootNamespace>sample</RootNamespace> <UseMaui>true</UseMaui> <SingleProject>true</SingleProject> <ImplicitUsings>enable</ImplicitUsings> <Nullable>enable</Nullable> <WindowsPackageType>None</WindowsPackageType> <WindowsAppSDKSelfContained Condition="'$(IsUnpackaged)' == 'true'">true</WindowsAppSDKSelfContained> <SelfContained Condition="'$(IsUnpackaged)' == 'true'">true</SelfContained> <EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk> <AndroidMinSdkVersion>30</AndroidMinSdkVersion> <AndroidTargetSdkVersion>34</AndroidTargetSdkVersion> <!-- Display name --> <ApplicationTitle>MediaShare</ApplicationTitle> <!-- App Identifier --> <ApplicationId>com.infinira.mediashare</ApplicationId> <!-- Versions --> <ApplicationDisplayVersion>1.0</ApplicationDisplayVersion> <ApplicationVersion>1</ApplicationVersion> <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">11.0</SupportedOSPlatformVersion> <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">13.1</SupportedOSPlatformVersion> <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">30.0</SupportedOSPlatformVersion> <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion> <TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion> <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion> <SupportedArchitectures>x86_64</SupportedArchitectures> <NeutralLanguage>en-US</NeutralLanguage> <PlatformTarget>x64</PlatformTarget> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net8.0-android34.0|AnyCPU'"> <AndroidPackageFormat>apk</AndroidPackageFormat> <AndroidEnableMultiDex>True</AndroidEnableMultiDex> <DebugSymbols>True</DebugSymbols> <Debugger>Xamarin</Debugger> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-android34.0|AnyCPU'"> <AndroidEnableMultiDex>True</AndroidEnableMultiDex> <Debugger>Xamarin</Debugger> <RunAOTCompilation>True</RunAOTCompilation> </PropertyGroup> <ItemGroup> <!-- App Icon --> <!-- Splash Screen --> <MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#FFFFFF" BaseSize="128,128" /> <!-- Images --> <MauiImage Include="Resources\Images\*" /> <!-- Custom Fonts --> <MauiFont Include="Resources\Fonts\*" /> <MauiFont Include="Resources\**" /> <!-- Raw Assets (also remove the "Resources\Raw" prefix) --> <MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" /> </ItemGroup> <ItemGroup> <AndroidResource Remove="Platforms\Android\Resources\values\styles.xml" /> </ItemGroup> <ItemGroup> <None Remove="Resources\AppIcon\ic_launcher.png" /> <None Remove="Resources\Images\add.png" /> <None Remove="Resources\Images\add_device_icon.png" /> <None Remove="Resources\Images\back_arrow.png" /> <None Remove="Resources\Images\delete.png" /> <None Remove="Resources\Images\device.svg" /> <None Remove="Resources\Images\down_arrow.svg" /> <None Remove="Resources\Images\history.svg" /> <None Remove="Resources\Images\info.png" /> <None Remove="Resources\Images\kebab_icon.png" /> <None Remove="Resources\Images\receive.png" /> <None Remove="Resources\Images\scan_qr_icon.png" /> <None Remove="Resources\Images\search_icon.png" /> <None Remove="Resources\Images\send.png" /> <None Remove="Resources\Images\up_arrow.svg" /> <None Remove="Resources\Images\wifi.svg" /> <None Remove="Resources\Splash\splash.png" /> </ItemGroup> <ItemGroup> <MauiIcon Include="Resources\AppIcon\ic_launcher.png" ForegroundFile="Resources\AppIcon\ic_launcher.png" Color="#512BD4" /> </ItemGroup> <ItemGroup> <MauiReference Include="Microsoft.Maui.Controls" /> </ItemGroup> <ItemGroup> <PackageReference Include="CommunityToolkit.Maui" Version="7.0.1" /> <PackageReference Include="Microsoft.Maui.Controls" Version="8.0.3" /> <PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.3" /> <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" /> <PackageReference Include="sqlite-net-pcl" Version="1.9.172" /> <PackageReference Include="ZXing.Net.Maui" Version="0.4.0" /> <PackageReference Include="ZXing.Net.Maui.Controls" Version="0.4.0" /> <PackageReference Include="Xamarin.Essentials" Version="1.8.1" /> <PackageReference Include="Microsoft.Maui.Essentials" Version="8.0.3" /> </ItemGroup> <ItemGroup> <Compile Update="Properties\Resources.Designer.cs"> <DesignTime>True</DesignTime> <AutoGen>True</AutoGen> <DependentUpon>Resources.resx</DependentUpon> </Compile> <Compile Update="Resources\String_en.Designer.cs"> <DesignTime>True</DesignTime> <AutoGen>True</AutoGen> <DependentUpon>String_en.resx</DependentUpon> </Compile> <Compile Update="View\AddDevicePage.xaml.cs"> <DependentUpon>AddDevicePage.xaml</DependentUpon> </Compile> <Compile Update="View\NearbyPage.xaml.cs"> <DependentUpon>NearbyPage.xaml</DependentUpon> </Compile> <Compile Update="View\ScanQRPage.xaml.cs"> <DependentUpon>ScanQRPage.xaml</DependentUpon> </Compile> <Compile Update="View\SocialmediaPage.xaml.cs"> <DependentUpon>SocialmediaPage.xaml</DependentUpon> </Compile> </ItemGroup> <ItemGroup> <EmbeddedResource Update="Properties\Resources.resx"> <Generator>PublicResXFileCodeGenerator</Generator> <LastGenOutput>Resources.Designer.cs</LastGenOutput> </EmbeddedResource> <EmbeddedResource Update="Resources\String_en.resx"> <Generator>ResXFileCodeGenerator</Generator> <LastGenOutput>String_en.Designer.cs</LastGenOutput> </EmbeddedResource> </ItemGroup> <ItemGroup> <MauiXaml Update="Resources\AppStyles\String.xaml"> <Generator>MSBuild:Compile</Generator> </MauiXaml> <MauiXaml Update="Resources\AppStyles\Styles.xaml"> <Generator>MSBuild:Compile</Generator> </MauiXaml> <MauiXaml Update="View\AboutPage.xaml"> <Generator>MSBuild:Compile</Generator> </MauiXaml> <MauiXaml Update="View\AddDevicePage.xaml"> <Generator>MSBuild:Compile</Generator> </MauiXaml> <MauiXaml Update="View\FileSelectionView.xaml"> <Generator>MSBuild:Compile</Generator> </MauiXaml> <MauiXaml Update="View\InfoPopupPage.xaml"> <Generator>MSBuild:Compile</Generator> </MauiXaml> <MauiXaml Update="View\MyDevices.xaml"> <Generator>MSBuild:Compile</Generator> </MauiXaml> <MauiXaml Update="View\NearbyPage.xaml"> <Generator>MSBuild:Compile</Generator> </MauiXaml> <MauiXaml Update="View\ScanQRPage.xaml"> <Generator>MSBuild:Compile</Generator> </MauiXaml> <MauiXaml Update="View\ScanQRPopupPage.xaml"> <Generator>MSBuild:Compile</Generator> </MauiXaml> <MauiXaml Update="View\SearchResultsPage.xaml"> <Generator>MSBuild:Compile</Generator> </MauiXaml> <MauiXaml Update="View\SelectedFilesPopupPage.xaml"> <Generator>MSBuild:Compile</Generator> </MauiXaml> <MauiXaml Update="View\SendTabHeader.xaml"> <Generator>MSBuild:Compile</Generator> </MauiXaml> <MauiXaml Update="View\SocialmediaPage.xaml"> <Generator>MSBuild:Compile</Generator> </MauiXaml> <MauiXaml Update="View\HistoryPage.xaml"> <Generator>MSBuild:Compile</Generator> </MauiXaml> <MauiXaml Update="View\VideoPage.xaml"> <Generator>MSBuild:Compile</Generator> </MauiXaml> </ItemGroup> </Project>
-
Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) 41,601 Reputation points • Microsoft Vendor
2024-07-24T06:50:43.1466667+00:00 Thanks for your feedback.
I used the same environment to call the Navigation method and this error did not occur.
To investigate further, could you please provide a minimal code snippet and steps that can reproduce this issue in a new project?
-
Deleted
This comment has been deleted due to a violation of our Code of Conduct. The comment was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.
-
dedeepya yarlagadda 45 Reputation points
2024-07-25T09:31:37.8633333+00:00 Hi Yonglun,
Thanks for your response.
I am attaching my code snippetsTab1.xml SubTab1.xml DeviceTabButtons.xml DeviceTabButtons.txt AddDevicePage.xml AddDevicePage.txt
In Add device page onAddbuttonclick and cancelclicked I am seeing the issue.
please let us know how to proceed further.
Thanks
-
Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) 41,601 Reputation points • Microsoft Vendor
2024-07-26T09:16:40.7333333+00:00 Thanks for your feedback.
There are many referenced static classes in the code you provided. Could you please provide a minimal code that can reproduce this problem?
This will help to reproduce the issue and locate the cause of the issue.
Sign in to comment