Crash with new version of SfDataGrid (27.1.48)

As soon i updated the syncfusion application, it crashes on load.
If i revert back to version 26 it works again.

Xaml:

<datagrid:SfDataGrid
    x:Name="Summary"
    Grid.Row="1"
    AllowEditing="False"
    AutoGenerateColumns="False"
    ColumnWidthMode="AutoLastColumnFill"
    ItemsSource="{Binding Items, Mode=OneWay}">
    <datagrid:SfDataGrid.Columns>
        <datagrid:GridTextColumn
            ColumnWidthMode="AutoLastColumnFill"
            DisplayBinding="{Binding Value}"
            HeaderText="" />
        <datagrid:GridNumericColumn
            AllowSorting="True"
            DisplayBinding="{Binding Amount}"
            DisplayNumberFormat="C2"
            HeaderText="{m:LanguageResource Key=TotalAmount}" />
        <datagrid:GridNumericColumn
            AllowSorting="True"
            DisplayBinding="{Binding Revenue}"
            DisplayNumberFormat="C2"
            HeaderText="{m:LanguageResource Key=TotalRevenue}" />
        <datagrid:GridNumericColumn
            AllowSorting="True"
            DisplayBinding="{Binding VAT}"
            DisplayNumberFormat="N2"
            HeaderText="{m:LanguageResource Key=TotalVAT}" />
        <datagrid:GridNumericColumn
            DisplayBinding="{Binding Discount}"
            DisplayNumberFormat="C2"
            HeaderText="{m:LanguageResource Key=TotalDiscounts}" />
    </datagrid:SfDataGrid.Columns>
</datagrid:SfDataGrid>


 NullReferenceException:

at Syncfusion.UI.Xaml.DataGrid.DataGridColumnSizer.SetSizerWidth(Double viewPortWidth)
   at Syncfusion.UI.Xaml.DataGrid.DataGridColumnSizer.Refresh(Double AvailableWidth, Boolean needToInvalidateMeasure)
   at Syncfusion.UI.Xaml.DataGrid.DataGridColumnSizer.InitialRefresh(Double AvailableWidth, Boolean needToInvalidateMeasure)
   at Syncfusion.UI.Xaml.DataGrid.RowGenerator.ApplyColumnSizeronInitial(Double availableWidth)
   at Syncfusion.UI.Xaml.DataGrid.VisualContainer.MeasureOverride(Size constraint)
   at Microsoft.UI.Xaml.FrameworkElement.Microsoft.UI.Xaml.IFrameworkElementOverrides.MeasureOverride(Size availableSize)
   at ABI.Microsoft.UI.Xaml.IFrameworkElementOverrides.Do_Abi_MeasureOverride_0(IntPtr thisPtr, Size availableSize, Size* result)
--- End of stack trace from previous location ---
   at WinRT.ExceptionHelpers.<ThrowExceptionForHR>g__Throw|38_0(Int32 hr)
   at ABI.Microsoft.UI.Xaml.IFrameworkElementOverridesMethods.MeasureOverride(IObjectReference _obj, Size availableSize)
   at Microsoft.UI.Xaml.FrameworkElement.MeasureOverride(Size availableSize)
   at Syncfusion.UI.Xaml.DataGrid.SfDataGrid.MeasureOverride(Size availableSize)
   at Microsoft.UI.Xaml.FrameworkElement.Microsoft.UI.Xaml.IFrameworkElementOverrides.MeasureOverride(Size availableSize)
   at ABI.Microsoft.UI.Xaml.IFrameworkElementOverrides.Do_Abi_MeasureOverride_0(IntPtr thisPtr, Size availableSize, Size* result)
--- End of stack trace from previous location ---
   at WinRT.ExceptionHelpers.<ThrowExceptionForHR>g__Throw|38_0(Int32 hr)
   at ABI.Microsoft.UI.Xaml.IFrameworkElementOverridesMethods.MeasureOverride(IObjectReference _obj, Size availableSize)
   at Microsoft.UI.Xaml.FrameworkElement.MeasureOverride(Size availableSize)
   at Microsoft.UI.Xaml.FrameworkElement.Microsoft.UI.Xaml.IFrameworkElementOverrides.MeasureOverride(Size availableSize)
   at ABI.Microsoft.UI.Xaml.IFrameworkElementOverrides.Do_Abi_MeasureOverride_0(IntPtr thisPtr, Size availableSize, Size* result)

11 Replies

JP Jon Perkins September 22, 2024 02:52 PM UTC

I get exactly the same error.

Error goes away if I set AutoGenerateColumns to True and remove the <Columns> part of the XAML.



MA Manikanda Akash Munisamy Syncfusion Team September 23, 2024 03:02 PM UTC

Hi Ismail Hassani,

We have reviewed your scenario where the application crashes on load after upgrading to v27.1.48 while AutoGenerateColumns = False and manually generating columns in XAML. To investigate, we created a simple sample and attempted to replicate the issue based on the details provided. However, we were unable to reproduce the crash.

