Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Calculator][Android] App crashes when move from the standard calculator's History tab to the Programmer calculator. #6998

Closed
sakshi173 opened this issue Sep 8, 2021 · 3 comments · Fixed by #7111
Assignees
Labels
area/canary 🐤 Categorizes an issue or PR as relevant to canary testing difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. kind/bug Something isn't working platform/android 🤖 Categorizes an issue or PR as relevant to the Android platform triage/untriaged Indicates an issue requires triaging or verification
Milestone

Comments

@sakshi173
Copy link

sakshi173 commented Sep 8, 2021

Current behavior

app.crashes.mp4

Expected behavior

The app should not crash and the Programmer calculator should open properly.

How to reproduce it (as minimally and precisely as possible)

Do some calculation using Standard calculator from burger menu.
Tap on the history sign on Standard calculator.
Tap on the Scientific Calculator.
Do some calculation using Scientific calculator from burger menu.
Tap on the history sign on the Scientific calculator.
Now Tap on the programmer calculator from burger menu.
Observe that the app crashes when goes to binary option of programmer calculator.

Workaround

No response

Works on UWP/WinUI

No response

Environment

No response

NuGet package version(s)

No response

Affected platforms

Android

IDE

No response

IDE version

No response

Relevant plugins

No response

Anything else we need to know?

No response

@sakshi173 sakshi173 added kind/bug Something isn't working platform/android 🤖 Categorizes an issue or PR as relevant to the Android platform triage/untriaged Indicates an issue requires triaging or verification area/canary 🐤 Categorizes an issue or PR as relevant to canary testing difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. labels Sep 8, 2021
@sakshi173 sakshi173 changed the title [Calculator][Android] App crashes when move from the standard calculator History tab to the Programmer calculator. [Calculator][Android] App crashes when move from the standard calculator's History tab to the Programmer calculator. Sep 8, 2021
@jeromelaban jeromelaban added this to the 3.10 milestone Sep 11, 2021
@jeromelaban
Copy link
Member

jeromelaban commented Sep 11, 2021

Exception stack trace:

