G
Guest
I have a SystemData class (Singleton class extends the DataSet) which has one Table (Trace: 4 Columns). I start a thread in its constructor which keeps on adding data to the table (simulating Real-Time data).
I have a form (Form1) in my C# project which has a DataGrid (DataGrid1). I have set the DataSource property of this grid to the "Trace" table created above.
I can see the data being added to the grid instantaneously but after some time the system hangs up and I see the following Stack Trace. It also hangs up if I try to change the Column width in the grid. I have no clue whats going on as I am not trying to set any tool tips.
********************Stack Trace***************************
system.windows.forms.dll!System.Windows.Forms.DataGridToolTip.CreateToolTipHandle() + 0x1db bytes
system.windows.forms.dll!System.Windows.Forms.DataGrid.ResetToolTip() + 0x44 bytes
system.windows.forms.dll!System.Windows.Forms.DataGrid.OnLayout(System.Windows.Forms.LayoutEventArgs levent = {System.Windows.Forms.LayoutEventArgs}) + 0xad bytes
system.windows.forms.dll!System.Windows.Forms.Control.PerformLayout(System.Windows.Forms.Control affectedControl = <undefined value>, string affectedProperty = null) + 0x7c bytes
system.windows.forms.dll!System.Windows.Forms.Control.PerformLayout() + 0xf bytes
system.windows.forms.dll!System.Windows.Forms.DataGridColumnStyle.set_Width(int value = 123) + 0x4f bytes
system.windows.forms.dll!System.Windows.Forms.DataGrid.ColResizeEnd(System.Windows.Forms.MouseEventArgs e = {X=158 Y=26 Button=Left}) + 0x19f bytes
system.windows.forms.dll!System.Windows.Forms.DataGrid.OnMouseUp(System.Windows.Forms.MouseEventArgs e = {X=158 Y=26 Button=Left}) + 0x7f bytes
system.windows.forms.dll!System.Windows.Forms.Control.WmMouseUp(System.Windows.Forms.Message m = {System.Windows.Forms.Message}, System.Windows.Forms.MouseButtons button = Left, int clicks = 1) + 0x261 bytes
system.windows.forms.dll!System.Windows.Forms.Control.WndProc(System.Windows.Forms.Message m = {System.Windows.Forms.Message}) + 0x49b bytes
system.windows.forms.dll!ControlNativeWindow.OnMessage(System.Windows.Forms.Message m = {System.Windows.Forms.Message}) + 0x13 bytes
system.windows.forms.dll!ControlNativeWindow.WndProc(System.Windows.Forms.Message m = {System.Windows.Forms.Message}) + 0xda bytes
system.windows.forms.dll!System.Windows.Forms.NativeWindow.DebuggableCallback(int hWnd = 26871752, int msg = 514, int wparam = 0, int lparam = 1704094) + 0x3d bytes
system.windows.forms.dll!System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods+IMsoComponentManager.FPushMessageLoop(int dwComponentID = 1, int reason = -1, int pvLoopData = 0) + 0x349 bytes
system.windows.forms.dll!ThreadContext.RunMessageLoopInner(int reason = -1, System.Windows.Forms.ApplicationContext context = {System.Windows.Forms.ApplicationContext}) + 0x1f3 bytes
system.windows.forms.dll!ThreadContext.RunMessageLoop(int reason = -1, System.Windows.Forms.ApplicationContext context = {System.Windows.Forms.ApplicationContext}) + 0x50 bytes
system.windows.forms.dll!System.Windows.Forms.Application.Run(System.Windows.Forms.Form mainForm = {Testing.Form1}) + 0x34 bytes
********************************************************
********************SystemData.cs**************************
using System;
using System.Data;
using System.Threading;
using System.Windows.Forms;
namespace Testing
{
public class SystemData : DataSet
{
#region Private Variables
private static SystemData m_instance = null;
#endregion
#region Public Constructor
private SystemData()
{
m_Write = new ManualResetEvent(true);
// Add Trace Table
DataTable dtTrace = new DataTable("Trace");
dtTrace.Columns.Add("Time Stamp", Type.GetType("System.String"));
dtTrace.Columns.Add("Module Name", Type.GetType("System.String"));
dtTrace.Columns.Add("Method Name", Type.GetType("System.String"));
dtTrace.Columns.Add("Message", Type.GetType("System.String"));
Tables.Add(dtTrace);
Thread m_SubscriptionThread = new Thread (new ThreadStart (FillData));
m_SubscriptionThread.Start();
}
#endregion
#region Public Methods
public static SystemData GetInstance()
{
if ( m_instance == null )
m_instance = new SystemData();
return m_instance;
}
#endregion
#region Private Methods
private void FillData()
{
while (true)
{
Tables["Trace"].Rows.Add ( new Object[] {DateTime.Now.ToString(), "Module", "Method", "Message"} );
Thread.Sleep (1000);
}
}
#endregion
}
}
********************************************************
I have a form (Form1) in my C# project which has a DataGrid (DataGrid1). I have set the DataSource property of this grid to the "Trace" table created above.
I can see the data being added to the grid instantaneously but after some time the system hangs up and I see the following Stack Trace. It also hangs up if I try to change the Column width in the grid. I have no clue whats going on as I am not trying to set any tool tips.
********************Stack Trace***************************
system.windows.forms.dll!System.Windows.Forms.DataGridToolTip.CreateToolTipHandle() + 0x1db bytes
system.windows.forms.dll!System.Windows.Forms.DataGrid.ResetToolTip() + 0x44 bytes
system.windows.forms.dll!System.Windows.Forms.DataGrid.OnLayout(System.Windows.Forms.LayoutEventArgs levent = {System.Windows.Forms.LayoutEventArgs}) + 0xad bytes
system.windows.forms.dll!System.Windows.Forms.Control.PerformLayout(System.Windows.Forms.Control affectedControl = <undefined value>, string affectedProperty = null) + 0x7c bytes
system.windows.forms.dll!System.Windows.Forms.Control.PerformLayout() + 0xf bytes
system.windows.forms.dll!System.Windows.Forms.DataGridColumnStyle.set_Width(int value = 123) + 0x4f bytes
system.windows.forms.dll!System.Windows.Forms.DataGrid.ColResizeEnd(System.Windows.Forms.MouseEventArgs e = {X=158 Y=26 Button=Left}) + 0x19f bytes
system.windows.forms.dll!System.Windows.Forms.DataGrid.OnMouseUp(System.Windows.Forms.MouseEventArgs e = {X=158 Y=26 Button=Left}) + 0x7f bytes
system.windows.forms.dll!System.Windows.Forms.Control.WmMouseUp(System.Windows.Forms.Message m = {System.Windows.Forms.Message}, System.Windows.Forms.MouseButtons button = Left, int clicks = 1) + 0x261 bytes
system.windows.forms.dll!System.Windows.Forms.Control.WndProc(System.Windows.Forms.Message m = {System.Windows.Forms.Message}) + 0x49b bytes
system.windows.forms.dll!ControlNativeWindow.OnMessage(System.Windows.Forms.Message m = {System.Windows.Forms.Message}) + 0x13 bytes
system.windows.forms.dll!ControlNativeWindow.WndProc(System.Windows.Forms.Message m = {System.Windows.Forms.Message}) + 0xda bytes
system.windows.forms.dll!System.Windows.Forms.NativeWindow.DebuggableCallback(int hWnd = 26871752, int msg = 514, int wparam = 0, int lparam = 1704094) + 0x3d bytes
system.windows.forms.dll!System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods+IMsoComponentManager.FPushMessageLoop(int dwComponentID = 1, int reason = -1, int pvLoopData = 0) + 0x349 bytes
system.windows.forms.dll!ThreadContext.RunMessageLoopInner(int reason = -1, System.Windows.Forms.ApplicationContext context = {System.Windows.Forms.ApplicationContext}) + 0x1f3 bytes
system.windows.forms.dll!ThreadContext.RunMessageLoop(int reason = -1, System.Windows.Forms.ApplicationContext context = {System.Windows.Forms.ApplicationContext}) + 0x50 bytes
system.windows.forms.dll!System.Windows.Forms.Application.Run(System.Windows.Forms.Form mainForm = {Testing.Form1}) + 0x34 bytes
Testing.exe!Testing.Form1.Main() Line 122 C#
********************************************************
********************SystemData.cs**************************
using System;
using System.Data;
using System.Threading;
using System.Windows.Forms;
namespace Testing
{
public class SystemData : DataSet
{
#region Private Variables
private static SystemData m_instance = null;
#endregion
#region Public Constructor
private SystemData()
{
m_Write = new ManualResetEvent(true);
// Add Trace Table
DataTable dtTrace = new DataTable("Trace");
dtTrace.Columns.Add("Time Stamp", Type.GetType("System.String"));
dtTrace.Columns.Add("Module Name", Type.GetType("System.String"));
dtTrace.Columns.Add("Method Name", Type.GetType("System.String"));
dtTrace.Columns.Add("Message", Type.GetType("System.String"));
Tables.Add(dtTrace);
Thread m_SubscriptionThread = new Thread (new ThreadStart (FillData));
m_SubscriptionThread.Start();
}
#endregion
#region Public Methods
public static SystemData GetInstance()
{
if ( m_instance == null )
m_instance = new SystemData();
return m_instance;
}
#endregion
#region Private Methods
private void FillData()
{
while (true)
{
Tables["Trace"].Rows.Add ( new Object[] {DateTime.Now.ToString(), "Module", "Method", "Message"} );
Thread.Sleep (1000);
}
}
#endregion
}
}
********************************************************