From 0c46d5169cdfeda9e014867437be09c96ca25b22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Srbeck=C3=BD?= Date: Mon, 6 Feb 2006 18:56:47 +0000 Subject: [PATCH] Fixed SD2-649: Breakpoint within anonymous delegate method causes COMException git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1081 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../Project/Src/Modules/Module.cs | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Modules/Module.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Modules/Module.cs index 45596642b6..90d1475f07 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Modules/Module.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Modules/Module.cs @@ -144,12 +144,21 @@ namespace Debugger fullPath = Marshal.PtrToStringUni(pString); Marshal.FreeHGlobal(pString); + string tempPath = Path.Combine(Path.GetTempPath(), Path.Combine("DebeggerPdb", new Random().Next().ToString())); + string pdbFilename = Path.GetFileNameWithoutExtension(FullPath) + ".pdb"; + string oldPdbPath = Path.Combine(Path.GetDirectoryName(FullPath), pdbFilename); + string newPdbPath = Path.Combine(tempPath, pdbFilename); + if (File.Exists(oldPdbPath)) { + Directory.CreateDirectory(tempPath); + File.Move(oldPdbPath, newPdbPath); + } + fullPathPDB = newPdbPath; SymBinder symBinder = new SymBinder(); IntPtr ptr = IntPtr.Zero; try { ptr = Marshal.GetIUnknownForObject(metaDataInterface); - symReader = (SymReader)symBinder.GetReader(ptr, fullPath, string.Empty); + symReader = (SymReader)symBinder.GetReader(ptr, fullPath, tempPath); } catch (System.Exception) { symReader = null; } finally { @@ -158,17 +167,8 @@ namespace Debugger } } - if (symReader != null) { - string tempPath = Path.Combine(Path.GetTempPath(), Path.Combine("DebeggerPdb", new Random().Next().ToString())); - string pdbFilename = Path.GetFileNameWithoutExtension(FullPath) + ".pdb"; - string oldPdbPath = Path.Combine(Path.GetDirectoryName(FullPath), pdbFilename); - string newPdbPath = Path.Combine(tempPath, pdbFilename); - - Directory.CreateDirectory(tempPath); - File.Copy(oldPdbPath, newPdbPath); - symReader.UpdateSymbolStore(newPdbPath, IntPtr.Zero); - - fullPathPDB = newPdbPath; + if (File.Exists(newPdbPath)) { + File.Copy(newPdbPath, oldPdbPath); } JMCStatus = SymbolsLoaded;