diff --git a/src/Main/Base/Project/Src/Services/File/FileChangeWatcher.cs b/src/Main/Base/Project/Src/Services/File/FileChangeWatcher.cs index b73a8a7c9f..7dd94fe26f 100644 --- a/src/Main/Base/Project/Src/Services/File/FileChangeWatcher.cs +++ b/src/Main/Base/Project/Src/Services/File/FileChangeWatcher.cs @@ -6,8 +6,9 @@ using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Windows.Forms; -using ICSharpCode.SharpDevelop.Gui; + using ICSharpCode.Core; +using ICSharpCode.SharpDevelop.Gui; namespace ICSharpCode.SharpDevelop { @@ -89,7 +90,9 @@ namespace ICSharpCode.SharpDevelop activeWatchers.Add(this); SetWatcher(); - isFileReadOnly = (System.IO.File.GetAttributes(this.file.FileName) & FileAttributes.ReadOnly) == FileAttributes.ReadOnly; + if (System.IO.File.Exists(this.file.FileName)) { + isFileReadOnly = (System.IO.File.GetAttributes(this.file.FileName) & FileAttributes.ReadOnly) == FileAttributes.ReadOnly; + } } void file_FileNameChanged(object sender, EventArgs e)