Closed marketdevsoft closed 1 year ago
Hi. We've tried the code above with those exact version of the Grial's nuget and API 30 but we couldn't reproduce the error. What exact android device are you targeting? Are you working in windows or mac?
Hi, i've tested again this example in my windows sys.op. with Microsoft Visual Studio Community 2022 (64 bit) - Preview Versione 17.5.0 Preview 1.0 and Android Emulator - pixel5-_api_30:5554
I've just try now after updating with new grial version (Version="4.0.72"), but the error remain :
System.InvalidCastException Messaggio=Specified cast is not valid.
" 0x1A in Android.Runtime.JNINativeWrapper._unhandled_exception at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:12,5 C# 0x21 in Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PPLL_Z at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:232,26 C# 0xA3 in UXDivers.Grial.ScreenHelper.GetScreenCoordinates C# 0x45 in UXDivers.Grial.FloatingMenu.AddCloseButton C# 0x17 in UXDivers.Grial.FloatingMenu.FloatingMenuTapped C# 0x3C in Microsoft.Maui.Controls.TapGestureRecognizer.SendTapped at D:\a_work\1\s\src\Controls\src\Core\TapGestureRecognizer.cs:63,4 C# 0x161 in Microsoft.Maui.Controls.Platform.TapGestureHandler.OnTap at D:\a_work\1\s\src\Controls\src\Core\Platform\Android\TapGestureHandler.cs:71,5 C# 0x1C in Microsoft.Maui.Controls.Platform.InnerGestureListener.Android.Views.GestureDetector.IOnGestureListener.OnSingleTapUp at D:\a_work\1\s\src\Controls\src\Core\Platform\Android\InnerGestureListener.cs:156,4 C# 0x11 in Android.Views.GestureDetector.IOnGestureListenerInvoker.n_OnSingleTapUp_Landroid_viewMotionEvent at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/obj/Release/net7.0/android-33/mcw/Android.Views.GestureDetector.cs:701,5 C# 0x9 in Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PPL_Z at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:132,5 C# 0x3A in Java.Interop.NativeMethods.java_interop_jnienv_call_nonvirtual_boolean_method_a C# 0x74 in Java.Interop.JniEnvironment.InstanceMethods.CallNonvirtualBooleanMethod at /Users/runner/work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/obj/Release/net7.0/JniEnvironment.g.cs:11969,4 C# 0x8A in Java.Interop.JniPeerMembers.JniInstanceMethods.InvokeVirtualBooleanMethod at /Users/runner/work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/Java.Interop/JniPeerMembers.JniInstanceMethods_Invoke.cs:164,7 C# 0x38 in Android.Views.GestureDetector.OnTouchEvent at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/obj/Release/net7.0/android-33/mcw/Android.Views.GestureDetector.cs:1629,5 C# 0x2 in Microsoft.Maui.Controls.Platform.TapAndPanGestureDetector.OnTouchEvent at D:\a_work\1\s\src\Controls\src\Core\Platform\Android\TapAndPanGestureDetector.cs:38,4 C# 0x68 in Microsoft.Maui.Controls.Platform.GestureManager.OnTouchEvent at D:\a_work\1\s\src\Controls\src\Core\Platform\GestureManager\GestureManager.Android.cs:77,5 C# 0x34 in Microsoft.Maui.Controls.Platform.GestureManager.OnPlatformViewTouched at D:\a_work\1\s\src\Controls\src\Core\Platform\GestureManager\GestureManager.Android.cs:198,5 C# 0x17 in Android.Views.View.IOnTouchListenerImplementor.OnTouch at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/obj/Release/net7.0/android-33/mcw/Android.Views.View.cs:4139,5 C# 0x1A in Android.Views.View.IOnTouchListenerInvoker.n_OnTouch_Landroid_view_View_Landroid_viewMotionEvent at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/obj/Release/net7.0/android-33/mcw/Android.Views.View.cs:4080,5 C# 0xB in Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PPLL_Z at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:231,5 C# "
In my project i use these packages:
<PackageReference Include="CommunityToolkit.Maui" Version="3.1.0" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.0.0" />
<PackageReference Include="Crc32.NET" Version="1.2.0" />
<PackageReference Include="GeoTimeZone" Version="5.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.755" />
<PackageReference Include="MQTTnet" Version="4.1.4.563" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="System.Text.Json" Version="7.0.0" />
<PackageReference Include="TimeZoneConverter" Version="6.0.1" />
<PackageReference Include="UXDivers.GrialMaui" Version="4.0.72" />
<PackageReference Include="Microsoft.Maui.Controls.Maps" Version="7.0.49" />
<PackageReference Include="Mopups" Version="1.1.0" />
Can someone help me to resolve this problem?
Best regards!
Raffaele
Hi, can someone help me about this problem? I retry using 4.0.75 library version, but the problem is the same: when i click in the plus buttom, the float-menu doesn't appear, and app crash with this error: System.InvalidCastException: 'Specified cast is not valid.'
0xFFFFFFFFFFFFFFFF in Android.Runtime.JNIEnv.monodroid_debugger_unhandled_exception C#
0x1A in Android.Runtime.JNINativeWrapper._unhandled_exception at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:12,5 C#
0x1F in Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PPL_Z at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:133,26 C#
0xA3 in UXDivers.Grial.ScreenHelper.GetScreenCoordinates C#
0x45 in UXDivers.Grial.FloatingMenu.AddCloseButton C#
0x17 in UXDivers.Grial.FloatingMenu.FloatingMenuTapped C#
0x3C in Microsoft.Maui.Controls.TapGestureRecognizer.SendTapped at D:\a\_work\1\s\src\Controls\src\Core\TapGestureRecognizer.cs:63,4 C#
0x161 in Microsoft.Maui.Controls.Platform.TapGestureHandler.OnTap at D:\a\_work\1\s\src\Controls\src\Core\Platform\Android\TapGestureHandler.cs:71,5 C#
0x1C in Microsoft.Maui.Controls.Platform.InnerGestureListener.Android.Views.GestureDetector.IOnGestureListener.OnSingleTapUp at D:\a\_work\1\s\src\Controls\src\Core\Platform\Android\InnerGestureListener.cs:156,4 C#
0x11 in Android.Views.GestureDetector.IOnGestureListenerInvoker.n_OnSingleTapUp_Landroid_view_MotionEvent_ at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/obj/Release/net7.0/android-33/mcw/Android.Views.GestureDetector.cs:701,5 C#
0x9 in Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PPL_Z at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:132,5 C#
0x3A in Java.Interop.NativeMethods.java_interop_jnienv_call_nonvirtual_boolean_method_a C#
0x74 in Java.Interop.JniEnvironment.InstanceMethods.CallNonvirtualBooleanMethod at /Users/runner/work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/obj/Release/net7.0/JniEnvironment.g.cs:11969,4 C#
0x8A in Java.Interop.JniPeerMembers.JniInstanceMethods.InvokeVirtualBooleanMethod at /Users/runner/work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/Java.Interop/JniPeerMembers.JniInstanceMethods_Invoke.cs:164,7 C#
0x38 in Android.Views.GestureDetector.OnTouchEvent at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/obj/Release/net7.0/android-33/mcw/Android.Views.GestureDetector.cs:1629,5 C#
0x2 in Microsoft.Maui.Controls.Platform.TapAndPanGestureDetector.OnTouchEvent at D:\a\_work\1\s\src\Controls\src\Core\Platform\Android\TapAndPanGestureDetector.cs:38,4 C#
0x68 in Microsoft.Maui.Controls.Platform.GestureManager.OnTouchEvent at D:\a\_work\1\s\src\Controls\src\Core\Platform\GestureManager\GestureManager.Android.cs:77,5 C#
0x34 in Microsoft.Maui.Controls.Platform.GestureManager.OnPlatformViewTouched at D:\a\_work\1\s\src\Controls\src\Core\Platform\GestureManager\GestureManager.Android.cs:198,5 C#
0x17 in Android.Views.View.IOnTouchListenerImplementor.OnTouch at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/obj/Release/net7.0/android-33/mcw/Android.Views.View.cs:4139,5 C#
0x1A in Android.Views.View.IOnTouchListenerInvoker.n_OnTouch_Landroid_view_View_Landroid_view_MotionEvent_ at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/obj/Release/net7.0/android-33/mcw/Android.Views.View.cs:4080,5 C#
0xB in Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PPLL_Z at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:231,5 C#
This was fixed in latest version 4.0.84.
@dirivero Hey! exact the same error on Xamarin.Forms "UXDivers.Grial4" Version"4.0.49". Maybe I missing something ? Thanks!
Nuget:
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Xamarin.FFImageLoading.Forms" Version="2.4.11.982" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Microcharts.Forms" Version="0.9.5.9" />
<PackageReference Include="Microcharts" Version="0.9.5.9" />
<PackageReference Include="Rg.Plugins.Popup" Version="2.1.0" />
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2401" />
<PackageReference Include="Xamanimation" Version="1.3.0" />
<PackageReference Include="Xamarin.Essentials" Version="1.7.2" />
<PackageReference Include="Xamarin.FFImageLoading.Svg" Version="2.4.11.982" />
<PackageReference Include="Xamarin.FFImageLoading.Svg.Forms" Version="2.4.11.982" />
<PackageReference Include="Xamarin.FFImageLoading.Transformations" Version="2.4.11.982" />
<PackageReference Include="Xamarin.CommunityToolkit" Version="2.0.1" />
<PackageReference Include="Xamarin.Forms.Maps" Version="5.0.0.2401" />
<PackageReference Include="UXDivers.Grial4" Version="4.0.49" />
Source code:
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:AtlasMobile"
xmlns:grial="http://uxdivers.com/grial"
x:Class="AtlasMobile.ExplorerListPage"
Title="Title"
BackgroundColor="{ DynamicResource MainWrapperBackgroundColor }">
<ContentPage.Resources>
<!-- FLOATING MENU BUTTON TEMPLATE -->
<ControlTemplate x:Key="FloatingMenu_ControlTemplate">
<grial:CardView
CornerRadius="25"
HeightRequest="50"
WidthRequest="50"
ShadowOpacity="0.2"
ShadowSize="15"
grial:Effects.ShadowIOSOffset="10"
BackgroundColor="{ DynamicResource BasePageColor }"
Padding="0">
<Label
HorizontalOptions="Center"
VerticalOptions="Center"
FontSize="30"
FontFamily="{ StaticResource IconsFontFamily }"
Text="{ x:Static local:GrialIconsFont.Plus }"
TextColor="{ DynamicResource AccentColor }"
/>
</grial:CardView>
</ControlTemplate>
<!-- FLOATING MENU CLOSE BUTTON TEMPLATE -->
<ControlTemplate x:Key="FloatingMenu_CloseButtonControlTemplate">
<Frame
HasShadow="False"
CornerRadius="25"
HeightRequest="50"
WidthRequest="50"
BackgroundColor="{ DynamicResource AccentColor }"
BorderColor="Transparent"
Padding="0">
<Label
HorizontalOptions="Center"
VerticalOptions="Center"
FontSize="30"
FontFamily="{ StaticResource IconsFontFamily }"
Text="{ x:Static local:GrialIconsFont.Close }"
TextColor="{ DynamicResource OverDarkTextColor }"
/>
</Frame>
</ControlTemplate>
<!-- FLOATING MENU OPTION BUTTONS TEMPLATE -->
<ControlTemplate x:Key="FloatingMenu_ItemControlTemplate">
<Frame
HasShadow="False"
CornerRadius="25"
HeightRequest="50"
BackgroundColor="{ DynamicResource AccentColor }"
BorderColor="Transparent"
Padding="20,0">
<StackLayout Orientation="Horizontal">
<Label
HorizontalOptions="Center"
VerticalOptions="Center"
FontSize="24"
FontFamily="{ StaticResource IconsFontFamily }"
Text="{ TemplateBinding IconText }"
TextColor="{ DynamicResource OverDarkTextColor }"
/>
<Label
HorizontalOptions="Center"
VerticalOptions="Center"
FontSize="{ StaticResource SmallFontSize }"
Text="{ TemplateBinding Text }"
TextColor="{ DynamicResource OverDarkTextColor }"
/>
</StackLayout>
</Frame>
</ControlTemplate>
</ContentPage.Resources>
<Grid RowDefinitions="Auto,*">
<!-- FLOATING BUTTON -->
<grial:FloatingMenu
Grid.Row="1"
Direction="Top"
Margin="30,0,30,50"
VerticalOptions="End"
HorizontalOptions="End"
OverlayBackgroundColor="Transparent"
ItemsAlignment="End"
Spacing="10"
ControlTemplate="{ StaticResource FloatingMenu_ControlTemplate }"
CloseButtonTemplate="{ StaticResource FloatingMenu_CloseButtonControlTemplate }"
ItemControlTemplate="{ StaticResource FloatingMenu_ItemControlTemplate }">
<grial:FloatingMenuItem
Text="New Folder"
IconText="{ x:Static local:GrialIconsFont.Folder }"
TapCommand="{ Binding NewFolderCommand }"
/>
</grial:FloatingMenu>
</Grid>
</ContentPage>
using Xamarin.Forms;
namespace AtlasMobile
{
public partial class ExplorerListPage : ContentPage
{
public ExplorerListPage()
{
InitializeComponent();
BindingContext = new ExplorerFlowViewModel();
}
}
}
using System.Windows.Input;
using Xamarin.Forms;
namespace AtlasMobile
{
public class ExplorerFlowViewModel : ObservableObject
{
public ICommand NewFolderCommand => new Command( () => OnNewFolderCommand());
private void OnNewFolderCommand()
{
}
}
}
When test Floating menu, my application crash .
Description
I test the floating menu following documentation example here: https://docs.grialkit.com/controls/floating_menu/ Now i try with .NET 7 in android simulator with api 30, and "UXDivers.GrialMaui" Version="4.0.66-RC". When i push into plus button, the application crash ... and i find this error in device-logger:
pixel5-_api_30 Error 21582 MessageQueue-JNI android.runtime.JavaProxyThrowable: System.InvalidCastException: Arg_InvalidCastException at UXDivers.Grial.ScreenHelper.GetScreenCoordinates(VisualElement view) at UXDivers.Grial.FloatingMenu.AddCloseButton() at UXDivers.Grial.FloatingMenu.FloatingMenuTapped(Object sender, EventArgs e) at Microsoft.Maui.Controls.TapGestureRecognizer.SendTapped(View sender, Func`2 getPosition) at Microsoft.Maui.Controls.Platform.TapGestureHandler.OnTap(Int32 count, MotionEvent e) at Microsoft.Maui.Controls.Platform.InnerGestureListener.Android.Views.GestureDetector.IOnGestureListener.OnSingleTapUp(MotionEvent e) at Android.Views.GestureDetector.IOnGestureListenerInvoker.n_OnSingleTapUp_Landroid_viewMotionEvent(IntPtr , IntPtr , IntPtr ) at Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PPL_Z(_JniMarshal_PPL_Z , IntPtr , IntPtr , IntPtr )
Steps to Reproduce
This is the simple page that i use for my test:
Expected Behavior
Actual Behavior
Application crash when i push the "plus" action menu button ! Those are the android log information:
Ora Nome del dispositivo Tipo PID Tag Messaggio pixel5-_api_30 Error 21582 MessageQueue-JNI android.runtime.JavaProxyThrowable: System.InvalidCastException: Arg_InvalidCastException at UXDivers.Grial.ScreenHelper.GetScreenCoordinates(VisualElement view) at UXDivers.Grial.FloatingMenu.AddCloseButton() at UXDivers.Grial.FloatingMenu.FloatingMenuTapped(Object sender, EventArgs e) at Microsoft.Maui.Controls.TapGestureRecognizer.SendTapped(View sender, Func`2 getPosition) at Microsoft.Maui.Controls.Platform.TapGestureHandler.OnTap(Int32 count, MotionEvent e) at Microsoft.Maui.Controls.Platform.InnerGestureListener.Android.Views.GestureDetector.IOnGestureListener.OnSingleTapUp(MotionEvent e) at Android.Views.GestureDetector.IOnGestureListenerInvoker.n_OnSingleTapUp_Landroid_viewMotionEvent(IntPtr , IntPtr , IntPtr ) at Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PPL_Z(_JniMarshal_PPL_Z , IntPtr , IntPtr , IntPtr )
Basic Information
Screenshots