{
  "WorkItem": {
    "AffectedComponent": {
      "Name": "",
      "DisplayName": ""
    },
    "ClosedComment": "fixed in change set 22339.  This fix is in the v1.6 preview interim build, and will be in the v1.6 final release.",
    "ClosedDate": "2008-08-15T18:36:45.823-07:00",
    "CommentCount": 0,
    "Custom": null,
    "Description": "If I add a directory to a zipfile with the AddDirectory method and then do a Save, and if there is a zero byte file in the directory, I get the error \"Object reference not set to an instance of an object.\nI am using version 1.5 of the DotNet Zip library.",
    "LastUpdatedDate": "2013-05-16T05:32:41.327-07:00",
    "PlannedForRelease": "1.6 DotNetZip Library",
    "ReleaseVisibleToPublic": true,
    "Priority": {
      "Name": "Low",
      "Severity": 50,
      "Id": 1
    },
    "ProjectName": "DotNetZip",
    "ReportedDate": "2008-08-06T05:49:54.627-07:00",
    "Status": {
      "Name": "Closed",
      "Id": 4
    },
    "ReasonClosed": {
      "Name": "Unassigned"
    },
    "Summary": "Save can't handle zero byte files",
    "Type": {
      "Name": "Issue",
      "Id": 3
    },
    "VoteCount": 1,
    "Id": 5722
  },
  "FileAttachments": [
    {
      "FileId": 1224,
      "FileName": "Testcase.zip",
      "DownloadUrl": ".\\1224"
    }
  ],
  "Comments": [
    {
      "Message": "I believe this problem has been fixed in the v1.5 library.  DotNetZip v1.5 was patched on July 21st.   Do you have the latest version? \r\nI just tested with that patched version and I could not reproduce this problem.  \r\n",
      "PostedDate": "2008-08-07T19:49:00.433-07:00",
      "Id": -2147483648
    },
    {
      "Message": "I believe this problem has been fixed in the v1.5 library.  DotNetZip v1.5 was patched on July 21st.   Do you have the latest version? \r\nI just tested with that patched version and I could not reproduce this problem.  \r\n",
      "PostedDate": "2008-08-07T19:49:35.7-07:00",
      "Id": -2147483648
    },
    {
      "Message": "I am using the latest release (1.6 preview) now but 1.5 also has the problem . I don't see the zero byte fix in the list of issues of 1.5. I do see the following:\r\n'Fixed a bug relating to reading and writing zip files with zero entries.'  but  this is a different problem.\r\nCode:\r\nZipFile zip = new ZipFile(someZipfileName);\r\nzip.Password = somePassword;\r\nzip.AddDirectory(someDirectory, \"\");\r\nzip.Save();\r\n\r\n",
      "PostedDate": "2008-08-12T02:32:30.8-07:00",
      "Id": -2147483648
    },
    {
      "Message": "I have the same problem with latest 1.5 library(today)\r\n\r\nWhen i pass in lbrary a temporary file created by Path.GetTempFile... it throws exception \"Could not read signature - no data!\"!\r\n\r\nIf i will delete zero length temp file before zipping i could not relay that this temp file already got another application\r\n\r\nCould you please fix it?",
      "PostedDate": "2008-08-12T06:03:30.267-07:00",
      "Id": -2147483648
    },
    {
      "Message": "i've downloaded library from binaries package!",
      "PostedDate": "2008-08-12T06:04:21.11-07:00",
      "Id": -2147483648
    },
    {
      "Message": "Sorry, I don't understand what you are doing.  I read what you wrote:  \r\n   \"When i pass in lbrary a temporary file created by Path.GetTempFile... it throws exception \"Could not read signature - no data!\"!\"\r\n\r\nThis error can happen when the library READS a zip file.   But I understood that you were CREATING a zip file.   Can you clarify for me, what exactly are you doing in the code?  Can you show me the code that causes this problem? \r\n\r\nAlso, I do not understand what you mean by \"If i will delete zero length temp file before zipping i could not relay that this temp file already got another application\"\r\n\r\nIf you are zipping a file, then how would you zip it, if you delete it before zipping it?  I really have a basic misunderstanding here.  Show me the code please.\r\n   \r\n\r\n\r\n\r\n",
      "PostedDate": "2008-08-12T13:41:02.27-07:00",
      "Id": -2147483648
    },
    {
      "Message": "Maybe what  you are doing is this:  CREATING a file with System.IO.Path.GetTempFileName .  And then you are calling the ZipFile constructor or the static Read() method using that filename. \r\nThis will not succeed.  The file you create via GetTempFileName is not a valid zip file, and cannot be read.  \r\n\r\nIf you want to create a new ZipFile using a temporary filename, I suggest you try System.IO.Path.GetRandomFileName , which does not CREATE the file in question.  The name returned from this method is a cryptographically generated string of random characters, and that gives you a good guarantee that there will be no contention for the filename. If you want to further uniquify the name, you can add a timestamp, an assembly name, or whatever else you want.  Then, pass the result to the ZipFile() constructor and call Save() and it will work correctly.  \r\n\r\nI could imagine you asking me to modify the Zip library to accept the name of a zero-byte file in the constructor for the ZipFile class.  But this does not guarantee a unique association between the file and your application.  It is possible that some other app will generate the same filename and overwrite you.   You will get a stronger guarantee if you use System.IO.Path.GetRandomFileName .  But in either case, I think it is a very unlikely scenario, unless you are creating many many zipfiles concurrently, and constantly.  Like if you are trying to create 100's of zipfiles per second.  If that is not your scenario, then I think it is unlikely you will see name collisions.  And in that case you probably want to use the approach I suggested above anyway - to add the timestamp and the assembly name as \"salt\" to the basic randomized filename. \r\n\r\n\r\n\r\n\r\n\r\n\r\n",
      "PostedDate": "2008-08-12T13:55:46.92-07:00",
      "Id": -2147483648
    },
    {
      "Message": "@Cheeso: the problem that dr Web writes is NOT the same problem as I have. I am not using temporary files or whatever.\r\nPlease try to reproduce the problem using the code that I wrote earlier. I am just using the simple AddDirectory method of the zipfile object. If the directory comtains a zero byte file, the save method will fail. Try setting the password of the zipfile, this might trigger the exception.\r\nHope you can fix this, otherwise I'll have to change back to sharpziplib which I don't like :-(",
      "PostedDate": "2008-08-14T02:07:47.17-07:00",
      "Id": -2147483648
    },
    {
      "Message": "@Albatros - happy to have a look.  Rather than have me guess at how to reproduce it, can you please provide a test case that reliably reproduces the problem you are having?  I would like to see the code that creates the directory, creates the zero-byte file within that directpry, and zips up the directory, thus causing the problem.  \r\n\r\nI have multiple test cases that do exactly this, following the pseudo code you provided, and they do not exhibit any problems. \r\nI have also tried it manually with zipit.exe, and I cannot produce the problem you reported. \r\n\r\nI need REAL code, not pseudo code. \r\nI believe you are having a problem, it's just that I don't know how to reproduce it, and don't know how to fix it.\r\n",
      "PostedDate": "2008-08-14T21:44:28.243-07:00",
      "Id": -2147483648
    },
    {
      "Message": "@Cheeso:\r\nThanks for answering. I have attached a testcase project. Hope you can check it out, Also contains a word document with screenshot of error.",
      "PostedDate": "2008-08-15T01:41:55.33-07:00",
      "Id": -2147483648
    },
    {
      "Message": "",
      "PostedDate": "2008-08-15T01:41:56.03-07:00",
      "Id": -2147483648
    },
    {
      "Message": "Got it.  Ok, I reproduced the error here.  Very clear. I see the problem. I think the fix is straightforward.  Need to do some testing to make sure .",
      "PostedDate": "2008-08-15T16:32:11.193-07:00",
      "Id": -2147483648
    },
    {
      "Message": "",
      "PostedDate": "2008-08-15T16:32:28.35-07:00",
      "Id": -2147483648
    },
    {
      "Message": "",
      "PostedDate": "2008-08-15T18:36:45.823-07:00",
      "Id": -2147483648
    },
    {
      "Message": "Thanks Cheeso! Just curious, why didn't your test case reproduce the error?",
      "PostedDate": "2008-08-16T10:34:26.46-07:00",
      "Id": -2147483648
    },
    {
      "Message": "",
      "PostedDate": "2013-02-21T18:44:43.9-08:00",
      "Id": -2147483648
    },
    {
      "Message": "",
      "PostedDate": "2013-05-16T05:32:41.327-07:00",
      "Id": -2147483648
    }
  ]
}