FileHelpers icon indicating copy to clipboard operation
FileHelpers copied to clipboard

CultureNotFoundException is thrown when initializing engine

Open DavidFineboym opened this issue 5 years ago • 2 comments

I encountered this issue with South Ndebele (South Africa)

image

System.Globalization.CultureNotFoundException: Culture is not supported. Parameter name: culture 3072 (0x0c00) is an invalid culture identifier.

Stack Trace:

at System.Globalization.CultureInfo.InitializeFromCultureId(Int32 culture, Boolean useUserOverride) at FileHelpers.ConvertHelpers.CreateCulture(String decimalSep) at FileHelpers.ConvertHelpers.GetDefaultConverter(String fieldName, Type fieldType) at FileHelpers.FieldBase..ctor(FieldInfo fi) at FileHelpers.FieldBase.CreateField(FieldInfo fi, TypedRecordAttribute recordAttribute) at FileHelpers.RecordInfo.CreateCoreFields(IList1 fields, TypedRecordAttribute recordAttribute) at FileHelpers.RecordInfo.InitRecordFields() at FileHelpers.RecordInfo..ctor(Type recordType) at FileHelpers.RecordInfo.RecordInfoFactory.Resolve(Type type) at FileHelpers.EngineBase..ctor(Type recordType, Encoding encoding) at FileHelpers.FileHelperAsyncEngine1..ctor()

DavidFineboym avatar Mar 23 '19 08:03 DavidFineboym

I had the same issue and resolved it by setting the culture of the currently executing thread in my AppConsole: First I set the thread culture: Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;

Then I instantiated the FileHelpers Engine and the exception did not occur.

AJPoulter avatar Jul 09 '19 17:07 AJPoulter

Release 3.5.1 contains a fix for detecting the culture. #413

Are you able to verify, if it works now?

Matthias

mcavigelli avatar Oct 21 '21 20:10 mcavigelli