�[41m�[30mfail�[39m�[22m�[49m: Windows.UI.Xaml.Data.BindingExpression[0]
  at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualVoidMethod (System.String encod09-10 21:08:36.153 V/mono-stdout(18464):       Failed to apply binding to property [DependencyPropertyDetails(IsProgrammer)] on [CalculatorApp.Calculator] (Attempt to invoke virtual method 'void android.view.View.unFocus(android.view.View)' on a null object reference)
Java.Lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.unFocus(android.view.View)' on a null object reference
  at Java.Interop.JniEnvironment+InstanceMethods.CallNonvirtualVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x0008e] in <271fc2d6b26d4b38b0f576ab844a08b8>:0 
  at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualVoidMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x00063] in <271fc2d6b26d4b38b0f576ab844a08b8>:0 
  at Android.Views.ViewGroup.RemoveViewAt (System.Int32 index) [0x00018] in /Users/builder/azdo/_work/1/s/xamarin-android/src/Mono.Android/obj/Release/monoandroid10/android-29/mcw/Android.Views.ViewGroup.cs:4219 
  at Windows.UI.Xaml.ElementStub.SwapViews (Android.Views.View oldView, System.Func`1[TResult] newViewProvider) [0x0004c] in C:\a\1\s\src\Uno.UI\UI\Xaml\ElementStub.Android.cs:21 
  at Windows.UI.Xaml.ElementStub.Materialize (System.Boolean isVisibilityChanged) [0x00008] in C:\a\1\s\src\Uno.UI\UI\Xaml\ElementStub.cs:149 
  at Windows.UI.Xaml.ElementStub.Materialize () [0x00000] in C:\a\1\s\src\Uno.UI\UI\Xaml\ElementStub.cs:143 
  at Windows.UI.Xaml.IFrameworkElementHelper.ConvertFromStubToElement (Windows.UI.Xaml.IFrameworkElement element, Windows.UI.Xaml.IFrameworkElement originalRootElement, System.String name) [0x0000a] in C:\a\1\s\src\Uno.UI\UI\Xaml\IFrameworkElement.cs:383 
  at Windows.UI.Xaml.IFrameworkElementHelper.FindName (Windows.UI.Xaml.IFrameworkElement e, System.Collections.Generic.IEnumerable`1[T] subviews, System.String name) [0x0008e] in C:\a\1\s\src\Uno.UI\UI\Xaml\IFrameworkElement.cs:242 
  at Windows.UI.Xaml.FrameworkElement.FindName (System.String name) [0x0000a] in C:\a\1\s\src\Uno.UI\Mixins\Android\FrameworkElementMixins.g.cs:64 
  at Windows.UI.Xaml.IFrameworkElementHelper.FindName (Windows.UI.Xaml.IFrameworkElement e, System.Collections.Generic.IEnumerable`1[T] subviews, System.String name) [0x000b5] in C:\a\1\s\src\Uno.UI\UI\Xaml\IFrameworkElement.cs:248 
  at CalculatorApp.OperatorsPanel.EnsureProgrammerRadixOps () [0x0000f] in C:\s
v.github\calculator\src\Calculator.Shared\Views\OperatorsPanel.xaml.cs:111 
  at CalculatorApp.Calculator.OnIsProgrammerPropertyChanged (System.Boolean oldValue, System.Boolean newValue) [0x00007] in C:\s
v.github\calculator\src\Calculator.Shared\Views\Calculator.xaml.cs:328 
  at CalculatorApp.Calculator+<>c.<.cctor>b__425_2 (Windows.UI.Xaml.DependencyObject snd, Windows.UI.Xaml.DependencyPropertyChangedEventArgs args) [0x00000] in C:\s
v.github\calculator\src\Calculator.Shared\Views\Calculator.xaml.cs:68 
  at Windows.UI.Xaml.PropertyMetadata.RaisePropertyChanged (Windows.UI.Xaml.DependencyObject source, Windows.UI.Xaml.DependencyPropertyChangedEventArgs e) [0x00000] in C:\a\1\s\src\Uno.UI\UI\Xaml\PropertyMetadata.cs:187 
  at Windows.UI.Xaml.DependencyObjectStore.InvokeCallbacks (Windows.UI.Xaml.DependencyObject actualInstanceAlias, Windows.UI.Xaml.DependencyProperty property, Windows.UI.Xaml.DependencyPropertyDetails propertyDetails, System.Object previousValue, Windows.UI.Xaml.DependencyPropertyValuePrecedences previousPrecedence, System.Object newValue, Windows.UI.Xaml.DependencyPropertyValuePrecedences newPrecedence, System.Boolean bypassesPropagation) [0x000e0] in C:\a\1\s\src\Uno.UI\UI\Xaml\DependencyObjectStore.cs:1630 
  at Windows.UI.Xaml.DependencyObjectStore.RaiseCallbacks (Windows.UI.Xaml.DependencyObject actualInstanceAlias, Windows.UI.Xaml.DependencyPropertyDetails propertyDetails, System.Object previousValue, Windows.UI.Xaml.DependencyPropertyValuePrecedences previousPrecedence, System.Object newValue, Windows.UI.Xaml.DependencyPropertyValuePrecedences newPrecedence) [0x0005b] in C:\a\1\s\src\Uno.UI\UI\Xaml\DependencyObjectStore.cs:1540 
  at Windows.UI.Xaml.DependencyObjectStore.InnerSetValue (Windows.UI.Xaml.DependencyProperty property, System.Object value, Windows.UI.Xaml.DependencyPropertyValuePrecedences precedence, Windows.UI.Xaml.DependencyPropertyDetails propertyDetails, System.Boolean isThemeBinding) [0x001b4] in C:\a\1\s\src\Uno.UI\UI\Xaml\DependencyObjectStore.cs:496 
  at Windows.UI.Xaml.DependencyObjectStore.SetValue (Windows.UI.Xaml.DependencyProperty property, System.Object value, Windows.UI.Xaml.DependencyPropertyValuePrecedences precedence, Windows.UI.Xaml.DependencyPropertyDetails propertyDetails, System.Boolean isThemeBinding) [0x00030] in C:\a\1\s\src\Uno.UI\UI\Xaml\DependencyObjectStore.cs:429 
  at Windows.UI.Xaml.DependencyObjectExtensions.SetValue (System.Object instance, Windows.UI.Xaml.DependencyProperty property, System.Object value, System.Nullable`1[T] precedence) [0x00000] in C:\a\1\s\src\Uno.UI\UI\Xaml\DependencyObjectExtensions.cs:302 
  at Uno.UI.DataBinding.BindingPropertyHelper+<>c__DisplayClass39_9.<InternalGetValueSetter>b__13 (System.Object instance, System.Object value) [0x00000] in C:\a\1\s\src\Uno.UI\DataBinding\BindingPropertyHelper.cs:846 
  at Windows.UI.Xaml.Data.BindingExpression.SetTargetValue (System.Object value) [0x0000f] in C:\a\1\s\src\Uno.UI\DataBinding\BindingExpression.cs:414 
  at Windows.UI.Xaml.Data.BindingExpression.SetTargetValueSafe (System.Object v, System.Boolean useTargetNullValue) [0x00114] in C:\a\1\s\src\Uno.UI\DataBinding\BindingExpression.cs:595 
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.unFocus(android.view.View)' on a null object reference
	at android.view.ViewGroup.removeViewInternal(ViewGroup.java:5544)
	at android.view.ViewGroup.removeViewAt(ViewGroup.java:5507)
	at crc64122dcf5ad656876d.UIElement.n_onNativeMotionEvent(Native Method)
	at crc64122dcf5ad656876d.UIElement.onNativeMotionEvent(UIElement.java:57)
	at Uno.UI.UnoMotionHelper.dispatchMotionEvent(UnoMotionHelper.java:268)
	at Uno.UI.UnoViewGroup.dispatchTouchEvent(UnoViewGroup.java:324)
	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118)
	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799)
	at Uno.UI.UnoRecyclerView.access$001(UnoRecyclerView.java:10)
	at Uno.UI.UnoRecyclerView$TouchMotionTarget.dispatchToSuper(UnoRecyclerView.java:37)
	at Uno.UI.UnoMotionHelper.dispatchMotionEvent(UnoMotionHelper.java:191)
	at Uno.UI.UnoRecyclerView.dispatchTouchEvent(UnoRecyclerView.java:50)
	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118)
	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799)
	at Uno.UI.UnoViewGroup.access$201(UnoViewGroup.java:14)
	at Uno.UI.UnoViewGroup$TouchMotionTarget.dispatchToSuper(UnoViewGroup.java:311)
	at Uno.UI.UnoMotionHelper.dispatchMotionEvent(UnoMotionHelper.java:191)
	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118)
	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799)
	at Uno.UI.UnoViewGroup.access$201(UnoViewGroup.java:14)
	at Uno.UI.UnoViewGroup$TouchMotionTarget.dispatchToSuper(UnoViewGroup.java:311)
	at Uno.UI.UnoMotionHelper.dispatchMotionEvent(UnoMotionHelper.java:191)
	at Uno.UI.UnoViewGroup.dispatchTouchEvent(UnoViewGroup.java:324)
	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118)
	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799)
	at Uno.UI.UnoViewGroup.access$201(UnoViewGroup.java:14)

/cc @MartinZikmund

@MartinZikmund MartinZikmund self-assigned this Sep 11, 2021
@jeromelaban jeromelaban modified the milestones: 3.10, 3.11 Sep 13, 2021
@jeromelaban
Copy link
Member

The issue is actually caused by a interaction between a Visibility binding and x:Load. It happens that the focus exception is just the first call that happens inside Android because we're requesting a view that is not at the requested index.

@sakshi173
Copy link
Author

Verified, Bug is fixed, closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/canary 🐤 Categorizes an issue or PR as relevant to canary testing difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. kind/bug Something isn't working platform/android 🤖 Categorizes an issue or PR as relevant to the Android platform triage/untriaged Indicates an issue requires triaging or verification
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants