Visual Studio をバージョン 2013 Ultimate にアップグレードしたところ、System.IO.FileSystemWatcher
クラスが Visual Studio 2013 によって編集されたファイルの監視に失敗したことがわかりました。以下のコードがあるとします。
class Program
{
static void Main(string[] args)
{
var watcher = new FileSystemWatcher(@"C:\test", "*.txt");
watcher.Changed += watcher_Changed;
watcher.EnableRaisingEvents = true;
Console.Read();
watcher.Changed -= watcher_Changed;
}
static void watcher_Changed(object sender, FileSystemEventArgs e)
{
Console.WriteLine("file is changed");
}
}
メモ帳でファイルを編集するC:\test\a.txt
と、プログラムはファイルが変更されたことを報告しますが、Visual Studio 2013 で編集すると、プログラムは黙っています。なんで?