FIX: You receive a NullReferenceException exception when you manually set a Control ID in the .NET Framework 1.1 (875434)



The information in this article applies to:

  • Microsoft .NET Framework 1.1

SYMPTOMS

In Microsoft .NET Framework 1.1, if you manually set the Control ID of an owner-drawn Windows Forms control, you may receive a NullReferenceException exception when you run the code. The call stack that appears in the exception dialog box may contain the following entries:
Exception:System.NullReferenceException: Object reference not set to an instance of an object.
at System.Windows.Forms.NativeWindow.GetHandleFromID(Int16 id)
at System.Windows.Forms.Control.WmOwnerDraw(Message& m)
at System.Windows.Forms.Control.WmMeasureItem(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.AxHost.WndProc(Message& m)
This behavior does not occur in the Microsoft .NET Framework 1.0.

CAUSE

This problem occurs because manual setting of Control IDs was not intended to be a supported scenario. A code change in the Microsoft .NET Framework 1.1 created a case where this behavior can cause a crash.

RESOLUTION

A supported hotfix is now available from Microsoft, but it is only intended to correct the problem that is described in this article. Only apply it to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next .NET Framework 1.1 Service Pack that contains this hotfix.

To resolve this problem immediately, contact Microsoft Product Support Services to obtain the hotfix. For a complete list of Microsoft Product Support Services telephone numbers and information about support costs, visit the following Microsoft Web site: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 usual 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 hotfix 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
   ---------------------------------------------------------------------------
   19-July-2004  17:30:30  1.1.4322.1063  1,703,936   System.Design.dll
   19-July-2004  17:32:30  1.1.4322.1063    466,944   System.Drawing.dll
   19-July-2004  17:22:32  1.1.4322.1063  2,043,904   System.Windows.Forms.dll

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

Modification Type:MajorLast Reviewed:4/7/2006
Keywords:kbQFE KBHotfixServer kbBug kbfix KB875434 kbAudDeveloper