Additionally, if you are taking advantage of inheritance and the variable is declared in a parent package, you might need to set the data flow as While your variable is assigned, perhaps the way you are populating the variable is causing the issue. perhaps you have a config entry that is not populated or the result set of a query. If you provide more detail that would be helpful I'm unable to reproduce this.
The only scenario where I get that error is when the variable is unset.
You can use the updated variable in a separate data flow. The Advanced Editor dialog box reflects the properties that can be set programmatically.
These enable you to work with reduced data samples, monitor row counts, use data viewers, configure error-handling and monitoring package execution.There’s a little gotcha here – whilst the tab for ‘Input Columns” is active, if you try to select any columns it will return an error and not allow you to continue.It is worth noting that the variable is only updated once rows of data have passed through the data flow – i’ve demonstrated this in the sample package by adding the variable to a column in a Derived Column – it returns zero all the way through, so you cannot use the Row Count as a row number generator.Also set Delay Valdiations to True, wherever applicable. I just had this exact problem (error message regarding a null variable).I had added a rowcount task, which I wasn't happy with & then deleted it.