CsvHelper icon indicating copy to clipboard operation
CsvHelper copied to clipboard

Add CsvReader.ctor(TextReader)

Open GSPP opened this issue 2 years ago • 6 comments

I'm trying to use a NuGet package that makes internal use of CsvReader. This package was compiled for an older version and expects a constructor CsvReader.ctor(TextReader). Apparently, this constructor has been removed. For that reason, that library fails with a MissingMethodException.

Ideally, that package would be updated but the library author is likely no longer interested in maintaining it.

I suggest adding that constructor back and retaining its original meaning in order to maintain binary compatibility.

GSPP avatar Dec 04 '21 08:12 GSPP

Add the version the library expects. It should said what version is the dependency is on NuGet.

What library is it?

JoshClose avatar Dec 04 '21 13:12 JoshClose

Thank you for investigating!

The package is YahooFinanceApi and the full repro code is:

var candles = Yahoo.GetHistoricalAsync("TSLA").Result;

image

I simply installed this package in a .NET 5 project (which is nearly empty) and the version is:

image

CsvHelper is installed as 27.2.1. No package updates are being offered.

GSPP avatar Dec 07 '21 08:12 GSPP

That library should have maximum version specified then.

There are a few things you can do.

  1. Add CsvHelper version 7.1.1 to your project.
  2. Use a binding redirect for CsvHelper.
  3. Fork the YahooFinanceApi project and fix the issue.

JoshClose avatar Dec 08 '21 17:12 JoshClose

Thanks! I appreciate the pointers.

For future visitors I'll leave some information. The latest version of CsvHelper that is usable with that YahooFinanceApi package is 12 (found by bisecting). v13 is no longer usable because some date value cannot be parsed (I have not investigated this but I assume there was a behavioral change). v15 made changes to CsvConfiguration which required small changes to downgrade.

I found this existing issue about it: https://github.com/karlwancl/YahooFinanceApi/issues/45

The issue is resolved for me now. Feel free to close this if you do not want to take any further action.

GSPP avatar Dec 09 '21 12:12 GSPP

Which option did you go with?

JoshClose avatar Dec 09 '21 17:12 JoshClose

I chose to downgrade CsvHelper to 12.0. I'm hoping that the linked issue will be fixed at some point, although the project appears dormant. I considered forking but I'd then need to maintain a private 1 line fork and copy DLLs around.

I am not experienced with maintaining a public NuGet package but I understand that the issue of binary compatibility is a thorny one. It might very well be that YahooFinanceApi is at fault here, but as a consumer, I'm stuck with only suboptimal options.

GSPP avatar Dec 10 '21 13:12 GSPP