Home Forums .NET libraries Xceed Zip & Real-Time Zip for .NET Xceed.FileSystem.FileSystemNotSupportedException when using different Regional settings

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • User (Old forums)
    Post count: 23064
    #20164 |

    We are seeing the following exception and error message when trying to zip multiple streams into a zip archive.

    Type : Xceed.FileSystem.FileSystemNotSupportedException, Message : Cannot copy a file onto itself.


    The strange thing is that we only see this error when we switch our regional settings to EN: United Kingdom.   We have not tried other settings yet but we were wondering if this is bug in the zip libraries or if anyone else is seeing the same problems and have come up with a solution.


    Here is our code:


    NB: NamedStream wraps the stream class so that we can give it a file name.

             public List<NamedStream> Create(List<NamedStream> streams, string zipFileName, long splitSize) {
                var rootFolder = Guid.NewGuid().ToString();

                var zipFile = new MemoryFile(rootFolder, CreateZipFileName(zipFileName)); ‘replaces file extension with .zip extension
                var archive = new ZipArchive(zipFile) {
                    DefaultCompressionMethod = CompressionMethod.Deflated,
                    DefaultEncryptionMethod = EncryptionMethod.Compatible,
                    AllowSpanning = true,
                    SplitNameFormat = SplitNameFormat.WinZip,
                    SplitSize = splitSize,

                foreach (var stream in streams) {
                    var streamFile = new StreamFile(stream.ContentStream, stream.Name);
                    streamFile.CopyTo(archive, true);      <——————         ‘!!!!! The error is thrown at this line !!!!!
                var zipFolder = new MemoryFolder(rootFolder, @”\”);
                zipFolder.CopyFilesTo(new ZipEvents(), “”, archive, false, true, “*” + GetExtension(zipFileName));
                var namedStreams = new List<NamedStream>();
                foreach (var item in zipFolder.GetFiles(true)) {
                    namedStreams.Add(new NamedStream(item.OpenRead(), item.Name));
                return namedStreams;


    Imported from legacy forums. Posted by Anthony (had 2031 views)

    User (Old forums)
    Post count: 23064

    I found the answer.  Our split size was being set to 0


    we set this appropriately and the probem went away.

    Imported from legacy forums. Posted by Anthony (had 1960 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.