SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and iOS Chart & Android Chart Components
I am showing a dialog window with a ChartSurface in it. I have a context menu option to export to an image, and on window load I export to an XPS file. The dialog works fine if I do not use either feature, but once I do, I intermittently get an exception when showing the dialog. It appears to regularly take 3 instances of the dialog after the export feature is used to throw the exception, and the exception gets thrown twice the first time, threes times the second time, and so on. Again, if I do not use the export feature (no call to ExportToFile), I do not get any exceptions no matter how many times I show the dialog.
The exception message is “The provided DependencyObject is not a context for this Freezable. Parameter name: context”.
There are no other useful details in the exception from what I can see. Its all pretty abstract WPF stuff. The exported file/image seem to be generated accurately regardless of the exception.
I am using SciChart 184.108.40.20624, Visual Studio 2017 Professional, C#, WPF
I’m able to reproduce the issue, or a similar issue with version 5.4
What my code has is a “Start/Stop” button. When “Start” is pressed, the Axes are cleared and re-initialized.
If just using Start / Stop then it works, but if I export the chart into an image (a PNG in that matter), and after few seconds I click on the “Start”, then few seconds later, the software crash on the exception mentioned above.
From what I’ve been able to debug, the Export to image create a new chart control with all the bindings, and renders it to an image.
When I click on start, then the Axis (in this case, I see that the Y Axes are the ones that cause it) are cleared and created in my view model, and therefore it also affects the chart.
The binding of the chart that was created for the rendering is probably not cleared, so it gets the change event after some time, and Arrange is being called.
I see that ArrangeOverride on the AxisPanel is called, and _axisTitle,Arrange is called at this point the application crashes.
Please fix it.
I am fairly sure that this issue has been fixed in version 5.x of SciChart. However, I cannot tell for sure unless you test it.
Diagnosing complex bug reports like this requires three things: (see our Support Policy)
1.) That you are using the latest version of SciChart
2.) That your support is not expired (it shows as expired on our system)
3.) That you have provide a code sample such as a Visual Studio project to reproduce to the problem
Can you try out v5.x on the same code and see if it works? If YES then your solution is to upgrade. If NO then provide a code sample, and we will investigate, however, we won’t provide the fix to you with an expired support subscription.
Finally if our system is incorrect (you have a valid license) let me know and we will update.
Alexander, what is your scenario?
Is it the same as the original post, or is it more like mine?
Do you have a small sample project that reproduces the problem?
(I could not create one that reproduces the problem I’m having, but I was able to see that after rendering the chart to png, the temporary surface for the rendering is not being disposed, the binding are not cleared, and the surface remains in memory and never collected).
Please login first to submit.