Reputation: 171
C#, .NET and MAUI: When navigating to a page in the Views folder I receive the following Exception error: System.Runtime.InteropServices.COMException: '0x88000FA8'. Exception Error screenshot
This error occurs on the FundsPage of the project, however if I resize the window smaller and try to navigate to the other pages (for example StudentsPage) I encounter the same error.
I've tested the project on a different windows machine and the same problem occurs.
I'm not sure why I'm getting this error. Could this be a bug or something related MAUI?
Navbar.xaml.cs
namespace EduCube;
public partial class Navbar : ContentView
{
public Navbar()
{
InitializeComponent();
}
private async void mainpageroute(object sender, EventArgs e)
{
await Shell.Current.GoToAsync("/DashboardPage");
}
private async void teacherpageroute(object sender, EventArgs e)
{
await Shell.Current.GoToAsync("/TeachersPage");
}
private async void studentpageroute(object sender, EventArgs e)
{
await Shell.Current.GoToAsync("/StudentsPage");
}
private async void subjectpageroute(object sender, EventArgs e)
{
await Shell.Current.GoToAsync("/SubjectsPage");
}
private async void fundspageroute(object sender, EventArgs e)
{
await Shell.Current.GoToAsync("/FundsPage"); //Exception User-Unhandled error
}
}
Code Behind: FundsPage.xaml.cs
namespace EduCube;
public partial class FundsPage : ContentPage
{
public FundsPage()
{
InitializeComponent();
}
}
AppShell.xaml.cs
using EduCube.Views.AddUpdateViews;
namespace EduCube;
public partial class AppShell : Shell
{
public AppShell()
{
InitializeComponent();
//initialise routes
Routing.RegisterRoute("DashboardPage", typeof(DashboardPage));
Routing.RegisterRoute("StudentsPage", typeof(StudentsPage));
Routing.RegisterRoute("SubjectsPage", typeof(SubjectsPage));
Routing.RegisterRoute("TeachersPage", typeof(TeachersPage));
Routing.RegisterRoute("FundsPage", typeof(FundsPage));
Routing.RegisterRoute("MainPage", typeof(MainPage));
//initialize add and update pages
Routing.RegisterRoute(nameof(AddUpdateSubjectPage), typeof(AddUpdateSubjectPage));
}
}
AppShell.xaml
<Shell
x:Class="EduCube.AppShell"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:EduCube"
Shell.FlyoutBehavior="Disabled">
<!--Login Page -->
<ShellContent
ContentTemplate="{DataTemplate local:MainPage}"
Route="MainPage" />
<!-- Dashboard page -->
<ShellContent
ContentTemplate="{DataTemplate local:DashboardPage}"
Route="DashboardPage" />
<!-- Teachers page -->
<ShellContent
ContentTemplate="{DataTemplate local:TeachersPage}"
Route="TeachersPage" />
<!-- Students page -->
<ShellContent
ContentTemplate="{DataTemplate local:StudentsPage}"
Route="StudentsPage" />
<!-- Subjects page -->
<ShellContent
ContentTemplate="{DataTemplate local:SubjectsPage}"
Route="SubjectsPage" />
<!-- Funds page -->
<ShellContent
ContentTemplate="{DataTemplate local:FundsPage}"
Route="FundsPage" />
</Shell>
System.Runtime.InteropServices.COMException: '0x88000FA8'
System.Runtime.InteropServices.COMException
HResult=0x88000FA8
Message=0x88000FA8
Source=WinRT.Runtime
StackTrace:
at WinRT.ExceptionHelpers.<ThrowExceptionForHR>g__Throw|20_0(Int32 hr)
at Microsoft.Maui.Controls.Handlers.ShellItemHandler.MapTabBarIsVisible(ShellItemHandler handler, ShellItem item)
at Microsoft.Maui.PropertyMapper.UpdateProperties(IElementHandler viewHandler, IElement virtualView)
at Microsoft.Maui.Controls.Handlers.ShellItemHandler.SetVirtualView(IElement view)
at Microsoft.Maui.Controls.Platform.ShellView.CreateShellItemView()
at Microsoft.Maui.Controls.Platform.ShellView.SwitchShellItem(ShellItem newItem, Boolean animate)
at Microsoft.Maui.Controls.Element.OnPropertyChanged(String propertyName)
at Microsoft.Maui.Controls.Shell.OnPropertyChanged(String propertyName)
at Microsoft.Maui.Controls.BindableObject.SetValueActual(BindableProperty property, BindablePropertyContext context, Object value, Boolean currentlyApplying, SetValueFlags attributes, Boolean silent)
at Microsoft.Maui.Controls.BindableObject.SetValueCore(BindableProperty property, Object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes)
at Microsoft.Maui.Controls.ShellNavigationManager.<GoToAsync>d__14.MoveNext()
at EduCube.Navbar.<fundspageroute>d__5.MoveNext() in C:\Users\hello\source\repos\EduCube2\Components\Navbar.xaml.cs:line 38
Upvotes: 2
Views: 1531
Reputation: 171
I've managed to fix this problem with the FundsPage crashing when navigating to the page. I did a reset and new installation of Windows 11 OS on my machine. I installed Visual Studio Community Preview (17.4.0 Preview 1.0). During installation of VS I made sure to select the ASP.Net and web development
, .NET Multi-platform App UI development
and .NET desktop development
workloads. I then cloned the repository again and Rebuilt the project and ran it.
If anyone has the same error this solution might or might not work for you. In my case it did.
Upvotes: 2