[Solved] ZipArchive errors

2 Answers 17 Views
General Discussions
Fit2Page
Top achievements
Rank 2
Bronze
Iron
Iron
Fit2Page asked on 29 Apr 2026, 12:17 PM

With code coming from your demo's I get:

 


Compiler Error Message: BC30517: Overload resolution failed because no 'New' is accessible.

Source Error:

Line 97: 
Line 98:             Dim memStream As New MemoryStream()
Line 99:             Using archive As New ZipArchive(memStream, ZipArchiveMode.Create, True, Nothing)

 

What am I doing wrong?

 

Marc

2 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 29 Apr 2026, 02:41 PM

Hi Marc,

Thank you for reaching out. The error you're seeing is caused by a breaking change introduced in RadZipLibrary 2024 Q1. Starting from that version, the ZipArchive constructors were made obsolete and are no longer accessible. Full details are available here: Backward Compatibility - RadZipLibrary.

How to fix:

Replace the constructor call:

Using archive As New ZipArchive(memStream, ZipArchiveMode.Create, True, Nothing)

With the new static factory method:

Using archive As ZipArchive = ZipArchive.Create(memStream)

Do the same for any other place where you instantiate a ZipArchive — use ZipArchive.Create() for writing, ZipArchive.Read() for reading, or ZipArchive.Update() for updating existing archives.

Also, could you let us know which specific demo page is still erroring out for you? All ZipLibrary demos have been updated and should be working correctly now — for example: https://demos.telerik.com/aspnet-ajax/ziplibrary/examples/overview/defaultcs.aspx. If you are still seeing an error on a particular demo, we'd like to investigate further.

Regards,
Rumen
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Telerik family, check out our getting started resources
Fit2Page
Top achievements
Rank 2
Bronze
Iron
Iron
commented on 30 Apr 2026, 07:39 AM

 

 

Thanks for your support.

 

I found the bespoken information en code snippet here:

 

https://www.telerik.com/products/aspnet-ajax/documentation/knowledge-base/ziplibrary-download-multiple-files-in-a-single-archive

Fit2Page
Top achievements
Rank 2
Bronze
Iron
Iron
commented on 30 Apr 2026, 07:46 AM | edited

Hi Rumen,

 

When creating the ZIP and sending it to the client we get the following message:

0
Rumen
Telerik team
answered on 30 Apr 2026, 09:42 AM

Hi Marc,

Thank you for the detailed report! We identified two issues in the KB article code that were causing the corrupt archive.

Issue 1: Obsolete Constructor (2024 Q1+)

Starting with the 2024 Q1 release, the ZipArchive constructors were made obsolete. Replace:

Using archive As New ZipArchive(memStream, ZipArchiveMode.Create, True, Nothing)

With the new static factory method:

Using archive As ZipArchive = ZipArchive.Create(memStream)

Issue 2: Incorrect entry/writer disposal pattern (the real cause of the 0-byte entries)

Even after switching to the new API, the archive was still corrupt because the BinaryWriter was wrapped in a Using block while the ZipArchiveEntry was not. This causes the entry stream to close before the entry is finalized, resulting in 0-byte entries.

The correct pattern — matching our working demo — is to wrap the entry in Using, call writer.Flush(), and not wrap the BinaryWriter in Using:

' Wrong - produces corrupt archive
Dim entry As ZipArchiveEntry = archive.CreateEntry(fileName)
Using writer As New BinaryWriter(entry.Open())
    writer.Write(File.ReadAllBytes(docFile))
End Using

' Correct - matches the working demo
Using entry As ZipArchiveEntry = archive.CreateEntry(fileName)
    Dim writer As New BinaryWriter(entry.Open())
    writer.Write(File.ReadAllBytes(docFile))
    writer.Flush()
End Using

Full corrected VB.NET code:

Protected Sub RadButton1_Click(sender As Object, e As EventArgs)
    Dim memStream As New MemoryStream()
    Using archive As ZipArchive = ZipArchive.Create(memStream)
        For Each docFile As String In Directory.GetFiles(HttpContext.Current.Server.MapPath("~/Files"))
            Dim fileName As String = Path.GetFileName(docFile)
            Using entry As ZipArchiveEntry = archive.CreateEntry(fileName)
                Dim writer As New BinaryWriter(entry.Open())
                writer.Write(File.ReadAllBytes(docFile))
                writer.Flush()
            End Using
        Next
    End Using

    SendZipToClient(memStream)
End Sub

The KB article will be updated with the corrected code for both C# and VB.NET: Download Multiple Files in a Single Archive.

As a small note of gratitude for reporting the outdated KB, I have update your Telerik points. Please let us know if you have any further questions.

Regards,
Rumen
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Telerik family, check out our getting started resources
Tags
General Discussions
Asked by
Fit2Page
Top achievements
Rank 2
Bronze
Iron
Iron
Answers by
Rumen
Telerik team
Share this question
or