Parameter is not valid with Bitmap

4 posts, 0 answers
  1. Sandra
    Sandra avatar
    4 posts
    Member since:
    Apr 2018

    Posted 08 Feb Link to this post

    Hi

    I use telerik 2018.1.220.40 and now I have problem with error:

    System.ArgumentException: Parameter is not valid.
       at System.Drawing.Bitmap..ctor(Int32 width, Int32 height, PixelFormat format)
       at System.Drawing.Bitmap..ctor(Int32 width, Int32 height)
       at Telerik.WinControls.UI.ThemedFormBehavior.PaintTitleBar(Graphics hDCGraphics)
       at Telerik.WinControls.UI.ThemedFormBehavior.OnNCPaint(Graphics graphics)
       at Telerik.WinControls.UI.ThemedFormBehavior.OnWMNCPaint(Message& m)
       at Telerik.WinControls.UI.ThemedFormBehavior.HandleWndProc(Message& m)
       at Telerik.WinControls.UI.RadFormBehavior.HandleWndProc(Message& m)
       at Telerik.WinControls.UI.RadFormControlBase.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)

     

    This error occurs several times per day. We need to restart application after this error because it doesn't respond. I don't create any Bitmap manual in my code and when I look at the error's path I think it's good to ask you about the reason of this error. Is it problem with Telerik or should I look for problem in my code?

  2. Dimitar
    Admin
    Dimitar avatar
    2714 posts

    Posted 08 Feb Link to this post

    Hi Sandra,

    I have checked for similar issues and I only found an old thread where the same exception occurred. In this case, Windows XP was used but we were unable to determine the exact reason for the exception. What I can suggest is try disabling the animations by adding this in the main form constructor:
    ThemeResolutionService.EnableAnimations = false;

    If you are indeed using Windows XP please make sure that you are not setting a transparent image for the form icon.

    If you have a clear way for reproducing I would recommend opening a support ticket and attaching a project that reproduces this. This will allow us to properly investigate the case and provide you with a solution. 

    I hope this will be useful. 

    Regards,
    Dimitar
    Progress Telerik
    Get quickly onboard and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  3. Sandra
    Sandra avatar
    4 posts
    Member since:
    Apr 2018

    Posted 26 Feb in reply to Dimitar Link to this post

    Hi,

    We put ThemeResolutionService.EnableAnimations = false; and we thought that it works and I was ready to say thank you, but after two weeks this situation occured again. It occurs only on one computer but all computers on production have operating system Windows 7 Embedded.But yesterday we saw also other error connected with OutOfMemory:

     

    System.OutOfMemoryException: Out of memory.
       at System.Drawing.Graphics.CheckErrorStatus(Int32 status)
       at System.Drawing.Graphics.DrawImage(Image image, Int32 x, Int32 y, Int32 width, Int32 height)
       at System.Drawing.Graphics.DrawImage(Image image, Rectangle rect)
       at Telerik.WinControls.UI.ThemedFormBehavior.PaintTitleBar(Graphics hDCGraphics)
       at Telerik.WinControls.UI.ThemedFormBehavior.OnNCPaint(Graphics graphics)
       at Telerik.WinControls.UI.ThemedFormBehavior.OnWMNCPaint(Message& m)
       at Telerik.WinControls.UI.ThemedFormBehavior.HandleWndProc(Message& m)
       at Telerik.WinControls.UI.RadFormBehavior.HandleWndProc(Message& m)
       at Telerik.WinControls.UI.RadFormControlBase.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)
    2019-02-25 06:49:18,417 [1] - Thread exception
    System.ArgumentException: Parameter is not valid.
       at System.Drawing.Bitmap..ctor(Int32 width, Int32 height, PixelFormat format)
       at System.Drawing.Bitmap..ctor(Int32 width, Int32 height)
       at Telerik.WinControls.UI.ThemedFormBehavior.PaintTitleBar(Graphics hDCGraphics)
       at Telerik.WinControls.UI.ThemedFormBehavior.OnNCPaint(Graphics graphics)
       at Telerik.WinControls.UI.ThemedFormBehavior.OnWMNCPaint(Message& m)
       at Telerik.WinControls.UI.ThemedFormBehavior.HandleWndProc(Message& m)
       at Telerik.WinControls.UI.RadFormBehavior.HandleWndProc(Message& m)
       at Telerik.WinControls.UI.RadFormControlBase.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)
    2019-02-25 06:49:29,826 [1] ERROR - Thread exception
    System.ArgumentException: Parameter is not valid.
       at System.Drawing.Bitmap..ctor(Int32 width, Int32 height, PixelFormat format)
       at System.Drawing.Bitmap..ctor(Int32 width, Int32 height)
       at Telerik.WinControls.UI.ThemedFormBehavior.PaintTitleBar(Graphics hDCGraphics)
       at Telerik.WinControls.UI.ThemedFormBehavior.OnNCPaint(Graphics graphics)
       at Telerik.WinControls.UI.ThemedFormBehavior.OnWMNCPaint(Message& m)
       at Telerik.WinControls.UI.ThemedFormBehavior.HandleWndProc(Message& m)
       at Telerik.WinControls.UI.RadFormBehavior.HandleWndProc(Message& m)
       at Telerik.WinControls.UI.RadFormControlBase.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)

     

    It is hard to reproduce this error because it repeats randomly. But is this error connecting with OutOfMemory helpful?

     

  4. Dimitar
    Admin
    Dimitar avatar
    2714 posts

    Posted 26 Feb Link to this post

    Hi Sandra,

    The stack trace looks the same so the issues might be connected. However without a clear way to reproduce that I cannot say what is causing it. Please try to isolate the case where this occurs and open a support ticket for this. 

    Please note that the stack trace leads to the title bar of the form. Have you applied any customizations to the title bar? If yes you can try removing them and see if the issue still occurs.

    Thank you for your understanding.

    Regards,
    Dimitar
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top