Microsoft KB Archive/813967

= FIX: ImageList Class Leaks GDI Objects =

Article ID: 813967

Article Last Modified on 10/11/2005

-

APPLIES TO


 * Microsoft .NET Framework 1.0 Service Pack 2

-



SYMPTOMS
When you use an ImageList class in a Microsoft Windows Forms application, the calling process will leak some GDI objects for each new instance of the ImageList class. When the number of GDI objects runs out, any later operation that requires an allocation of a new GDI object fails.

The type of failure depends on the type of operation that is requested. Typically, an OutOfMemoryException error occurs. You can view the number of GDI objects that a process uses in Windows Task Manager. To do this, click Select columns on the View menu, and then click to select the check box for GDI Objects to add the GDI objects count to the default view.



RESOLUTION
A supported fix is now available from Microsoft, but it is only intended to correct the problem that is described in this article. Apply it only to computers that are experiencing this specific problem. This fix may receive additional testing. Therefore, if you are not severely affected by this problem, Microsoft recommends that you wait for the next .NET Framework service pack that contains this fix.

To resolve this problem immediately, contact Microsoft Product Support Services to obtain the fix. For a complete list of Microsoft Product Support Services phone numbers and information about support costs, visit the following Microsoft Web site:

http://support.microsoft.com/contactus/?ws=support

NOTE: In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The typical support costs will apply to additional support questions and issues that do not qualify for the specific update in question.

The English version of this fix has the file attributes (or later) that are listed in the following table. The dates and times for these files are listed in coordinated universal time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.   Date         Time   Version       Size       File name -  22-Feb-2003  19:28  1.0.3705.409  1,179,648  System.data.dll 22-Feb-2003 19:31  1.0.3705.409  1,695,744  System.design.dll 22-Feb-2003 19:30  1.0.3705.409  1,990,656  System.windows.forms.dll 22-Feb-2003 11:45                   16,720  System.windows.forms.ldo 22-Feb-2003 11:40  1.0.3705.409     57,344  System.windows.forms.tlb



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.



MORE INFORMATION
The following is an example of an exception that the .NET Framework throws when it tries to create a new ImageList object after the calling process has run out of GDI objects: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: Failed to load ImageList. at System.Windows.Forms.ImageListStreamer..ctor(SerializationInfo info, StreamingContext context)

--- End of inner exception stack trace --- at System.Reflection.RuntimeConstructorInfo.SerializationInvoke(Object target, SerializationInfo info,     StreamingContext context) at System.Runtime.Serialization.ObjectManager.CompleteISerializableObject(Object obj, SerializationInfo     info, StreamingContext context) at System.Runtime.Serialization.ObjectManager.FixupSpecialObject(ObjectHolder holder) at System.Runtime.Serialization.ObjectManager.DoFixups at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler,      __BinaryParser serParser, Boolean fCheck, IMethodCallMessage methodCallMessage) at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream,     HeaderHandler handler, Boolean fCheck, IMethodCallMessage methodCallMessage) at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream,     HeaderHandler handler) at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream) at System.Resources.ResourceReader.LoadObject(Int32 pos) at System.Resources.RuntimeResourceSet.GetObject(String key, Boolean ignoreCase) at System.Resources.ResourceManager.GetObject(String name, CultureInfo culture) at System.Resources.ResourceManager.GetObject(String name) at WindowsApplication1.Form2.InitializeComponent at WindowsApplication1.Form2..ctor at WindowsApplication1.Form1.button1_Click(Object sender, EventArgs e)

Keywords: kbbug kbfix kbqfe kbnetframe100presp3fix kbhotfixserver KB813967

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.