SetVariableDefaultValue allows to set arbitrary values

Questions regarding the use of the .NET SDK 2.0 for Server or Client development or integration into customer products ...

Moderator: uasdknet

Post Reply
jramirez-jh
Hero Member
Hero Member
Posts: 21
Joined: 14 Jun 2021, 23:39

SetVariableDefaultValue allows to set arbitrary values

Post by jramirez-jh »

When using SetVariableDefaultValue I'm able to save any data type into another one without having any warning or error, for example: saving a string in a bool variable or a string inside an integer variable.

Just wanted to know why is this allowed?

User avatar
Support Team
Hero Member
Hero Member
Posts: 3064
Joined: 18 Mar 2011, 15:09

Re: SetVariableDefaultValue allows to set arbitrary values

Post by Support Team »

Hello,

The method SetVariableDefaultValue does not do any DataType checks for performance reasons. The method can only be called by the server application and we do not want to cause the overhead on checking the DataType, ValueRank because we expect the server application to call the methods in a correct way.
When a client is writing a value, then the checks are done by the sdk, because we cannot expect that all clients are implemented correctly.
Best regards
Unified Automation Support Team

Post Reply