I modified a workflow in TFS template, in the head of this workflow I initialized an array of string named
NextChainBuildDefinition. After a few steps, I tried to check if this array is null or not.
I did this way:
After this I see error:
Exception Message: Value cannot be null. Therefore
NextChainBuildDefinition is null, and in that step it throws an exception.
How do I check if this string array is null?
You need to check if the array itself is null or empty - your current code is checking if the string conversion of the number of elements in the array is empty - this isn't going to work at all.
Instead, you need to do a two step check - both for if the array itself is null, and if not, if it's empty:
If (NextChainBuildDefinition IsNot Nothing AndAlso NextChainBuildDefinition.Count > 0) Then 'Array has contents Else 'Array is null or empty End if
Why not just test ubound() of the array? old question, i know.