Best Practice: Data type mismatched: Expression types do not correspond to their values


What does this best practice check for?

When building management packs, it is often necessary to build custom modules. There custom module will have certain configurable parameters that are necessary to get the correct data or end-result from the module. As a best practice, configurable parameters should have data types that correspond to their values. For example, a Boolean typed parameter should have a value of either true or false.

Why is it important to follow this best practice? What is the impact of not following this best practice?

The data type of a value can affect how it is interpreted in a module, and having the wrong type can drastically change the intended effect. For example, when doing a comparison of two values, comparing two values as strings that were intended to be interpreted as integers could produce the wrong result.

How do I fix this?

Using the Authoring Console:

1.        For all modules, open the Properties dialog. In the Configuration Parameters tab, ensure that the data type for each parameter is the intended type.

Using XML:

< DataSourceModuleType ID = " Microsoft.Windows.Server.2008.CPUUtilization.ModuleType" Accessibility =" Internal" >

       < Configuration >

          < xsd:element name = " IntervalSeconds" type =" xsd:int" />

          < xsd:element name = " TargetComputerName" type =" xsd:string" />

          < xsd:element name = " NumSamples" type =" xsd:int" />

          < xsd:element name = " CounterName" type =" xsd:string" />

          < xsd:element name = " ObjectName" type =" xsd:string" />

          < xsd:element name = " InstanceName" type =" xsd:string" />

       </ Configuration >


     </ DataSourceModuleType >