I created a virtual disk in C # using the Dokan library (.NET) and it works very well.
However, when I try to read a file from disk in another application, I get an exception when using operations that are read synchronously, such as System.IO.File.ReadAllText(...) .
Exception text: "Handle does not support synchronous operations. It may be necessary to modify the parameters of the FileStream constructor to indicate that the handle was opened asynchronously."
So, if I interpret this correctly, .NET seems to be trying to read the entire contents of the file in one synchronous operation, but Dokan does not seem to allow this.
But when using a method like ReadAllText , I have no control over how the FileStream constructed (not that this whole point of this method, after all, just gets the contents of the file without having to worry about streams, readers and buffers and much more?) .
Can I get Dokan to support synchronous I / O access on it, somehow handling the file? Or do I need to somehow live with the fact that synchronous operations are simply impossible for files hosted on Dokan (and I hope that they will not run any application that can ever work on my virtual disk)?
c # file io dokan
Andreas Baus
source share