From aa7f96241096c5e549408e69300d87a16f5560a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Srbeck=C3=BD?= Date: Tue, 8 Dec 2009 19:39:27 +0000 Subject: [PATCH] Backported r5296 - Fixed "0x8013132E - This process has already been attached to" git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@5316 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../Project/Src/Service/WindowsDebugger.cs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) 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 363dfdd9d9..56ba8b3627 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 @@ -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; + } + } } }