473,471 Members | 1,953 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Synchronized TextWriters - change / reopen !?

In my multi-threaded application i'm getting to a point where I've got
the exception bellow:

------------------------------------------------------------------------
System.ObjectDisposedException: Cannot write to a closed TextWriter.
Server stack trace:
at System.IO.__Error.WriterClosed()
at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean
flushEncoder)
at System.IO.StreamWriter.Write(Char[] buffer, Int32 index, Int32
count)
at System.IO.TextWriter.WriteLine(String value)
at RemoteObject.DebugLogger.ExceptionLog(String aLogMessage)
at RemoteObject.DataAccessObject.ExecuteSQL(String aFuncName,
ArrayList aParameterList, DataSet& aDataset)
at
System.Runtime.Remoting.Messaging.StackBuilderSink .PrivateProcessMessage(MethodBase
mb, Object[] args, Object server, Int32 methodPtr, Boolean
fExecuteInContext, Object[]& outArgs)
at
System.Runtime.Remoting.Messaging.StackBuilderSink .SyncProcessMessage(IMessage
msg, Int32 methodPtr, Boolean fExecuteInContext)

Exception rethrown at [0]:
at
System.Runtime.Remoting.Proxies.RealProxy.HandleRe turnMessage(IMessage
reqMsg, IMessage retMsg)
at
System.Runtime.Remoting.Proxies.RealProxy.PrivateI nvoke(MessageData&
msgData, Int32 type)
at RemoteObject.DataAccessObject.ExecuteSQL(String aFuncName,
ArrayList aParameterList, DataSet& aDataset)
at RemoteClient.DataAccessClient.funct_name(Int32 comArrSize, Byte[]
i_appl_id, IntPtr*& o_icgdd_1v_r, IntPtr& no_of_rows_returned)
--------------------------------------------------------------------------

PS: I've used a TextWriter wrapper for StreamWriter class in order to
use the synchronization.

Thanks,
Papas

Nov 17 '05 #1
1 3410
Hi,

Well according to the exception the stream is closed , did you close it
previously?

post the code you are using otherwise.
cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation


<an******@gmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
In my multi-threaded application i'm getting to a point where I've got
the exception bellow:

------------------------------------------------------------------------
System.ObjectDisposedException: Cannot write to a closed TextWriter.
Server stack trace:
at System.IO.__Error.WriterClosed()
at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean
flushEncoder)
at System.IO.StreamWriter.Write(Char[] buffer, Int32 index, Int32
count)
at System.IO.TextWriter.WriteLine(String value)
at RemoteObject.DebugLogger.ExceptionLog(String aLogMessage)
at RemoteObject.DataAccessObject.ExecuteSQL(String aFuncName,
ArrayList aParameterList, DataSet& aDataset)
at
System.Runtime.Remoting.Messaging.StackBuilderSink .PrivateProcessMessage(MethodBase
mb, Object[] args, Object server, Int32 methodPtr, Boolean
fExecuteInContext, Object[]& outArgs)
at
System.Runtime.Remoting.Messaging.StackBuilderSink .SyncProcessMessage(IMessage
msg, Int32 methodPtr, Boolean fExecuteInContext)

Exception rethrown at [0]:
at
System.Runtime.Remoting.Proxies.RealProxy.HandleRe turnMessage(IMessage
reqMsg, IMessage retMsg)
at
System.Runtime.Remoting.Proxies.RealProxy.PrivateI nvoke(MessageData&
msgData, Int32 type)
at RemoteObject.DataAccessObject.ExecuteSQL(String aFuncName,
ArrayList aParameterList, DataSet& aDataset)
at RemoteClient.DataAccessClient.funct_name(Int32 comArrSize, Byte[]
i_appl_id, IntPtr*& o_icgdd_1v_r, IntPtr& no_of_rows_returned)
--------------------------------------------------------------------------

PS: I've used a TextWriter wrapper for StreamWriter class in order to
use the synchronization.

Thanks,
Papas

Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Frank | last post by:
Hi, In the javadocs regarding many of the java.util classes, it states that the classes are not synchronized, and suggest using the Collections.synchronizedX(...) methods for getting...
5
by: jackie | last post by:
public static String toGBString( String asciiStr ) { String s = ""; try { rtnStr = new String( ascii.getBytes(), "gb2312" ); } catch( Exception ex ) {} return s; }
5
by: Max Ischenko | last post by:
Hi, I wrote simple implementation of the "synchronized" methods (a-la Java), could you please check if it is OK: def synchronized(method): """ Guards method execution, similar to Java's...
4
by: Rich Sienkiewicz | last post by:
Some classes, like Queue and SortedList, have a Synchronized method which gives a thread safe wrapper object for these classes. But the lock() statement does the same thing. Is there any rules as to...
4
by: Zürcher See | last post by:
I have in a form a datagrid that display a dataset, but if I start a new thread that fill the dataset the program will crash, that's because the dataset is not synchronized, is not thread safe. I...
4
by: chrisben | last post by:
Hi I often use Queue.Synchronized method to create a queue for multithread writing. I also know I could use SyncRoot and lock to write Queue. Could anyone here please explain to me the pros and...
6
by: rmunson8 | last post by:
I have a derived class from the Queue base class. I need it to be thread-safe, so I am using the Synchronized method (among other things out of scope of this issue). The code below compiles, but...
8
by: ASP.Net programmer | last post by:
Hi, I have a few methods in a class that I want to synchronize (make sure they can't be used at the same time by multiple threads). As a Java programmer I just do this: public synchronized...
3
by: Ryan Liu | last post by:
Hi, What does ArrayList.Synchronized really do for an ArrayList? Is that equal to add lock(this) for all its public methods and properties? Not just for Add()/Insert()/Remvoe()/Count, but also...
2
by: Kanis | last post by:
(e.g. a file name g.py with class called "test") evreytime I change the content in test and saved , it will not update my script when I type >>> from g import test But it only work when I...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.