Question: (Ask your question here)
The program suddenly shuts down.
What are the points that I need to check?
Data is added to the queue when entered in real-time (50 msec) and the internal timer (50 msec) is chart updating the data. Nothing is done (no data is entered), or when data is entered, the chart is updated anew and goes down.
--windwos Event
Program terminated (code: -1073740791 (0xc0000409).
Error module name: clr.dll, version: 4.8.9310.0, timestamp: 0x67db4f7d
Exception code: 0xc0000409
Error offset: 0x005df2a5
ScottPlot Version: (What NuGet package are you using?)
Version 5.1.58
Code Sample:
private void OnRenderTick(object sender, EventArgs e)
{
if (_isRendering || this.IsDisposed || !this.IsHandleCreated) return;
if (_dataQueue.IsEmpty) return;
try
{
_isRendering = true;
bool hasNewData = false;
lock (formsPlot1.Plot.Sync)
{
int count = 0;
while (_dataQueue.TryDequeue(out var data) && count++ < 3000)
{
if (double.IsNaN(data.x) || double.IsNaN(data.y) ||
double.IsInfinity(data.x) || double.IsInfinity(data.y))
{
continue; // 이 데이터는 버립니다 (차트를 터트리는 주범)
}
hasNewData = true;
string typeName = data.type;
string targetType = plotDict.ContainsKey(typeName) ? typeName : (DEFAULT_USE ? "DEFAULT" : null);
if (targetType != null && dataX.ContainsKey(targetType))
{
if (targetType == "DEFAULT")
{
int currentDataCount = dataX["DEFAULT"].Count;
while (defaultOriginalNames.Count < currentDataCount)
{
defaultOriginalNames.Add("DEFAULT");
}
defaultOriginalNames.Add(typeName);
}
dataX[targetType].Add(data.x);
dataY[targetType].Add(data.y);
dataMeta[targetType].Add(data.meta ?? "-");
}
}
}
if (hasNewData)
{
_autoScaleCounter++;
if (_autoScaleCounter >= AUTO_SCALE_INTERVAL)
{
lock (formsPlot1.Plot.Sync)
{
formsPlot1.Plot.Axes.AutoScale();
var limits = formsPlot1.Plot.Axes.GetLimits();
if (!double.IsNaN(limits.Top) && !double.IsNaN(limits.Bottom))
{
if (_yreverse)
{
formsPlot1.Plot.Axes.SetLimitsY(limits.Bottom * 1.1, 0);
}
else
{
formsPlot1.Plot.Axes.SetLimitsY(0, limits.Top * 1.1);
}
}
}
_autoScaleCounter = 0;
}
}
formsPlot1.Refresh();
}
catch(Exception ex)
{
System.Diagnostics.Debug.WriteLine($"Render Error: {ex.Message}");
}
finally
{
_isRendering = false;
}
}
Question: (Ask your question here)
The program suddenly shuts down.
What are the points that I need to check?
Data is added to the queue when entered in real-time (50 msec) and the internal timer (50 msec) is chart updating the data. Nothing is done (no data is entered), or when data is entered, the chart is updated anew and goes down.
--windwos Event
Program terminated (code: -1073740791 (0xc0000409).
Error module name: clr.dll, version: 4.8.9310.0, timestamp: 0x67db4f7d
Exception code: 0xc0000409
Error offset: 0x005df2a5
ScottPlot Version: (What NuGet package are you using?)
Version 5.1.58
Code Sample: