Home > Enterprise >  VSCode Powershell terminal - truncating lines
VSCode Powershell terminal - truncating lines

Time:10-28

I'm trying to figure out why I keep getting this error

is not in 'name=value' format

is there a way to have VSCode turn OFF the truncation when running a command in its terminal? b/c the bit of data I'm looking for is exactly whats cut off!

    d5a2dd24f79c56d88e4e20b6c8a... My Pictures/Kaelyn/Automatic Upload/iPhone/2020-11-05 10-03-02.904.jpeg
ConvertFrom-StringData : Data line '                           ERROR  My Pictures/Kaelyn/Automatic Upload/iPhone/2020-11-05 10-03-02.703.jpeg' is not in 'name=value' format. 
At line:1 char:54
  ... efiles -replace '^[a-f0-9]{32}(  )', '$0=  ' | ConvertFrom-StringData
                                                     ~~~~~~~~~~~~~~~~~~~~~~
      CategoryInfo          : InvalidOperation: (:) [ConvertFrom-StringData], PSInvalidOperationException
      FullyQualifiedErrorId : InvalidOperation,Microsoft.PowerShell.Commands.ConvertFromStringDataCommand

CodePudding user response:

What you want to set is $FormatEnumerationLimit preference variable.

Set $FormatEnumerationLimit = -1 to disable output truncation within PowerShell. By default this is set to 4. This number represent the number of objects a given property will enumerate by default before truncating the output, and we can see that the first line of your stack trace is cut off in the middle of the 5th-penultimate word of that line.


For your specific case though you can also inspect the error more closely by picking apart $Error[0]. $Error is an automatic variable array that contains information about exceptions which have occurred in the current PowerShell session. The most recent exception is going to be the first (0) index, with each incrementation of the index representing the previous error in order of occurrence.

Specifically, $Error[0].Exception should give you the information you are looking for.

  • Related