Pre loader

Large ScatterSeries with PaletteProvider - Attemped to read or write protected memory

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

Hi,

I’m trying to colour individual points in what is a reasonably large scatter data set and when I enable the palette provider I get a System.AccessViolationException: ‘Attempted to read or write protected memory. This is often an indication that other memory is corrupt.’

I’ve managed to reproduce this in a test project. The code is provided below. The chart surface is set up pretty normally with these switches:

s:VisualXcceleratorEngine.IsEnabled="True"
s:VisualXcceleratorEngine.FallbackType="{x:Type s:HighQualityRenderSurface}"
s:VisualXcceleratorEngine.DowngradeWithoutException="False"
s:VisualXcceleratorEngine.EnableImpossibleMode="True" RenderPriority="Immediate" EnableMultiThreadedRendering="True"

Any ideas what is going on here or how I can fix it?

private int NUM_VALUES = 300000;
    public MainWindow()
    {
        InitializeComponent();
        DataContext = this;
        CreateGraph();
    }

    private void CreateGraph()
    {
        //
        var series = new XyDataSeries<double, double>();

        Random rand = new Random();
        int index = 0;
        int numAppends = 10;
        for (int j = 0; j < numAppends; j++)
        {
            double[] x = new double[NUM_VALUES/ numAppends];
            double[] y = new double[NUM_VALUES/ numAppends];
            PointMetadata[] m = new PointMetadata[NUM_VALUES/ numAppends];
            for (int i = 0; i < NUM_VALUES / numAppends; i++)
            {
                x[i] = index*0.001;
                y[i] = rand.NextDouble() * 100;
                m[i] = new PointMetadata(Color.FromRgb((byte)(rand.NextDouble() * 255), (byte)(rand.NextDouble() * 255), (byte)(rand.NextDouble() * 255)));
                index++;
            }
            series.Append(x, y, m);
        }

        scatterRenderSeries.DataSeries = series;
        sciChartSurface.ZoomExtents();
    }

    private void EnablePalette(object sender, RoutedEventArgs e)
    {
        scatterRenderSeries.PaletteProvider = new MainChartPaletteProvider();
    }
}

public class MainChartPaletteProvider : IPointMarkerPaletteProvider
{
    private PointPaletteInfo pointPaletteOverride;
    public void OnBeginSeriesDraw(IRenderableSeries rSeries)
    {

        pointPaletteOverride = new PointPaletteInfo();
        pointPaletteOverride.Fill = Colors.Red;
    }

    public PointPaletteInfo? OverridePointMarker(IRenderableSeries rSeries, int index, IPointMetadata metadata)
    {
        if (metadata == null)
        {
            return pointPaletteOverride;
        }
        pointPaletteOverride.Fill = (metadata as PointMetadata).Colour;
        return pointPaletteOverride;
    }
}

public class PointMetadata : IPointMetadata
{
    public Color Colour { get; set; }

    public bool IsSelected { get; set; }

    public event PropertyChangedEventHandler PropertyChanged;

    public PointMetadata(Color colour)
    {
        Colour = colour;
    }
}
Version
6.2.1.13304
  • Malcolm Geddes
    Hi Andrew, I get the exact same crash with the latest nightly build.
  • Malcolm Geddes
    Actually, I realised I hadn’t installed the nightly build across my library as well as my main project. That does seem to have fixed it
  • Malcolm Geddes
    On Further inspection, it still crashes with large sets. It seems that with the latest build the threshold for crashing has increased a bit but it will still crash with the same error if you push past that threshold
  • Andrew Burnett-Thompson
    Thanks Malcolm, we will log a bug and investigate
  • Andrew Burnett-Thompson
    Hi Malcolm, I believe the team have identified a reason for this and are working on a fix. More info to follow soon.
0
0

Hello Malcolm,

This issue was fixed in version #v6.2.2.13343, that is building now, and going to be published to our nightly later today, or tomorrow.

  • You must to post comments
0
0

Hello Malcolm,

This issue was fixed in version #v6.2.2.13343, that is building now, and going to be published to our nightly later today, or tomorrow.

  • You must to post comments
Showing 2 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