Browse Source

Fixed bug that prevented recompiling due to files locked by the debugger

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@513 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 21 years ago
parent
commit
47adfb89f7
  1. 29
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Modules/Module.cs
  2. 2
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/ObjectVariable.cs

29
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Modules/Module.cs

@ -24,7 +24,6 @@ namespace DebuggerLibrary
int orderOfLoading = 0; int orderOfLoading = 0;
readonly ICorDebugModule corModule; readonly ICorDebugModule corModule;
ISymbolReader symReader; ISymbolReader symReader;
object pMetaDataInterface;
IMetaDataImport metaDataInterface; IMetaDataImport metaDataInterface;
internal MetaData MetaData { internal MetaData MetaData {
@ -116,6 +115,7 @@ namespace DebuggerLibrary
pModule.IsInMemory(out isInMemory); pModule.IsInMemory(out isInMemory);
Guid metaDataInterfaceGuid = new Guid("{ 0x7dac8207, 0xd3ae, 0x4c75, { 0x9b, 0x67, 0x92, 0x80, 0x1a, 0x49, 0x7d, 0x44 } }"); Guid metaDataInterfaceGuid = new Guid("{ 0x7dac8207, 0xd3ae, 0x4c75, { 0x9b, 0x67, 0x92, 0x80, 0x1a, 0x49, 0x7d, 0x44 } }");
object pMetaDataInterface;
pModule.GetMetaDataInterface(ref metaDataInterfaceGuid, out pMetaDataInterface); pModule.GetMetaDataInterface(ref metaDataInterfaceGuid, out pMetaDataInterface);
metaDataInterface = (IMetaDataImport) pMetaDataInterface; metaDataInterface = (IMetaDataImport) pMetaDataInterface;
@ -135,11 +135,17 @@ namespace DebuggerLibrary
SymBinder symBinder = new SymBinder(); SymBinder symBinder = new SymBinder();
try { IntPtr ptr = IntPtr.Zero;
symReader = symBinder.GetReader(Marshal.GetIUnknownForObject(metaDataInterface), fullPath, string.Empty); try {
} catch (System.Exception) { ptr = Marshal.GetIUnknownForObject(metaDataInterface);
symReader = null; symReader = symBinder.GetReader(ptr, fullPath, string.Empty);
} } catch (System.Exception) {
symReader = null;
} finally {
if (ptr != IntPtr.Zero) {
Marshal.Release(ptr);
}
}
JMCStatus = SymbolsLoaded; JMCStatus = SymbolsLoaded;
} }
@ -156,8 +162,19 @@ namespace DebuggerLibrary
System.Reflection.MethodInfo m = symReader.GetType().GetMethod("{dtor}"); System.Reflection.MethodInfo m = symReader.GetType().GetMethod("{dtor}");
m.Invoke(symReader, null); m.Invoke(symReader, null);
} catch { } catch {
Console.WriteLine("symReader release failed. ({dtor})");
} finally {
symReader = null;
} }
} }
try {
Marshal.FinalReleaseComObject(metaDataInterface);
} catch {
Console.WriteLine("metaDataInterface release failed. (FinalReleaseComObject)");
} finally {
metaDataInterface = null;
}
} }
} }
} }

2
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/ObjectVariable.cs

@ -55,7 +55,7 @@ namespace DebuggerLibrary
uint classToken; uint classToken;
corClass.GetToken(out classToken); corClass.GetToken(out classToken);
corClass.GetModule(out corModule); corClass.GetModule(out corModule);
metaData = new Module(corModule).MetaData; metaData = debugger.GetModule(corModule).MetaData;
classProps = metaData.GetTypeDefProps(classToken); classProps = metaData.GetTypeDefProps(classToken);

Loading…
Cancel
Save