Write service fix: write a value variable with simple or enum type always results in BadTypeMismatch
Description
When a write is requested on a Variable Value for which DataType is a simple DataType (e.g. UtcTime is a simple DataType which is encoded as a DateTime) or is an enumeration type. The request is always refused with BadTypeMismatch error status whatever is the encoded type in the write request.
Analysis
The typechecking algorithm is only checking that the encoded value in the write request (Variant type or Extension Object type) is a subtype of the Variable DataType. In case of a Variable DataType which is a simple DataType and enumeration type the typechecking is too restrictive.
- Simple DataType is compatible with the Built-in type for which it is the subtype
- Enumeration type (and subtypes) is always encoded as an Int32 value
Fix
When typechecking based on subtype algorithm only fails, the simple data type and enumeration type cases shall be evaluated.