question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

.net core zip+aes ReadAsync failed on one of files

See original GitHub issue

Steps to reproduce

1.open archive with password “TestStorage” 2.try extract file “[www/autopilotandbridge/home.png]” using

var entry = _zf.GetEntry(path);
var zipStream = _zf.GetInputStream(entry);
var buffer = new byte[entry.Size];
var result = await zipStream.ReadAsync(buffer, 0, buffer.Length);

Expected behavior

file is extracted

Actual behavior

Got exception

TransformFinalBlock is not implemented and inputCount is greater than 0
   at ICSharpCode.SharpZipLib.Encryption.ZipAESTransform.TransformFinalBlock(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount)
   at System.Security.Cryptography.CryptoStream.<ReadAsyncCore>d__43.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at System.Security.Cryptography.CryptoStream.<ReadAsyncInternal>d__38.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at ResourceCollection.LazyZipDirectoryLoader.

Version of SharpZipLib

Obtained from (only keep the relevant lines)

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
ShadowTeologcommented, Feb 12, 2021

Yes, sync read work flawless. But this should be fixed somehow anyway or throw exception on any attempt to ReadAsync on ZIP+AES. Too many people will be puzzled by an error like: (only this file out of a hundred cannot be read), a lot of projects will be moved to .net 5.0 from .net Framework

0reactions
Numpsycommented, May 8, 2021

@ShadowTeolog You should no longer get this error with the new 1.3.2 release, though the stream reads won’t actually be async yet.

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - How to Async Files.ReadAllLines and await for results?
Apparently that the StreamReader "async" methods block the current thread for a considerable amount of time before returning an incomplete Task.
Read more >
File IO improvements in .NET 6 - .NET Blog
Learn about high-performance file IO features in NET 6, like concurrent reads and writes, scatter/gather IO and many more.
Read more >
StopNow(), Backup and cancellation tokens - Developer
Hi @gpatel-fr, I've been looking at the StopNow() issue, and attempting like you to looking at the code. My threading skills around async ......
Read more >
Issues to address to get out of beta - Developer
So the aftp issue seems to be fixed now. Has anyone else tested it in any way? I started testing with 2.0.4.29 yesterday,...
Read more >
ftp2? Evolving File Transfer with msgfiles
This low-level library wraps 3 rd party dependencies, including ZIP, AES, and JSON. It also includes the core TLS code including self-signed ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found