Forum Discussion
Philip_Baird
11 years agoCommunity Expert
Hi Julie, I reproduced the problem you are having, it appears Test Complete is not passing a byte to the SetValue() method.
I would expect the following to work as the code is doing an explicit cast to Byte using System.Convert.ToByte (ToByte_13 is the overload that accepts a String paramter).
var byteType = dotNET.System.Type.GetType("System.Byte");
var binaryData = dotNET.System.Array.CreateInstance(byteType, maxLength);
binaryData.SetValue( dotNET.System.Convert.ToByte_13( "1" ), 0 );
However, this gives the same type exception.
If you change dotNET.System.Type.GetType("System.Byte"); to dotNET.System.Type.GetType("System.Int32"); it works nicely.
Perhaps someone from SmartBear can provide further details.
Regards,
Phil Baird
I would expect the following to work as the code is doing an explicit cast to Byte using System.Convert.ToByte (ToByte_13 is the overload that accepts a String paramter).
var maxLength = 256;
var byteType = dotNET.System.Type.GetType("System.Byte");
var binaryData = dotNET.System.Array.CreateInstance(byteType, maxLength);
binaryData.SetValue( dotNET.System.Convert.ToByte_13( "1" ), 0 );
However, this gives the same type exception.
If you change dotNET.System.Type.GetType("System.Byte"); to dotNET.System.Type.GetType("System.Int32"); it works nicely.
Perhaps someone from SmartBear can provide further details.
Regards,
Phil Baird
Related Content
- 3 years ago
- 4 years ago
- 5 years ago
Recent Discussions
- 3 days ago
- 3 days ago
- 7 days ago