Share via

Memory Stream Timeout Error in Visual Studio Professional 2023

Anonymous
2023-08-01T19:08:34+00:00

I have been working on this code for the past few months in which I am attempting to take the byte array of a pdf document, pass it through a memory stream and eventually parse the stream using Aspose.Pdf in order to read it and make a comparison. However, any time I reach the part of the code that is writing the stream, I receive an error message stating that “timeouts are not supported on this stream”. Can you please assist with this or know anyone that can help?

Here is the portion of the code. The highlighted portion is the part where the steam1 is throwing the timeouts error.

// Load the PDF files

            byte[] firstpdfbytes = System.Text.Encoding.UTF8.GetBytes(documentA);

            MemoryStream stream1 = new MemoryStream(firstpdfbytes);

            stream1.Write(firstpdfbytes, 0, firstpdfbytes.Length);

            Document document = new Document();

            document.Pages.Add();

            document.Save(stream1);

            var doc1 = stream1;

            byte[] secondPdfBytes = System.Text.Encoding.UTF8.GetBytes(documentB);

            MemoryStream stream2 = new MemoryStream();

            stream2.Write(secondPdfBytes, 0, secondPdfBytes.Length);

            Document document2 = new Document();

            document2.Pages.Add();

            document2.Save(stream2);

            var doc2 = stream2;

            // Extract text from the first PDF

            Document pdfDocument1 = new Document(doc1);

            TextAbsorber textAbsorber1 = new TextAbsorber();

            pdfDocument1.Pages.Accept(textAbsorber1);

            string text1 = textAbsorber1.Text;

Microsoft 365 and Office | Install, redeem, activate | For business | Other

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

1 answer

Sort by: Most helpful
  1. Anonymous
    2023-08-02T04:24:39+00:00

    Hi ErikaJZ,

    Thanks for posting in Microsoft Community.

    As your query is about Visual Studio and we have a specific channel Q&A Community coping with Visual Studio questions, I suggest you post a new thread (assign the tab Visual Studio) there for expert help.

    Sorry for that our category may have limited resources on checking on your concern further.

    Thanks for your understanding.

    George | Microsoft Community Moderator

    Was this answer helpful?

    0 comments No comments