-
Notifications
You must be signed in to change notification settings - Fork 391
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot determine line endings as the text probably contain mixed line endings. #2074
Comments
Full script: $VMs = @("server1", "server2") Function to log messages to a filefunction Log-Message { Log script startLog-Message "Script execution started." Establish the sessions and execute the SQL command on each server in parallelforeach ($VM in $VMs) {
GO
} Wait for all jobs to finish$Jobs | ForEach-Object {
} If there were any connection errors, output them and logif ($Connection.Count -gt 0) { Log script completionLog-Message "Script execution completed." |
Before submitting a bug report:
Steps to reproduce
$scriptContent = Get-Content -Path "C:\temp\myscript_posh_v2.ps1" -Raw
Invoke-Formatter -ScriptDefinition $scriptContent | Set-Content -Path "C:\temp\myscript_posh_v2.ps1"
$error[0] | select *
Expected behavior
Actual behavior
PSMessageDetails :
Exception : System.ArgumentException: Cannot determine line endings as the text probably contain mixed line endings.
Parameter name: text
at Microsoft.Windows.PowerShell.ScriptAnalyzer.EditableText.GetNumNewLineCharacters(String text, String[]& lines)
at Microsoft.Windows.PowerShell.ScriptAnalyzer.EditableText.GetNewLineCharacters(String text, String[]& lines)
at Microsoft.Windows.PowerShell.ScriptAnalyzer.EditableText..ctor(String text)
at Microsoft.Windows.PowerShell.ScriptAnalyzer.Formatter.Format[TCmdlet](String scriptDefinition, Settings settings, Range range, TCmdlet cmdlet)
at Microsoft.Windows.PowerShell.ScriptAnalyzer.Commands.InvokeFormatterCommand.ProcessRecord()
at System.Management.Automation.CommandProcessor.ProcessRecord()
TargetObject :
CategoryInfo : NotSpecified: (:) [Invoke-Formatter], ArgumentException
FullyQualifiedErrorId : System.ArgumentException,Microsoft.Windows.PowerShell.ScriptAnalyzer.Commands.InvokeFormatterCommand
ErrorDetails :
InvocationInfo : System.Management.Automation.InvocationInfo
ScriptStackTrace : at , : line 2
PipelineIterationInfo : {}
If an unexpected error was thrown then please report the full error details using e.g.
$error[0] | Select-Object *
Environment data
The text was updated successfully, but these errors were encountered: