NullReferenceException Error When You Use Combined FlagsAttribute Enums in ASP.NET Controls (825082)



The information in this article applies to:

  • Microsoft .NET Framework 1.1

SYMPTOMS

In the Microsoft .NET Framework, you can use enum types for flags by using the FlagsAttribute class. If you use the enum type in ASP.NET controls, and the Flags property is set to a simple tag (for example, Flags="Flag1"), the application works as expected. However, if the Flags property is set to a bit combination, as in the following example, the result is a NullReferenceException error:
<i:SimpleControl runat="server" id="SimpleControl1" Flags="Flag1, Flag2" />

WORKAROUND

If you do not have many flag combinations, you can use the following enum declaration to work around the problem:
public enum MyFlags
    {
        Flag1 = 1,
        Flag2 = 2,
        Flag1And2 = Flag1|Flag2,
        Flag3 = 4
    }

RESOLUTION

A supported hotfix is now available from Microsoft, but it is only intended to correct the problem that this article describes. Apply it only to systems that are experiencing this specific problem.

To resolve this problem, 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
   ------------------------------------------------------------------------
   01-Aug-2003  19:47  1.1.4322.930    253,952  Aspnet_isapi.dll
   01-Aug-2003  19:47  1.1.4322.930     20,480  Aspnet_regiis.exe
   01-Aug-2003  19:47  1.1.4322.930     32,768  Aspnet_wp.exe
   16-May-2003  01:49                   33,522  Installpersistsqlstate.sql
   16-May-2003  01:49                   34,150  Installsqlstate.sql
   01-Aug-2003  19:38  1.1.4322.930     94,208  Perfcounter.dll
   01-Aug-2003  19:55  1.1.4322.930  1,216,512  System.dll
   01-Aug-2003  19:38  1.1.4322.930    323,584  System.runtime.remoting.dll
   01-Aug-2003  19:56  1.1.4322.930  1,253,376  System.web.dll
   01-Aug-2003  19:49  1.1.4322.930    819,200  System.web.mobile.dll
   01-Aug-2003  19:49  1.1.4322.930    569,344  System.web.services.dll
   01-Aug-2003  19:56  1.1.4322.930  1,335,296  System.xml.dll
   01-Aug-2003  19:42                   14,472  Webuivalidation.js

STATUS

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

Modification Type:MinorLast Reviewed:10/25/2005
Keywords:kbHotfixServer kbQFE kbNetFrame110sp1fix kbNetFrame110preSP1fix kbQFE kbfix kbbug KB825082 kbAudDeveloper