SfChart crashing with Collection was modified, enumeration operation may not execute.

I'm using SfChart v25.1.35 in a UWP application. I'm seeing the following error in my crash reports, although I'm unable to replicate it myself. It looks like the error could be caused by items being added to the chart series after it starts rendering, but I'm assigning the entire finished collection in one go. I have several charts in the app and unfortunately the stack trace doesn't make it clear where the problem is. Any suggestions?

Stack trace from telemetry:

  • System.InvalidOperationException: Collection was modified; enumeration operation may not execute.

  • System
    ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumFailedVersion ()
  • Syncfusion.UI.Xaml.Charts
    ChartColumnDefinition.Measure (Size, List`1, List`1)
  • Syncfusion.UI.Xaml.Charts
    ChartCartesianAxisLayoutPanel.MeasureAxis (Size, Rect)
  • Syncfusion.UI.Xaml.Charts
    ChartCartesianAxisLayoutPanel.Measure (Size)
  • Syncfusion.UI.Xaml.Charts
    SfChart.LayoutAxis (Size)
  • Syncfusion.UI.Xaml.Charts
    SfChart.UpdateArea (Boolean)
  • Syncfusion.UI.Xaml.Charts
    ChartBase.UpdateArea ()
  • Windows.ApplicationModel.Store
    LicenseChangedEventHandler.Invoke ()
  • PowerwallCompanion!<BaseAddress>+0x1d7db3c
  • System.Runtime.InteropServices
    McgMarshal.ThrowOnExternalCallFailed (Int32, RuntimeTypeHandle)
  • __Interop
    ComCallHelpers.Call (__ComObject, RuntimeTypeHandle, Int32)
  • __Interop
    ForwardComStubs.Stub_22[TThis] (__ComObject, Int32)
  • Microsoft.AppCenter.Utils
    ApplicationLifecycleHelper.<ctor>b__17_1 (Object, UnhandledErrorDetectedEventArgs)


8 Replies

NT Nitheeshkumar Thangaraj Syncfusion Team July 8, 2024 01:21 PM UTC

Hi Tom,


Thank you for reaching out. We attempted to replicate the reported issue using a simple sample that involved combinations of NaN, positive, and negative values dynamically over time. However, we were unable to reproduce the error on our end.


To assist you further, could you please provide us with more specific details or steps to reliably reproduce the issue? Like how you modified the collection dynamically, what number of data points have you added? Have you overwritten the data collection in the runtime, which is already present in the collection? This information will help us provide a better solution.

 

Thank you for your patience and understanding.


Regards,

Nitheeshkumar.



TH Tom Hollander July 10, 2024 05:44 AM UTC

Hi Nitheeshkumar -

Mainly I've ben seeing the error in telemetry from other users, but I did manage to reproduce it a couple of times. It appears to be a race condition of some sort, because I couldn't reproduce it reliably, and when it did occur it was just when the charts are initialising. I do not believe my code is modifying any collections used on the chart. 

I was hoping your team could investigate the stack trace and consider what could could cause this to be thrown from  ChartColumnDefinition.Measure (Size, List`1, List`1)

Tom



NT Nitheeshkumar Thangaraj Syncfusion Team July 11, 2024 12:15 PM UTC

Hi Tom,


Thank you for bringing this to our attention.


To assist us in investigating this issue further, could you please provide more details on the steps you followed when you managed to reproduce the issue? Specifically, we would like to know:

   1. The specific actions performed when the error occurred.

   2. The data and configurations used for the chart during initialization.

   3. Any patterns or observations that might help us understand when the error is more likely to occur.


Additionally, if you have any specific user scenarios or sequences of actions that seem to trigger this error, please share those details. This information will greatly aid us in reproducing the issue on our end and identifying a solution.

Thank you for your cooperation and patience.


Regards,

Nitheeshkumar.



TH Tom Hollander replied to Nitheeshkumar Thangaraj July 14, 2024 10:27 PM UTC

HI Nitheeshkumar -

Having experimented a bit more, this exception seems to be thrown if the user navigates away from the page containing the chart while it's still painting. I'll see if I can make a repro, but I strongly suspect this is a bug in the chart component.

Tom



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

Hi Tom,

 

Thank you for your information. We will try to reproduce your case in a simple sample. We will conduct a thorough investigation and provide you with the complete details within two business days, by July 17, 2024.

Regards,

Nitheeshkumar.



DR Dhanaraj Rajendran Syncfusion Team July 17, 2024 08:04 PM UTC

Hi Tom,


We have conducted tests based on your observation regarding navigating away from the page while the chart is still rendering. However, we were unable to reproduce the exception you mentioned. We did not encounter any issues or exceptions during the rendering process. We have attached the sample for your reference.


To further investigate the issue you're experiencing, could you please revert any changes made to reproduce the issue in the attached sample and provide us with more detailed steps or scenarios that might help us replicate the problem?


Your assistance in providing additional information will help us better understand and address the issue effectively.


Regards,

Dhanaraj Rajendran.


Attachment: SF_189191_13ff520a.zip


TH Tom Hollander replied to Dhanaraj Rajendran July 21, 2024 11:59 PM UTC

Thanks for trying to put together a repro. I also can't repro the same issue with your code - I'm trying to modify it to be more like my main app - I'll let you know if I have any success.



PR Preethi Rajakandham Syncfusion Team July 22, 2024 09:05 AM UTC

Hi Tom,

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

Regards,

Preethi R


Loader.
Up arrow icon