Comments (11)
Hi, there is a pull request from @sudoudaisuke
I have not yet merged (sorry for that)
b9a7b0d
It solve exactly this problem.
from sevenzipextractor.
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.
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.
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.
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.
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.
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.
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.
@Miles8of9 hi, thanks for reminding about this. I will fix this till weekend.
from sevenzipextractor.
another reminder 😉
but anyways, I want to THANK YOU developers very much for your work!
from sevenzipextractor.
- 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)
- . HOT 1
- Update 7z.dll to latest (v19.x) HOT 3
- Zip files over 4 gig. HOT 3
- Unable to cast COM object of type 'System.__ComObject' to interface type 'SevenZipExtractor.IInArchive'. HOT 1
- Application crash while getting Entries | System.AccessViolationException: "Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
- Is there a thread-safe way to extract files? HOT 1
- Exception "Unable to open archive" received when opening valid 7z archives HOT 7
- Progress event HOT 5
- I am unable to extract an .exe (7z self extracting archive) using SevenZipExtractor HOT 2
- How to chanage unzipped file folder? HOT 1
- NET6 support
- Is it possible to extract files from single zip file in parallel HOT 4
- [Bug]: V1.0.17 Nuget ships with 1.0.16 version and breaks the manifest reference lookup in tests etc. HOT 2
- Unable to initialize SevenZipHandle / Access Denied .NET 4.8??? HOT 2
- Decompression is too slow HOT 2
- Encrypted rar5 format is not supported I guess? HOT 1
- Exception : The string was not recognized as a valid DateTime HOT 6
- Solid Extract to MemoryStream or List HOT 1
- Gzip Signature HOT 1
- Signature Offsets
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sevenzipextractor.