This project is read-only.

DotNetZip failed after migrating app

Oct 8, 2012 at 6:32 PM

I am using DotNetZip unmodified in an app for some time. I recently moved the app from one computer to a newer one and DotNetZip is now failing. To make maters more complicated I have a second app that I migrated over a week before, that works just fine.

Error: Could not load file or assembly 'Ionic.Zip, Version=, Culture=neutral, PublicKeyToken=edbe51ad942a3f5c' or one of its dependencies. Access is denied.

This happens when the first function referring to a ZipFile type variable attempts to load.

Here are the key diferences between the systems:
[Old System/New System]
OS: XP/Win7
VS version: 2008/2010
Target CPU: msil/x86

Both target .Net 3.5 and use the same version of Ionic.Zip.dll.

A very similar app (using this same configuration) that a week earlier made the same transition, also using the same dll, is working just fine.

Any idea as to what I should look for here?


Oct 9, 2012 at 12:28 AM

I found a solution. Still working on an explanation.

In the app with the error I am using DotNEtZip only within a worker thread. The Iconic.Zip.Dll assembly isn't actually loaded at runtime until it is referenced in a method, since that is in a worker thread the worker thread was attempting to load the assembly, which failed.

I found that if I create a ZipFile object on load in the main thread then the dll is loaded by the main threat, which suceeded. Then, when the worker thread tried to use it later it was already loaded into the AppDomain and so it just worked.

I still don't understand why it worked in the other App, which is also using it in a worker thread. I will post here if I figure it out.