Quantcast
Channel: sharpcompress Discussions Rss Feed
Viewing all articles
Browse latest Browse all 239

New Post: ArgumentOutOfRangeException during tar file creation

$
0
0

I have a simple CompressFile wrapper method:

 

privatestring CompressFile(string infile, string outfile)
{using (var fs = File.OpenRead(infile))using (var w = File.Open(outfile, FileMode.OpenOrCreate, FileAccess.Write))using (var ws = WriterFactory.Open(w, ArchiveType.Tar, CompressionType.BZip2))
    {
        ws.Write(outfile, fs);
    }return outfile;
}

 

When I use this method on a tab separated text file that I generate in a different part of the program, I run into a ArgumentOutOfRangeException in SharpCompress.Common.Tar.Headers.TarHeader.Write(Stream output):

   at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)   at System.String.Substring(Int32 startIndex, Int32 length)   at SharpCompress.Common.Tar.Headers.TarHeader.Write(Stream output)  at SharpCompress.Writer.Tar.TarWriter.Write(String filename, Stream source, Nullable`1 modificationTime, Nullable`1 size)   at SharpCompress.Writer.Tar.TarWriter.Write(String filename, Stream source, Nullable`1 modificationTime)   at SharpCompress.Writer.IWriterExtensions.Write(IWriter writer, String entryPath, Stream source)

The exported file is being created with the FileHelpers library and is a simple tab separated file with newlines to separate records.


Viewing all articles
Browse latest Browse all 239

Trending Articles