Closed raymrdc closed 2 years ago
Looking at the code, I don't see how the file extension could cause problems. Maybe the file you are trying to open does not exist at all?
I tried this code, with 2 files that contain the text "TextFile1.txt" and "TextFile2.txta" respectively.
var s1 = ICSharpCode.AvalonEdit.Utils.FileReader.OpenFile("TextFile1.txt", Encoding.Unicode).ReadToEnd();
var s2 = ICSharpCode.AvalonEdit.Utils.FileReader.OpenFile("TextFile2.txta", Encoding.Unicode).ReadToEnd();
MessageBox.Show(s1); // shows contents of TextFile1.txt
MessageBox.Show(s2); // shows contents of TextFile2.txta
Hi, Thanks for the quick response. You can close this issue. After further investigation, my app reads the file twice which cause the error for filename with 4 char extension.
I wonder why the file with 3 char extension works successfully even though it goes through the same code but fails when the extension is 4 char.
using the following command fails if filename have file extension of 4 characters (example: sample.txta)
StreamReader file = ICSharpCode.AvalonEdit.Utils.FileReader.OpenFile(filename, Encoding.Unicode)