Pre loader

Tag: nullReferenceException

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 votes

hello, i have an exception.
see the try catch

public class CategoryDateTimeAxisEx : CategoryDateTimeAxis
    public override IComparable GetDataValue(double pixelCoordinate)
        var dataValue = DateTime.MinValue;

        var coordCalc = GetCurrentCoordinateCalculator();
        if (coordCalc != null)
            // Returns the index of a dataPoint, need to transform it to a dataValue
            var value = coordCalc.GetDataValue(pixelCoordinate);

            var catCoordCalc = coordCalc as ICategoryCoordinateCalculator<DateTime>;
                dataValue = catCoordCalc?.TransformIndexToData((int)value) ?? value.ToDateTime();
            catch (Exception e)
                 //TransformIndexToData() throw exception because catCoordCalc.BaseXValues is null,
                 //it only happend when my mouse over SciSurface and move faster on app startup
        return dataValue;

I use this class and override function now, it can work .but i don’t like this way.

0 votes

Hi, i’m developing an app in WPF and i found that it crashes when i’m dereferencing the user control where my chart lives in and have 1 or more points selected by code in one chart when the other one is not visible.

i would be very apreciated if someone could tell me a hint of where i have to look for the solution or what do this methods do or touch.

more data about the chart:

  • I have 2 fastlinerenderable series each with 2 Yaxis for itselves and 2 shared XAxis.
  • I also have a modified listbox which is have it’s sincronization synced to the chart.
  • have a modifiergroup to pan,zoom and select.

this is my Selectionmodifier:

                        XAxisId="{Binding XAxisType, NotifyOnTargetUpdated=True}"
                        IsEnabled="{Binding SelectionMode}" >

I think that this is the axis that breaks my program but it needs it to not crash when i select.

this is my stacktrace:

An unhandled exception of type ‘System.NullReferenceException’ occurred in SciChart.Charting.dll

en SciChart.Charting.ChartModifiers.DataPointSelectionModifier.DeselectAllPointMarkers()
en SciChart.Charting.ChartModifiers.DataPointSelectionModifier.OnXAxisIdDependencyPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)

I tried to make a program that could replicate the error but i couldn’t.

thanks in advance.

1 vote

Hello, SciChart Team!
i have an issue using mouse drag event ( RubberBandXyZoomModifier, ZoomPanMidifier). the message says “NullReferenceException in SciChart.Charting.dll ” or “Thread.cs not found” from time to time.
after some experiments i figured out that the app starts to crush after i change XAxis type .
i have a simple mvvm user control used to display both arrays of double and datebound data, XAxes of SciChart Surfase is bound to an observable collection of IAxis elements. if i need to change chart type i clear this collection and create an axis of desired type (DateTimeAxisViewModel or NumericAxisViewModel). after that the series can be added, but zooming causes crash with nearly to no info.

i attached a solution, which lacks only scichart dlls in order to run (hopefully), Window_Loaded method has a commented line which changes chart type and makes app crush on zooming, would be nice if you checked it out.
Thanks in advance!

0 votes

We are getting a NullReferenceException at OnRenderSurfaceBaseLoaded(Object sender, RoutedEventArgs e) in Direct3D10RenderSurface.

On calling:

if (Direct3D10CompatibilityHelper.SupportsDirectX10)
            // quickest one and optically on par with high quality or xaml rendering
            return new Direct3D10RenderSurface();

Windows 8: Version 6.2.9200.0
CLR version: 4.0.30319.42000

see Stacktrace:

Stack trace

System.NullReferenceException: Object reference not set to an instance of an object.
at SciChart.Drawing.DirectX.Context.D3D10.Direct3D10RenderSurface.OnRenderSurfaceBaseLoaded(Object sender, RoutedEventArgs e): 
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised): 
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args): 
at System.Windows.BroadcastEventHelper.BroadcastEvent(DependencyObject root, RoutedEvent routedEvent): 
at System.Windows.BroadcastEventHelper.BroadcastLoadedEvent(Object root): 
at MS.Internal.LoadedOrUnloadedOperation.DoWork(): 
at System.Windows.Media.MediaContext.FireLoadedPendingCallbacks(): 
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): 

Any help?

0 votes

I’m currently trying to adapt an example to post here as an example repro– But in the meantime I figured I’d post and see if there are any fundamental problems with trying to do this.

The exception message states:

Additional information: Cannot get data-value from coordinate as the associated Axis is null
0 votes

Here’s the situation:
Our app has a viewmodel with an XyDataSeries Property bound to the plot. We’ve overridden DataPointSelectionModifer to allow us to trigger calculations when the selected points are changed. This overridden modifier is not instantiated by nor is it directly aware of the viewmodel; it is referenced only in the view xaml.

When changing between datasets we replace the contents of the XyDataSeries Property. Afterwards we are experiencing NullReferenceExceptions in DataPointSelectionModifier.SelectManyPoints(). This occurs whether we replace the contents of the data series or we set a completely new XyDataSeries object into the property.

