CsvFormatException(string)
public CsvFormatException(string message)Creates an exception that is not tied to a position in the input.
Parameters
messagestring- The message that describes the problem.
Exception in CsvHelper
Thrown when CSV input is malformed and the reader was configured to reject it, and when a record cannot be read as its CsvRecordAttribute type (the cause is then the Exception.InnerException).
public sealed class CsvFormatException : FormatExceptionCsvHelperCsvHelper.dllpublic CsvFormatException(string message)Creates an exception that is not tied to a position in the input.
messagestringpublic CsvFormatException(string message, long recordNumber, long byteOffset)Creates an exception for a problem at a known record and byte offset.
messagestringrecordNumberlongbyteOffsetlongpublic CsvFormatException(string message, long recordNumber, long byteOffset, Exception? innerException)Creates an exception for a record that could not be read, caused by innerException.
messagestringrecordNumberlongbyteOffsetlonginnerExceptionException?public long ByteOffset { get; }The offset, in bytes of UTF-8 input, near where the problem was found, or 0 when it is not known.
public int FieldIndex { get; init; }The 0-based index of the field that Member reads, or -1 when it is not known (malformed input, no member, or a member that reads several fields, such as a nested record).
public long LineNumber { get; init; }The 1-based line of the input where the record with the problem starts, when CsvReaderOptions.TrackLineNumbers is on; 0 otherwise.
public string? Member { get; init; }For a record that could not be read as its CsvRecordAttribute type, the member whose field could not be read, as error messages name it (Order.Price); null for malformed input, and when no member was at fault on its own (a constructor or a setter threw).
public long RecordNumber { get; }The 1-based number of the record where the problem was found, counting the header and the records returned before it (not skipped records, empty lines or comments); 0 when the problem is not tied to a record.