diff --git a/source/Cosmos.Kernel.LogTail/Cosmos.Kernel.LogTail.csproj b/source/Cosmos.Kernel.LogTail/Cosmos.Kernel.LogTail.csproj
index 2d7c2f26c..8f33b9477 100644
--- a/source/Cosmos.Kernel.LogTail/Cosmos.Kernel.LogTail.csproj
+++ b/source/Cosmos.Kernel.LogTail/Cosmos.Kernel.LogTail.csproj
@@ -52,6 +52,7 @@
+
UserControl
diff --git a/source/Cosmos.Kernel.LogTail/ErrorStrippingFileStream.cs b/source/Cosmos.Kernel.LogTail/ErrorStrippingFileStream.cs
new file mode 100644
index 000000000..44860a851
--- /dev/null
+++ b/source/Cosmos.Kernel.LogTail/ErrorStrippingFileStream.cs
@@ -0,0 +1,38 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.IO;
+
+namespace Cosmos.Kernel.LogTail
+{
+ public class ErrorStrippingFileStream : FileStream
+ {
+ public ErrorStrippingFileStream(string file)
+ : base(file, FileMode.Open, FileAccess.ReadWrite, FileShare.Delete | FileShare.ReadWrite)
+ {
+
+ }
+
+ public override int ReadByte()
+ {
+ int result;
+ while ((result = base.ReadByte()) == 0) ;
+ return result;
+ }
+
+ public override int Read(byte[] array, int offset, int count)
+ {
+ int i;
+ for (i = 0; i < count; i++)
+ {
+ int b = ReadByte();
+ if (b == -1)
+ return i;
+
+ array[offset + i] = (byte) b;
+ }
+ return i;
+ }
+ }
+}
diff --git a/source/Cosmos.Kernel.LogTail/MainForm.cs b/source/Cosmos.Kernel.LogTail/MainForm.cs
index d40aa9eda..d6bf5bc7c 100644
--- a/source/Cosmos.Kernel.LogTail/MainForm.cs
+++ b/source/Cosmos.Kernel.LogTail/MainForm.cs
@@ -45,8 +45,8 @@ namespace Cosmos.Kernel.LogTail
private void CreateReader()
{
-
- _fs = new FileStream(_file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
+
+ _fs = new ErrorStrippingFileStream(_file);
_watching = true;
_watcher_Changed(this, new FileSystemEventArgs(WatcherChangeTypes.All, "", ""));
@@ -78,8 +78,16 @@ namespace Cosmos.Kernel.LogTail
if (_watching)
{
XmlReader _reader = CreateXmlReader();
- while (_reader.Read())
+ bool reading = true;
+ while (reading)
{
+ try
+ {
+ reading = true;
+ reading = _reader.Read();
+ }
+ catch { }
+
LogMessage message = new LogMessage(_reader.Name);
for (int i = 0; i < _reader.AttributeCount; i++)
{