Azure / azure-storage-net

Microsoft Azure Storage Libraries for .NET

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CanRead does not really reflect if the Blob can be read after disposing

Algo-ryth-mix opened this issue · comments

Which service(blob, file, queue, table) does this issue concern?

blob

Which version of the SDK was used?

4.0.3 (seems to be present in 4.0.4)

Which platform are you using? (ex: .NET Core 2.1)

.NETStandard 2.0

What problem was encountered?

BlobReadStreamBase reports that it can be read from, even after the internalBuffer has been disposed of

How can we reproduce the problem in the simplest way?

  • Create a [Blob] Stream
  • Dispose it
  • check the value of CanRead

Have you found a mitigation/solution?

Obviously Not disposing it is a good solution here to make it actually work, but it would be nice if "CanRead" and "CanSeek" would reflect the internal invalidness something like this:

public override bool CanRead
{
    get
    {
        return this.internalBuffer != null;
    }
}