Exception barseries with Adornment

I'm getting the following exception when using a barseries or columnseries under specific conditions.

  1. If I use an Adornment AND an AutoScrollingDelta AND EnableAnimation = true  it fails .
  2. If I remove either of these options, it works fine.

Here's the exception:

Object reference not set to an instance of an object.
   at Syncfusion.UI.Xaml.Charts.ColumnSeries.Animate()
   at Syncfusion.UI.Xaml.Charts.ChartSeriesPanel.Update(Size finalSize)
   at Syncfusion.UI.Xaml.Charts.ChartSeriesBase.UpdateOnSeriesBoundChanged(Size size)
   at Syncfusion.UI.Xaml.Charts.AdornmentSeries.UpdateOnSeriesBoundChanged(Size size)
   at Syncfusion.UI.Xaml.Charts.CartesianSeries.UpdateOnSeriesBoundChanged(Size size)
   at Syncfusion.UI.Xaml.Charts.SfChart.RenderSeries()
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

I've included some sample XAML and C# to reproduce the issue:

<chart:SfChart Grid.Row="0" x:Name="chartSample" Margin="5, 5, 5, 5" HorizontalHeaderAlignment="Left" Background="White" BorderBrush="#D1D8DD" BorderThickness="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
    <chart:SfChart.Behaviors>
        <chart:ChartSelectionBehavior SelectionStyle="Multiple" EnableSegmentSelection="True" >
        </chart:ChartSelectionBehavior>
    </chart:SfChart.Behaviors>

    <chart:SfChart.Header>
        <TextBlock TextAlignment="Left" Text="Spend by Category" FontFamily="Calibri" Foreground="#223F5D" FontSize="17" Margin="10" FontWeight="Bold"/>
    </chart:SfChart.Header>

    <chart:SfChart.PrimaryAxis>
        <chart:CategoryAxis MaximumLabels ="15" LabelPlacement="BetweenTicks" ShowGridLines="false" Margin="0, 0, 0, 0" AxisLineOffset="0" TickLineSize="0" ShowAxisNextToOrigin="True" EnableScrollBar="True" AutoScrollingDelta="15" EnableTouchMode="True" PlotOffset="5">
            <chart:CategoryAxis.LabelStyle>
                <chart:LabelStyle FontSize="12" Foreground="#8597B0" FontFamily="Calibri"/>
            </chart:CategoryAxis.LabelStyle>
        </chart:CategoryAxis>
    </chart:SfChart.PrimaryAxis>

    <chart:SfChart.SecondaryAxis>
        <chart:NumericalAxis Minimum="0" Interval="20" Visibility="Visible" Foreground="#8597B0" FontFamily="Calibri" FontSize="12" ShowGridLines="false" LabelFormat="$0K">

        </chart:NumericalAxis>
    </chart:SfChart.SecondaryAxis>


    <chart:ColumnSeries XBindingPath="Category" EnableAnimation="True" SegmentSelectionBrush="#9EC2E7" YBindingPath="Spend" Interior="#9EC2E7" >

        <chart:ColumnSeries.AdornmentsInfo>
            <chart:ChartAdornmentInfo ShowLabel="True" LabelPosition="Center" Background="Transparent" FontFamily="Calibri" Foreground="Black " HighlightOnSelection="False" SegmentLabelFormat="$0K" >
            </chart:ChartAdornmentInfo>
        </chart:ColumnSeries.AdornmentsInfo>
    </chart:ColumnSeries>

</chart:SfChart>


public test()
{
    InitializeComponent();
    ViewModel viewModel = new ViewModel();
    viewModel.Data = new ObservableCollection<SpendData>();
    viewModel.Data.Add(new SpendData { Category = "Category 1", Spend = Convert.ToDecimal(1.23) });
    viewModel.Data.Add(new SpendData { Category = "Category 1", Spend = Convert.ToDecimal(1.23) });
    viewModel.Data.Add(new SpendData { Category = "Category 1", Spend = Convert.ToDecimal(1.23) });
    viewModel.Data.Add(new SpendData { Category = "Category 1", Spend = Convert.ToDecimal(1.23) });
    viewModel.Data.Add(new SpendData { Category = "Category 1", Spend = Convert.ToDecimal(1.23) });
    viewModel.Data.Add(new SpendData { Category = "Category 1", Spend = Convert.ToDecimal(1.23) });
    viewModel.Data.Add(new SpendData { Category = "Category 1", Spend = Convert.ToDecimal(1.23) });
    viewModel.Data.Add(new SpendData { Category = "Category 1", Spend = Convert.ToDecimal(1.23) });
    viewModel.Data.Add(new SpendData { Category = "Category 1", Spend = Convert.ToDecimal(1.23) });
    viewModel.Data.Add(new SpendData { Category = "Category 1", Spend = Convert.ToDecimal(1.23) });
    viewModel.Data.Add(new SpendData { Category = "Category 1", Spend = Convert.ToDecimal(1.23) });
    viewModel.Data.Add(new SpendData { Category = "Category 1", Spend = Convert.ToDecimal(1.23) });
    viewModel.Data.Add(new SpendData { Category = "Category 1", Spend = Convert.ToDecimal(1.23) });
    viewModel.Data.Add(new SpendData { Category = "Category 1", Spend = Convert.ToDecimal(1.23) });
    viewModel.Data.Add(new SpendData { Category = "Category 1", Spend = Convert.ToDecimal(1.23) });
    viewModel.Data.Add(new SpendData { Category = "Category 1", Spend = Convert.ToDecimal(1.23) });
    viewModel.Data.Add(new SpendData { Category = "Category 1", Spend = Convert.ToDecimal(1.23) });
    viewModel.Data.Add(new SpendData { Category = "Category 1", Spend = Convert.ToDecimal(1.23) });
    chartSample.Series[0].ItemsSource = viewModel.Data;
}


