09-17-2018 11:52 AM
I'm using the MGI SharpZipLib library so that I can get around the known issue with 2GB file size limits for zip files using the native and OpenG libraries. When I try to verify if a file is already present in the zip using the List Zip Contents VI, it causes havoc and throws errors.
Here's what I've come up with:
Error 1172 occurred at Constructor Node Error creating instance of DiskArchiveStorage in assembly ICSharpCode.SharpZipLib.Zip.DiskArchiveStorage, ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, (System.NullReferenceException: Object reference not set to an instance of an object.)
Error 1172 occurred at Invoke Node System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
Inner Exception: System.NotSupportedException: Stream does not support writing.
Error 1172 occurred at Invoke Node System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
Inner Exception: System.NotSupportedException: Stream does not support writing.
In all cases, the archives seem to be OK to open with Windows Explorer, so they don't appear to be corrupt.
Anyone had this problem before or know of a better way to see if a file exists in the zip archive?
Oh, using LV2014 SP1 x64 on Win10.
Thanks!
Cranky
09-17-2018 04:16 PM
If you have a problem with the MGI Library (which uses SharpZipLib), you might get in touch with David Moore, of Moore Good Ideas, who probably "pointed" you to this method. If anyone is likely to have a suggestion, he'd be my best guess (and he truly does have Good Ideas).
Bob Schor
09-18-2018 07:30 AM
Hi Bob,
I was thinking the same thing, but wanted to post the issue publicly, for posterity. I'll try and get a hold of them through their site.
Thanks!
09-18-2018 09:20 AM - edited 09-18-2018 09:26 AM
Looking inside Add File.vi, the error is thrown by ZipFile.CommitUpdate. The specific error code description comes from the Write() method, which is way down the call chain from CommitUpdate.
/// <summary> /// Writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written. /// </summary> /// <param name="buffer">An array of bytes. This method copies count bytes from buffer to the current stream.</param> /// <param name="offset">The zero-based byte offset in buffer at which to begin copying bytes to the current stream.</param> /// <param name="count">The number of bytes to be written to the current stream.</param> /// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception> /// <exception cref="T:System.NotSupportedException">The stream does not support writing. </exception> /// <exception cref="T:System.ObjectDisposedException">Methods were called after the stream was closed. </exception> /// <exception cref="T:System.ArgumentNullException">buffer is null. </exception> /// <exception cref="T:System.ArgumentException">The sum of offset and count is greater than the buffer length. </exception> /// <exception cref="T:System.ArgumentOutOfRangeException">offset or count is negative. </exception> public override void Write(byte[] buffer, int offset, int count) { baseStream_.Write(buffer, offset, count); }
/// <summary>
/// Writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.
/// </summary>
/// <param name="buffer">An array of bytes. This method copies count bytes from buffer to the current stream.</param>
/// <param name="offset">The zero-based byte offset in buffer at which to begin copying bytes to the current stream.</param>
/// <param name="count">The number of bytes to be written to the current stream.</param>
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
/// <exception cref="T:System.NotSupportedException">The stream does not support writing. </exception>
/// <exception cref="T:System.ObjectDisposedException">Methods were called after the stream was closed. </exception>
/// <exception cref="T:System.ArgumentNullException">buffer is null. </exception>
/// <exception cref="T:System.ArgumentException">The sum of offset and count is greater than the buffer length. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">offset or count is negative. </exception>
public override void Write(byte[] buffer, int offset, int count)
{
throw new NotSupportedException();
}
Is it possible that something in the List Zip Contents.vi is clobbering something else in the zip file and preventing the stream from being accessible?
The crazy thing is that I swear I had it working correctly once, but only once. Attached is a version that automatically lists the contents if the archive exists.
09-25-2018 08:26 AM
So after more experimenting, it loooks like any attempt to add files to an existing zip archive throws the System.NotSupportedException. Very frustrating.
I haven't heard back from MGI, nor from the SharpZipLib folks on their github site. It occurred to me that this might be related to antivirus software,
but I'll have to fight with IT to get anywhere with testing that out.
In the unlikely event that I get resolution to this, I'll try and remember to post an update.
12-20-2018 11:44 AM
Just posting an update for posterity.
I'm aware that I could just run something else on the command line, but these operations can take 30-90 minutes to complete. I'm not cool with just leaving the LabVIEW front panel with a stopped progress bar and a busy cursor because it just looks like the program is stuck.
So I'm basically waiting for RolfK to find the time to update the OpenG installer so that it doesn't bonk as the next step.