SevenZipSharp
SevenZipSharp copied to clipboard
0x80131515 on CompressStream
Hi there, I am trying to compress from a stream downloaded from azure blob to a stream on azure blob container. Below is a snippet of the code I have:
//Prepare outputstream on azure blob container
using (var zipOutFileStream = await OpenWriteZipFileStream(outputFilename, blobContainerDestinationName,
blobConnection, new System.Threading.CancellationToken()))
{
SevenZip.SevenZipCompressor.SetLibraryPath(@"C:\Program Files\7-Zip\DLL\7z64.dll");
var compressor = new SevenZip.SevenZipCompressor
{
DirectoryStructure = false,
ArchiveFormat = OutArchiveFormat.SevenZip,
CompressionMode = CompressionMode.Create,
CompressionMethod = SevenZip.CompressionMethod.Default
};
//Download the file into inputstream
var blockBlobClient = new BlockBlobClient(blobConnection, blobContainerSourceName, inputFilename);
MemoryStream zipInFileStream = new MemoryStream();
await blockBlobClient.DownloadToAsync(zipInFileStream);
zipInFileStream.Position = 0;
compressor.CompressStream(zipInFileStream, zipOutFileStream);
}
On execution I get an exception with the following message "Execution has failed due to an internal SevenZipSharp issue (0x80131515 / -2146233067). Please report it to https://github.com/squid-box/SevenZipSharp/issues/, include the release number, 7z version used, and attach the archive."
For your reference: Release number: 1.4.0.345 7z version: 7z64 dll from your master branch as on 08/07/21
So 0x80131515 indicates "Operation is not supported", which could mean a lot of things. As far as I can tell (without running any Azure-specific code to verify) what you're trying to do is supported by SevenZipSharp/7z, but something could be off in your setup.
Is either the 7z dll or the zip archive you're downloading being blocked as an insecure remote file by Windows? What .NET version are you running this under, etc?