diff options
author | therzok <marius.ungureanu@xamarin.com> | 2019-08-27 14:30:38 +0300 |
---|---|---|
committer | monojenkins <jo.shields+jenkins@xamarin.com> | 2019-08-28 15:02:22 +0300 |
commit | 72f85def1998c39008f4955cfbdb2053bb91548c (patch) | |
tree | e676326b8c5b4d9a2ff179bca7f84a0f242b1776 | |
parent | d5e008705293952cd27329421ca43bea58b74b12 (diff) |
[Ide] Prevent exceptions in project file watcher handlers from bringing down the IDEbackport-pr-8532-to-release-8.3
This doesn't fix any current bug, just hardens the code against future exceptions
-rw-r--r-- | main/src/core/MonoDevelop.Core/MonoDevelop.Projects/FileWatcherService.cs | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/FileWatcherService.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/FileWatcherService.cs index ba25d251a5..8cb37dc50d 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/FileWatcherService.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/FileWatcherService.cs @@ -388,8 +388,12 @@ namespace MonoDevelop.Projects var sw = FileWatcherService.Timings.Get (); sw.Restart (); NotifyNode (rootNode, e.FullPath, (id, path) => { - if (id is Project project) { - project.OnFileCreated (path); + try { + if (id is Project project) { + project.OnFileCreated (path); + } + } catch (Exception e) { + LoggingService.LogInternalError ("Exception in file watcher handler", e); } }); sw.Stop (); @@ -414,8 +418,12 @@ namespace MonoDevelop.Projects var sw = FileWatcherService.Timings.Get (); sw.Restart (); NotifyNode (rootNode, e.FullPath, (id, path) => { - if (id is Project project) - project.OnFileDeleted (path); + try { + if (id is Project project) + project.OnFileDeleted (path); + } catch (Exception e) { + LoggingService.LogInternalError ("Exception in file watcher handler", e); + } }); sw.Stop (); FileWatcherService.Timings.Add (sw, FileService.EventDataKind.Removed); @@ -438,8 +446,12 @@ namespace MonoDevelop.Projects var sw = FileWatcherService.Timings.Get (); sw.Restart (); NotifyNode (rootNode, (e.OldFullPath, e.FullPath), (id, state) => { - if (id is Project project) - project.OnFileRenamed (state.OldFullPath, state.FullPath); + try { + if (id is Project project) + project.OnFileRenamed (state.OldFullPath, state.FullPath); + } catch (Exception e) { + LoggingService.LogInternalError ("Exception in file watcher handler", e); + } }); sw.Stop (); FileWatcherService.Timings.Add (sw, FileService.EventDataKind.Renamed); |