This is a migrated thread and some comments may be shown as answers.

Parameter is not valid with Bitmap

3 Answers 2339 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Sandra
Top achievements
Rank 1
Sandra asked on 08 Feb 2019, 10:01 AM

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?

3 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 08 Feb 2019, 11:19 AM
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.
0
Sandra
Top achievements
Rank 1
answered on 26 Feb 2019, 07:29 AM

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?

 

0
Dimitar
Telerik team
answered on 26 Feb 2019, 09:42 AM
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.
Tags
General Discussions
Asked by
Sandra
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Sandra
Top achievements
Rank 1
Share this question
or