This project is read-only.

Unhandled Exception: System.IO.FileLoadException:

Mar 9, 2009 at 9:41 PM
We are getting the following exception when we try to run a self extracting zip. (.exe)

Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'Ionic.Zip, Version=, Culture=neutral, PublicKeyToken=edbe51ad942a3f5c'
 or one of its dependencies. Invalid pointer (Exception from HRESULT: 0x80004003 (E_POINTER))File name: 'Ionic.Zip, Version=, Culture=neutral,
PublicKeyToken=edbe51ad942a3f5c' --->
System.NullReferenceException: Object reference not set to an instance of an object.
   at Ionic.Zip.WinFormsSelfExtractorStub.Resolver(Object sender, ResolveEventArgs args)
   at System.AppDomain.OnAssemblyResolveEvent(String assemblyFullName)
   at Ionic.Zip.WinFormsSelfExtractorStub..ctor()
   at Ionic.Zip.WinFormsSelfExtractorStubProgram.Main()

Here's how we are utilizing the DotNetZip:
- Version: Ionic.Zip.dll v
- Method invoked to create Self Extracting zip.   SaveSelfExtractor   Type: Ionic.Zip.SelfExtractorFlavor.WinFormsApplication
- Wrapped into our own framework and utilized through a Web Application.
- Web app calls our wrapper, which calls SaveSelfExtractor.  File is created and placed in inetpub directory with no issues or exceptions.

When we try to run the .exe that is created, we get the above exception.  We can resolve the issue by adding the Ionic.Zip.dll into the same folder as the .exe's, but this will not work our solution.
We need to be able to distribute the .exe's to other machines, that do not have Ionic.Zip.

- Adam

Mar 9, 2009 at 10:28 PM
Edited Mar 9, 2009 at 10:48 PM

Hi Adam,

I understand what you're saying. 

I just tried out your scenario here on v1.7.2.4 of the library, and could not reproduce it. 

any chance you could

  1. send me the app that fails, or any SFX you can create that fails?  (you could open a work item and attach a file there)
  2. send me source code that reliably reproduces the problem - in other words source code that you use to produce an SFX that will not run.  (ditto)


Totally separate questions:

  • why not update to the update of v1.7?    There were a few bug fixes, I believe unrelated to your problem.  Still, it should be an easy upgrade.
  • Why save the file in /inetpub?  Are you just downloading it to the browser?  Why not just save it directly to Response.OutputStream  ?

 EDIT: oh, wait, forget that last question.  You're saving an SFX.  I forgot.  The only way to save an SFX is to save to a file.

Mar 9, 2009 at 10:41 PM

Did you by any chance re-build the Ionic.Zip.dll from source at any point?

If you are savvy with .NET Reflector, you may be able to inspect the generated SFX within that tool to determine the exact dependencies.  Open the misbehaving assembly in Reflector.  Expland the "References" node for the SFX assembly, and you should see a dependency on Ionic.Zip.dll, as well as on System.Drawing and System.Windows.Forms.   There will be version numbers for all of these.  I would suspect that you will see v1.7.2.4 for the Ionic.Zip.dll there.  You should verify that this matches exactly with the Ionic.Zip.dll that is present in the \bin directory of your web app.  (load that file into Reflector as well)

That's where I would start, if you were able to send me your exe.

Mar 10, 2009 at 8:51 PM
I will see if we can send one of the SFX files. I'll need to put some dummy data into the .exe.  This may alter how it runs. I'll test it before I submit to ensure the problem is reproducible.

1. How/Where do I open a work item?
2. Which update would you recommend we use? .12? or go up top 1.8?

"Did you by any chance re-build the Ionic.Zip.dll from source at any point?" - No, we are using the pre compiled bits.

I'll fire up reflector and see if there are any missing references.

- Adam
Mar 11, 2009 at 8:45 AM
Open a work item on the "Issue Tracker" tab - up at the top of the page it is net to the "Discussions" tab, which shows in green in my browser.
I would stay with the latest version of 1.7, for now. 
I think 1.8 is pretty stable , but I find a bug every couple days.  So ... v1.7 is a safer choice.
Mar 11, 2009 at 9:09 PM
Follow up:
- Opened good vs bad files with several utilities: Redgate Reflector, ILDASM, CFF Explorer.
   Other than file name differences, there were no distinguishing differences between the files.
   I was able to extract the Ionic.Zip.dll (resource) from the bad .exe using CFF

We did try the build to see if there was a fix that may have resolved the issue.  No luck.

Unfortunately, we have run out of time to try and debug, so we have devised a work around for anyone else that may run up against this issue.

We have moved calling the Ionic.Zip methods out of our code behind and created a small driver program (console app) which we spin up from our web application.  We are then passing parameters from to the process and waiting for results.  This is done via System.Diagnostics.Process.Start method.

Not the best solution by far, but it allows us to continue down the path we have started.

Thank you for your help.

- Adam