SystemInvalidCastException occurs when using SByte together with int
This issue may be caused to SByte not meeting the requirements for CLS compliance and causes issues when casting from int.
Possible solution:
- Replace
SBytewithintto prevent data type casting.