-
Notifications
You must be signed in to change notification settings - Fork 981
Closed
Labels
Description
Issue: (It will cause collection has changed exception on Rendering)
ScottPlot Version: (5.0.31)
ScottPlot/src/ScottPlot5/ScottPlot5/Rendering/RenderActions/RenderPlottables.cs
Lines 7 to 26 in 45e90a9
| foreach (IPlottable plottable in rp.Plot.PlottableList) | |
| { | |
| if (!plottable.IsVisible) | |
| continue; | |
| plottable.Axes.DataRect = rp.DataRect; | |
| rp.CanvasState.Save(); | |
| if (plottable is IPlottableGL plottableGL) | |
| { | |
| plottableGL.Render(rp); | |
| } | |
| else | |
| { | |
| rp.CanvasState.Clip(rp.DataRect); | |
| plottable.Render(rp); | |
| } | |
| rp.CanvasState.DisableClipping(); | |
| } |
/* code to reproduce the bug */
MeasuredSpan = avaplot.Plot.Add.HorizontalSpan(x1, x1, Colors.Red.WithOpacity(0.4));
MeasuredSpan.Axes.XAxis = avaplot.Plot.Axes.Top;when Plot.Add.HorizontalSpan() called,it will add to the PlottableList,if now is rendering,it will caused collection has changed exception.
So rp.Plot.PlottableList need a sample clone, for example rp.Plot.PlottableList.ToList()
Reactions are currently unavailable