The ReadToEnd method of CsvReader generally only does that when duplicate column names are found. Since you've checked for duplicates already, my guess is that there are empty header names on the end that are being recognized as duplicates or something odd like that.
To troubleshoot, instead of calling ReadToEnd, call ReadHeaders and then see what values are returned in the Headers property. You can also look at the headers by viewing the file in Notepad and see if the header line has noticeable issues.
I'm pasting the logic of ReadToEnd below to help you troubleshoot. It's really just a simple convenience method, but you'll see that it gets a little verbose in attempting to prevent exceptions when naming the columns.
If you can reply by pasting what the header line looks like in Notepad, maybe I can help identify the issue, or you can email me a sample file.
public DataTable ReadToEnd(bool readHeaders, ulong maxRecords)
{
DataTable csvTable = new DataTable();
// turn off notifications and constraints for faster loading
csvTable.BeginLoadData();
if (readHeaders)
{
ReadHeaders();
bool preserveNames = true;
for (int i = 0; i < headersHolder.Length; i++)
{
if (preserveNames)
{
string header = headersHolder.Headers[i];
if (header.Length == 0)
{
header = "Column" + (i + 1);
}
// check for duplicates
if (csvTable.Columns.Contains(header))
{
// change the naming convention to prevent exceptions
for (int j = i - 1; j >= 0; j--)
{
csvTable.Columns[j].ColumnName = "Column" + (j + 1);
}
preserveNames = false;
}
else
{
// use the name from the data
csvTable.Columns.Add(header);
}
}
if (!preserveNames)
{
// use a name based on the column index
csvTable.Columns.Add("Column" + (i + 1));
}
}
}
int currentColumnCount = headersHolder.Length;
bool partialReading = maxRecords > 0;
DataRowCollection rows = csvTable.Rows;
while (
(
!partialReading ||
currentRecord < maxRecords
) &&
ReadRecord())
{
if (columnsCount > currentColumnCount)
{
// add extra columns because we encountered a wider row
// or this is the first row and readHeaders == false
for (int i = currentColumnCount; i < columnsCount; i++)
{
csvTable.Columns.Add("Column" + (i + 1));
for (int currentRows = 0; currentRows < (int) currentRecord - 1; currentRows++)
{
rows[currentRows][i] = "";
}
}
currentColumnCount = columnsCount;
}
rows.Add(Values);
for (int columnsNeeded = columnsCount; columnsNeeded < currentColumnCount; columnsNeeded++)
{
rows[rows.Count - 1][columnsNeeded] = "";
}
}
// reenable notifications and constraints
csvTable.EndLoadData();
return csvTable;