CsvHelper
CsvHelper copied to clipboard
Add CsvReader.ctor(TextReader)
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.
Add the version the library expects. It should said what version is the dependency is on NuGet.
What library is it?
Thank you for investigating!
The package is YahooFinanceApi
and the full repro code is:
var candles = Yahoo.GetHistoricalAsync("TSLA").Result;
I simply installed this package in a .NET 5 project (which is nearly empty) and the version is:
CsvHelper is installed as 27.2.1. No package updates are being offered.
That library should have maximum version specified then.
There are a few things you can do.
- Add CsvHelper version 7.1.1 to your project.
- Use a binding redirect for CsvHelper.
- Fork the YahooFinanceApi project and fix the issue.
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.
Which option did you go with?
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.