ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

WaveformGraph err

有時程式在跑時會出現以下錯誤,請問會是什麼原因呢

ystem.InvalidOperationException 未處理
  Message="集合已修改; 列舉作業可能尚未執行。"
  Source="mscorlib"
  StackTrace:
       於 System.Collections.Hashtable.HashtableEnumerator.MoveNext()
       於 NationalInstruments.UI.Internal.InnerAxisElement.a(ComponentDrawArgsInternal A_0, RectangleF[] A_1)
       於 NationalInstruments.UI.Internal.InnerAxisElement.DrawForeground(ComponentDrawArgsInternal args)
       於 NationalInstruments.Restricted.ControlElement.a(ComponentDrawArgsInternal A_0, Rectangle A_1, Boolean A_2)
       於 NationalInstruments.Restricted.ControlElement.DrawChildren(ComponentDrawArgsInternal args, Rectangle clipRectangle)
       於 NationalInstruments.Restricted.ControlElement.a(ComponentDrawArgsInternal A_0, Rectangle A_1, Boolean A_2)
       於 NationalInstruments.Restricted.ControlElement.DrawChildren(ComponentDrawArgsInternal args, Rectangle clipRectangle)
       於 NationalInstruments.Restricted.ControlElement.a(ComponentDrawArgsInternal A_0, Rectangle A_1, Boolean A_2)
       於 NationalInstruments.Restricted.ControlElement.a(ComponentDrawArgsInternal A_0, Rectangle A_1)
       於 NationalInstruments.Restricted.ControlElement.Paint(PaintEventArgs e)
       於 NationalInstruments.UI.WindowsForms.ControlBase.OnPaint(PaintEventArgs e)
       於 System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)
       於 System.Windows.Forms.Control.WmPaint(Message& m)
       於 System.Windows.Forms.Control.WndProc(Message& m)
       於 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       於 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       於 System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       於 System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       於 System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
       於 System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       於 System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       於 System.Windows.Forms.Application.Run(ApplicationContext context)
       於 Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
       於 Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
       於 Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
       於 WindowsApplication1.My.MyApplication.Main(String[] Args) 於 17d14f5c-a337-4978-8281-53493378c1071.vb: 行 81
       於 System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       於 System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       於 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       於 System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       於 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       於 System.Threading.ThreadHelper.ThreadStart()
  InnerException: 

0 Kudos
Message 1 of 8
(7,026 Views)

May I know your version of VB.NET?

 

version of Measurement Studio?

 

OS ?

0 Kudos
Message 2 of 8
(7,000 Views)

os:windows xp sp3

Microsoft Visual Studio 2008 

Measurement Studio 8.6

0 Kudos
Message 3 of 8
(6,995 Views)
0 Kudos
Message 4 of 8
(6,973 Views)

The same exception was thrown in my application when I've worked with ScatterGraph.

One can chose ScopeChart mode instead StripChart for problematic axis (usually  x axis). Using this mode, the problem is avoided. Or, if you create your graphs dynamically, you can recreate graph that was thrown an exception (actually, I recreate all graphs that are presented if exception is thrown). User can see a little flicker, and application continues to work.

"The software isn’t finished until the last user is dead."
0 Kudos
Message 5 of 8
(6,570 Views)
我的mode為:AutoScaleLoose 請問要如何抓取ERROR
0 Kudos
Message 6 of 8
(6,187 Views)

我已試到答案但不知是否正確,目前run都沒問題

 ScatterGraph1.Plots.Item(0).XAxis.Mode = AxisMode.AutoScaleLoose
 ScatterGraph1.Plots.Item(0).YAxis.Mode = AxisMode.AutoScaleVisibleExact

將mode改變一下就行了

0 Kudos
Message 7 of 8
(6,182 Views)

跑久了還是一樣會出錯...不知道該如何解決了..

0 Kudos
Message 8 of 8
(6,149 Views)