login about faq

Hello, I am having this strange issue where I am issuing an ExtractInto call on a ZipEntry. I am unable to find an example of how to check for error. I am using events OnAbortCheck and OnPercentDone. I am checking if (!zipEntry.LastMethodSuccess) to throw an error to the user. Is this the correct way? Can anyone point me to an example to trap errors inside the method call. Any help is appreciated.

asked Aug 12 '16 at 14:42

keeve's gravatar image


Error is: WindowsError: The handle is invalid. Failed to read filebytes to buffer. Failed to get bytes at current index: <somenumber> Data source read failed.

(Aug 12 '16 at 14:45) keeve

Here is the full lasterrortext

LastError Text

    DllDate: Mar 11 2016
    UnlockPrefix: SHAREC.ZPX0617
    Username: AISDEVWS01:kpratap
    Architecture: Little Endian; 32-bit
    Language: .NET 4.0
    VerboseLogging: 1
                extraHeaderId: 0x9901
                extraHeaderLen: 7
                extraHeaderId: 0xa
                extraHeaderLen: 32
              mode: 3
              saltSize: 16
                mode: 3
                  salt: A0F0 C98E A7AA 23FF 7E97 3024 3860 B4BD
                  salt_len: 16
                  key_len: 66
                  key: D52F E5F1 EE1E AF22 A7B8 D20F 9B8F A9BF
502D 064D 2198 7DC1 8339 C1A3 727E 4883
06E0 240E 2BE1 66AE FFCA A8D9 5738 8A6F
CC1C 0BC4 A7BC EA6D AAF9 F311 4F92 F787
                key_length: 32
                kbuf: D52F E5F1 EE1E AF22 A7B8 D20F 9B8F A9BF
502D 064D 2198 7DC1 8339 C1A3 727E 4883
                passwordVerifier: 90C1
              aesVerificationBytes: 90C1
                  WindowsError: The handle is invalid.
                  Failed to read file bytes to buffer.
                  Failed to get bytes at current index.
                  curIndex: 145686698
                  Data source read failed.
                Inflate from source failed.
        Unzip failed
        path: C:UserskpratapDocumentsf53exhnq.4puENTIREFILE.PDF



answered Aug 12 '16 at 14:57

keeve's gravatar image


edited Aug 12 '16 at 15:17

chilkat's gravatar image

chilkat ♦♦

Thanks. I'm having a look. (I can see from the UnlockPrefix in your LastErrorText that you are a customer with valid support..)

(Aug 12 '16 at 15:09) chilkat ♦♦

Thanks. The zip file is on a share drive and kind of looks like this. \eqxdevserver01zFTPRootTIPPostOfficeRepository8020759303353074_CFT-S-AADF.zip The unzipped file when it is about a gig in size.

(Aug 12 '16 at 15:21) keeve

Also.. if it is a shared drive, then there is a network involved -- and that means a lot of data must be passing over a network if the drive is not local. Given that networks are not 100% reliable, this could be the source of the problem..

(Aug 12 '16 at 15:26) chilkat ♦♦

My only guess as to the cause of the problem is that you have multiple threads operating at the same time. Perhaps one thread is calling ZipEntry.ExtractInto, while another thread is closing the Zip object?

Could this be possible?


answered Aug 12 '16 at 15:22

chilkat's gravatar image

chilkat ♦♦

I was thinking the same thing about using a network drive. When I run from my dev machine connecting to this zip file, I have never had an issue so far. When I run from a RDP machine (it might be a virtual one), I get occasional issues. The QA person seems to get it a lot more from the QA workstation. Am I doing the right thing in terms of checking for error like this.

    public void OnAbortCheck(object source, Chilkat.AbortCheckEventArgs args)
        if (!zipEntry.LastMethodSuccess)
            _Cancelled = true;
            _lastErrorText = zipEntry.LastErrorText;
            ErrorLog.Logger.RecordError(new Exception("Unexpected Error on extract", new Exception(_lastErrorText)));
            lblUnzipStatus.Text = "Unexpected Error on extract, operation cancelled. Please retry. ";
            buttonViewPdf.Enabled = true;
            buttonViewPdf.Text = "View PDF Image";
        if (_Cancelled)
            args.Abort = true;
            lblUnzipStatus.Text += "..Extract cancelled.";

Here is the ExtractInfo call. zipEntry.VerboseLogging = _isDevQa;

        zipEntry.HeartbeatMs = 200;
        zipEntry.EnableEvents = true;
        zipEntry.OnPercentDone += OnPercentDone;
        zipEntry.OnAbortCheck += OnAbortCheck;
        _lastErrorText = string.Empty;
        _success = zipEntry.ExtractInto(docPath);

My main focus right now is to trap the error and ask the user to try again. Am I checking for the error correctly? This is a Winforms application, btw.


answered Aug 12 '16 at 15:40

keeve's gravatar image


There's no reason to try to trap the error because when the error occurs, the method (ExtractInfo) returns immediately. The AbortCheck would only be used if you want to provide a means for aborting a method call that is humming along just fine without any errors.

(Also, the LastMethodSuccess wouldn't be set until the method is already in the act of returning.)


answered Aug 12 '16 at 15:51

chilkat's gravatar image

chilkat ♦♦

Essentially, should I then check _success after the ExtractInfo Call? Am a bit confused.


answered Aug 12 '16 at 16:02

keeve's gravatar image


Yes, that is correct. When the "WindowsError: The handle is invalid." is hit, it's not like the method is going to continue onward -- it's going to return immediately. If the method has not yet returned, then it's still proceeding without errors. If the method returns within an error status, then something failed.

(Aug 12 '16 at 16:06) chilkat ♦♦

I think I got it working.

(Aug 12 '16 at 16:40) keeve

Thanks for your help.

(Aug 12 '16 at 16:40) keeve
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: Aug 12 '16 at 14:42

Seen: 937 times

Last updated: Aug 12 '16 at 16:40

powered by OSQA