LINQtoCSV icon indicating copy to clipboard operation
LINQtoCSV copied to clipboard

Reading raw data does not work for me.

Open Phosphan opened this issue 12 years ago • 3 comments

... but with this patch to CsvContext.cs, it does:

Index: CsvContext.cs

--- CsvContext.cs (revision 2611) +++ CsvContext.cs (revision 2612) @@ -179,6 +179,7 @@ if (readingRawDataRows) { obj = row as T;

  •                            row = new T() as IDataRow;
                         }
                         else
                         {
    

Phosphan avatar Mar 13 '14 08:03 Phosphan

Hi,

Thanks for your bug report and fix. However, from your issue, I'm not sure what the bug is.

Could you please send me a pull request that includes 1) the code change; and 2) one or more unit tests that cover the bug that you solved.

Matt

mperdeck avatar Mar 13 '14 09:03 mperdeck

Sorry, I am neither familiar with github nor with git. No idea how to "send a pull request".

The code change (no idea why my comment was cut off) is a simple one-liner: if (readingRawDataRows) { obj = row as T; Add this one: ---> row = new T() as IDataRow;

As it currently is, you are yielding always the same object when processing raw data. Calling clear() on it for each and every row. This results in a list with the correct number of lines, but all empty entries.

Maybe I'll find time for unit tests for this later, currently I have a deadline in my neck, approaching at awesome speed :-/

Phosphan avatar Mar 13 '14 10:03 Phosphan

I'm experiencing this as well. I'll see if I can put together a PR tonight.

provegard avatar Sep 30 '14 13:09 provegard