diff --git a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs index 8c337c4cae..363dfdd9d9 100644 --- a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs +++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs @@ -41,9 +41,11 @@ using System; using System.Diagnostics; using System.Drawing; using System.IO; +using System.Runtime.InteropServices; using System.Security.Cryptography; using System.Text; using System.Windows.Forms; + using Debugger; using Debugger.AddIn; using Debugger.AddIn.TreeModel; @@ -58,7 +60,7 @@ using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor; using ICSharpCode.SharpDevelop.Gui; using ICSharpCode.SharpDevelop.Project; using BM = ICSharpCode.SharpDevelop.Bookmarks; -using Process=Debugger.Process; +using Process = Debugger.Process; namespace ICSharpCode.SharpDevelop.Services { @@ -180,10 +182,28 @@ namespace ICSharpCode.SharpDevelop.Services if (DebugStarting != null) DebugStarting(this, EventArgs.Empty); - Process process = debugger.Start(processStartInfo.FileName, - processStartInfo.WorkingDirectory, - processStartInfo.Arguments); - SelectProcess(process); + try { + Process process = debugger.Start(processStartInfo.FileName, + processStartInfo.WorkingDirectory, + processStartInfo.Arguments); + SelectProcess(process); + } catch (System.Exception e) { + // COMException: The request is not supported. (Exception from HRESULT: 0x80070032) + // COMException: The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log for more detail. (Exception from HRESULT: 0x800736B1) + // COMException: The requested operation requires elevation. (Exception from HRESULT: 0x800702E4) + // COMException: The directory name is invalid. (Exception from HRESULT: 0x8007010B) + // BadImageFormatException: is not a valid Win32 application. (Exception from HRESULT: 0x800700C1) + // UnauthorizedAccessException: Отказано в доступе. (Исключение из HRESULT: 0x80070005 (E_ACCESSDENIED)) + if (e is COMException || e is BadImageFormatException || e is UnauthorizedAccessException) { + string msg = StringParser.Parse("${res:XML.MainMenu.DebugMenu.Error.CannotStartProcess}"); + MessageService.ShowMessage(msg + " " + e.Message); + + if (DebugStopped != null) + DebugStopped(this, EventArgs.Empty); + } else { + throw; + } + } } }