SharpCompress unable to unzip few tar.gz #84

Open
opened 2026-01-29 22:06:21 +00:00 by claunia · 0 comments
Owner

Originally created by @HrishikeshSingh on GitHub (Feb 16, 2016).

I am using SharpCompress nuget package to unzip files.
There are few files that SharpCompress is unable to unzip.
You can get the file from the link https://github.com/isagalaev/highlight.js/archive/8.9.1.tar.gz

Below is the exception that I am getting:

System.ArgumentNullException was unhandled
HResult=-2147467261
Message=Value cannot be null.
Parameter name: path2
ParamName=path2
Source=mscorlib
StackTrace:
at System.IO.Path.Combine(String path1, String path2)
at SharpCompress.Reader.IReaderExtensions.WriteEntryToDirectory(IReader reader, String destinationDirectory, ExtractOptions options)
at Sharpcompress.Program.Main(String[] args) in E:\2015Projects\Sharpcompress\Program.cs:line 24
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:

The code used to unzip is

        string filePath = @"E:\drop\highlight.js-8.9.1.tar.gz";
         using (Stream stream = File.OpenRead(filePath))
         {
             var reader = ReaderFactory.Open(stream);
             while (reader.MoveToNextEntry())
             {
                 if (!reader.Entry.IsDirectory)
                 {
                     reader.WriteEntryToDirectory(@"E:\drop\archive", ExtractOptions.ExtractFullPath | ExtractOptions.Overwrite);
                 }
             }
         }
Originally created by @HrishikeshSingh on GitHub (Feb 16, 2016). I am using SharpCompress nuget package to unzip files. There are few files that SharpCompress is unable to unzip. You can get the file from the link https://github.com/isagalaev/highlight.js/archive/8.9.1.tar.gz **Below is the exception that I am getting:** System.ArgumentNullException was unhandled HResult=-2147467261 Message=Value cannot be null. Parameter name: path2 ParamName=path2 Source=mscorlib StackTrace: at System.IO.Path.Combine(String path1, String path2) at SharpCompress.Reader.IReaderExtensions.WriteEntryToDirectory(IReader reader, String destinationDirectory, ExtractOptions options) at Sharpcompress.Program.Main(String[] args) in E:\2015Projects\Sharpcompress\Program.cs:line 24 at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException: The code used to unzip is ``` string filePath = @"E:\drop\highlight.js-8.9.1.tar.gz"; using (Stream stream = File.OpenRead(filePath)) { var reader = ReaderFactory.Open(stream); while (reader.MoveToNextEntry()) { if (!reader.Entry.IsDirectory) { reader.WriteEntryToDirectory(@"E:\drop\archive", ExtractOptions.ExtractFullPath | ExtractOptions.Overwrite); } } } ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/sharpcompress#84