[Mono-bugs] [Bug 74732][Blo] Changed - Sharing/Access violation after exiting a running mono app with an open StreamWriter (SVN checkouts)
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Wed, 27 Apr 2005 17:36:37 -0400 (EDT)
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by flashdict@gmail.com.
http://bugzilla.ximian.com/show_bug.cgi?id=74732
--- shadow/74732 2005-04-26 17:23:45.000000000 -0400
+++ shadow/74732.tmp.24074 2005-04-27 17:36:37.000000000 -0400
@@ -116,6 +116,36 @@
------- Additional Comments From Andrew.Gleave@ifgmgt.com 2005-04-26 17:23 -------
I have tried it on our Debain machine and it is now functioning correctly. However, it is
still broken on OS X as it doesn't have procfs.
+
+------- Additional Comments From flashdict@gmail.com 2005-04-27 17:36 -------
+A workaround, at least temporarily, is to explicitly set filesharing
+on the stream. Then you can interrupt it all day long, with or
+without a /proc filesystem, and always reopen it. The following works:
+
+using System;
+using System.IO;
+class ViolationDemo
+{
+ [STAThread]
+ static void Main(string[] args)
+ {
+ StreamWriter writer = null;
+ // Setup the stream with explicit sharing...
+ FileStream s = new FileStream("TestApp.log", FileMode.Append,
+ FileAccess.Write, FileShare.Write);
+ string command = string.Empty;
+ // Now pass the pre-configured stream to StreamWriter,
+ // instead of a filename
+ writer = new StreamWriter(s,System.Text.Encoding.UTF8,4096);
+ writer.AutoFlush = true;
+ writer.WriteLine("...");
+ while(command != "quit")
+ command = Console.ReadLine().ToLower();
+ }
+}
+
+
+