I need to have an anonymous pipe within the same process to allow stream based async communication between two libraries.
Everything works until I call the Stream.Read() - I get a UnauthorizedAccessException - Access to the path is denied. Any ideas?
using (var pipeServer = new AnonymousPipeServerStream(PipeDirection.Out))
using (var pipeClient = new AnonymousPipeClientStream(PipeDirection.In, pipeServer.SafePipeHandle))
{
// External lib should close server pipe when it's done
archFile.ExtractionFinished += (sender, args) => pipeServer.Close();
archFile.BeginExtractFile(archFileName, pipeServer);
var buf = new byte[1000];
int read;
while ((read = pipeClient.Read(buf, 0, buf.Length)) > 0)
{ ... }
}