473,513 Members | 2,669 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problems using FileStream in a seperate AppDomain

Hey,

I've created a very simple test app to try and fix a problem I'm
having. Basically I'm trying to log to a text file from a class in a
seperate app domain that I've created. When I first create the
AppDomain I'm able to log. However, I have the requirement that I'll
have to tear down the AppDomain and then load it back up again. When I
do this I no longer get any logging.

Note that the first thing I thought of is that the file was somehow not
being release, but I've modified the code below to create with a
different filename each time the AppDomain is loaded with no success.

Any help would be appreciated!

***** Text Logger *****

using System;
using System.IO;
using System.Text;

namespace prairieFyre.IQRealtimeClient
{
public class TestLogger : MarshalByRefObject
{
StreamWriter m_fileWriter;

public TestLogger()
{
FileStream stream = new FileStream("TestLogger.txt",
FileMode.Append, FileAccess.Write, FileShare.ReadWrite);
m_fileWriter = new StreamWriter(stream);

}

public void WriteText()
{
m_fileWriter.WriteLine("THIS IS MY TEST!");
m_fileWriter.Flush();
}
}
}
******* Test App *******

(this loads the AppDomain)
m_realtimeAppDomain = AppDomain.CreateDomain("Realtime AppDomain");
TestLogger testLogger =
(TestLogger)m_realtimeAppDomain.CreateInstanceAndU nwrap("RealtimeClient",
"prairieFyre.IQRealtimeClient.TestLogger");

testLogger.WriteText();
testLogger.WriteText();

(This is how I unload the AppDomain)
AppDomain.Unload(m_realtimeAppDomain);
m_realtimeClient = null;

Aug 18 '06 #1
0 846

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

Similar topics

4
3103
by: Shane Mergy | last post by:
i have a program that reads through an ini file and does stuff so far the only thing i am having trouble with is the writing to the ini file. if the section is alreadey there i want to do a search...
9
39661
by: Lawrence Oluyede | last post by:
I have a list of strings and i'd like to build up an enum from them... is there a way to do that? Thanks in advance. -- Lawrence "Rhymes" Oluyede http://loluyede.blogspot.com
1
2144
by: Andreas Håkansson | last post by:
Hello, I'm using the WebRequest class to download a few files of a webserver. I use async io to fecth the data. My problem is that the first file works like a charm, and the second file loads...
1
1281
by: Kiana Toufighi | last post by:
Hi, I have a simple CGI program that allows that user to upload a file. However, since accessing the the value of the uploaded file using the value attribute or the getvalue() method reads the...
1
1589
by: Dan Dorey | last post by:
Hey, I've created a very simple test app to try and fix a problem I'm having. Basically I'm trying to log to a text file from a class in a seperate app domain that I've created. When I first...
0
1703
by: neoret | last post by:
Hello. I have developed an application (an office addin).The application works fine with no error messages on my devoping machine (that machine is not connected to any domains). I have...
0
1124
by: neoret | last post by:
Hello. I have developed an application (an office com addin).The application works fine with no error messages on my devoping machine (that machine is not connected to any domains). I have...
2
3049
by: Andez | last post by:
I've wrote a windows service that performs simple functions within our application. To ensure safe running of the service - if it errors we want to know where when how - it logs to a text file - in...
1
3424
by: nicerun | last post by:
I'm using the Application_Start event at Global.asax.cs to invoke thread that do some job. I know that Application_Start event occurs when the very first request to Web Application received. -...
0
7257
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
7157
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...
0
7379
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7535
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7521
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...
1
5084
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
3232
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1591
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
798
muto222
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.