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

S

shapper

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
 
F

Family Tree Mike

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

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...
 
J

Jeff Johnson

shapper said:
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?

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.
 
S

shapper

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...

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 ...
 
F

Family Tree Mike

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 ...

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top