Closed NavigatorXia closed 4 years ago
It would mean the value was not or no longer a stream in the context. Do you have a way to reproduce it? Could it be a directory someone try to read? Directory do not have any context stream
It's not a directory, I'm not sure if there are some problem in multi-thread or async read/write.
and i also get a error like: System.ObjectDisposedException:“Cannot access a closed file.”
BTW, I use it to run a developed edition of UE4(Unreal Engine).
@NavigatorXia It might be a read happening after close.
The logic missing here would be to reopen the stream during read / write if the stream is invalid.
@NavigatorXia Did I answer your question correctly?
Thanks for your reply.
I use the sample "mirror" to do the test, and its readfile has code as following: if (info.Context == null) // memory mapped read { 。。。 } else // normal read { var stream = info.Context as FileStream; lock (stream) //Protect from overlapped read .... the error occurred in "lock(stream)", it shows stream is null(the info.Context also is null), but we have checked it by “if (info.Context == null) ”