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;
}
}
- Malcolm Geddes asked 5 years ago
- Hi Andrew, I get the exact same crash with the latest nightly build.
- 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
- 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
- Thanks Malcolm, we will log a bug and investigate
- Hi Malcolm, I believe the team have identified a reason for this and are working on a fix. More info to follow soon.
- 2 more comments
- You must login to post comments
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.
- Nazariy Pelyushkevych answered 4 years ago
- Thanks!
- You must login to post comments
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.
- Nazariy Pelyushkevych answered 4 years ago
- You must login to post comments
Please login first to submit.