System.ArgumentNullException

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tom C

    System.ArgumentNullException

    This error occurs erratically at startup. It appears to be all native
    code. Does anyone have any idea what the heck could be cauing this?

    System.Argument NullException: Value cannot be null.
    Parameter name: pen
    at System.Drawing. Graphics.DrawLi ne(Pen pen, Int32 x1, Int32 y1,
    Int32 x2, Int32 y2)
    at dh.OnPaint(Pain tEventArgs e)
    at
    System.Windows. Forms.Control.P aintWithErrorHa ndling(PaintEve ntArgs e,
    Int16 layer, Boolean disposeEventArg s)
    at System.Windows. Forms.Control.O nPrint(PaintEve ntArgs e)
    at System.Windows. Forms.Control.W mPrintClient(Me ssage& m)
    at System.Windows. Forms.Control.W ndProc(Message& m)
    at System.Windows. Forms.Scrollabl eControl.WndPro c(Message& m)
    at dh.WndProc(Mess age& m)
    at
    System.Windows. Forms.Control.C ontrolNativeWin dow.OnMessage(M essage& m)
    at
    System.Windows. Forms.Control.C ontrolNativeWin dow.WndProc(Mes sage& m)
    at System.Windows. Forms.NativeWin dow.Callback(In tPtr hWnd, Int32
    msg, IntPtr wparam, IntPtr lparam)
  • Brian Gideon

    #2
    Re: System.Argument NullException

    On Mar 24, 9:09 am, Tom C <tom_cla...@asd software.comwro te:
    This error occurs erratically at startup. It appears to be all native
    code. Does anyone have any idea what the heck could be cauing this?
    >
    System.Argument NullException: Value cannot be null.
    Parameter name: pen
       at System.Drawing. Graphics.DrawLi ne(Pen pen, Int32 x1, Int32 y1,
    Int32 x2, Int32 y2)
       at dh.OnPaint(Pain tEventArgs e)
       at
    System.Windows. Forms.Control.P aintWithErrorHa ndling(PaintEve ntArgs e,
    Int16 layer, Boolean disposeEventArg s)
       at System.Windows. Forms.Control.O nPrint(PaintEve ntArgs e)
       at System.Windows. Forms.Control.W mPrintClient(Me ssage& m)
       at System.Windows. Forms.Control.W ndProc(Message& m)
       at System.Windows. Forms.Scrollabl eControl.WndPro c(Message& m)
       at dh.WndProc(Mess age& m)
       at
    System.Windows. Forms.Control.C ontrolNativeWin dow.OnMessage(M essage& m)
       at
    System.Windows. Forms.Control.C ontrolNativeWin dow.WndProc(Mes sage& m)
       at System.Windows. Forms.NativeWin dow.Callback(In tPtr hWnd, Int32
    msg, IntPtr wparam, IntPtr lparam)
    I have seen an ArgumentNullExc eption generated inside the control
    painting routines when threading is used incorrectly with windows
    applications. What happens is another thread modifies a control which
    causes it to enter a half-baked state the moment it simultantenousl y
    receives say the WM_PAINT message. Remember, only the UI thread can
    ever access a windows control or form. I'm not saying that's what's
    happening here, but it is one thing to consider.

    Comment

    • Tom C

      #3
      Re: System.Argument NullException

      On Mar 24, 10:04 am, Brian Gideon <briangid...@ya hoo.comwrote:
      On Mar 24, 9:09 am, Tom C <tom_cla...@asd software.comwro te:
      >
      >
      >
      >
      >
      This error occurs erratically at startup. It appears to be all native
      code. Does anyone have any idea what the heck could be cauing this?
      >
      System.Argument NullException: Value cannot be null.
      Parameter name: pen
         at System.Drawing. Graphics.DrawLi ne(Pen pen, Int32 x1, Int32 y1,
      Int32 x2, Int32 y2)
         at dh.OnPaint(Pain tEventArgs e)
         at
      System.Windows. Forms.Control.P aintWithErrorHa ndling(PaintEve ntArgs e,
      Int16 layer, Boolean disposeEventArg s)
         at System.Windows. Forms.Control.O nPrint(PaintEve ntArgs e)
         at System.Windows. Forms.Control.W mPrintClient(Me ssage& m)
         at System.Windows. Forms.Control.W ndProc(Message& m)
         at System.Windows. Forms.Scrollabl eControl.WndPro c(Message& m)
         at dh.WndProc(Mess age& m)
         at
      System.Windows. Forms.Control.C ontrolNativeWin dow.OnMessage(M essage& m)
         at
      System.Windows. Forms.Control.C ontrolNativeWin dow.WndProc(Mes sage& m)
         at System.Windows. Forms.NativeWin dow.Callback(In tPtr hWnd, Int32
      msg, IntPtr wparam, IntPtr lparam)
      >
      I have seen an ArgumentNullExc eption generated inside the control
      painting routines when threading is used incorrectly with windows
      applications.  What happens is another thread modifies a control which
      causes it to enter a half-baked state the moment it simultantenousl y
      receives say the WM_PAINT message.  Remember, only the UI thread can
      ever access a windows control or form.  I'm not saying that's what's
      happening here, but it is one thing to consider.- Hide quoted text -
      >
      - Show quoted text -
      Thanks for the input Brian. We really use threads rather sparingly so
      we took a look and really don't SEE anything readily obvious. Does
      anyone have any ides on how we might be able to capture more
      information about the error when it occurs as we seem to be at a
      disadvantage as it appears to all be native code.

      Comment

      Working...