PowerShell string concatenation behaves differently inside vs. outside a function
I think the problem is in the way you're passing arguments to your function. See if this works better:
Test-Diff $sRepoGUID $sChangeset1 $sChangeset2
Short Answer: Test-Diff $sRepoGUID $sChangeset1 $sChangeset2
is the correct syntax to pass three parameters.
Long answer: ($sRepoGUID, $sChangeset1, $sChangeset2)
is an array of three elements. So, when you call Test-Diff ($sRepoGUID, $sChangeset1, $sChangeset2)
, you're actually calling Test-Diff
with one parameter that happens to be an array, rather than the three parameters you meant to pass. So, in the expression
$g_backendUrl + "repo/" + $sRepoGUID + "/diff/" + $sChangeset1 + ":" + $sChangeset2 + "?format=json&ignorews=True&maxsize=100000&timeout=10"
$sRepoGUID
is an array, and will be rendered into the string as 34CAA433-1600-469E-95B7-35CA0A0FECF4 9d21e91b213a07e56d16a9b8fe519ad570d5c46e 68269169cdd0b803d0e419752ce9cae627e589e5
, while $sChangeset1
and $sChangeset2
are both null, and will not contribute any text to the resulting string.