Extracting files from ZIP - unable after last update - missing ExtractToFile()

0 Answers 16 Views
ZipLibrary
Pruszkow
Top achievements
Rank 1
Pruszkow asked on 22 May 2025, 09:53 AM | edited on 22 May 2025, 10:01 AM

After recent update to 2025.2.520.462 I'm unable to extract file and save on disk. ExtractToFile() method is not longer here.
I've changed my usings from Telerik.WinControls.Zip to Telerik.Windows.Zip but I'm missing Telerik.Windows.Zip.Extensions.dll file.

What should I replace method ExtractToFile() with?

There is a code we use right now:

 

Byte[] bytes = File.ReadAllBytes(filePath);
using (MemoryStream zipStream = new MemoryStream(bytes))
using (ZipArchive archive = ZipArchive.Read(zipStream))
{
    foreach (ZipArchiveEntry entry in archive.Entries)
    {
        string extractedFilePath = Path.Combine(Path.GetTempPath(), entry.FullName);
        entry.ExtractToFile(extractedFilePath, true);
        thumbnail = AddGridFile(extractedFilePath);
        File.Delete(extractedFilePath);
    }
}
Pruszkow
Top achievements
Rank 1
commented on 22 May 2025, 10:13 AM

BTW I'm using WinForms

And there is a code we use now:

Byte[] bytes = File.ReadAllBytes(filePath);
using (MemoryStream zipStream = new MemoryStream(bytes))
using (ZipArchive archive = ZipArchive.Read(zipStream))
{
    foreach (ZipArchiveEntry entry in archive.Entries)
    {
        string extractedFilePath = Path.Combine(Path.GetTempPath(), entry.FullName);
        entry.ExtractToFile(extractedFilePath, true);
        thumbnail = AddGridFile(extractedFilePath);
        File.Delete(extractedFilePath);
    }
}
Yoan
Telerik team
commented on 22 May 2025, 02:20 PM

Hello Pruszkow,

Thank you for reaching out.

Based on the provided description and details, it is highly likely that you are dealing with an API change we have introduced for security reasons with our latest official release. With Q2 2025, some of our Zip Extensions methods now require an extra TimeSpan? parameter:

void ExtractToFile(this ZipArchiveEntry source, string destinationFileName, TimeSpan? timeout)

And you should be getting the following warning:

That can be resolved, for example, like this:

entry.ExtractToFile(extractedFilePath, true, TimeSpan.FromSeconds(20));

That said, according to your license, you should have access and be able to see the Telerik.Windows.Zip.Extensions NuGet package:

Would you be able to provide more details about the setbacks you are experiencing? Perhaps an exception, a warning message, or an expected and actual results comparison.

Thank you in advance for your cooperation.


No answers yet. Maybe you can help?

Tags
ZipLibrary
Asked by
Pruszkow
Top achievements
Rank 1
Share this question
or