From ba5522da6ce4414b392c9e12ef36f4c037735909 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 17 Feb 2011 16:12:00 -0600 Subject: [PATCH] wrapped dot call in a try catch block to catch exception when graphviz is not installed --- ILSpy/MainWindow.xaml.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/ILSpy/MainWindow.xaml.cs b/ILSpy/MainWindow.xaml.cs index 7a79cc166..898b5a7bc 100644 --- a/ILSpy/MainWindow.xaml.cs +++ b/ILSpy/MainWindow.xaml.cs @@ -307,9 +307,17 @@ namespace ICSharpCode.ILSpy foreach (char c in Path.GetInvalidFileNameChars()) name = name.Replace(c, '-'); string fileName = Path.Combine(Path.GetTempPath(), name); - graph.Save(fileName + ".gv"); - Process.Start("dot", "\"" + fileName + ".gv\" -Tpng -o \"" + fileName + ".png\"").WaitForExit(); - Process.Start(fileName + ".png"); + graph.Save(fileName + ".gv"); + try + { + Process.Start("dot", "\"" + fileName + ".gv\" -Tpng -o \"" + fileName + ".png\"").WaitForExit(); + Process.Start(fileName + ".png"); + } + catch (Win32Exception ex) + { + MessageBox.Show(String.Format("Unable to find Graphviz on your computer. Please install it. {0}", ex.Message), "ILSpy"); + } + } #endif #endregion