Samsung / Tizen.CircularUI

Tizen Wearable CircularUI project is to develop an open source software motivate software developer to creating Tizen Wearable Xamarin Forms app more easily and efficiently.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug] [Tizen] NullReferenceException in VisualElementRenderer.ComputeAbsoluteX(VisualElement e)

SHuygh opened this issue · comments

Describe the bug
We are using Xamarin Forms to make a Tizen watch application. But are getting app crashes for which I do not have an immediate idea how to fix them.
Below you can find the stack trace.

at Xamarin.Forms.Platform.Tizen.VisualElementRenderer1.ComputeAbsoluteX(VisualElement e) at Xamarin.Forms.Platform.Tizen.VisualElementRenderer1.ComputeAbsolutePoint(VisualElement e)
at Xamarin.Forms.Platform.Tizen.VisualElementRenderer1.UpdateNativeGeometry() at Xamarin.Forms.Platform.Tizen.VisualElementRenderer1.UpdateLayout()
at Xamarin.Forms.Platform.Tizen.VisualElementRenderer1.OnBatchCommitted(Object sender, EventArg1 e)
at Xamarin.Forms.VisualElement.BatchCommit()
at Xamarin.Forms.VisualElement.set_Bounds(Rectangle value)
at Xamarin.Forms.VisualElement.Layout(Rectangle bounds)
at Tizen.Wearable.CircularUI.Forms.Renderer.CirclePageRenderer.OnLayout()
at ElmSharp.Box.<>cDisplayClass14_0.b0(IntPtr obj, IntPtr priv, IntPtr data)
at Tizen.Applications.CoreBackend.UICoreBackend.Run(String[] args)
at Tizen.Applications.CoreApplication.Run(String[] args)
at Tizen.Applications.CoreUIApplication.Run(String[] args)

The relevant code can be found here https://github.com/xamarin/Xamarin.Forms/blob/4.3.0/Xamarin.Forms.Platform.Tizen/Renderers/VisualElementRenderer.cs#L655-L658
The VisualElement should not be null as we already block dispose being called from the background thread due to a custom implementation and the CirclePageRenderer.OnLayout() quick returns after dispose.

I suspect that Platform.GetRenderer(e.RealParent) might be null. However, I am not able to find a specific code path which could cause this issue.

We are not capable of finding a reproducible scenario as it both occurs while the user is using the app, or leaves the application open for some time without any actions. It is not caused due to navigation as it would not happen at that time.

To Reproduce
We have been trying to reproduce this for quite some time, but have not been able to. However, in our production environment users are getting this crash multiple times

Expected behavior
No null reference exception.

Environment (please complete the following information):

  • Target Product: Samsung Galaxy Watch

  • Tizen Platform Version: Tizen 4.0.0

  • Tizen.CircularUI Version 1.4.0 (Currently we have forked from this version to block Dispose being called on a background thread and OnLayout to be called after being disposed for the CirclePageRenderer) The crash already occurred before this.

  • Nuget Packages:

    • Autofac "Version="4.8.1"
    • Fody" Version="6.0.4"
    • Newtonsoft.Json Version="12.0.1"
    • PropertyChanged.Fody Version="3.1.3"
    • Xamarin.Forms Version="4.3.0.947036"

Additional context
Moved from xamarin/Xamarin.Forms#10427

Thank you for reaching out! Welcome to CircularUI!
However, unfortunately, it is difficult to find out the cause of the problem with the information given.
(Can't reproduce, not latest version both XF and Circular UI,....)

We couldn't promise when it will be, but we will do our best to analyze and update as we find the cause. 🙏

Thank you for your engagement in still trying to analyze as it is indeed not simple. We have been trying to reproduce this issue for quite some time but haven't been able to do it in our development environment even by programmatically increasing the pressure on the application.

As far as I know v1.4.0 is your latest stable release and v1.5.0 is only in prerelease.

For XF I will take a look in upgrading to the latest stable. For our next release we are also going to target Tizen 5.0.0 for some required fixes in Tizen.Net.

It seems to access on worker thread (not main thread), All UI operation should be on main thread

We are currently releasing an updated version to our production environment and will be able to monitor this further. I will add new information once available.