title: Get the entire CSV line on error parsing or reading
body: <p>Get the entire Csv Line on parsing error</p>
  
  <p>With <a href="https://joshclose.github.io/CsvHelper/" rel="nofollow noreferrer">CsvHelper</a> we use :</p>
  
  <blockquote>
    <h3><code>MissingFieldFound</code>:</h3>
    
    <p>Gets or sets the function that is called when a missing field is found.The default 
    function will throw a CsvHelper.MissingFieldException.You can supply your own 
    function to do other things like logging the issue instead of throwing an exception. 
    Arguments: headerNames, index, context  </p>
    
    <h3><code>BadDataFound</code>:</h3>
    
    <p>Gets or sets the function that is called when bad field data is found. A field
    has bad data if it contains a quote and the field is not quoted (escaped). You
    can supply your own function to do other things like logging the issue instead
    of throwing an exception. Arguments: context</p>
  </blockquote>
  
  <p>In the following MCVE, only <code>MissingFieldFound</code> capture the complete line when <code>BadDataFound</code> did not.</p>
  
  <pre><code>static void Main()
  {
      using (var stream = new MemoryStream())
      using (var writer = new StreamWriter(stream))
      using (var reader = new StreamReader(stream))
      using (var csv = new CsvReader(reader))
      {
          writer.WriteLine("FirstName,LastName");
          writer.WriteLine("\"Jon\"hn\"\",\"Doe\"");
          writer.WriteLine("\"JaneDoe\"");
          writer.WriteLine("\"Jane\",\"Doe\"");
          writer.Flush();
          stream.Position = 0;
  
          var good = new List&lt;Test&gt;();
          var bad = new List&lt;string&gt;();
          var isRecordBad = false;
  
          csv.Configuration.BadDataFound = context =&gt;
          {
              isRecordBad = true;
              bad.Add(context.RawRecord);
          };
  
          csv.Configuration.MissingFieldFound = (headerNames, index, context) =&gt;
          {
              isRecordBad = true;
              bad.Add(context.RawRecord);
          };
  
          while (csv.Read())
          {
              var record = csv.GetRecord&lt;Test&gt;();
              if (!isRecordBad)
              {
                  good.Add(record);
              }
  
              isRecordBad = false;
          }
  
          good.Dump();
          bad.Dump();
      }
  }
  
  public class Test
  {
      public string FirstName { get; set; }
      public string LastName { get; set; }
  }
  </code></pre>
  
  <p>I would like the result to be :</p>
  
  <blockquote>
    <p>"Jon"hn"","Doe"<br>
    "JaneDoe"</p>
  </blockquote>
  
  <p>Instead of :</p>
  
  <blockquote>
    <p>"Jon"hn"", 
    "JaneDoe"</p>
  </blockquote>
  
  <p>For long Csv with a lot of column the rest of the line often have valuable information.</p>