It appears that the DataPointSelectionModifier.SelectedPointMarkers collection is no longer properly synced to the plot’s XyDataSeries. The size of the the collections are different and with the original DataSeries being garbage-collected the DataPointInfo.DataPointMetadata references are null. So we attempt to dial in a new selection and the deselection of this orphaned null metadata raises exceptions.

Is there some secret-sauce to keeping these collections in line?
Any and all suggestions are greatly appreciated.

0 votes


I have the following code for a vertical slice modifier

    <s:VerticalSliceModifier Name="sliceModifier"
                            <s:VerticalLineAnnotation Style="{StaticResource sliceStyle}"
                                                      X1="{Binding ParentViewModel.SliceModifierPosition, Mode=TwoWay}" />


This results in a nullreference exception. When I remove the VerticalLines, there is no nullreference exception, also no vertical lines.
As far as I can see ParentViewModel.SliceModifierPosition, does not have a value at the time.

I tried setting the visibility of the slicemodifier to collapsed, but it did not help the exception. Is there any to remove the slicemodifier for the time when X1 is not valid (using MVVM and not binding the slicemodifier itself)?

nullreference exception location
: Abt.Controls.SciChart.ChartModifiers.VerticalSliceModifier.OnAttached()
: Abt.Controls.SciChart.ChartModifiers.ModifierGroup.TB(IChartModifier C)
: Abt.Controls.SciChart.Common.Extensions.EnumerableExtensions. <a href="IEnumerable1 , Action1″>
: Abt.Controls.SciChart.ChartModifiers.ModifierGroup.TB(IEnumerable`1 C)
0 votes
0 answers

Hello again!
I’m working with new scichart version (5th august). In view XAML file I have this code snippet:

visuals:SciChartSurface Annotations="{Binding AnnotationCollection}"  SeriesSource="{Binding GraphicsCollection}" XAxis="{Binding XAxis, Mode=TwoWay}" YAxes="{Binding YAxisCollection}"  >

When I try to run the application, I get this NullReferenceException:

   в A. .Convert(Object value, Type targetType, Object parameter, CultureInfo culture)
   в System.Windows.Data.BindingExpression.TransferValue(Object newValue, Boolean isASubPropertyChange)
   в System.Windows.Data.BindingExpression.Activate(Object item)
   в System.Windows.Data.BindingExpression.AttachToContext(AttachAttempt attempt)
   в System.Windows.Data.BindingExpression.AttachOverride(DependencyObject target, DependencyProperty dp)
   в System.Windows.Data.BindingExpressionBase.OnAttach(DependencyObject d, DependencyProperty dp)
   в System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
   в System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
   в System.Windows.Data.BindingOperations.SetBinding(DependencyObject target, DependencyProperty dp, BindingBase binding)
   в System.Windows.FrameworkElement.SetBinding(DependencyProperty dp, BindingBase binding)
   в Abt.Controls.SciChart.Visuals.Annotations.LineAnnotationWithLabelsBase.VB()
   в Abt.Controls.SciChart.Visuals.Annotations.LineAnnotationWithLabelsBase.TB()
   в Abt.Controls.SciChart.Visuals.Annotations.LineAnnotationWithLabelsBase.OnXAxesCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args)
   в Abt.Controls.SciChart.Visuals.Annotations.AnnotationBase.Abt.Controls.SciChart.Visuals.Annotations.IAnnotation.OnXAxesCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args)
   в Abt.Controls.SciChart.Visuals.Annotations.AnnotationCollection.OnXAxesCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args)
   в Abt.Controls.SciChart.Visuals.SciChartSurface.OnXAxesCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args)
   в System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)

But if I change my xaml file this way:

visuals:SciChartSurface SeriesSource="{Binding GraphicsCollection}" XAxis="{Binding XAxis, Mode=TwoWay}" YAxes="{Binding YAxisCollection}" 
Annotations="{Binding AnnotationCollection}"   >

there won’t be any exceptions. I’ve attached project with exception below.

P.S. in the previuous version it works fine.

  • Egor asked 9 years ago
0 votes

Hello, SciChart team, i’m trying to implement vertical slices on my chart surface, but X axis is a DateTimeAxis, but i’m getting nullReferenceException when trying to move (just click on it).

“System.NullReferenceException occurred
_message=Ссылка на объект не указывает на экземпляр объекта.
Message=Ссылка на объект не указывает на экземпляр объекта.
в Abt.Controls.SciChart.Visuals.Annotations.AnnotationBase.GetBasePoints()
InnerException: “

trying to solve this problem i downloaded scischart 3.42 but this didn’t help, it even made things worse underlining my scichartsurface declaration in .xaml file saying “2 is not a valid value for property orintation”
which is not used, and this chart worked before upgrade.
please help me out,
Volkov Alexander

Update: full rebuilding solved the latter problem. i’m adding zip containing txt with scichartsurface definition and methods from .cs which add and remove slices

Showing 9 results