C
Chris Tacke, eMVP
I think I've found a bug. Put the code below in a Button click handler or
wherever. The Write function will cause an exception. The full framework
exhibits the same behavior.
-Chris
------------------
System.Text.StringBuilder sb = new System.Text.StringBuilder();
System.IO.FileStream fs;
System.IO.StreamWriter sw;
fs = new System.IO.FileStream(@"\x.html", System.IO.FileMode.OpenOrCreate &
System.IO.FileMode.Truncate, System.IO.FileAccess.Write);
sw = new System.IO.StreamWriter(fs);
sb.Append("this is text");
sb.Append("\n");
sb.Append("{"); // exception caused by this
//sb.Append("\{"); // this prevents an exception, but it puts the (unwanted)
slash in the string
sb.Append("this is more text");
sw.Write(sb.ToString(), 0, 1);
sw.Flush();
sw.Close();
wherever. The Write function will cause an exception. The full framework
exhibits the same behavior.
-Chris
------------------
System.Text.StringBuilder sb = new System.Text.StringBuilder();
System.IO.FileStream fs;
System.IO.StreamWriter sw;
fs = new System.IO.FileStream(@"\x.html", System.IO.FileMode.OpenOrCreate &
System.IO.FileMode.Truncate, System.IO.FileAccess.Write);
sw = new System.IO.StreamWriter(fs);
sb.Append("this is text");
sb.Append("\n");
sb.Append("{"); // exception caused by this
//sb.Append("\{"); // this prevents an exception, but it puts the (unwanted)
slash in the string
sb.Append("this is more text");
sw.Write(sb.ToString(), 0, 1);
sw.Flush();
sw.Close();