Home Forums WinForms controls Xceed Chart for WinForms Chart control crashing randomly

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #18988 |

    I’m writing an app that receives data over at TCP link and updates a chart control’s mesh surface series when it receives a new packet of data.  It will run fine for a while, but at some point it will crash in a weird way.  I’ve seen the chart control generate a red x in place of where the control should be.  I’ve seen it generate a .Net dialog saying a user defined breakpoint has been reached.  I’ve also seen it generate an error dialog.  I can’t remember the details of the exception (I’ll reply when it happens again), but the source of the error in my code is the line where I set the RenderDevice to RenderDevice.OpenGL.

     I’m Invoking the method that manipulates the controls, so its happening on the Form’s thread.  I’m licensed for version 4.0 fo the charts, but I downloaded a trial of 4.2, and its still happening on that version as well.  Where do I begin looking for the cause of the problem?  I’m out of ideas.  I can send the source of my project to an Xceed employee’s email address if need be.  

    Imported from legacy forums. Posted by cokert (had 2613 views)

    User (Old forums)
    Member
    Post count: 23064

    Here’s one of the random crashes I get.  “Value of <large negative number> is not valid for ‘alpha’. ‘alpha’ should be greater than or equal to 0 and less than or equal to 255.”  There are others, and I’ll update this post as I see them.

    Imported from legacy forums. Posted by cokert (had 561 views)

    User (Old forums)
    Member
    Post count: 23064

    Here’s another exception I get “Attempted to read or write protected memory. This is often an indication that other memory is corrupt.”

    Imported from legacy forums. Posted by cokert (had 568 views)

    User (Old forums)
    Member
    Post count: 23064

    I didn’t mention it, but this behavior is exhibited on x64 Vista as well as x86 XP

    Imported from legacy forums. Posted by cokert (had 772 views)

    User (Old forums)
    Member
    Post count: 23064

    One more exception…
    System.Exception: Failed to set pixel format [GLRenderSurface::SetupPixelFormat]

     Here’s  the call stack for this one from the point where I set the RenderSurface to OpenGL

    System.Exception: Failed to set pixel format [GLRenderSurface::SetupPixelFormat]
       at Xceed.Chart.GraphicsGL.GLRenderSurface.SetupPixelFormat(HDC__* hDC, UInt32 dwFlags)
       at Xceed.Chart.GraphicsGL.GLBitmapRenderSurface.Init(Control pOuterControl, Size rcSurfaceDimensions, Int32 nColorDepth)
       at Xceed.Chart.GraphicsGL.GLDevice.Init(Boolean bRenderToBitmap, Control pOuterControl, Size szDimensions, Int32 nColorDepth, Boolean bTransparentBackground)
       at Xceed.Chart.Core.ChartControlBase.InitDevice(Control ctrl)
       at Xceed.Chart.Core.Settings.ChangeRenderSurface(Boolean bChangeDevice)
       at Xceed.Chart.Core.Settings.set_RenderDevice(RenderDevice value)

    Imported from legacy forums. Posted by cokert (had 675 views)

    User (Old forums)
    Member
    Post count: 23064

    Should I not expect a response to this?  I appreciate that you don’t necessarily know exactly where my problem is, but some guidance as to where the problem may be coming from would be appreciated.  If I need to buy a support contract, tell me, don’t just ignore my questions.  Ignoring a valid question from a paying customer is very poor customer service. 

    Edited by André :

    You have to note that this is a community supported forum, which means that even though we try to provide answers to unanswered post, we will not cover all of them under all circumstances.  For paying customer, we provide a direct email address which they can use to get custom support on less general issues, like this one.  Normally it is easier to support this through emails, since we can have more details, or even a sample application, which we can use to reproduce the issue and debug it.

    Imported from legacy forums. Posted by cokert (had 586 views)

    User (Old forums)
    Member
    Post count: 23064

    I have some call stacks from a few of the crashes I’ve gotten when running in release mode with no debugger attached.  I don’t have permission to attach files, and they’re so long, I’m just going to paste one at the end of this post.  You can see no user code is in the stack when it crashes. (There is a suspicious looking call in the stack “PaintWithErrorHandling”.)  When running in Release with no debugger, sometimes I get the .Net crashed application error dialog.  Sometimes I just get the Red X in place of the control.  I’ve tried enabling the jitdebugging flag in app.congig of the application, but that didn’t help.  When the app is running in debug mode, I have yet to see it actually crash.  In this mode, I just get the Red X.  

    The Red X on controls looks to be caused by threading issues.  Most information I could find is related to DataGrids (specifically, DataGrids whose backing data source is modified on a non-owning thread), but it seems WinForms will do this to your control when the OnPaint method fails for your control.  Visual Studio is supposed to catch Cross Threading issues with controls, but when running under VS2008, the charting controls on the app in question just get the “Red X” with no crash or Cross Thread warning dialog.  The app is multithreaded, but I’m doing Invoke any time I touch the form’s controls.  I’m going to go back through and make sure I’m invoking everywhere I need to,  Can anyone provide any help into where I might look from here?

     

    System.ArgumentException: Value of ‘-2147483393’ is not valid for ‘alpha’. ‘alpha’ should be greater than or equal to 0 and less than or equal to 255.
       at System.Drawing.Color.CheckByte(Int32 value, String name)
       at System.Drawing.Color.FromArgb(Int32 alpha, Int32 red, Int32 green, Int32 blue)
       at Xceed.Chart.Core.Palette.SmoothColorForValue(Double dValue, Int32 nIndex)
       at Xceed.Chart.Core.ZoneTriangle.AddColorVertex(SurfacePoint p)
       at Xceed.Chart.Core.ZoneTriangle.IntersectEdgeSmooth(SurfacePoint p1, SurfacePoint p2)
       at Xceed.Chart.Core.ZoneTriangle.RenderSmoothColorPolygon()
       at Xceed.Chart.Core.SurfaceSeriesBase.RenderZoneFilledTriangle()
       at Xceed.Chart.Core.MeshSurfaceSeries.RenderZoneFilling()
       at Xceed.Chart.Core.SurfaceSeriesBase.RenderPolygons(SceneGL scene)
       at Xceed.Chart.Core.SurfaceSeriesBase.Render(SceneGL scene, RenderPass rm)
       at Xceed.Chart.Core.SeriesCollection.Render(SceneGL scene, RenderPass rp)
       at Xceed.Chart.Core.Chart.MakeRenderPass(SceneGL scene, RenderPass rp)
       at Xceed.Chart.Core.Chart.Render(SceneGL scene)
       at Xceed.Chart.Core.SceneGL.OnRender()
       at Xceed.Chart.GraphicsGL.GLDevice.InnerRender()
       at Xceed.Chart.GraphicsGL.GLDevice.Render()
       at Xceed.Chart.GraphicsGL.GLBitmapRenderSurface.OnPaint(Object sender, PaintEventArgs e)
       at System.Windows.Forms.Control.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.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

    Imported from legacy forums. Posted by cokert (had 972 views)

    User (Old forums)
    Member
    Post count: 23064

    I made a change yesterday evening and the app ran through the night.  I ended up overriding the OnPaint method of the chart control (I had already created a class that inherited from the Xceed chart control) and wrapping the call to base.OnPaint inside a lock statement.  For all other chart manipulation in the class, I lock the same variable so even if chart manipulation occurs on other threads, it will be serialized.  I’ll report back if any other problems arise in case someone happens across this thread, but it looks to be working for now.

    Imported from legacy forums. Posted by cokert (had 2786 views)

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.