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

" No members are mapped for type", not on local Windows machine, but on CentOS machine #1230

Closed
rh78 opened this issue Feb 12, 2019 · 3 comments

Comments

@rh78
Copy link

rh78 commented Feb 12, 2019

I am trying to parse a CSV file, getting this error. As a solution I also tried to register a class map but it doesn't help.

The strange thing is, it works on my local machine (Windows, .NET Core 2.2, ASP.NET Core 2.2.1), but it fails on my production machine (CentOS 7, .NET Core 2.2, ASP.NET Core 2.2.1) so it does not seem to be an issue with the configuration.

What is the possible causes of this exception, that are possibly environment dependent?

Stack Trace:
at CsvHelper.Expressions.ObjectRecordCreator.CreateCreateRecordDelegate(Type recordType)
at CsvHelper.Expressions.RecordCreator.GetCreateRecordDelegate(Type recordType)
at CsvHelper.Expressions.RecordCreator.CreateT
at CsvHelper.CsvReader.GetRecordsT+MoveNext()
...

@rh78 rh78 changed the title " No members are mapped for type", but only in Production System " No members are mapped for type", not on local Windows machine, but on CentOS machine Feb 12, 2019
@Chris197
Copy link

Chris197 commented Jul 31, 2019

I just ran into a similar problem and came across this issue looking for a solution. As I've now figured out what the cause was, I thought I would share it here.

The problem in my case was the delimiter. When you don't specify the delimiter explicitly, I suspect CsvHelper uses the default delimiter from your local culture settings, which in my case on Windows was a semi-colon. Therefore, if your file uses semi-colons, it will work fine on Windows. Then, when you move to a different OS (like in my case Linux in a Docker container), a different delimiter may apply (like a comma), and the exception you saw is raised.

So the safest solution is to specify the delimiter explicitly with Configuration.Delimiter.

@rh78
Copy link
Author

rh78 commented Jul 31, 2019

Oh I forgot to mention the solution when I solved it. Yes it was exactly that issue. Thanks for helping!

@taori
Copy link

taori commented May 11, 2020

@rh78 In that case you should close the issue.

@rh78 rh78 closed this as completed May 11, 2020
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

3 participants