Closed ozeback closed 4 weeks ago
@sagilio @sociometry @AsakusaRinne
Thank you for your feedback. CsvHelper has been upgraded in the PR https://github.com/casbin/Casbin.NET/pull/357 You can try version v2.8.0 to see if it can resolve this issue.
That did the trick. Thanks!
We are using Casbin and CsvHelper in a .NET 8 application, and we are encountering null and TypeInitialization exceptions. There were some changes in the constructor of CsvConfiguration believed to be causing this. In v30 of CsvHelper, the constructor signature was CsvConfiguration(CultureInfo cultureInfo, Type? attributesType=null). In newer versions, the signature has been changed slightly and marked obsolete, CsvConfiguration(CultureInfo cultureInfo, Type attributesType).
When an application references Casbin and explicitly references a newer version of CsvHelper, there isn't a compile-time error because the calling signature still matches an existing constructor in the newer CsvHelper (e.g. Casbin is essentially compiled with this call signature: CsvConfiguration(cultureInfo, null)). However, the CsvHelper constructor also removed the null check for attributesType, and so you encounter an error at runtime.
This can be resolved with Casbin recompiling with a newer version of CsvHelper as there is another constructor with just the CultureInfo argument. Otherwise, anyone wanting to use a newer version of CsvHelper along with Casbin can't and is stuck on v30 of CsvHelper.