Skip to content

[DataAccess.AssertException] = {"Row 1 does not have the expected number of values (0)"} #32

Open

Description

@arteny

This exception occurs for line:
var table = DataTable.New.FromEnumerable(Data);
where Data is not empty List of dynamic

Activity

  1. MikeStall commented on Apr 27, 2014

    @MikeStall
    Owner

    Can you give me a specific expression for Data? I can make that into a test case and fix.

  2. arteny commented on Apr 27, 2014

    @arteny
    Author

    There is no any specific.
    I suppose the simplest example is:

    var Data = new List<dynamic>();
    Data.Add(new{1});
    

    I used it as

                Data = DataTable.New.ReadCsv("data.csv").RowsAs<dynamic>().ToList();
                Data.Add(new
                {data1, data2, ...});
                DataTable.New.FromEnumerable(Data).SaveCSV(@".\data.csv");
    
  3. MikeStall commented on Oct 18, 2015

    @MikeStall
    Owner

    RowsAs requires T be strongly typed so that it can infer the columns. It can't do that from dynamic. So this may be by-design, although we could have a better error message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions