npoi icon indicating copy to clipboard operation
npoi copied to clipboard

SXSSF Workbook Incompatible with SharpZipLib 1.4.2

Open amirali079 opened this issue 1 year ago • 9 comments

Hi. We get this error "Method not found: 'Void ICSharpCode.SharpZipLib.Zip.ZipFile..ctor(System.String)" in runtime. We detect our problem fix if we reference to "SharpZipLib 1.3.3" . Do you have any idea to fix it or plan to upgrades "SharpZipLib" package in your codes?

amirali079 avatar Aug 02 '23 17:08 amirali079

Hi, can you please attach the file causing this exception?

Bykiev avatar Aug 02 '23 18:08 Bykiev

which NPOI version are you using?

tonyqus avatar Aug 03 '23 07:08 tonyqus

Hi, can you please attach the file causing this exception?

Hi my file causing this exception in this repo https://github.com/amirali079/ExcelWriter/tree/main/WriteExcel .

amirali079 avatar Aug 03 '23 13:08 amirali079

which NPOI version are you using?

I use the last version of NPOI (2.6.1)

amirali079 avatar Aug 03 '23 13:08 amirali079

Issue is pretty simple, SharpZipLib added an optional argument to the constructor that is being used at NPOI.XSSF.Streaming.SXSSFWorkbook.InjectData, rebuilding it with a higher version selected should solve it.

jesterret avatar Aug 03 '23 18:08 jesterret

Wow, but it is marked as optional

https://github.com/icsharpcode/SharpZipLib/blob/0ef794188009c17465e6444d9cf9fffd36eae6e7/src/ICSharpCode.SharpZipLib/Zip/ZipFile.cs#L402

If it's really the issue it seems to be a breaking change in SharpZipLib and instead of creating a new optional parameter it'll be better to create 2 separate constructors

Bykiev avatar Aug 03 '23 18:08 Bykiev

Yes, so basically it's a nonissue if You'd constrain dependency to exact version 1.3.3, as that prevents binary incompatibility from anyone upgrading transitional dependencies. Building & publishing the library with the higher version of the reference would also solve the issue, but obviously more issues might arise if SharpZipLib would introduce more breaking changes & upgradability is still possible.

jesterret avatar Aug 03 '23 19:08 jesterret

Yes, so basically it's a nonissue if You'd constrain dependency to exact version 1.3.3, as that prevents binary incompatibility from anyone upgrading transitional dependencies. Building & publishing the library with the higher version of the reference would also solve the issue, but obviously more issues might arise if SharpZipLib would introduce more breaking changes & upgradability is still possible.

Thanks, I've created a bug report in SharpZipLib https://github.com/icsharpcode/SharpZipLib/issues/839

Bykiev avatar Aug 03 '23 19:08 Bykiev

Let's pend the new release of SharpZipLib

tonyqus avatar Aug 23 '23 11:08 tonyqus