Pre loader

ExportToFile Exception "The provided DependencyObject is not a context for this Freezable"

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

0
0

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 4.2.2.9724, Visual Studio 2017 Professional, C#, WPF

Any ideas?

Version
4.2.2.9724
  • You must to post comments
1
0

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.

  • You must to post comments
0
0

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).

  • You must to post comments
0
0

Hi
The mentioned issue still reproducible with SciChart version 7
Sample code is simple (My scenario Export to BitmapSource at Specific Size)
var image = SciChart.ExportToBitmapSource(false, size);
just followed what is mentioned in link https://www.scichart.com/documentation/win/current/Screenshots,_Printing_and_Export_to_XPS.html

After export image , when some binding changes on the SciChart, Surface leads to crash with with below crash log
2024-01-31 10:20:01.352 +05:30 [Error] The provided DependencyObject is not a context for this Freezable.
Parameter name: context
System.ArgumentException: The provided DependencyObject is not a context for this Freezable.
Parameter name: context
at System.Windows.Freezable.RemoveContextInformation(DependencyObject context, DependencyProperty property)
at System.Windows.Freezable.RemoveInheritanceContext(DependencyObject context, DependencyProperty property)
at System.Windows.DependencyObject.RemoveSelfAsInheritanceContext(DependencyObject doValue, DependencyProperty dp)
at System.Windows.Freezable.OnFreezablePropertyChanged(DependencyObject oldValue, DependencyObject newValue, DependencyProperty property)
at System.Windows.Media.RenderData.PropagateChangedHandler(EventHandler handler, Boolean adding)
at System.Windows.UIElement.RenderClose(IDrawingContent newContent)
at System.Windows.Media.RenderDataDrawingContext.DisposeCore()
at System.Windows.Media.DrawingContext.System.IDisposable.Dispose()
at System.Windows.UIElement.Arrange(Rect finalRect)
at SciChart.Charting.Themes.AxisPanel.ArrangeOverride(Size finalSize)
at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
at System.Windows.UIElement.Arrange(Rect finalRect)
at System.Windows.Controls.Grid.ArrangeOverride(Size arrangeSize)
at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
at System.Windows.UIElement.Arrange(Rect finalRect)
at System.Windows.Controls.StackPanel.StackArrangeHelper(IStackMeasure arrangeElement, IStackMeasureScrollData scrollData, Size arrangeSize)
at System.Windows.Controls.StackPanel.ArrangeOverride(Size arrangeSize)
at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
at System.Windows.UIElement.Arrange(Rect finalRect)
at System.Windows.Controls.Border.ArrangeOverride(Size finalSize)
at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
at System.Windows.UIElement.Arrange(Rect finalRect)
at System.Windows.Controls.Control.ArrangeOverride(Size arrangeBounds)
at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
at System.Windows.UIElement.Arrange(Rect finalRect)
at System.Windows.Controls.StackPanel.StackArrangeHelper(IStackMeasure arrangeElement, IStackMeasureScrollData scrollData, Size arrangeSize)
at System.Windows.Controls.StackPanel.ArrangeOverride(Size arrangeSize)
at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
at System.Windows.UIElement.Arrange(Rect finalRect)
at MS.Internal.Helper.ArrangeElementWithSingleChild(UIElement element, Size arrangeSize)
at System.Windows.Controls.ItemsPresenter.ArrangeOverride(Size arrangeSize)
at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
at System.Windows.UIElement.Arrange(Rect finalRect)
at System.Windows.Controls.Border.ArrangeOverride(Size finalSize)
at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
at System.Windows.UIElement.Arrange(Rect finalRect)
at System.Windows.Controls.Control.ArrangeOverride(Size arrangeBounds)
at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
at System.Windows.UIElement.Arrange(Rect finalRect)
at System.Windows.Controls.Grid.ArrangeOverride(Size arrangeSize)
at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
at System.Windows.UIElement.Arrange(Rect finalRect)
at System.Windows.Controls.Border.ArrangeOverride(Size finalSize)
at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
at System.Windows.UIElement.Arrange(Rect finalRect)
at System.Windows.Controls.Control.ArrangeOverride(Size arrangeBounds)
at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
at System.Windows.UIElement.Arrange(Rect finalRect)
at System.Windows.ContextLayoutManager.UpdateLayout()
at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
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)

Images
  • You must to post comments
0
0

Hi Jeremy,

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.

Best regards,
Andrew

  • Jeramy Soucy
    I’ve downloaded 5.3.0 as a trial. When I rebuilt my code, instead of my usual charts I get a message saying my support subscription has expired and my license is only valid for earlier versions. How do I make use of demoing the newest version?
  • You must to post comments
0
0

I’m facing the exact same problem in v5.4.1.12182. Could you please fix it?

Best regards
Alexander

  • You must to post comments
Showing 5 results
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies