Coder Social home page Coder Social logo

Comments (11)

adoconnection avatar adoconnection commented on July 26, 2024 1

Hi, there is a pull request from @sudoudaisuke
I have not yet merged (sorry for that)
b9a7b0d

It solve exactly this problem.

from sevenzipextractor.

geneb avatar geneb commented on July 26, 2024

I suspect this is due to the project being created as a console application for .Net Core 2.1 - it doesn't happen using .Net 4.7.1. Sorry for the noise.

from sevenzipextractor.

geneb avatar geneb commented on July 26, 2024

It actually appears to be related to ARJ files.
I stepped through the code in order to find the point where the exception was being triggered - in this case it's simply, "Specified cast is not valid".

I've been able to trace it as far as the routine starting at line #209 in ArchiveFile.cs:
private T GetProperty(uint fileIndex, ItemPropId name)
{
PropVariant propVariant = new PropVariant();
this.archive.GetProperty(fileIndex, name, ref propVariant);
// exception is thrown in the line below
T result = propVariant.VarType != VarEnum.VT_EMPTY
? (T) propVariant.GetObject()
: default(T);

        propVariant.Clear();

        return result;
    }

The caller of this is on line #171 of ArchiveFile.cs:
ulong size = this.GetProperty(fileIndex, ItemPropId.kpidSize);

The value of this.VarType going into GetObject() (line 78 in SevenZipInterface.cs) is VT_UI4. That causes the switch to execute the 'default' branch:
return Marshal.GetObjectForNativeVariant(PropHandle.AddrOfPinnedObject());
At that point my C#-fu is exhausted and I'm unable to discover the root cause of the issue.

help!

g.
Here's the file that is causing the issue:
http://annex.retroarchive.org/cdrom/cotc-1/BATCH/ANSIMATE.ARJ

from sevenzipextractor.

geneb avatar geneb commented on July 26, 2024

It's nice to see the fix is so simple. :) Any ETA on when you'll be able to do the merge?

tnx!

g.

from sevenzipextractor.

geneb avatar geneb commented on July 26, 2024

I just tried that patch by hand and it /almost/ works. Now it reaches line 180 in ArchiveFile.cs:
string method = this.GetProperty(fileIndex, ItemPropId.kpidMethod);
This triggers the exception "Cannot Convert type 'byte' to 'string'".
The variable propVariant.VarType in the GetProperty method is set to VT_UI1 at this point.
is the Method property actually supposed to be a string? In the file "Methods.txt" doc file that's in the LZMA SDK file (https://www.7-zip.org/sdk.html) it shows that the compression method uses an arbitrary ID length, but can't exceed 63 bits (8 bytes). Wouldn't a long be more appropriate for that property type? I don't see anywhere in the solution where Method is actually /used/.... Am I missing something?

[edit]
I changed the type to a long and it appears to be processing the ARJ files I have without a problem. I'll also test it against other types and update this comment if there's a problem.
tnx.
g.

from sevenzipextractor.

geneb avatar geneb commented on July 26, 2024

I could have sworn I updated this last week. The issue happened again with a different variable and archive type, so I just commented out the section that assigned the Method value entirely so I could continue my work.

g.

from sevenzipextractor.

geneb avatar geneb commented on July 26, 2024

Apparently the edit I did last week didn't take - nor did the comment I /just/ added seem to appear. I'll try again.
I ran into the same type conversion issue with a different type and decided to just comment out the Method assignment entirely so I could continue my work. At some point it should be investigated to see why on earth the 7Zip API seems to return different variable types for the same field type. Even if the origin archiving method uses the Method value differently, it should be presented as a "universal" type to the application that's consuming the api call.

g.

from sevenzipextractor.

Miles8of9 avatar Miles8of9 commented on July 26, 2024

Hi, sorry to disturb you, feel free to delete this comment if it violates your rules. I've hit this bug with arj files today. I see this issue is open since several months. Any chances it will be fixed any time soon? I would really need it. I've looked around but didn't find any other libraries that can read and uncompress .arj files.
Thanks for your understanding and your help.

from sevenzipextractor.

adoconnection avatar adoconnection commented on July 26, 2024

@Miles8of9 hi, thanks for reminding about this. I will fix this till weekend.

from sevenzipextractor.

oo-dev17 avatar oo-dev17 commented on July 26, 2024

another reminder 😉

but anyways, I want to THANK YOU developers very much for your work!

from sevenzipextractor.

adoconnection avatar adoconnection commented on July 26, 2024
  • Initial problem with ANSIMATE.ARJ is covered by test, (it works for me)
  • Cannot Convert type 'byte' to 'string' is known to be resolved

Closing for now. Please reopen if problem remains.

from sevenzipextractor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.