Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error - delimeter found after the last field of the class #360

Open
stpete111 opened this issue Sep 26, 2019 · 1 comment
Open

Error - delimeter found after the last field of the class #360

stpete111 opened this issue Sep 26, 2019 · 1 comment

Comments

@stpete111
Copy link

Visual Studio 2019, .Net Core 2.2 - getting the following error when debugging code to parse a csv file with 10 rows:

{"Line: 2 Column: 593. Delimiter ',' found after the last field 'Taxonomy_Group_15' (the file is wrong or you need to add a field to the record class)"}

I have checked the file and I don't see anything in column 593 (or anywhere else beyond the defined columns for that matter).

Here is the code I'm testing with:

 public static void Main(string[] args)
        {
            var engine = new FileHelperEngine<Entity>();
           
            var result = engine.ReadFile(@"C:\Users\me\Desktop\pfile_20190902-20190908.csv");

                foreach (Entity subject in result)
                    {
                    Console.WriteLine("Subject Info:");
                    Console.WriteLine(subject.NPI + " - " + subject.Entity_Type_Code);
                    }
         }   

The error is thrown before the foreach loop is entered. I've checked my Entity Class and all columns are present. Can someone help me understand what's going on here?

@pefford
Copy link

pefford commented Feb 21, 2023

If one of your fieldas contains a comma, the parser interpretates it as two fileds and hence, the last column of the row is (probably) considered to be the first column of the next row and there's of course no comma to separate it from the real first column of the row...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants