This project is read-only.

NullRereferenceException when extracting

Oct 14, 2010 at 9:30 PM
Edited Oct 14, 2010 at 9:31 PM

Hey Cheeso, I am getting a NullReferenceException when extracting.  Here's the stackTrace

   at Ionic.Zip.ZipEntry.InternalExtract(String baseDir, Stream outstream, String password) in C:\DotNetZip\v1.9.1.5\DotNetZip\Zip Partial DLL\ZipEntry.Extract.cs:line 602
   at Ionic.Zip.ZipEntry.Extract(Stream stream) in C:\DotNetZip\v1.9.1.5\DotNetZip\Zip Partial DLL\ZipEntry.Extract.cs:line 112
   at MyConsole.Program.Main(String[] args) in C:\NetTiers\SourceAnywhere\NoMoreConsole\Program.cs:line 34
   at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

And here's my code. 

class Program
  static void Main(string[] args)
    Item1 item = DataRepository.Provider.Item1Provider.Get(new Item1Key(33170));
    FileInfo1 fileInfo = DataRepository.Provider.FileInfo1Provider.Get(new FileInfo1Key(item.BiFlInfoId));//Vss.GetFileBytes(47013);

    using (FileStream fileStream = File.Create(item.StrItnme))
      byte[] fileBytes = fileInfo.ImEfldat;
      byte[] fileBytes2 = fileInfo.ImFldat;

      MemoryStream memStream = new MemoryStream();
      memStream.Write(fileBytes, 0, fileBytes.Length);
      memStream.Write(fileBytes2, 0, fileBytes2.Length);
      memStream.Seek(0, SeekOrigin.Begin);

      ZipInputStream zipInStream = new ZipInputStream(memStream);

      ZipEntry zipEntry = zipInStream.GetNextEntry();


Am I doing anything really dumb and obvious to you?  I am trying to take those bytes which contain compressed data, get the first file contained in the compressed bytes and then write the decompressed file to the fileStream.


It appears that


 is failing in ZipEntry.Extract.cs

Oct 14, 2010 at 11:04 PM

Seems like a bug!

Oct 14, 2010 at 11:04 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Mar 9, 2011 at 10:44 PM

I added to the work item another code example and what I found on the issue after stepping through the source code.  I hope my addition helps push a fix out for the work item soon.