diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Debugger.Core.csproj b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Debugger.Core.csproj
index 3db8f23045..727d9bed6c 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Debugger.Core.csproj
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Debugger.Core.csproj
@@ -74,6 +74,7 @@
+
@@ -86,7 +87,7 @@
-
+
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Eval.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Eval.cs
index 28acc76e12..4d1d94e8f4 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Eval.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Eval.cs
@@ -11,7 +11,6 @@ using System.Runtime.InteropServices;
using Debugger.MetaData;
using Debugger.Interop.CorDebug;
-using CorElementType = Debugger.Interop.CorDebug.CorElementType;
namespace Debugger
{
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Internal/MTA2STA.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Internal/MTA2STA.cs
index a685130b9d..b925bea63e 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Internal/MTA2STA.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Internal/MTA2STA.cs
@@ -212,7 +212,8 @@ namespace Debugger.Internal
}
// Marshal a COM object
object comObject = Marshal.GetObjectForIUnknown(param);
- return Activator.CreateInstance(outputType, comObject);
+ Debugger.Interop.TrackedComObjects.Track(comObject);
+ return comObject;
}
///
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Internal/ManagedCallback.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Internal/ManagedCallback.cs
index 7505154cca..2ea7ee88d8 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Internal/ManagedCallback.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Internal/ManagedCallback.cs
@@ -12,12 +12,10 @@
// Replace with:
// \1\2\n\1{\n\1\tEnterCallback(PausedReason.Other, "\3");\n\1\t\n\1\tExitCallback_Continue();\n\1}
+using Debugger.Interop;
using System;
using System.Runtime.InteropServices;
using Debugger.Interop.CorDebug;
-using CorDebugStepReason = Debugger.Interop.CorDebug.CorDebugStepReason;
-using CorDebugExceptionCallbackType = Debugger.Interop.CorDebug.CorDebugExceptionCallbackType;
-using CorDebugExceptionUnwindCallbackType = Debugger.Interop.CorDebug.CorDebugExceptionUnwindCallbackType;
namespace Debugger.Internal
{
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Internal/ManagedCallbackProxy.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Internal/ManagedCallbackProxy.cs
index afc37c4514..e281290584 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Internal/ManagedCallbackProxy.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Internal/ManagedCallbackProxy.cs
@@ -7,10 +7,8 @@
using System;
using System.Windows.Forms;
+using Debugger.Interop;
using Debugger.Interop.CorDebug;
-using CorDebugStepReason = Debugger.Interop.CorDebug.CorDebugStepReason;
-using CorDebugExceptionCallbackType = Debugger.Interop.CorDebug.CorDebugExceptionCallbackType;
-using CorDebugExceptionUnwindCallbackType = Debugger.Interop.CorDebug.CorDebugExceptionUnwindCallbackType;
// Regular expresion:
// ^{\t*}{(:Ll| )*{:i} *\(((.# {:i}, |\))|())^6\)*}\n\t*\{(.|\n)@\t\}
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Internal/ManagedCallbackSwitch.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Internal/ManagedCallbackSwitch.cs
index 0d2ebe05a9..3964a0f0ba 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Internal/ManagedCallbackSwitch.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Internal/ManagedCallbackSwitch.cs
@@ -12,12 +12,10 @@
// Replace with:
// \1\2\n\1{\n\1\tGetProcessCallbackInterface(\4).\3(\4, \5, \6, \7, \8, \9);\n\1}
+using Debugger.Interop;
using System;
using System.Runtime.InteropServices;
using Debugger.Interop.CorDebug;
-using CorDebugStepReason = Debugger.Interop.CorDebug.CorDebugStepReason;
-using CorDebugExceptionCallbackType = Debugger.Interop.CorDebug.CorDebugExceptionCallbackType;
-using CorDebugExceptionUnwindCallbackType = Debugger.Interop.CorDebug.CorDebugExceptionUnwindCallbackType;
namespace Debugger.Internal
{
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/Common.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/Common.cs
new file mode 100644
index 0000000000..48534ee697
--- /dev/null
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/Common.cs
@@ -0,0 +1,89 @@
+//
+//
+//
+//
+// $Revision$
+//
+
+#pragma warning disable 108, 1591
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+namespace Debugger.Interop
+{
+ // These are used in both CorDebug and CorSym
+
+ [StructLayout(LayoutKind.Sequential, Pack=4)]
+ public struct _FILETIME
+ {
+ public uint dwLowDateTime;
+ public uint dwHighDateTime;
+ }
+
+ [StructLayout(LayoutKind.Sequential, Pack=8)]
+ public struct _LARGE_INTEGER
+ {
+ public long QuadPart;
+ }
+
+ [StructLayout(LayoutKind.Sequential, Pack=8)]
+ public struct _ULARGE_INTEGER
+ {
+ public ulong QuadPart;
+ }
+
+ [ComImport, Guid("0C733A30-2A1C-11CE-ADE5-00AA0044773D"), InterfaceType((short) 1)]
+ public interface ISequentialStream
+ {
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
+ void __RemoteRead(out byte pv, [In] uint cb, out uint pcbRead);
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
+ void __RemoteWrite([In] ref byte pv, [In] uint cb, out uint pcbWritten);
+ }
+
+ [ComImport, InterfaceType((short) 1), Guid("0000000C-0000-0000-C000-000000000046")]
+ public interface IStream : ISequentialStream
+ {
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
+ void __RemoteRead(out byte pv, [In] uint cb, out uint pcbRead);
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
+ void __RemoteWrite([In] ref byte pv, [In] uint cb, out uint pcbWritten);
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
+ void __RemoteSeek([In] _LARGE_INTEGER dlibMove, [In] uint dwOrigin, out _ULARGE_INTEGER plibNewPosition);
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
+ void __SetSize([In] _ULARGE_INTEGER libNewSize);
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
+ void __RemoteCopyTo([In, MarshalAs(UnmanagedType.Interface)] IStream pstm, [In] _ULARGE_INTEGER cb, out _ULARGE_INTEGER pcbRead, out _ULARGE_INTEGER pcbWritten);
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
+ void __Commit([In] uint grfCommitFlags);
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
+ void __Revert();
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
+ void __LockRegion([In] _ULARGE_INTEGER libOffset, [In] _ULARGE_INTEGER cb, [In] uint dwLockType);
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
+ void __UnlockRegion([In] _ULARGE_INTEGER libOffset, [In] _ULARGE_INTEGER cb, [In] uint dwLockType);
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
+ void __Stat(out tagSTATSTG pstatstg, [In] uint grfStatFlag);
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
+ void __Clone([MarshalAs(UnmanagedType.Interface)] out IStream ppstm);
+ }
+
+ [StructLayout(LayoutKind.Sequential, Pack=8)]
+ public struct tagSTATSTG
+ {
+ [MarshalAs(UnmanagedType.LPWStr)]
+ public string pwcsName;
+ public uint type;
+ public _ULARGE_INTEGER cbSize;
+ public _FILETIME mtime;
+ public _FILETIME ctime;
+ public _FILETIME atime;
+ public uint grfMode;
+ public uint grfLocksSupported;
+ public Guid clsid;
+ public uint grfStateBits;
+ public uint reserved;
+ }
+}
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorDebug.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorDebug.cs
index 740053cb2c..b5474be9ed 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorDebug.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorDebug.cs
@@ -30,19 +30,6 @@ namespace Debugger.Interop.CorDebug
public uint dwSubBuild;
}
- [StructLayout(LayoutKind.Sequential, Pack=4)]
- public struct _FILETIME
- {
- public uint dwLowDateTime;
- public uint dwHighDateTime;
- }
-
- [StructLayout(LayoutKind.Sequential, Pack=8)]
- public struct _LARGE_INTEGER
- {
- public long QuadPart;
- }
-
[StructLayout(LayoutKind.Sequential, Pack=4)]
public struct _SECURITY_ATTRIBUTES
{
@@ -51,12 +38,6 @@ namespace Debugger.Interop.CorDebug
public int bInheritHandle;
}
- [StructLayout(LayoutKind.Sequential, Pack=8)]
- public struct _ULARGE_INTEGER
- {
- public ulong QuadPart;
- }
-
[StructLayout(LayoutKind.Sequential, Pack=4)]
public struct COR_DEBUG_STEP_RANGE
{
@@ -1635,59 +1616,6 @@ namespace Debugger.Interop.CorDebug
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void __Next([In] uint celt, [Out] IntPtr values, out uint pceltFetched);
}
-
- [ComImport, Guid("0C733A30-2A1C-11CE-ADE5-00AA0044773D"), InterfaceType((short) 1)]
- public interface ISequentialStream
- {
- [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
- void __RemoteRead(out byte pv, [In] uint cb, out uint pcbRead);
- [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
- void __RemoteWrite([In] ref byte pv, [In] uint cb, out uint pcbWritten);
- }
-
- [ComImport, Guid("0000000C-0000-0000-C000-000000000046"), InterfaceType((short) 1)]
- public interface IStream : ISequentialStream
- {
- [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
- void __RemoteRead(out byte pv, [In] uint cb, out uint pcbRead);
- [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
- void __RemoteWrite([In] ref byte pv, [In] uint cb, out uint pcbWritten);
- [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
- void __RemoteSeek([In] _LARGE_INTEGER dlibMove, [In] uint dwOrigin, out _ULARGE_INTEGER plibNewPosition);
- [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
- void __SetSize([In] _ULARGE_INTEGER libNewSize);
- [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
- void __RemoteCopyTo([In, MarshalAs(UnmanagedType.Interface)] IStream pstm, [In] _ULARGE_INTEGER cb, out _ULARGE_INTEGER pcbRead, out _ULARGE_INTEGER pcbWritten);
- [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
- void __Commit([In] uint grfCommitFlags);
- [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
- void __Revert();
- [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
- void __LockRegion([In] _ULARGE_INTEGER libOffset, [In] _ULARGE_INTEGER cb, [In] uint dwLockType);
- [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
- void __UnlockRegion([In] _ULARGE_INTEGER libOffset, [In] _ULARGE_INTEGER cb, [In] uint dwLockType);
- [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
- void __Stat(out tagSTATSTG pstatstg, [In] uint grfStatFlag);
- [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
- void __Clone([MarshalAs(UnmanagedType.Interface)] out IStream ppstm);
- }
-
- [StructLayout(LayoutKind.Sequential, Pack=8)]
- public struct tagSTATSTG
- {
- [MarshalAs(UnmanagedType.LPWStr)]
- public string pwcsName;
- public uint type;
- public _ULARGE_INTEGER cbSize;
- public _FILETIME mtime;
- public _FILETIME ctime;
- public _FILETIME atime;
- public uint grfMode;
- public uint grfLocksSupported;
- public Guid clsid;
- public uint grfStateBits;
- public uint reserved;
- }
}
#pragma warning restore 108, 1591
\ No newline at end of file
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorDebugExtensionMethods.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorDebugExtensionMethods.cs
index 25cc6bcf07..e131a51438 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorDebugExtensionMethods.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorDebugExtensionMethods.cs
@@ -31,6 +31,11 @@ namespace Debugger.Interop.CorDebug
return obj as T;
}
+ static void ProcessOutParameter(object parameter)
+ {
+ TrackedComObjects.ProcessOutParameter(parameter);
+ }
+
// ICorDebugArrayValue
public static unsafe uint[] GetDimensions(this ICorDebugArrayValue corArray)
@@ -215,9 +220,7 @@ namespace Debugger.Interop.CorDebug
public static bool HasQueuedCallbacks(this ICorDebugProcess corProcess)
{
- int pbQueued;
- corProcess.HasQueuedCallbacks(null, out pbQueued);
- return pbQueued != 0;
+ return corProcess.HasQueuedCallbacks(null) != 0;
}
// ICorDebugStepper
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorDebugExtensionMethods.generated.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorDebugExtensionMethods.generated.cs
index e68fdbab79..1fb45dc59d 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorDebugExtensionMethods.generated.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorDebugExtensionMethods.generated.cs
@@ -13,10 +13,6 @@ namespace Debugger.Interop.CorDebug
{
public static partial class CorDebugExtensionMethods
{
- static void ProcessOutParameter(object parameter)
- {
- }
-
public static void CanLaunchOrAttach(this CorDebugClass instance, uint dwProcessId, int win32DebuggingEnabled)
{
instance.__CanLaunchOrAttach(dwProcessId, win32DebuggingEnabled);
@@ -386,7 +382,7 @@ namespace Debugger.Interop.CorDebug
return pceltFetched;
}
- public static uint GetType(this ICorDebugArrayValue instance)
+ public static uint GetTheType(this ICorDebugArrayValue instance)
{
uint pType;
instance.__GetType(out pType);
@@ -557,7 +553,7 @@ namespace Debugger.Interop.CorDebug
return pceltFetched;
}
- public static uint GetType(this ICorDebugBoxValue instance)
+ public static uint GetTheType(this ICorDebugBoxValue instance)
{
uint pType;
instance.__GetType(out pType);
@@ -908,7 +904,7 @@ namespace Debugger.Interop.CorDebug
return pceltFetched;
}
- public static uint GetType(this ICorDebugContext instance)
+ public static uint GetTheType(this ICorDebugContext instance)
{
uint pType;
instance.__GetType(out pType);
@@ -1469,7 +1465,7 @@ namespace Debugger.Interop.CorDebug
return pnOffset;
}
- public static uint GetType(this ICorDebugGenericValue instance)
+ public static uint GetTheType(this ICorDebugGenericValue instance)
{
uint pType;
instance.__GetType(out pType);
@@ -1508,7 +1504,7 @@ namespace Debugger.Interop.CorDebug
instance.__SetValue(pFrom);
}
- public static uint GetType(this ICorDebugHandleValue instance)
+ public static uint GetTheType(this ICorDebugHandleValue instance)
{
uint pType;
instance.__GetType(out pType);
@@ -1585,7 +1581,7 @@ namespace Debugger.Interop.CorDebug
instance.__Dispose();
}
- public static uint GetType(this ICorDebugHeapValue instance)
+ public static uint GetTheType(this ICorDebugHeapValue instance)
{
uint pType;
instance.__GetType(out pType);
@@ -2400,7 +2396,7 @@ namespace Debugger.Interop.CorDebug
return pceltFetched;
}
- public static uint GetType(this ICorDebugObjectValue instance)
+ public static uint GetTheType(this ICorDebugObjectValue instance)
{
uint pType;
instance.__GetType(out pType);
@@ -2747,7 +2743,7 @@ namespace Debugger.Interop.CorDebug
return pceltFetched;
}
- public static uint GetType(this ICorDebugReferenceValue instance)
+ public static uint GetTheType(this ICorDebugReferenceValue instance)
{
uint pType;
instance.__GetType(out pType);
@@ -2917,7 +2913,7 @@ namespace Debugger.Interop.CorDebug
return pceltFetched;
}
- public static uint GetType(this ICorDebugStringValue instance)
+ public static uint GetTheType(this ICorDebugStringValue instance)
{
uint pType;
instance.__GetType(out pType);
@@ -3156,7 +3152,7 @@ namespace Debugger.Interop.CorDebug
return pceltFetched;
}
- public static uint GetType(this ICorDebugType instance)
+ public static uint GetTheType(this ICorDebugType instance)
{
uint ty;
instance.__GetType(out ty);
@@ -3248,7 +3244,7 @@ namespace Debugger.Interop.CorDebug
instance.__DebugEvent(pDebugEvent, fOutOfBand);
}
- public static uint GetType(this ICorDebugValue instance)
+ public static uint GetTheType(this ICorDebugValue instance)
{
uint pType;
instance.__GetType(out pType);
@@ -3337,87 +3333,5 @@ namespace Debugger.Interop.CorDebug
return pceltFetched;
}
- public static void RemoteRead(this ISequentialStream instance, out byte pv, uint cb, out uint pcbRead)
- {
- instance.__RemoteRead(out pv, cb, out pcbRead);
- ProcessOutParameter(pv);
- }
-
- public static uint RemoteWrite(this ISequentialStream instance, ref byte pv, uint cb)
- {
- uint pcbWritten;
- instance.__RemoteWrite(ref pv, cb, out pcbWritten);
- ProcessOutParameter(pv);
- return pcbWritten;
- }
-
- public static void RemoteRead(this IStream instance, out byte pv, uint cb, out uint pcbRead)
- {
- instance.__RemoteRead(out pv, cb, out pcbRead);
- ProcessOutParameter(pv);
- }
-
- public static uint RemoteWrite(this IStream instance, ref byte pv, uint cb)
- {
- uint pcbWritten;
- instance.__RemoteWrite(ref pv, cb, out pcbWritten);
- ProcessOutParameter(pv);
- return pcbWritten;
- }
-
- public static _ULARGE_INTEGER RemoteSeek(this IStream instance, _LARGE_INTEGER dlibMove, uint dwOrigin)
- {
- _ULARGE_INTEGER plibNewPosition;
- instance.__RemoteSeek(dlibMove, dwOrigin, out plibNewPosition);
- ProcessOutParameter(plibNewPosition);
- return plibNewPosition;
- }
-
- public static void SetSize(this IStream instance, _ULARGE_INTEGER libNewSize)
- {
- instance.__SetSize(libNewSize);
- }
-
- public static void RemoteCopyTo(this IStream instance, IStream pstm, _ULARGE_INTEGER cb, out _ULARGE_INTEGER pcbRead, out _ULARGE_INTEGER pcbWritten)
- {
- instance.__RemoteCopyTo(pstm, cb, out pcbRead, out pcbWritten);
- ProcessOutParameter(pcbRead);
- ProcessOutParameter(pcbWritten);
- }
-
- public static void Commit(this IStream instance, uint grfCommitFlags)
- {
- instance.__Commit(grfCommitFlags);
- }
-
- public static void Revert(this IStream instance)
- {
- instance.__Revert();
- }
-
- public static void LockRegion(this IStream instance, _ULARGE_INTEGER libOffset, _ULARGE_INTEGER cb, uint dwLockType)
- {
- instance.__LockRegion(libOffset, cb, dwLockType);
- }
-
- public static void UnlockRegion(this IStream instance, _ULARGE_INTEGER libOffset, _ULARGE_INTEGER cb, uint dwLockType)
- {
- instance.__UnlockRegion(libOffset, cb, dwLockType);
- }
-
- public static void Stat(this IStream instance, out tagSTATSTG pstatstg, uint grfStatFlag)
- {
- instance.__Stat(out pstatstg, grfStatFlag);
- ProcessOutParameter(pstatstg);
- }
-
- public static IStream Clone(this IStream instance)
- {
- IStream ppstm;
- instance.__Clone(out ppstm);
- ProcessOutParameter(ppstm);
- return ppstm;
- }
-
}
}
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorPublishExtensionMethods.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorPublishExtensionMethods.cs
index b77a7b8121..934ef3e3f0 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorPublishExtensionMethods.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorPublishExtensionMethods.cs
@@ -11,5 +11,9 @@ namespace Debugger.Interop.CorPublish
{
public static partial class CorPublishExtensionMethods
{
+ static void ProcessOutParameter(object parameter)
+ {
+ TrackedComObjects.ProcessOutParameter(parameter);
+ }
}
}
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorPublishExtensionMethods.generated.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorPublishExtensionMethods.generated.cs
index 349ac72b7b..34687e3ace 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorPublishExtensionMethods.generated.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorPublishExtensionMethods.generated.cs
@@ -14,10 +14,6 @@ namespace Debugger.Interop.CorPublish
{
public static partial class CorPublishExtensionMethods
{
- static void ProcessOutParameter(object parameter)
- {
- }
-
public static ICorPublishEnum Clone(this CorpubPublishClass instance)
{
ICorPublishEnum ppEnum;
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorSym.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorSym.cs
index 26c23e8947..9665abe4ec 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorSym.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorSym.cs
@@ -381,42 +381,6 @@ namespace Debugger.Interop.CorSym
}
- [ComImport, Guid("0C733A30-2A1C-11CE-ADE5-00AA0044773D"), InterfaceType((short) 1)]
- public interface ISequentialStream
- {
- [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
- void __RemoteRead(out byte pv, [In] uint cb, out uint pcbRead);
- [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
- void __RemoteWrite([In] ref byte pv, [In] uint cb, out uint pcbWritten);
- }
-
- [ComImport, InterfaceType((short) 1), Guid("0000000C-0000-0000-C000-000000000046")]
- public interface IStream : ISequentialStream
- {
- [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
- void __RemoteRead(out byte pv, [In] uint cb, out uint pcbRead);
- [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
- void __RemoteWrite([In] ref byte pv, [In] uint cb, out uint pcbWritten);
- [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
- void __RemoteSeek([In] _LARGE_INTEGER dlibMove, [In] uint dwOrigin, out _ULARGE_INTEGER plibNewPosition);
- [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
- void __SetSize([In] _ULARGE_INTEGER libNewSize);
- [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
- void __RemoteCopyTo([In, MarshalAs(UnmanagedType.Interface)] IStream pstm, [In] _ULARGE_INTEGER cb, out _ULARGE_INTEGER pcbRead, out _ULARGE_INTEGER pcbWritten);
- [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
- void __Commit([In] uint grfCommitFlags);
- [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
- void __Revert();
- [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
- void __LockRegion([In] _ULARGE_INTEGER libOffset, [In] _ULARGE_INTEGER cb, [In] uint dwLockType);
- [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
- void __UnlockRegion([In] _ULARGE_INTEGER libOffset, [In] _ULARGE_INTEGER cb, [In] uint dwLockType);
- [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
- void __Stat(out tagSTATSTG pstatstg, [In] uint grfStatFlag);
- [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
- void __Clone([MarshalAs(UnmanagedType.Interface)] out IStream ppstm);
- }
-
[ComImport, InterfaceType((short) 1), Guid("AA544D42-28CB-11D3-BD22-0000F80849BD")]
public interface ISymUnmanagedBinder
{
@@ -729,42 +693,6 @@ namespace Debugger.Interop.CorSym
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void __DefineConstant2([In] IntPtr name, [In, MarshalAs(UnmanagedType.Struct)] object value, [In] uint sigToken);
}
-
- [StructLayout(LayoutKind.Sequential, Pack=4)]
- public struct _FILETIME
- {
- public uint dwLowDateTime;
- public uint dwHighDateTime;
- }
-
- [StructLayout(LayoutKind.Sequential, Pack=8)]
- public struct _LARGE_INTEGER
- {
- public long QuadPart;
- }
-
- [StructLayout(LayoutKind.Sequential, Pack=8)]
- public struct _ULARGE_INTEGER
- {
- public ulong QuadPart;
- }
-
- [StructLayout(LayoutKind.Sequential, Pack=8)]
- public struct tagSTATSTG
- {
- [MarshalAs(UnmanagedType.LPWStr)]
- public string pwcsName;
- public uint type;
- public _ULARGE_INTEGER cbSize;
- public _FILETIME mtime;
- public _FILETIME ctime;
- public _FILETIME atime;
- public uint grfMode;
- public uint grfLocksSupported;
- public Guid clsid;
- public uint grfStateBits;
- public uint reserved;
- }
}
#pragma warning restore 108, 1591
\ No newline at end of file
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorSymExtensionMethods.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorSymExtensionMethods.cs
index 6fd06d1f17..a770db622c 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorSymExtensionMethods.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorSymExtensionMethods.cs
@@ -12,6 +12,11 @@ namespace Debugger.Interop.CorSym
{
public static partial class CorSymExtensionMethods
{
+ static void ProcessOutParameter(object parameter)
+ {
+ TrackedComObjects.ProcessOutParameter(parameter);
+ }
+
// ISymUnmanagedBinder
public static ISymUnmanagedReader GetReaderForFile(this ISymUnmanagedBinder symBinder, object importer, string filename, string searchPath)
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorSymExtensionMethods.generated.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorSymExtensionMethods.generated.cs
index 1ef693789c..eb0f70912e 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorSymExtensionMethods.generated.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorSymExtensionMethods.generated.cs
@@ -13,10 +13,6 @@ namespace Debugger.Interop.CorSym
{
public static partial class CorSymExtensionMethods
{
- static void ProcessOutParameter(object parameter)
- {
- }
-
public static ISymUnmanagedReader GetReaderForFile(this CorSymBinder_SxSClass instance, object importer, IntPtr filename, IntPtr searchPath)
{
ISymUnmanagedReader returnValue = instance.__GetReaderForFile(importer, filename, searchPath);
@@ -493,88 +489,6 @@ namespace Debugger.Interop.CorSym
instance.__UsingNamespace(fullName);
}
- public static void RemoteRead(this ISequentialStream instance, out byte pv, uint cb, out uint pcbRead)
- {
- instance.__RemoteRead(out pv, cb, out pcbRead);
- ProcessOutParameter(pv);
- }
-
- public static uint RemoteWrite(this ISequentialStream instance, ref byte pv, uint cb)
- {
- uint pcbWritten;
- instance.__RemoteWrite(ref pv, cb, out pcbWritten);
- ProcessOutParameter(pv);
- return pcbWritten;
- }
-
- public static void RemoteRead(this IStream instance, out byte pv, uint cb, out uint pcbRead)
- {
- instance.__RemoteRead(out pv, cb, out pcbRead);
- ProcessOutParameter(pv);
- }
-
- public static uint RemoteWrite(this IStream instance, ref byte pv, uint cb)
- {
- uint pcbWritten;
- instance.__RemoteWrite(ref pv, cb, out pcbWritten);
- ProcessOutParameter(pv);
- return pcbWritten;
- }
-
- public static _ULARGE_INTEGER RemoteSeek(this IStream instance, _LARGE_INTEGER dlibMove, uint dwOrigin)
- {
- _ULARGE_INTEGER plibNewPosition;
- instance.__RemoteSeek(dlibMove, dwOrigin, out plibNewPosition);
- ProcessOutParameter(plibNewPosition);
- return plibNewPosition;
- }
-
- public static void SetSize(this IStream instance, _ULARGE_INTEGER libNewSize)
- {
- instance.__SetSize(libNewSize);
- }
-
- public static void RemoteCopyTo(this IStream instance, IStream pstm, _ULARGE_INTEGER cb, out _ULARGE_INTEGER pcbRead, out _ULARGE_INTEGER pcbWritten)
- {
- instance.__RemoteCopyTo(pstm, cb, out pcbRead, out pcbWritten);
- ProcessOutParameter(pcbRead);
- ProcessOutParameter(pcbWritten);
- }
-
- public static void Commit(this IStream instance, uint grfCommitFlags)
- {
- instance.__Commit(grfCommitFlags);
- }
-
- public static void Revert(this IStream instance)
- {
- instance.__Revert();
- }
-
- public static void LockRegion(this IStream instance, _ULARGE_INTEGER libOffset, _ULARGE_INTEGER cb, uint dwLockType)
- {
- instance.__LockRegion(libOffset, cb, dwLockType);
- }
-
- public static void UnlockRegion(this IStream instance, _ULARGE_INTEGER libOffset, _ULARGE_INTEGER cb, uint dwLockType)
- {
- instance.__UnlockRegion(libOffset, cb, dwLockType);
- }
-
- public static void Stat(this IStream instance, out tagSTATSTG pstatstg, uint grfStatFlag)
- {
- instance.__Stat(out pstatstg, grfStatFlag);
- ProcessOutParameter(pstatstg);
- }
-
- public static IStream Clone(this IStream instance)
- {
- IStream ppstm;
- instance.__Clone(out ppstm);
- ProcessOutParameter(ppstm);
- return ppstm;
- }
-
public static ISymUnmanagedReader GetReaderForFile(this ISymUnmanagedBinder instance, object importer, IntPtr filename, IntPtr searchPath)
{
ISymUnmanagedReader returnValue = instance.__GetReaderForFile(importer, filename, searchPath);
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/MetaDataWrapper.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/MetaDataWrapper.cs
index be8f1971c3..093c335b26 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/MetaDataWrapper.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/MetaDataWrapper.cs
@@ -28,25 +28,25 @@ namespace Debugger.Interop.MetaData
{
Guid guid = new Guid("{ 0x7dac8207, 0xd3ae, 0x4c75, { 0x9b, 0x67, 0x92, 0x80, 0x1a, 0x49, 0x7d, 0x44 } }");
metaData = (IMetaDataImport)pModule.GetMetaDataInterface(ref guid);
- ResourceManager.TrackCOMObject(metaData, typeof(IMetaDataImport));
+ TrackedComObjects.Track(metaData);
}
public ISymUnmanagedReader GetSymReader(string fullname, string searchPath)
{
try {
- // TODO: Track
ISymUnmanagedBinder symBinder = new Debugger.Interop.CorSym.CorSymBinder_SxSClass();
+ TrackedComObjects.Track(symBinder);
return symBinder.GetReaderForFile(metaData, fullname, searchPath);
} catch {
return null;
}
}
- public ISymUnmanagedReader GetSymReader(Debugger.Interop.CorSym.IStream stream)
+ public ISymUnmanagedReader GetSymReader(IStream stream)
{
try {
- // TODO: Track
ISymUnmanagedBinder symBinder = new Debugger.Interop.CorSym.CorSymBinder_SxSClass();
+ TrackedComObjects.Track(symBinder);
return symBinder.GetReaderFromStream(metaData, stream);
} catch {
return null;
@@ -60,16 +60,15 @@ namespace Debugger.Interop.MetaData
public void Dispose()
{
- if (metaData != null) {
- ResourceManager.ReleaseCOMObject(metaData, typeof(IMetaDataImport));
+ IMetaDataImport m = this.metaData;
+ if (m != null) {
+ Marshal.ReleaseComObject(m);
metaData = null;
}
}
-
// CloseEnum, CountEnum and ResetEnum are not wrapped
-
public uint[] EnumCustomAttributes(uint token_Scope, uint token_TypeOfAttributes)
{
return EnumerateTokens(metaData.EnumCustomAttributes, token_Scope, token_TypeOfAttributes);
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/ResourceManager.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/ResourceManager.cs
deleted file mode 100644
index 7ea5b4fc57..0000000000
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/ResourceManager.cs
+++ /dev/null
@@ -1,114 +0,0 @@
-//
-//
-//
-//
-// $Revision$
-//
-
-#pragma warning disable 1591
-
-using Debugger.Internal;
-using System;
-using System.Collections.Generic;
-using System.Runtime.InteropServices;
-using Debugger.Interop;
-
-namespace Debugger.Interop
-{
- class TrackedObjectMetaData
- {
- public Type ObjectType;
- public int RefCount;
-
- public TrackedObjectMetaData(Type objectType, int refCount)
- {
- this.ObjectType = objectType;
- this.RefCount = refCount;
- }
- }
-
- public static class ResourceManager
- {
- static MTA2STA mta2sta = new MTA2STA();
- static bool trace = false;
- static Dictionary