CsvHelper Failing to Handle DateTime on GitHub Build

Using net6.0. Using CsvHelper 30.0.1 So when building locally the build succeeds without issue, however when committing to Github the Build fails with the following error: CsvHelper.TypeConversion.TypeConverterException : The conversion cannot be performed. Text: ’03/20/2023′ MemberName: StartDate MemberType: System.Nullable`1[[System.DateTime, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]] TypeConverter: ‘CsvHelper.TypeConversion.NullableConverter’ IReader state: ColumnCount: 0 CurrentIndex: 2 HeaderRecord: ["Id","Name","StartDate","TotalSpend"] IParser state:… Read More CsvHelper Failing to Handle DateTime on GitHub Build

CsvHelper: Writing CSV when using generics fails

C# 10 | .NET 6 | CsvHelper 29.0.0 I am attempting to use CsvHelper to write CSVs of generic types: public async Task RunAsync<T>() { List<T> dataList = default!; dataList = await ApiService.GetDataAsync<T>(Job.Read); try { string path = $"./inbox/read.{typeof(T).Name}.csv"; CsvConfiguration config = new(System.Globalization.CultureInfo.InvariantCulture); using StreamWriter sw = new(path, append: false); using CsvWriter csvWriter = new(sw,… Read More CsvHelper: Writing CSV when using generics fails

CsvHelper exception Unhandled exception. CsvHelper.HeaderValidationException: Header with name when reading a file generated by CsvWriter

OK I have the following record definition: namespace Test09_CSVHelperTest { public sealed record Filter { public Filter(string body, string category) { if (string.IsNullOrEmpty(body)) throw new ArgumentException(@"Value cannot be null or empty.", nameof(body)); if (string.IsNullOrWhiteSpace(body)) throw new ArgumentException(@"Value cannot be null or whitespace.", nameof(body)); if (string.IsNullOrEmpty(category)) category = "Unknown"; var replaceRegex = new Regex(@"\s+", RegexOptions.IgnoreCase |… Read More CsvHelper exception Unhandled exception. CsvHelper.HeaderValidationException: Header with name when reading a file generated by CsvWriter

IWriterConfiguration.ReferenceHeaderPrefix equivalent in newer versions of CsvHelper

What is the equivalent of csvWriter.Configuration.ReferenceHeaderPrefix in the newer version of CsvHelper? Trying this csvWriter.Configuration.ReferenceHeaderPrefix = (memberType, memberName) => $"{memberName}_"; but its not let me because ReferenceHeaderPrefix has only get method after version 20.0.0 >Solution : The usual workflow is to construct an instance of the CsvConfiguration class and pass that into the constructor for… Read More IWriterConfiguration.ReferenceHeaderPrefix equivalent in newer versions of CsvHelper

CS0103 – The name 'GetListFromCVS' does not exist in the current context

Pretty new to C# and object-oriented programming in general. I’m currently recieving this error when trying to call GetListFromCSV method that resides in another ".cs" file but resides in the same namespace. I’m not sure why I’m not able to call this method? I originally had the code in GetListFromCSV method in main but wanted… Read More CS0103 – The name 'GetListFromCVS' does not exist in the current context