I am using compare-object to compare a here-string (reference object) to the contents of a file via "get-content" (difference object). The side indicators say that the first line in each is different, even though they look the same and I manually removed all white spaces from both sources. The file content is created with the here-string itself, so I am at a loss as to why it thinks the first line is different:
$GitIgnorePath = 'file'
$NewGitIgnore = @"
# Local .terraform directories
**/.terraform/*
123
"@
Set-Content -path $GitIgnorePath -value $NewGitIgnore
$CurrentGitIgnore = Get-Content -Path $GitIgnorePath -Raw
Compare-Object $NewGitIgnore $CurrentGitIgnore
InputObject SideIndicator
-----------
# Local .terraform directories... =>
# Local .terraform directories... <=
If I change '123' in $NewGitIgnore to "1234" and run compare-object again, I get the same results.