From c346f0a9a639a3af0d6b47ada3728fac809e6e13 Mon Sep 17 00:00:00 2001 From: omerbenda Date: Sat, 27 Dec 2025 18:28:14 +0200 Subject: [PATCH] fix(CsvConfiguration class): Allow setting the delimiter to a newline character as long as it is different from the newline value --- src/CsvHelper/Configuration/CsvConfiguration.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/CsvHelper/Configuration/CsvConfiguration.cs b/src/CsvHelper/Configuration/CsvConfiguration.cs index 120970d69..a2060f2b8 100644 --- a/src/CsvHelper/Configuration/CsvConfiguration.cs +++ b/src/CsvHelper/Configuration/CsvConfiguration.cs @@ -211,8 +211,7 @@ public void Validate() if (whiteSpaceChars.Contains(quote)) throw new ConfigurationException($"The quote character '{Quote}' cannot be a WhiteSpaceChar."); // Delimiter - if (Delimiter == NewLine && IsNewLineSet) throw new ConfigurationException($"The delimiter '{Delimiter}' and new line '{NewLine}' cannot be the same."); - if (lineEndings.Contains(Delimiter)) throw new ConfigurationException($"The delimiter '{Delimiter}' cannot be a line ending. ('\\r', '\\n', '\\r\\n')"); + if (Delimiter == NewLine) throw new ConfigurationException($"The delimiter '{Delimiter}' and new line '{NewLine}' cannot be the same."); if (whiteSpaceChars.Contains(Delimiter)) throw new ConfigurationException($"The delimiter '{Delimiter}' cannot be a WhiteSpaceChar."); // Detect Delimiter