PrismLibrary / Prism

Prism is a framework for building loosely coupled, maintainable, and testable XAML applications in WPF, Xamarin Forms, and Uno / Win UI Applications..

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] Getting exception while navigating in Release mode on iOS

Himanshu045 opened this issue · comments

Description

I'm having a strange issue with .net MAUI, when I run app in release mode on iOS navigation is not working, I'm getting below exception.
When i'm clicking first time on button for Navigation i'm getting below exception,

Prism.Navigation.NavigationException: An error occurred while resolving the page. This is most likely the result of invalid XAML or other type initialization exception

second time when I'm clicking same button I'm getting different exception,

Prism.Navigation.NavigationException: An unsupported event occurred while Navigating. The attempted Navigation Stack is not supported by .NET MAUI

App is working fine in debug mode on both Android and iOS, but in release mode it is only working on Android.

Steps to Reproduce

Create new blank MAUI app
Add Prism.DryIoc.Maui 9.0.271-pre

  • Add two View: named ViewA, ViewB
  • Add ViewModels: named ViewModelA, ViewModelB
    Add a button on ViewA to Navigate to ViewB
    Add command on ViewModelA for navigation

private async Task DoGoToViewB()
{
_navigationService.NavigateAsync("ViewB")
.OnNavigationError(ex => Console.WriteLine("\nDoGoToViewB-------- " + ex)); ;
}

register View and ViewModels in MauiProgram

private static void RegisterNavigationDependency(IContainerRegistry containerRegistry)
{
containerRegistry.RegisterForNavigation();
containerRegistry.RegisterForNavigation<ViewA, ViewModelA>();
containerRegistry.RegisterForNavigation<ViewB, ViewModelB>();
}

set onAppStart:

.UseMauiApp().
UsePrism(prism =>
{
prism.RegisterTypes(RegisterNavigationDependency);
prism.OnAppStart("ViewA");

        })

Platform with bug

.NET MAUI

Affected platforms

iOS

Did you find any workaround?

No response

Relevant log output

No response

All bug reports require a reproduction app

TestNav.zip
@dansiegel Please find reproduction app