jehugaleahsa / FlatFiles

Reads and writes CSV, fixed-length and other flat file formats with a focus on schema definition, configuration and speed.
The Unlicense
357 stars 64 forks source link

RecordErrorEventArgs's Exception property is always null #41

Closed giacomelli closed 6 years ago

giacomelli commented 6 years ago

Describe the bug RecordErrorEventArgs sets the exception passed to the constructor to a private field that is never used https://github.com/jehugaleahsa/FlatFiles/blob/66fe13f752fa5beecd2408519516d4c196e79186/FlatFiles/RecordErrorEventArgs.cs#L14

then the Exception properyt is always null

To Reproduce Create a reader and subscribe to RecordError event

reader.RecordError += new EventHandler<RecordErrorEventArgs>((sender, args) =>
 {
    // args.Exception is null
});

Expected behavior The type of Exception property should be RecordProcessingException and the RecordErrorEventArgs's constructor should set the passed argument directly to the property. The private field should be removed.

Version: 4.3.1.1

jehugaleahsa commented 6 years ago

I applied the fix and created a unit test. As soon as the package is refreshed on NuGet, you should see v4.3.2 become available.