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

ConfigurationException: "Types that inherit IEnumerable cannot be auto mapped" when calling GetRecords<Dictionary<string, object>> #2294

Open
palenshus opened this issue Oct 8, 2024 · 0 comments
Labels

Comments

@palenshus
Copy link

Describe the bug
I'm trying to deserialize to a list of dictionaries.

To Reproduce

var records = csv.GetRecords<Dictionary<string, object>>();

Results in this exception:

CsvHelper.Configuration.ConfigurationException: 'Types that inherit IEnumerable cannot be auto mapped. Did you accidentally call GetRecord or WriteRecord which acts on a single record instead of calling GetRecords or WriteRecords which acts on a list of records?'

Expected behavior
I'd expect this to work and produce the same types of objects as:

var records = csv.GetRecords<dynamic>().Cast<ExpandoObject>();

Additional context
ExpandoObject/dynamic isn't NAOT-compatible. (Neither is CsvHelper, for now, but that's a separate issue)

@palenshus palenshus added the bug label Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant