From 7e778c84b70feafbe9f4c765afc3f894910ba1eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Srbeck=C3=BD?= Date: Sun, 6 Dec 2009 14:49:14 +0000 Subject: [PATCH] Fixed "0x8013132E - This process has already been attached to" git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@5296 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../Debugger.AddIn/Service/WindowsDebugger.cs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/AddIns/Debugger/Debugger.AddIn/Service/WindowsDebugger.cs b/src/AddIns/Debugger/Debugger.AddIn/Service/WindowsDebugger.cs index 519f10abc7..8a53e61b99 100644 --- a/src/AddIns/Debugger/Debugger.AddIn/Service/WindowsDebugger.cs +++ b/src/AddIns/Debugger/Debugger.AddIn/Service/WindowsDebugger.cs @@ -233,9 +233,22 @@ namespace ICSharpCode.SharpDevelop.Services if (DebugStarting != null) DebugStarting(this, EventArgs.Empty); - Process process = debugger.Attach(existingProcess); - attached = true; - SelectProcess(process); + try { + Process process = debugger.Attach(existingProcess); + attached = true; + SelectProcess(process); + } catch (System.Exception e) { + // CORDBG_E_DEBUGGER_ALREADY_ATTACHED + if (e is COMException || e is UnauthorizedAccessException) { + string msg = StringParser.Parse("${res:XML.MainMenu.DebugMenu.Error.CannotAttachToProcess}"); + MessageService.ShowMessage(msg + " " + e.Message); + + if (DebugStopped != null) + DebugStopped(this, EventArgs.Empty); + } else { + throw; + } + } } }