Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

CSV deserialization outputs nothing if there are only a certain number of empty fields #24698

Copy link
Copy link
@surfingoldelephant

Description

@surfingoldelephant
Issue body actions

Prerequisites

If CSV input data doesn't satisfy an uncommunicated threshold regarding the number of columns and empty quoted/unquoted fields, CSV deserialization using ConvertFrom-Csv/Import-Csv yields no output. No error/warning is emitted either; the input is effectively ignored.

Steps to reproduce

Test 1

In the following examples, no custom object is emitted by ConvertFrom-Csv irrespective of row count.

# No custom object output, irrespective of row count.

# Example 1a:
@'
"P1"
""
'@ | ConvertFrom-Csv

# Example 1b:
@'
"P1"
""
""
""
'@ | ConvertFrom-Csv

Tests 2-3

In the following examples, a custom object is emitted for all rows except the last.

# Partial custom object output. 
# Output for each row except the last.
# If there is only one row, no object is emitted.

# Example 2a:
@'
"P1","P2"
"",
'@ | ConvertFrom-Csv # Nothing

# Example 2b:
@'
"P1","P2"
"",
"",
'@ | ConvertFrom-Csv # 1 custom object

# Example 3a:
@'
"P1","P2"
,
'@ | ConvertFrom-Csv # Nothing

# Example 3b:
@'
"P1","P2"
,
,
'@ | ConvertFrom-Csv # 1 custom object

Tests 4-6

Custom object output is correct in following examples.

# Custom object output in examples 4-6.

# Example 4a:
@'
"P1","P2"
,""
'@ | ConvertFrom-Csv

# Example 4b:
@'
"P1","P2"
,""
,""
'@ | ConvertFrom-Csv

# Example 5a:
@'
"P1","P2"
"",""
'@ | ConvertFrom-Csv

# Example 5b:
@'
"P1","P2"
"",""
"",""
'@ | ConvertFrom-Csv

# Example 6a:
@'
"P1","P2","P3"
,,
'@ | ConvertFrom-Csv

# Example 6b:
@'
"P1","P2","P3"
,,
,,
'@ | ConvertFrom-Csv

Note:

Expected behavior

  • Test 1: Should emit a custom object with a P1 property.
  • Tests 2a & 3a: Should emit a custom object with a P1 and P2 property.
  • Tests 2b & 3b: Should emit 2 custom objects, each with a P1 and P2 property.

Actual behavior

  • Test 1: No custom object output.
  • Tests 2-3: Partial custom object output for all rows except the last.

Environment data

Name                           Value
----                           -----
PSVersion                      7.5.0-rc.1
PSEdition                      Core
GitCommitId                    7.5.0-rc.1
OS                             Microsoft Windows 10.0.19045
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

In-PRIndicates that a PR is out for the issueIndicates that a PR is out for the issueIssue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productWG-Cmdletsgeneral cmdlet issuesgeneral cmdlet issuesWG-ReviewedA Working Group has reviewed this and made a recommendationA Working Group has reviewed this and made a recommendation

Type

No type
No fields configured for issues without a type.

Projects

Status
Issue In Progress
Show more project fields

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.