I encountered the System.IO.PathTooLongException, using ZipFile.AddDirectory() to save a zip. Problem here, the resulting exception doesn't even say which path was too long . Using the DotNetZip devkit I saw this happened in ZipEntry.Create when File (Directory)
will be first accessed with File.GetLastWriteTime(filename) (ZipEntry.cs line 2402).
The path really was too long. A subdirectory of the directory I wanted to zip had a path longer than 259 characters (267 :) ), apparently the maximum path length the .NET IO system can handle. So the error was due to the .net limit. I found a nice blog post
about this and how to use Win32 to access file/folders with >260 path length.
If you zip such a directory, the whole process fails. What really bothered me was to find out which file/directory was too long, because the PathTooLongException doesn't return the path value. So it would be nice if you would catch this PathTooLongException
and return a custom exception that tells u the path.