Framework Error: Invalid Parameter used.

D

Don Stewart

I receive the error below at least 10 times a day
from some of the many thousands of customer
machines via an automatic error reporting
module we have.

It does not occur everytime on any particular Form.
But it does happen ocaisonally on nearly every Form
and causes a horrible RED X to be painted in it's place.

You'll notice the stacktrace does NOT
go through any of my code at all.
The OnPaint event is NOT being handled by me.
It is ALL 100% framework code.

/////////////////////////////////////////////////////////////////////////////////////////
///////////// BEGIN ERROR INFORMATION ///////////////////
/////////////////////////////////////////////////////////////////////////////////////////
CLR Version: 1.1.4322.2032
Process Memory: 31469568
Error Message: Invalid parameter used.
Method: IntPtr GetHdc()
STACK TRACE:
at System.Drawing.Graphics.GetHdc()
at System.Windows.Forms.ImageList.GetBitmap(Int32 index)
at System.Windows.Forms.ImageCollection.get_Item(Int32 index)
at System.Windows.Forms.ButtonBase.get_Image()
at System.Windows.Forms.ButtonBase.CommonLayout()
at System.Windows.Forms.ButtonBase.PaintFlatLayout(PaintEventArgs e,
Boolean up, Boolean check)
at System.Windows.Forms.ButtonBase.PaintFlatUp(PaintEventArgs e,
CheckState state)
at System.Windows.Forms.ButtonBase.PaintFlat(PaintEventArgs pevent)
at System.Windows.Forms.ButtonBase.PaintControl(PaintEventArgs pevent)
at System.Windows.Forms.ButtonBase.OnPaint(PaintEventArgs pevent)
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.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)
/////////////////////////////////////////////////////////////////////////////////////////
/////////////// END ERROR INFORMATION ////////////////////
/////////////////////////////////////////////////////////////////////////////////////////

After looking on the web for similar GDI Errors,
I think that using anything other than a Bitmap
in an imagelist may be the source of some problems.
We do have jpegs and icon files mixed in on some
Imagelists ourselves. - any comments?

Also, there is a huge amount of Physical RAM installed
on these systems. But I do notice that these errors
seem to happen on systems that have been running
our program for many hours. Is there some sort of
internal GDI memory or stacks limits that I could check on?

Does anyone have any suggestion on where
to start looking or troubleshooting?

(e-mail address removed)
Systems Architect
Encite Inc.
 
P

Peter Huang [MSFT]

Hi

I think you may try to observe the GDI Object count via the TaskManager, we
need to add a column(GDI Object).
You may try to watch the number of GDI objects when the app starts and then
watch how GDI objects increases and decreases to find a pattern.
Or use the GDIObj utility from http://www.fengyuan.com/download.html and
watch his app on different GDI objects

Windows have GDI Object limit based on different OS, you may try to take a
look at link below.
By default, it is 9999 per process.
http://groups.google.co.jp/groups?hl=zh-CN&lr=&threadm=DLfQju#EFHA.2916@
TK2MSFTNGXA01.phx.gbl&rnum=1&prev=/groups%3Fq%3Dgdi%2520limit%2520%2522v-ray
gon%2522%26hl%3Dzh-CN%26lr%3D%26sa%3DN%26tab%3Dwg

Also I think it would better contact MSPSS to do dump analysis and code
review to see what is the problem.
http://support.microsoft.com

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top