小编Miy*_*ang的帖子

.NET MAUI 错误:“无法访问已处置的对象。对象名称:'Microsoft.Maui.Platform.ContentViewGroup'”

我目前正在使用 .NET MAUI 开发应用程序,但遇到了无法解决的问题。我在调试的时候,在android平台上导航页面时,遇到了一个奇怪的异常

\n

该应用程序有两个选项卡:主页和自助。登录后,用户将进入“主页”选项卡。但是,当我尝试从主页导航到任何其他页面时,应用程序会抛出以下错误并随后崩溃:

\n
\n

无法访问已处置的对象。\n对象名称: \xe2\x80\x98Microsoft.Maui.Platform.ContentViewGroup\'

\n
\n

这是我的 xaml 代码:

\n
<?xml version="1.0" encoding="utf-8" ?>\n<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"\n             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"\n             x:Class="Views.Dashboard.HomePageDashboard"\n             Title="HomePageDashboard">\n\n<Shell.TitleView>\n        <Grid>\n            <Grid.RowDefinitions>\n                <RowDefinition Height="*" />\n            </Grid.RowDefinitions>\n            <Grid.ColumnDefinitions>\n                <ColumnDefinition Width="9*" />\n                <ColumnDefinition Width="*" />\n            </Grid.ColumnDefinitions>\n            <Frame \n                           \n           Grid.Column="1"\n           HeightRequest="40"\n           WidthRequest="40"\n           CornerRadius="20"\n           BackgroundColor="Transparent"\n           HorizontalOptions="Center"\n           VerticalOptions="Center"\n           IsClippedToBounds="True"\n           Padding="0"\n           >\n                <Border BackgroundColor="{StaticResource PrimaryColorLight}">\n                    <Label Text="{Binding ProfileImageLabel}" TextColor="White" FontSize="Micro" LineBreakMode="WordWrap" HorizontalOptions="Center" VerticalOptions="Center"/>\n                    <Border.GestureRecognizers>\n                        <TapGestureRecognizer Command="{Binding GotoProfileCommand}"/>\n                    </Border.GestureRecognizers>\n                </Border>\n                </Frame>\n        </Grid>\n\n    </Shell.TitleView>\n <VerticalStackLayout Margin="0,30,0,0">\n                <Label Text="Categories" FontSize="Subtitle" FontAttributes="Bold" FontFamily="Bold" HorizontalOptions="Start" VerticalOptions="Start" …
Run Code Online (Sandbox Code Playgroud)

c# xaml android maui

2
推荐指数
1
解决办法
2000
查看次数

标签 统计

android ×1

c# ×1

maui ×1

xaml ×1