-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Labels
Description
I have a unit test that goes though some SharpZipLib methods.
Every once in a while it fails in a VM which the following error:
ModTime cannot be before Jan 1st 1970 (Parameter 'value')
at ICSharpCode.SharpZipLib.Tar.TarHeader.set_ModTime(DateTime value)
at ICSharpCode.SharpZipLib.Tar.TarHeader.ParseBuffer(Byte[] header, Encoding nameEncoding)
at ICSharpCode.SharpZipLib.Tar.TarInputStream.GetNextEntryAsync(CancellationToken ct, Boolean isAsync)
at ICSharpCode.SharpZipLib.Tar.TarInputStream.GetNextEntry()
The code that is throwing that exception is the below one and is ALWAYS called with input Array.Empty():
public static byte[] Dummy(this byte[] data) {
using var inStream = new MemoryStream(data);
using var outStream = new MemoryStream();
using var gzipStream = new GZipInputStream(inStream);
using var tarInputStream = new TarInputStream(gzipStream, Encoding.UTF8);
while (tarInputStream.GetNextEntry() is { } tarEntry) {
}
return outStream.ToArray();
}The "fun" part is that this NEVER happens in my local machine. Only in the CICD pipeline, once in a while.
The CICD pipeline is a newly booted ubuntu-20.04 container on Azure Devops.
Steps to reproduce
- Boot a ubuntu-20.04 container (freshly booted?)
- Run the function
- Repeat until it happens
Expected behavior
A dummy empty tar.gz archive should be enumerated
Actual behavior
An exception is (rarely) thrown.
Version of SharpZipLib
1.4.0
Obtained from (only keep the relevant lines)
- Package installed using NuGet