Opening PST from stream "Cannot read beyond the end of the stream"

I am opening a pst which comes from an attacment in an msg file. I can save the pst from the email and open it with outlook so I know the file is good. When I get the attachment and save it to a memorystream then open the stream like this:
pst = PersonalStorage.FromStream(MemoryStream)

I get this error.

System.IO.EndOfStreamException was caught
HResult=-2147024858
Message=Unable to read beyond the end of the stream.
Source=mscorlib
StackTrace:
at System.IO.BinaryReader.FillBuffer(Int32 numBytes)
at System.IO.BinaryReader.ReadUInt32()
at #=zS3PMPJNLxe2OUsFPzsAxjFJ3cYm16RbyjKOoaPY8DGmJ.#=z3ldsLOc=()
at #=zS3PMPJNLxe2OUsFPzsAxjFJ3cYm16RbyjKOoaPY8DGmJ.#=zYk7gd_Q=(Stream #=z6mD78mY=)
at #=zS3PMPJNLxe2OUsFPzsAxjFJ3cYm16RbyjKOoaPY8DGmJ…ctor(Stream #=z6mD78mY=)
at #=zEt2lbvn4Y__XT_FoycbRLFA09M6sQiINYNYkx7bBummJ…ctor(Stream #=z6mD78mY=)
at #=zMe5qSsZWooQM9Z05eLjU3dvvwXgAL4f59GeybAY=…ctor(Stream #=z6mD78mY=, Boolean #=z1cncAac=)
at Aspose.Email.Storage.Pst.PersonalStorage.FromStream(Stream stream, Boolean writable)
at Aspose.Email.Storage.Pst.PersonalStorage.FromStream(Stream stream)
at Breeze.frmBreeze.ProcessPSTFile(String lPSTFile, String lFileSourceRoot, Boolean lIsEmbedded, String lParent, List`1& AttList, Boolean printFile, MemoryStream printFileStream)
InnerException:

@salemantulsa,

Can you please share source file along with sample code so that we may further investigate to help you out.

I resolved the issue.

@salemantulsa,

It’s good to know things are fine on your end. Please share with us, if any further help is needed from our end.