ParamArray parameter has been changed from ByRef to ByVal
In Visual Basic, the ParamArray keyword could be used to specify an arbitrary number of parameters for a declaration, sub, or function. ParamArrays were always passed by reference (ByRef). In Visual Basic .NET, ParamArrays are always passed by value; the ParamArray keyword must be preceded by the ByVal keyword.
When a parameter is passed by value, a copy of the variable is passed; when passed by reference, a pointer to the variable is passed. When passing by value, it is possible that the value of the variable may have changed and that the copy is out of date.
During upgrade, ParamArray parameters are modified as follows:
' Visual Basic 6.0 Sub HasParameters(ParamArray X()) ' After upgrade to Visual Basic .NET ' UPGRADE_WARNING: ParamArray X was changed from ByRef to ByVal. Sub HasParameters(ParamArray ByVal X() As Object)
What to do next
- Review your code to make sure that the variables being passed as parameters are not being changed between the time that they are set and the time that they are used in a procedure. If necessary, modify your code so that the procedure executes before the variables are modified.