Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

((System.IO.Stream)(s)).ReadTimeout. What might be wrong?

488 views
Skip to first unread message

shapper

unread,
May 20, 2010, 11:57:20 AM5/20/10
to
Hello,

I have a class that writes to a MemoryStream but I am getting a
strange error:

ReadTimeout = '((System.IO.Stream)(s)).ReadTimeout' threw an exception
of type 'System.InvalidOperationException'

base {System.SystemException} = {"Timeouts are not supported on this
stream."}

Source = "mscorlib"

WriteTimeout = '((System.IO.Stream)(s)).WriteTimeout' threw an
exception of type 'System.InvalidOperationException'

base {System.SystemException} = {"Timeouts are not supported on this
stream."}

Source = "mscorlib"

Any idea why might be wrong?

I really have no idea.

Thank You,

Miguel

Family Tree Mike

unread,
May 20, 2010, 12:26:13 PM5/20/10
to

I see you are posting this and at least one other question here and to
the forums as well.

MemoryStreams don't support timeouts and it is documented that some
streams throw an exception. If you have a timeout on a memory stream,
you have bigger concerns to worry about, like needing a new computer...

--
Mike

Jeff Johnson

unread,
May 20, 2010, 12:27:52 PM5/20/10
to
"shapper" <mdm...@gmail.com> wrote in message
news:98424b2f-c282-437a...@o39g2000vbd.googlegroups.com...

Yes: memory will never time out, so there's no point in MemoryStream
supporting these properties, and .NET is slapping you on the wrist for
accessing them when you shouldn't be.


Jeff Johnson

unread,
May 20, 2010, 12:31:59 PM5/20/10
to
"Family Tree Mike" <FamilyT...@ThisOldHouse.com> wrote in message
news:OAhuokD%23KHA...@TK2MSFTNGP05.phx.gbl...

> If you have a timeout on a memory stream, you have bigger concerns to
> worry about, like needing a new computer...

<snicker>


shapper

unread,
May 20, 2010, 1:20:28 PM5/20/10
to
On May 20, 5:26 pm, Family Tree Mike <FamilyTreeM...@ThisOldHouse.com>
wrote:

Sorry, both questions are related to the same problem.
The first is to solve it and the second is an alternative I am trying
to use to check if it solves it.

This is driving me crazy for hours and I decided to post in the two
different forums to try to get some help.
Didn't know the forums are related ....

Should I post only in one? Which one? I just though the communities
were different ...

Sorry but it sounds strange this is a problem with my computer ...

Maybe the fact that I am using NET 4.0?

The CSVWriter class is:
http://kbcsv.codeplex.com/SourceControl/changeset/view/42031#530488

I can't find what might be the problem ...

Family Tree Mike

unread,
May 20, 2010, 4:38:01 PM5/20/10
to

Find the line that the exception occurs. This line is presumably a
WriteTimeout or ReadTimout property on a stream being set. If this is
in the CSVWriter class, then the class has a bug, because it cannot work
with MemoryStreams. If it is your code, it is because you cannot set
the properties. Setting the properties throws this exception, not a
timeout during your read/write with the memory stream. This is because
memory streams do not timeout. They cannot time out.

--
Mike

0 new messages