PowerShell / PowerShell/PSScriptAnalyzer
Cannot determine line endings as the text probably contain mixed line endings.
Nessuno ha ancora preso questa issue.
- Lingua principale
- C#
- Stelle
- 2.2k
- Fork
- 414
- Merge medio
- 13h 1m
- PR unite (30g)
- 2
Descrizione
Before submitting a bug report:
- Make sure you are able to repro it on the latest released version
- Perform a quick search for existing issues to check if this bug has already been reported
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
> $PSVersionTable
Name Value
---- -----
PSVersion 5.1.26100.1882
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.26100.1882
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
> (Get-Module -ListAvailable PSScriptAnalyzer).Version | ForEach-Object { $_.ToString() }
1.23.0
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia riproducendo il problema con Invoke-Formatter e i comandi forniti Get-Content -Raw e Set-Content su PowerShell 5.1. Leggi gli stack frame EditableText.GetNumNewLineCharacters e GetNewLineCharacters, quindi esamina il percorso Formatter.Format. L’attività è completata quando l’input segnalato con terminatori di riga misti viene gestito senza l’ArgumentException e il comportamento è coperto da un test appropriato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- csharp, powershell
- Ambito
- tooling
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100