-
Notifications
You must be signed in to change notification settings - Fork 116
Description
I'm using Dokan.NET to build a virtual file system. In CreateFile, I fetch PDF bytes from a remote server, save them to disk, and create a FileStream, storing it in info.Context. In ReadFile, I retrieve this stream, set its position using offset, and copy data into the buffer with stream.Read(buffer.Span).
Problem:
When I double-click the PDF file from the virtual drive, Windows copies it to a temporary folder and attempts to open it with Adobe Reader, but the app shows "access denied" or "file corrupted." However, if I manually open the copied file, it’s intact and opens correctly.
Note:
This disk-based approach was implemented only to help isolate the issue. My original design used a service that streamed file chunks on demand, but that didn’t work reliably with Adobe Reader, so I switched to this method for clearer diagnostics.
Relevant Code:
csharp
// CreateFile
File.WriteAllBytes(path, fileBytesFromServer);
info.Context = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read);
// ReadFile
stream.Position = offset;
bytesRead = stream.Read(buffer.Span);
Request:
I’d like to know if there are known limitations or best practices for serving large binary files (like PDFs) via Dokan.NET, especially when accessed by applications like Adobe Reader that perform multiple concurrent reads.