Android only throws error on MVVM, when using SFNavigationDrawer

When Debugging the Code on a Android device, I run into an error, when Setup a BindingContext on the NavigationPage, when using the SFNavigationDrawer. Using the same BindingContex on the MainPage, no error. Debugging on IOS or UWP everything is working. 

I have a DataBinding with a MVVM Model:

On the NavigationPage I have Setup a BindingContex:

    public partial class TrackSetupPage : ContentPage
    {
       TrackViewModel obj;

        public TrackSetupPage()
        {
            InitializeComponent();

           obj = new TrackViewModel();
           BindingContext = obj; 

ViewModel:

using Split.Models;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
Namespace Split.ViewModels
{
    public class TrackViewModel
    {
        public ObservableCollection<Track> altitudeGraph { get; set; }
        public TrackViewModel()
        {
            altitudeGraph = new ObservableCollection<Track>();
            FillData();
        }
        private void FillData()
        {
            Track obj = new Track
            {
                Distance = 0,
                Altitude = 0
            };
            altitudeGraph.Add(obj);
        }
    }

Model:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
Namespace Split.Models
{
    public class Track : INotifyPropertyChanged
    {
        private double distance;
        private double altitude;
        public event PropertyChangedEventHandler PropertyChanged;
        private void RaisePropertyChanged(String Name)
        {
            if (PropertyChanged != null)
                this.PropertyChanged(this, new PropertyChangedEventArgs(Name));
        }
        public double Distance
        {
            get { return distance; }
            set { this.distance = value; PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Distance")); }
        }

        public double Altitude
        {
            get { return altitude; }
            set { this.altitude = value; PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Altitude")); }
        }
        public Track(double distance, double altitude)
        {
            this.Distance = distance;
            this.Altitude = altitude;
        }
        public Track()
        {
        }
    }
}


The error:

The error message is in the attachment

Thanks for any help,

Markus


Attachment: ErrorMessage_ac50fac7.zip

21 Replies

SP Sakthivel Palaniyappan Syncfusion Team May 13, 2020 06:22 AM UTC

Hi Markus,

Greetings from Syncfusion.

We have already fixed the reported issue "Null Reference Exception"  
and please find the  patch files from the following location.

Advanced approach – use only if you have specific needs and can directly replace existing assemblies for your build environment


http://syncfusion.com/Installs/support/patch/18.1.0.42/1224149/F152092/SyncfusionPatch_18.1.0.42_1224149_5122020094244242_F152092.exe

(OR)


Please find the patch assemblies from below location:  

http://syncfusion.com/Installs/support/patch/18.1.0.42/1224149/F152092/SyncfusionPatch_18.1.0.42_1224149_5122020094244242_F152092.zip

(OR)

Please find the NuGet from below location:

http://syncfusion.com/Installs/support/patch/18.1.0.42/1224149/F152092/SyncfusionNuget_18.1.0.42_1224149_5122020094244242_F152092.zip

Assembly Version: 18.1.0.42


Disclaimer:  
Please note that we have created this patch for version 18.1.0.42 specifically to resolve the issue reported in this incident. If you have received other patches for the same version for other products, please apply all patches in the order received

 
Note: Please clear the NuGet cache, before using the latest one.
 
  
   

The fix for the reported issue will be included in our upcoming weekly NuGet release which is scheduled to be rolled out on May 19, 2020.


Regards,
Sakthivel P.
 



MA Markus May 13, 2020 10:42 AM UTC

Hallo Sakthivel,

thank you, I will wait for the next rollout on the 19.5

Thanks,
Markus



SP Sakthivel Palaniyappan Syncfusion Team May 14, 2020 07:41 AM UTC

Hi Markus,

Thanks for the update. As we said earlier, we will include the fix in our next weekly release which is expected to be rolled out on May 19,2020.We appreciate your patience until then.

Regards,
Sakthivel P.



MS Mugundhan Saravanan Syncfusion Team May 20, 2020 09:04 AM UTC

Hi Markus,

We are glad to announce that our weekly NuGet was rolled out and fix for the reported issue was included in the weekly NuGet.

NuGet Version: 18.1.0.53

We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance.

Regards,
Mugundhan S.



MA Markus May 20, 2020 12:46 PM UTC

Hi Mugundhan,

thank you, the error is gone, but what still is not working on Android is the Databinding,

I have in XAML the follwoing Code:

   <chart:AreaSeries x:Name="AltitudeChart"  ItemsSource="{Binding altitudeGraph}" XBindingPath="Distance" YBindingPath="Altitude" ListenPropertyChange="True" EnableTooltip="True">
                                            <chart:AreaSeries.DataMarker>

IOS & UWP is working fine, but when I set a debug Point in the get { return distance; }, I see, that Android is just not using it


        public double Distance
        {
            get { return distance; } <--
IOS & UWP is getting there, Android don't
            set { this.distance = value; PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Distance")); }
        }

Thanks,

Markus



SJ Suyamburaja Jayakumar Syncfusion Team May 21, 2020 05:57 PM UTC

Hi Markus, 
 
We have tried to reproduce the reported issue at our end based on the provided code snippet details and we were unable to reproduce the reported issue with the provided details in android. Please find the tested sample below which is working fine at our end, with the possible cases 
 
 
Can you please share the following details which will be helpful for us to analyze the reported issue at our end and to provide a possible solution at earlier?  
       Please check the provided sample at your end and ensure us whether you have using the same at your end or not.  
       If possible, can you please modify the above the reproduce the reported issue.  
  
Regards, 
Suyamburaja J. 



MA Markus May 21, 2020 07:12 PM UTC

Hallo Suyamburaja,
thank you for your answer, but unfortunately, it is not working in my code, even IOS & UWP is now not showing the graph. With the setup below, UWP & IOS is working fine:
My setup:
ViewModelPage (TrackViewModel.cs):
using CycleSplit.Models;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Text;
namespace CycleSplit.ViewModels
{
    public class TrackViewModel
    {
        public ObservableCollection<Track> altitudeGraph { get; set; }
        public TrackViewModel()
        {
            altitudeGraph = new ObservableCollection<Track>();
        }
    }
}
Model page (Track.cs):
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CycleSplit.Models
{
    public class Track : INotifyPropertyChanged
    {
        private double distance;
        private double altitude;
        public event PropertyChangedEventHandler PropertyChanged;
        public double Distance
        {
            get { return distance; }
            set { this.distance = value; PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Distance")); }
        }
        public double Altitude
        {
            get { return altitude; }
            set { this.altitude = value; PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Altitude")); }
        }
        public Track(double distance, double altitude)
        {
            this.Distance = distance;
            this.Altitude = altitude;
        }
    }
}
I fill the graph on the TrackSetupPage.cs:
public partial class TrackSetupPage : ContentPage
    {
       TrackViewModel obj;
 public TrackSetupPage()
        {
            InitializeComponent();
           obj = new TrackViewModel();
           BindingContext = obj;
 }
Loading the Data from the Database:
 obj.altitudeGraph.Add(new Track(Distance, Convert.ToDouble(TrackList.SectionAltitudeEnd)));

Thanks,

Markus


MA Markus replied to Markus May 24, 2020 08:25 AM UTC

Hallo Suyamburaja,
thank you for your answer, but unfortunately, it is not working in my code, even IOS & UWP is now not showing the graph. With the setup below, UWP & IOS is working fine:
My setup:
ViewModelPage (TrackViewModel.cs):
using CycleSplit.Models;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Text;
namespace CycleSplit.ViewModels
{
    public class TrackViewModel
    {
        public ObservableCollection<Track> altitudeGraph { get; set; }
        public TrackViewModel()
        {
            altitudeGraph = new ObservableCollection<Track>();
        }
    }
}
Model page (Track.cs):
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CycleSplit.Models
{
    public class Track : INotifyPropertyChanged
    {
        private double distance;
        private double altitude;
        public event PropertyChangedEventHandler PropertyChanged;
        public double Distance
        {
            get { return distance; }
            set { this.distance = value; PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Distance")); }
        }
        public double Altitude
        {
            get { return altitude; }
            set { this.altitude = value; PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Altitude")); }
        }
        public Track(double distance, double altitude)
        {
            this.Distance = distance;
            this.Altitude = altitude;
        }
    }
}
I fill the graph on the TrackSetupPage.cs:
public partial class TrackSetupPage : ContentPage
    {
       TrackViewModel obj;
 public TrackSetupPage()
        {
            InitializeComponent();
           obj = new TrackViewModel();
           BindingContext = obj;
 }
Loading the Data from the Database:
 obj.altitudeGraph.Add(new Track(Distance, Convert.ToDouble(TrackList.SectionAltitudeEnd)));

Thanks,

Markus

Hallo,

I did some Tests this Weekend and Android Needs the following Databinding to Display the graph:

<chart:SfChart.BindingContext>
<local:TrackViewModel/>
</chart:SfChart.BindingContext>

IOS & UWP dosn't not Need this above databinding and is working fine with the normal databding in place

But when I set this, the other databinding is not more function:

 <ContentPage.BindingContext>
        <local:TrackViewModel/>
    </ContentPage.BindingContext>

...


Thanks,

Markus
      obj = new TrackViewModel();
            BindingContext = obj;





MA Markus replied to Markus May 24, 2020 06:05 PM UTC

Hallo Suyamburaja,
thank you for your answer, but unfortunately, it is not working in my code, even IOS & UWP is now not showing the graph. With the setup below, UWP & IOS is working fine:
My setup:
ViewModelPage (TrackViewModel.cs):
using CycleSplit.Models;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Text;
namespace CycleSplit.ViewModels
{
    public class TrackViewModel
    {
        public ObservableCollection<Track> altitudeGraph { get; set; }
        public TrackViewModel()
        {
            altitudeGraph = new ObservableCollection<Track>();
        }
    }
}
Model page (Track.cs):
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CycleSplit.Models
{
    public class Track : INotifyPropertyChanged
    {
        private double distance;
        private double altitude;
        public event PropertyChangedEventHandler PropertyChanged;
        public double Distance
        {
            get { return distance; }
            set { this.distance = value; PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Distance")); }
        }
        public double Altitude
        {
            get { return altitude; }
            set { this.altitude = value; PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Altitude")); }
        }
        public Track(double distance, double altitude)
        {
            this.Distance = distance;
            this.Altitude = altitude;
        }
    }
}
I fill the graph on the TrackSetupPage.cs:
public partial class TrackSetupPage : ContentPage
    {
       TrackViewModel obj;
 public TrackSetupPage()
        {
            InitializeComponent();
           obj = new TrackViewModel();
           BindingContext = obj;
 }
Loading the Data from the Database:
 obj.altitudeGraph.Add(new Track(Distance, Convert.ToDouble(TrackList.SectionAltitudeEnd)));

Thanks,

Markus

Hallo,

I did some Tests this Weekend and Android Needs the following Databinding to Display the graph:

<chart:SfChart.BindingContext>
<local:TrackViewModel/>
</chart:SfChart.BindingContext>

IOS & UWP dosn't not Need this above databinding and is working fine with the normal databding in place

But when I set this, the other databinding is not more function:

 <ContentPage.BindingContext>
        <local:TrackViewModel/>
    </ContentPage.BindingContext>

...


Thanks,

Markus
      obj = new TrackViewModel();
            BindingContext = obj;




Hallo,

I found what cause, why Android is not working correctly with databinding, it is when I use the SfNavigationDrawer.

When I set in the App.xaml.cs the starting page to any page, where I use any Databinding, Android is working fine, if I navigate over the SFNavigationDrawer to the same page, the Databinding with only Android is not working, UWP & IOS is working as expected, not even with a very simple Databing setup, with any control I was testing

Is this a known issue and is there a work around?

Buh, this took me now the whole sunday, with alot of tests, but hopefully, there is a fix

Thanks,

Markus


SJ Suyamburaja Jayakumar Syncfusion Team May 26, 2020 03:57 AM UTC

Hi Markus, 
 
Thanks for your patience.  
 
Currently we are validating the reported issue and we will update the complete status on or before May 27,2020. 
  
Regards, 
Suyamburaja J 



SJ Suyamburaja Jayakumar Syncfusion Team May 27, 2020 01:00 PM UTC

Hi Markus, 
 
Thanks for your update. 
 
We have checked your code snippet and possible test case to be checked and its working fine at our end, please refer the below screenshot. 
 
Screenshot: 
 
 
Please find the tested sample [we have also tried to SQL lite database] 
 
Please refer the provided sample and try in your side. if it is not workable solution for you, please provide additional details to validate from our side, 
·       Please share the Visual studio details and using android device version. 
·       With explanation about Video or image.   
·       If possible, can you please modify the above the reproduce the reported issue. 
 
Regards,  
Suyamburaja J. 



MA Markus replied to Suyamburaja Jayakumar May 27, 2020 04:38 PM UTC

Hi Markus, 
 
Thanks for your update. 
 
We have checked your code snippet and possible test case to be checked and its working fine at our end, please refer the below screenshot. 
 
Screenshot: 
 
 
Please find the tested sample [we have also tried to SQL lite database] 
 
Please refer the provided sample and try in your side. if it is not workable solution for you, please provide additional details to validate from our side, 
·       Please share the Visual studio details and using android device version. 
·       With explanation about Video or image.   
·       If possible, can you please modify the above the reproduce the reported issue. 
 
Regards,  
Suyamburaja J. 


Hallo Suyamburaja ,

thank you for your Reply. 

I created an simple example app, only with the SFNavigationDrawer and a simple Picker. I have a second page, where the picker is located. When navigating with the NaviagtionDrawer to that page, the picker has no items in Android. In UWP & IOS the items are showing. When navigating directly to the page Page1 as Startup page for the app, (see picture), Android is Binding and showing the items in the picker.

Since I can only upload with 30 MB I put the zip Archive with the a shared Location, to downlaod the example app. You find the Location URL in the attachment as txt file

On the real Android device, I use Android 9 (see Picture), I tested also with the same resulkt in Emulator, with Android Version 10.0



Thanks,

Markus

Attachment: Syncfsuion_20200527_e9f85ad8.zip


SP Sakthivel Palaniyappan Syncfusion Team May 29, 2020 08:09 AM UTC

Hi Markus,

Thanks for the patience,

We have fixed the reported issue "NavigationDrawer Binding does not work"  and please download the patch files from the below location. 

Advanced approach – use only if you have specific needs and can directly replace existing assemblies for your build environment

http://syncfusion.com/Installs/support/patch/18.1.0.52/1224149/F154662/SyncfusionPatch_18.1.0.52_1224149_5292020032833551_F154662.exe

(OR)


Please find the patch assemblies alone from below location:  
http://syncfusion.com/Installs/support/patch/18.1.0.52/1224149/F154662/SyncfusionPatch_18.1.0.52_1224149_5292020032833551_F154662.zip

(OR)


Please find the NuGet from below location:
http://syncfusion.com/Installs/support/patch/18.1.0.52/1224149/F154662/SyncfusionNuget_18.1.0.52_1224149_5292020032833551_F154662.zip

Assembly Version: 18.1.0.52

Disclaimer:

Please note that we have created this patch for version 18.1.0.52 specifically to resolve the issue reported in this. If you have received other patches for the same version for other products, please apply all patches in the order received.
 
  
Note: Please clear the NuGet cache, before using the latest one.
https://www.syncfusion.com/kb/6987/how-to-clear-nuget-cache
 

The fix will be included in our weekly NuGet release which is expected to be rolled out on
June 09, 2020.We appreciate your patience until then.

Regards,
Sakthivel P.




MA Markus replied to Sakthivel Palaniyappan June 1, 2020 03:14 AM UTC

Hi Markus,

Thanks for the patience,

We have fixed the reported issue "NavigationDrawer Binding does not work"  and please download the patch files from the below location. 

Advanced approach – use only if you have specific needs and can directly replace existing assemblies for your build environment

http://syncfusion.com/Installs/support/patch/18.1.0.52/1224149/F154662/SyncfusionPatch_18.1.0.52_1224149_5292020032833551_F154662.exe

(OR)


Please find the patch assemblies alone from below location:  
http://syncfusion.com/Installs/support/patch/18.1.0.52/1224149/F154662/SyncfusionPatch_18.1.0.52_1224149_5292020032833551_F154662.zip

(OR)


Please find the NuGet from below location:
http://syncfusion.com/Installs/support/patch/18.1.0.52/1224149/F154662/SyncfusionNuget_18.1.0.52_1224149_5292020032833551_F154662.zip

Assembly Version: 18.1.0.52

Disclaimer:

Please note that we have created this patch for version 18.1.0.52 specifically to resolve the issue reported in this. If you have received other patches for the same version for other products, please apply all patches in the order received.
 
  
Note: Please clear the NuGet cache, before using the latest one.
https://www.syncfusion.com/kb/6987/how-to-clear-nuget-cache
 

The fix will be included in our weekly NuGet release which is expected to be rolled out on
June 09, 2020.We appreciate your patience until then.

Regards,
Sakthivel P.



Good morning Sakthivel,

thank you for your Reply, I will wait for the Update on June 09, 2020 and give you an update on this thread

Thanks,

Markus


SP Sakthivel Palaniyappan Syncfusion Team June 2, 2020 09:05 AM UTC

Hi Markus,

Thanks for the update and we will let you know once release has been rolled out.

Regards,
Sakthivel P.
 



SP Sakthivel Palaniyappan Syncfusion Team June 10, 2020 03:49 AM UTC

Hi Markus,

Thank you for your patience.

We have fixed the reported issue of “NavigationDrawer Binding does not work” and included the issue fix in our latest Weekly NuGet release update version 18.1.0.56 which is available for download (https://www.nuget.org/).

We thank you for your support and appreciate your patience in waiting for this update. Please get in touch with us if you would require any further assistance.

Regards,
Sakthivel P.
 



MA Markus June 10, 2020 06:25 PM UTC

Hi Sakthivel ,

thank for the update. I did test today, but it is still not working correctly

Sometimes the binding is working and the data is displaying and than when navigating to a different page, the binding may working or not. I prepared an other example. The download link is in the attachment I downloaded to this thread. 


Thanks,
Markus

Attachment: Syncfsuion_20200610_e28b3980.zip


SP Sakthivel Palaniyappan Syncfusion Team June 11, 2020 03:12 PM UTC

Hi Markus,

Sorry for the inconvenience.

We have checked the reported issue and we are able to reproduce the issue. Currently we are analyzing the root cause of an issue and we will update the details on June 15, 2020. We appreciate your patience until then.

Regards,
Sakthivel P.



RS Ramya Soundar Rajan Syncfusion Team June 12, 2020 10:12 AM UTC

Hi Markus,
 
We would like to inform that NavigationDrawer is ContentView control, so the issue occur in ContentPage content binding context.We suggest that if you have used the content page content then set the binding context into view directly as like in the below sample to resolve the reported issue.Please find the sample from below link
 
Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/TestAndroid1516190128

Please check with the above and let us know if you have any concern.
 
 
Regards, 
Ramya S 



MA Markus replied to Ramya Soundar Rajan June 13, 2020 04:13 PM UTC

Hi Markus,
 
We would like to inform that NavigationDrawer is ContentView control, so the issue occur in ContentPage content binding context.We suggest that if you have used the content page content then set the binding context into view directly as like in the below sample to resolve the reported issue.Please find the sample from below link
 
Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/TestAndroid1516190128

Please check with the above and let us know if you have any concern.
 
 
Regards, 
Ramya S 


Hi Ramya,

thank you very much, you are my hero :) 

Now everything is working as expected.

Many thanks,

Markus


SP Sakthivel Palaniyappan Syncfusion Team June 15, 2020 06:23 AM UTC

Hi Markus,

Thanks for the update. We are glad to know that the given solution resolves the problem. Please let us know if you need further assistance on this.

Regards,
Sakthivel P. 


Loader.
Up arrow icon