Error "This method or property cannot be called on Null values" when trying to add Attribute

Article:TECH28241  |  Created: 2007-04-02  |  Updated: 2007-05-24  |  Article URL http://www.symantec.com/docs/TECH28241
Article Type
Technical Solution

Issue



When clicking the Add New Attribute button in a data class edit screen, the following error is returned:

Module: AltirisNativeHelper.dll
Source: global.asax
Description: Unhandled exception.  Type=System.Data.SqlTypes.SqlNullValueException Msg=Data is Null. This method or property cannot be called on Null values.
StackTrace=
   at System.Data.SqlTypes.SqlString.get_Value()
   at System.Data.SqlClient.SqlDataReader.GetString(Int32 i)
   at Altiris.Resource.Web.ResourceTypeManagement.DataClassAttributeConfig.LoadResourceTypeList()
   at Altiris.Resource.Web.ResourceTypeManagement.DataClassAttributeConfig.Page_Load(Object sender, EventArgs e)
   at System.Web.UI.Control.OnLoad(EventArgs e)
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Page.ProcessRequestMain()


Environment



Notification Server 6.0.6074
Asset 6.2

Cause



This can be caused by uninstalling Site Monitor Solution and subsequently running an older version, prior to version 4, of the SQL cleanup script found in article 26146. Site Monitor Solution leaves remnants in various tables in the Altiris database upon removal. Specifically in this case, the error is caused by the fnLocalizeStringByGuid function returning a null record which causes the /Altiris/Resource/ResourceTypeManagement/DataClassAttributeConfig.aspx page to crash with the error noted in the Problem section of this article.

This was due to the Network Service Resource still being defined in the ResourceType table, but not having the String table record needed for the fnLocalizeStringByGuid function.

Below is a list of the tables that the GUID, 567067C0-853B-43C6-8326-24C175725668, had been left in and the column name with the matching GUID:

ItemPresentation     BaseGuid
ItemPresentation     Guid
ItemReplication     ItemGuid
ItemResource      ResourceTypeGuid
ResourceTab      ResourceTypeGuid
ResourceType      Guid
ResourceTypeDataClass     ResourceTypeGuid
ResourceTypeDataClassReplication   ResourceTypeGuid
ResourceTypeHierarchy     BaseResourceTypeGuid
ResourceTypeHierarchy     ResourceTypeGuid

Steps to reproduce:
  1. Install Gauge Subsystem.
  2. Install Site Monitor Solution 6.0.
  3. Uninstall Site Monitor Solution 6.0 from Control Panel > Add or Remove Programs.
  4. Uninstall Gauge Subsystem from Control PanelAdd or Remove Programs.
  5. Run a version of the cleanup script, prior to version 4, from article 26146.
  6. Try to add an attribute to a data class; observe the error message as shown in the Problem section of this article.

Solution



Run version 4, or higher, of the SQL cleanup script found in article 26146.



Legacy ID



34067


Article URL http://www.symantec.com/docs/TECH28241


Terms of use for this information are found in Legal Notices