FileHelpers
FileHelpers copied to clipboard
CultureNotFoundException is thrown when initializing engine
I encountered this issue with South Ndebele (South Africa)
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.FileHelperAsyncEngine
1..ctor()
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.
Release 3.5.1 contains a fix for detecting the culture. #413
Are you able to verify, if it works now?
Matthias