无法激活 Xamarin.Forms.Platform.Android.FastRenderers.FrameRenderer 类型的实例
Unable to activate instance of type Xamarin.Forms.Platform.Android.FastRenderers.FrameRenderer
当我单击一个与网络服务对话的按钮然后单击另一个按钮时,我遇到了 Android 应用程序的问题,我得到了这个异常。
Unable to activate instance of type
Xamarin.Forms.Platform.Android.FastRenderers.FrameRenderer from native
handle 0x7fcb566738 (key_handle 0x3ed634c).
异常似乎来自以下 xaml
<Frame x:Name="TileFrame" Margin="5" Grid.Column="0" Grid.Row="0"
BindingContext="{x:Reference this}"
effects:TouchEffect.Command="{Binding TapTile}"
effects:TouchEffect.CommandParameter="{Binding}">
<StackLayout VerticalOptions="Center">
<Label
BindingContext="{x:Reference this}"
Text="{Binding Title}"
FontSize="20"
LineHeight="1"
FontAttributes="Bold"
TextTransform="Uppercase"
HorizontalTextAlignment="Center"
Opacity="1"
Margin="5, 0" />
</StackLayout>
</Frame>
如果我将框架更改为按钮,则会出现以下异常
<Button x:Name="TileFrame" Margin="5" Grid.Column="0" Grid.Row="0"
BindingContext="{x:Reference this}"
effects:TouchEffect.Command="{Binding TapTile}"
effects:TouchEffect.CommandParameter="{Binding}">
</Button>
Unable to activate instance of type
Xamarin.Forms.Platform.Android.FastRenderers.ButtonRenderer from
native handle 0x7fcb55a1d8 (key_handle 0x46ac678).
我在 git 集线器上发现了这个,但它是从 2020 年开始的,我发现它遇到了同样的问题,到目前为止,变通办法没有解决我的问题
经过大量挖掘。该应用程序正在使用 UI 而不是总是在 UI 线程上执行操作。因此,将代码包装在以下代码中可以为应用程序提供更高的稳定性。
MainThread.BeginInvokeOnMainThread(() =>
{
// Code to run on the main thread
});
https://docs.microsoft.com/en-us/xamarin/essentials/main-thread
当我单击一个与网络服务对话的按钮然后单击另一个按钮时,我遇到了 Android 应用程序的问题,我得到了这个异常。
Unable to activate instance of type Xamarin.Forms.Platform.Android.FastRenderers.FrameRenderer from native handle 0x7fcb566738 (key_handle 0x3ed634c).
异常似乎来自以下 xaml
<Frame x:Name="TileFrame" Margin="5" Grid.Column="0" Grid.Row="0"
BindingContext="{x:Reference this}"
effects:TouchEffect.Command="{Binding TapTile}"
effects:TouchEffect.CommandParameter="{Binding}">
<StackLayout VerticalOptions="Center">
<Label
BindingContext="{x:Reference this}"
Text="{Binding Title}"
FontSize="20"
LineHeight="1"
FontAttributes="Bold"
TextTransform="Uppercase"
HorizontalTextAlignment="Center"
Opacity="1"
Margin="5, 0" />
</StackLayout>
</Frame>
如果我将框架更改为按钮,则会出现以下异常
<Button x:Name="TileFrame" Margin="5" Grid.Column="0" Grid.Row="0"
BindingContext="{x:Reference this}"
effects:TouchEffect.Command="{Binding TapTile}"
effects:TouchEffect.CommandParameter="{Binding}">
</Button>
Unable to activate instance of type Xamarin.Forms.Platform.Android.FastRenderers.ButtonRenderer from native handle 0x7fcb55a1d8 (key_handle 0x46ac678).
我在 git 集线器上发现了这个,但它是从 2020 年开始的,我发现它遇到了同样的问题,到目前为止,变通办法没有解决我的问题
经过大量挖掘。该应用程序正在使用 UI 而不是总是在 UI 线程上执行操作。因此,将代码包装在以下代码中可以为应用程序提供更高的稳定性。
MainThread.BeginInvokeOnMainThread(() =>
{
// Code to run on the main thread
});
https://docs.microsoft.com/en-us/xamarin/essentials/main-thread