10 Replies

NT Nitheeshkumar Thangaraj Syncfusion Team July 16, 2024 05:35 PM UTC

Hi Karl,

 

Thank you for reaching out. We would like to let you know that we have ensured the code snippet provided by you in a simple sample. We are able to reproduce the issue you reported when using Adornment, AutoScrollingDelta, and EnableAnimation = true.

 

We need to validate this at the source level. Therefore, we require some time to investigate the issue thoroughly. We will provide an update on the status within two working business days (18th July 2024).

 

Thank you for your patience and understanding. If you have any further questions, feel free to ask.

 

Regards,

Nitheeshkumar.



KG Karl Grambow July 16, 2024 11:29 PM UTC

Thanks for the update. That's great news.  


Take your time with finding the root cause.  My current workaround is to disable animations so it's not too bad.


Regards,


Karl



NT Nitheeshkumar Thangaraj Syncfusion Team July 18, 2024 04:07 PM UTC

Hi Karl,


Thank you for your update.

We are currently validating this case from various aspects. We will provide a thorough validation report and status update by tomorrow (July 19, 2024).

Thank you for your patience and understanding.


Regards,

Nitheeshkumar.



NT Nitheeshkumar Thangaraj Syncfusion Team July 19, 2024 01:33 PM UTC

Hi Karl,


After validating the reported issue, we have identified it as a bug that Null Reference Exception When Using Adornments with AutoScrollingDelta and Series Animation in WPF SfChart. We have created a bug report for this issue, and you can track its status and progress in the following feedback portal link.


Feedback LinkNull Reference Exception When Using Adornments with AutoScrollingDelta and Series Animation in WPF


The fix will be available in the upcoming weekly NuGet release on July 30th, 2024.


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.


Thank you for your patience and understanding.


Regards,

Nitheeshkumar.



NT Nitheeshkumar Thangaraj Syncfusion Team July 31, 2024 06:15 PM UTC

Hi Karl,


We apologize for the inconvenience caused. Due to a pending automation, we were unable to move the fix at the promised timeline. However, we have created a patch for the reported issue regarding the Null Reference Exception When Using Adornments with AutoScrollingDelta and Series Animation in WPF SfChart. Currently, the issue fix is in the testing phase.


As of now, we have prepared a custom assembly for the issue fix and shared it below for your reference. Please note that we have created this patch for version 26.1.35 specifically to resolve the issue reported in this ticket.


Please check with our patch and let us know whether your issue is resolved.


HTTP Link

https://syncfusion.com/Installs/support/patch/26.1.35/1748311/F189353/SyncfusionPatch_26.1.35_1748311_7312024100000623_F189353.exe

HTTP Link(Assemblies)

https://syncfusion.com/Installs/support/patch/26.1.35/1748311/F189353/SyncfusionPatch_26.1.35_1748311_7312024100000623_F189353.zip

HTTP Link(Nuget)

https://syncfusion.com/Installs/support/patch/26.1.35/1748311/F189353/SyncfusionNuget_26.1.35_1748311_7312024100000623_F189353.zip



Note:

Before installing the patch, kindly remove bin and obj folders from all the projects of solution and clear NuGet cache:

https://www.syncfusion.com/kb/6987/how-to-clear-nuget-cache


This fix will be included in our upcoming weekly release based on your confirmation. We will notify you once NuGet is released and appreciate your understanding and patience until that time.


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


Root cause:  The exception occurs because the adornments logic does not check whether the index j is within the bounds of AdornmentsInfo.LabelPresenters when auto-scrolling is enabled. This oversight can cause an attempt to access a label that does not exist, leading to an exception.


Regards,

Nitheeshkumar.



KG Karl Grambow August 1, 2024 07:01 AM UTC

Hi. Thanks for the update. I’m not in a position to apply the patch for a couple of weeks but I’ll do so on my return and will update you accordingly.

Regards,

Karl



PR Preethi Rajakandham Syncfusion Team August 2, 2024 05:31 AM UTC

Hi karl,

Thank you for the update. We will await your response.

Regards,

Preethi R



NT Nitheeshkumar Thangaraj Syncfusion Team August 6, 2024 12:52 PM UTC

Hi Karl,


The fix for the reported issue of Null Reference Exception When Using Adornments with AutoScrollingDelta and Animation in Wpf has been included in our latest weekly Nuget release, version 26.2.8 which is available for download ( https://www.nuget.org/).


NuGet Version: 26.2.8


Root Cause:  The exception occurs because the adornments logic does not check whether the index is within the bounds of AdornmentsInfo.LabelPresenters when auto-scrolling is enabled. This oversight can cause an attempt to access a label that does not exist, leading to an exception.


We thank you for your support and appreciate your patience. Please contact us if you require any further assistance.


Regards,

Nitheeshkumar.



KG Karl Grambow August 8, 2024 02:10 PM UTC

Thanks for the follow up.  I can confirm that his has been fixed in the latest version.


Regards,


Karl



PR Preethi Rajakandham Syncfusion Team August 9, 2024 04:26 AM UTC

Hi Karl,

We are glad that the provided response meets your requirement. Please let us know if you need further assistance. As always, we are happy to help you out. 

Regards,

Preethi R


Loader.
Up arrow icon