NullReferenceException on Syncfusion.Data.WPF

Hi,
I'm trying to load data async to an sfDataGrid but I get a null reference exception and I can't understand why. Essentially, I'm populating the sfDataGrid with an ObservableCollection. This observablecollection gets its data through an async method that returns a Task of IEnumerable. This method uses a dbcontext class from entityframework to get the data. (i'm using MVVM).
This should be pretty straightforward but I'm getting the NullReferenceException. I wonder if it has anything to do with the way I'm using INotifyPropertyChanged.
Here's some of the code:

public class ExploradorFaturasViewModel : BindableBase
    {
        (...)
        private ObservableCollection<Invoice> _invoices;
        public ObservableCollection<Invoice> Invoices
        {
            get { return _invoices; }
            set { SetProperty(ref _invoices, value); }
        }
        (...)
   }


 public class BindableBase : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged = delegate { };
        
        protected virtual void SetProperty<T>(ref T member, T val, [CallerMemberName] string propertyName = null)
        {
            if (object.Equals(member, val)) return;

            member = val;
            PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }

        protected virtual void OnPropertyChanged(string propertyName)
        {
            PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }

    }

Could you help me? Do you need more info or is this enough?


1 Reply 1 reply marked as answer

DM Dhanasekar Mohanraj Syncfusion Team January 26, 2021 01:48 PM UTC

Hi Rui,

Thank you for using Syncfusion controls.

We have checked the reported issue, and we are unable to replicate the reported issue we have prepared the sample load data async to an SfDatagrid.

 
 
Please refer the below forum for more information’s  
Forum link: https://www.syncfusion.com/forums/118297/sfdatagrid-asynchron-data-loading

Please check the above sample and revert us if you still facing the same issue? If yes, please modify the sample based on your scenario and revert us back with the following details, 

  
·       Issue reproducing video (If possible ) 
·       Issue reproducing sample (If possible) 

It will be helpful for us to check on it and provide you the sample at the earliest. 

Regards,
Dhanasekar M. 


Marked as answer
Loader.
Up arrow icon