We have attached the prepared sample and a screen recording that demonstrates our approach. Could you please share more details regarding the manually generated columns? Specifically, we noticed you are binding m:LanguageResource for some column headers as HeaderText. Kindly ensure that all necessary keys are present in the resource file.

If possible, please modify the attached sample to replicate the issue on your end, so we can investigate further and provide a more accurate solution.

We look forward to your response.

Regards,
Manikanda Akash

Attachment: SfDataGrid_Net_1e064180.zip


JP Jon Perkins September 23, 2024 06:47 PM UTC

I have edited your project to include the grid that I have been developing, and this shows the same error as Ismail is reporting.

You will need to Rebuild as I omitted the bin and obj files, otherwise the file size to upload was 800MB.

This app crashes immediately in the unhandled app block when in the dev environment. The error is an exception with a StackTrace location of SyncFusion.UI.Xaml.DataGrid.DataGridColumnSizer.SetSizerWidth. The exception message is "Object is not set to an instance of an object".

This same code worked fine with SyncFusion v25.


Thanks,

Jon Perkins

 


Attachment: SfDataGrid_Net_Reply_8f670d2d.zip


MA Manikanda Akash Munisamy Syncfusion Team September 24, 2024 10:40 AM UTC

Hi Jon Perkins,

We have reviewed the modified sample, and in this sample, we were able to replicate the exception. The issue does not occur when AutoGenerateColumns is set to True and the manually defined columns are commented out.
 
However, we discovered that you are binding a value (TopUpActivityList) as ItemsSource for the SfDataGrid that is not declared in the ViewModel. Once we bound the correct property (ActivityList), the exception did not occur, even with manually defined columns.
 
This issue represents a breaking change in the existing behavior. In our previous release, the newly implemented code changes in DataGridColumnSizer.SetSizerWidth(double viewPortWidth), which causes the crash in v27.
 
We regret any inconvenience this may have caused. We have identified the cause and will include the fix in our upcoming NuGet release scheduled for September 30, 2024.

Note: The provided feedback link is private, and you need to log in to view this feedback.

We will let you know once it is released. We appreciate your patience until then.

Disclaimer: Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization.

Regards,
Manikanda Akash M


IH Ismail Hassani replied to Manikanda Akash Munisamy September 24, 2024 12:24 PM UTC

Dear Manikanda,

The m:LanguageResource is an markup extension that takes as resx value and returns the localized string.
I use it through out the whole application and can assure you that's not the problem.
More info about this markup extension: I-Synergy Framework > LanguageResource 



MA Manikanda Akash Munisamy Syncfusion Team September 25, 2024 07:02 AM UTC

Hi Ismail Hassani,
Thank you for confirming that m:LanguageResource is not causing any issue with the exception. We have identified the cause, and we will fix the issue in our upcoming NuGet release scheduled for September 30, 2024 as promised. 
We will notify you once it has been released. We appreciate your patience in the meantime.

Regards,
Manikanda Akash


JP Jon Perkins replied to Manikanda Akash Munisamy September 25, 2024 03:10 PM UTC

Hello Manikanda,


Many thanks for your quick response. I apologise for the error in my code. I used some real code but tried to make a few modifications to help with readability and of course made an error. However it does seem to have helped you identify an issue with this control and I am grateful that you will hopefully have a fix in such a short timescale.

With my gratitude,

Jon Perkins



MA Manikanda Akash Munisamy Syncfusion Team September 26, 2024 03:41 PM UTC

Hi Jon Ponkins,

Thank you for your understanding and kind words. We appreciate your prompt response and the effort you put into clarifying your code. We remain committed to delivering the fix within the promised timeline. 

We will notify you once it has been released. We appreciate your patience in the meantime.

Regards,

Manikanda Akash



MA Manikanda Akash Munisamy Syncfusion Team September 30, 2024 03:14 PM UTC

Hi Ismail Hassani/Jon Ponkins,

We would like to let you know that Essential Studio Weekly NuGet packages (v27.1.51) has been published in nuget.org with the fix for the issue "NullReferenceException occurs when binding undefined property as ItemsSource with columns are manually defined". Please let us know if you have any concerns in this.

Root Cause Details:
We missed checking whether the view for the DataGrid was created before accessing it, which caused the reported issue.

Regards,
Manikanda Akash


CP Chat Point December 8, 2024 06:00 PM UTC

same error




SP Sreemon Premkumar Muthukrishnan Syncfusion Team December 9, 2024 06:29 AM UTC

Hi Chat Point,


We have followed the same replication procedure to reproduce the exception on our end. Unfortunately, the exception does not occur in version 27.1.51 or the latest version. Could you please check if the same exception occurs in the latest version or version 27.1.51? If it does, could you kindly provide the replication procedure along with a video reference to help us reproduce the exception?


Regards,
Sreemon Premkumar M.


Loader.
Up arrow icon