M
Michael Lofgren
Hi,
(Apologies for the resend, but I forgot to add the subject previously)
Below is an excerpt from my code. When I run it, the I sometimes (one every
three times?) get a System.IO.IOException, with no error description. The
exception seems to occur when the flush occurs... With autoflushing on
Write() causes the exception, without autoflushing Flush() causes the
exception, and commenting out the Flush() results in the Close() causing the
exception.
Everytime the exception occurs, two identical lines are appended to my file
instead of one.
Can anyone tell me what is causing this, or how to track it down further?
I've referenced SR.dll in my project, it didn't improve the content of the
error message.
I am running this on CE 5, .NET 1.1 (I think).
try {
//Check directory existence
if (!Directory.Exists(eventLogPath)) {
Directory.CreateDirectory(eventLogPath);
}
StreamWriter w;
w = File.AppendText(eventLogPath + filename);
w.AutoFlush = true;
w.Write(eventstr);
w.Flush();
w.Close();
} catch (Exception x) {
MessageBox.Show("Exception thrown from EventLog.RecordEvent(): " +
x.ToString());
}
Thanks in advance,
Michael
(Apologies for the resend, but I forgot to add the subject previously)
Below is an excerpt from my code. When I run it, the I sometimes (one every
three times?) get a System.IO.IOException, with no error description. The
exception seems to occur when the flush occurs... With autoflushing on
Write() causes the exception, without autoflushing Flush() causes the
exception, and commenting out the Flush() results in the Close() causing the
exception.
Everytime the exception occurs, two identical lines are appended to my file
instead of one.
Can anyone tell me what is causing this, or how to track it down further?
I've referenced SR.dll in my project, it didn't improve the content of the
error message.
I am running this on CE 5, .NET 1.1 (I think).
try {
//Check directory existence
if (!Directory.Exists(eventLogPath)) {
Directory.CreateDirectory(eventLogPath);
}
StreamWriter w;
w = File.AppendText(eventLogPath + filename);
w.AutoFlush = true;
w.Write(eventstr);
w.Flush();
w.Close();
} catch (Exception x) {
MessageBox.Show("Exception thrown from EventLog.RecordEvent(): " +
x.ToString());
}
Thanks in advance,
Michael