HELP
I have a simple binding like that:
<Entry Text="{Binding Amount" OK
<Entry Text="{Binding Amount, Converter={StaticResource amountConverter}}" THROWS an exception.
Here is the complete page:
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:cvt="clr-namespace:TestVari.Converters"
x:Class="TestVari.Pages.TestMyKeyboardPage"
Title="Test">
<ContentPage.Resources>
<cvt:AmountConverter x:Key="amountConverter" />
</ContentPage.Resources>
<VerticalStackLayout>
<Label Text="dummy label" />
<Entry Text="{Binding Amount, Converter={StaticResource amountConverter}}"
WidthRequest="300" IsReadOnly="True"
VerticalOptions="Start" HorizontalOptions="Start"
TextColor="Blue" BackgroundColor="WhiteSmoke">
<Entry.GestureRecognizers>
<TapGestureRecognizer Tapped="OnFieldTapped" />
</Entry.GestureRecognizers>
</Entry>
<Button Text="37" WidthRequest="60" HorizontalOptions="Start" Clicked="On37" />
</VerticalStackLayout>
</ContentPage>
When I try to navigate to this page I have the following exception:
System.Reflection.TargetInvocationException
Message=Exception has been thrown by the target of an invocation.
Stack:
0xFFFFFFFFFFFFFFFF in Android.Runtime.RuntimeNativeMethods.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#
0x1D in Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PP_V at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:23,26 C#
0x17 in System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw C#
0x6 in System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_0 C#
0xC in Android.App.SyncContext. at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.App/SyncContext.cs:36,19 C#
0xE in Java.Lang.Thread.RunnableImplementor.Run at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Java.Lang/Thread.cs:37,6 C#
0x8 in Java.Lang.IRunnableInvoker.n_Run at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/obj/Release/net8.0/android-34/mcw/Java.Lang.IRunnable.cs:84,4 C#
0x8 in Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PP_V at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:22,5 C#
What makes me very confused is that I have other pages with similar binding and the same 'amountConverter', and they work fine.
Can anybody give me a clue on how to address this issue?