09-20-2011 04:08 AM - edited 09-20-2011 04:13 AM
After updating from version 8 to version 9, I now have a problem when plotting special values.
An unadvertised overflow exception or a livelock may occur when grids are visible and a special value is plotted.
I managed to set up a (minimal) reproduction which hopefully shows the same defect as in the real-live application:
using System;
using System.Windows.Forms;
using NationalInstruments.UI;
using NationalInstruments.UI.WindowsForms;
class Form1 : Form {
WaveformPlot waveformPlot1;
Form1() {
WaveformGraph waveformGraph1 = new WaveformGraph();
XAxis xAxis1 = new XAxis();
YAxis yAxis1 = new YAxis();
waveformPlot1 = new WaveformPlot();
waveformPlot1.ProcessSpecialValues = true;
waveformGraph1.Plots.AddRange(new WaveformPlot[] { waveformPlot1 });
waveformGraph1.XAxes.Add(xAxis1);
waveformGraph1.YAxes.Add(yAxis1);
yAxis1.AutoSpacing = false;
yAxis1.MinorDivisions.GridVisible = true;
waveformPlot1.XAxis = xAxis1;
waveformPlot1.YAxis = yAxis1;
Controls.Add(waveformGraph1);
}
protected override void OnShown(EventArgs e) {
base.OnShown(e);
//waveformPlot1.PlotYAppend(20); // OK
//waveformPlot1.PlotYAppend(double.NaN); // OK
//waveformPlot1.PlotYAppend(double.PositiveInfinity); // Livelock
waveformPlot1.PlotYAppend(double.NegativeInfinity); // Overflow error
}
[STAThread]
static void Main() {
Application.Run(new Form1());
}
}
The issue also exists in the Measurement Studio 2010 SP1 version.
The project was compiled against .NET 2.0, running on a Windows 7 OS with a dual core processor.
Work arounds:
Please fix this regression issue in vNext.
09-22-2011 11:19 AM
Marrocco,
Thank you for bringing this to our attention. There seems to be a bit of unexpected behavior with some of these values. However, I saw the same behavior in versions 8.9 and 9.1. What version were you using when you did not experience the incorrect behavior?
Also, I only see a livelock on positive infinity. I do not see an overflow error on negative infinity. Could you describe this in more detail? I did notice that the graph will not display if negative infinity is the only value plotted.
09-23-2011 12:50 AM
Hello D
I directly upgraded from version 8.5. Sorry for the impreciseness.
The OverflowException with message "Overflow error." is not immediately thrown from PlotYAppend, but in a callee of
Application.Run.
The stack trace is
at System.Drawing.Graphics.CheckErrorStatus(Int32 status) at System.Drawing.Graphics.DrawLines(Pen pen, PointF[] points) at NationalInstruments.UI.Internal.XYGraphPlotAreaManager.a(Graphics A_0, Rectangle A_1, DivisionBase A_2, PointF[] A_3) at NationalInstruments.UI.Internal.XYGraphPlotAreaManager.a(Graphics A_0, Rectangle A_1, ArrayList A_2) at NationalInstruments.UI.Internal.XYGraphPlotAreaManager.a(Graphics A_0, Rectangle A_1, Boolean A_2) at NationalInstruments.UI.Internal.XYGraphPlotAreaManager.DrawGridLines(ComponentDrawArgsInternal args, Boolean layout) at NationalInstruments.UI.Internal.XYGraphPlotAreaManager.DrawForeground(ComponentDrawArgsInternal args) at NationalInstruments.Restricted.ControlElement.a(ComponentDrawArgsInternal A_0, Rectangle A_1, Boolean A_2) at NationalInstruments.Restricted.ControlElement.DrawChildren(ComponentDrawArgsInternal args, Rectangle clipRectangle) at NationalInstruments.Restricted.ControlElement.a(ComponentDrawArgsInternal A_0, Rectangle A_1, Boolean A_2) at NationalInstruments.Restricted.ControlElement.a(ComponentDrawArgsInternal A_0, Rectangle A_1) at NationalInstruments.Restricted.ControlElement.Paint(PaintEventArgs e) at NationalInstruments.UI.WindowsForms.ControlBase.OnPaint(PaintEventArgs e) at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs) at System.Windows.Forms.Control.WmPaint(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.Run(Form mainForm) at Form1.Main() in C:\Users\Christian\Documents\Visual Studio 2008\Projects\WindowsFormsApplication3\Form1.cs:line 38
This is from version 2010 (9.0.35.292).
Hope this helps.
09-26-2011 04:28 PM
Marrocco,
Thank you for reporting this. I have verified the behavior you have described. I have created a bug report that you can track using # 316607.
09-27-2011 02:25 PM
Marrocco,
After investigating this a bit further, we have realized that this issue is related to the AutoSpacing property of the YAxis. You have set this property to false which is causing it to get stuck calculating the spacing. If you set this to true (or leave it as the default which is true), then the graph should act as expected. There is still an issue with the negative infinity when you have the property set to false, but hopefully you do not need the AutoSpacing set to false or can find a workaround specifying the intervals manually.
09-28-2011 07:20 AM
Thank you for the advice.
My option was to temporarily disable the minor grid. As there is still the major grid, and - in my case - there is only one minor tick between two major ticks, the graph is still usable.