How do I use the latest CsvHelper 34.0.0 inside Linqpad 8?
08:27 13 Nov 2026

I'm guessing the way LinqPad adds the Order class to a UserQuery class is keeping the CsvHelper source generator from being able to use the [CsvRecord] annotation.

I'm getting the following error. UserQuery+Order has no CSV mapper. Mark it [CsvRecord] and partial, and reference the CsvHelper source generator.

void Main()
{
    using var reader = CsvReader.FromFile(@"C:\Temp\orders.csv");
    var records = reader.GetRecords();

    records.Dump();
}

// You can define other methods, fields, classes and namespaces here
[CsvRecord]
public partial class Order
{
    public string Id { get; set; } = "";
    [CsvColumn("Unit Price")]
    public decimal Price { get; set; }
    [CsvColumn(Optional = true)]
    public int? Quantity { get; set; }
    [CsvIgnore]
    public decimal Total { get; set; }
}
linqpad csvhelper