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 8551fb3230..5857c81388 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Debugger.Core.csproj +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Debugger.Core.csproj @@ -293,6 +293,7 @@ + diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/NDebugger.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/NDebugger.cs index 4b862c066c..5ba528a611 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/NDebugger.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/NDebugger.cs @@ -64,6 +64,11 @@ namespace Debugger this.ModuleLoaded += SetBreakpointsInModule; localVariables = new VariableCollection(this); + + Wrappers.ResourceManager.TraceMessagesEnabled = false; + Wrappers.ResourceManager.TraceMessage += delegate (object s, MessageEventArgs e) { + TraceMessage(e.Message); + }; } /// @@ -138,6 +143,12 @@ namespace Debugger TraceMessage("ICorDebug terminated"); + Wrappers.ResourceManager.TraceMessagesEnabled = true; + Wrappers.ResourceManager.ReleaseAllTrackedCOMObjects(); + Wrappers.ResourceManager.TraceMessagesEnabled = false; + + TraceMessage("Tracked COM objects released"); + noProcessesHandle.Set(); } diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/CorDebug.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/CorDebug.cs index 4a8fdc1da8..2addb1850c 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/CorDebug.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/CorDebug.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public CorDebug(Debugger.Interop.CorDebug.CorDebug wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(CorDebug)); } public static CorDebug Wrap(Debugger.Interop.CorDebug.CorDebug objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new CorDebug(objectToWrap); } + ~CorDebug() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(CorDebug)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/CorDebugClass.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/CorDebugClass.cs index f12ac7ed29..686cfbb089 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/CorDebugClass.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/CorDebugClass.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public CorDebugClass(Debugger.Interop.CorDebug.CorDebugClass wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(CorDebugClass)); } public static CorDebugClass Wrap(Debugger.Interop.CorDebug.CorDebugClass objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new CorDebugClass(objectToWrap); } + ~CorDebugClass() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(CorDebugClass)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/EmbeddedCLRCorDebug.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/EmbeddedCLRCorDebug.cs index a79a35a6e2..851c17c22e 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/EmbeddedCLRCorDebug.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/EmbeddedCLRCorDebug.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public EmbeddedCLRCorDebug(Debugger.Interop.CorDebug.EmbeddedCLRCorDebug wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(EmbeddedCLRCorDebug)); } public static EmbeddedCLRCorDebug Wrap(Debugger.Interop.CorDebug.EmbeddedCLRCorDebug objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new EmbeddedCLRCorDebug(objectToWrap); } + ~EmbeddedCLRCorDebug() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(EmbeddedCLRCorDebug)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/EmbeddedCLRCorDebugClass.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/EmbeddedCLRCorDebugClass.cs index b14a5f0e6a..9e57206380 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/EmbeddedCLRCorDebugClass.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/EmbeddedCLRCorDebugClass.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public EmbeddedCLRCorDebugClass(Debugger.Interop.CorDebug.EmbeddedCLRCorDebugClass wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(EmbeddedCLRCorDebugClass)); } public static EmbeddedCLRCorDebugClass Wrap(Debugger.Interop.CorDebug.EmbeddedCLRCorDebugClass objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new EmbeddedCLRCorDebugClass(objectToWrap); } + ~EmbeddedCLRCorDebugClass() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(EmbeddedCLRCorDebugClass)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebug.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebug.cs index 8e466ae479..d672eff785 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebug.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebug.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebug(Debugger.Interop.CorDebug.ICorDebug wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebug)); } public static ICorDebug Wrap(Debugger.Interop.CorDebug.ICorDebug objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebug(objectToWrap); } + ~ICorDebug() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebug)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugAppDomain.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugAppDomain.cs index 7a19a30922..a218a20ad1 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugAppDomain.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugAppDomain.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugAppDomain(Debugger.Interop.CorDebug.ICorDebugAppDomain wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugAppDomain)); } public static ICorDebugAppDomain Wrap(Debugger.Interop.CorDebug.ICorDebugAppDomain objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugAppDomain(objectToWrap); } + ~ICorDebugAppDomain() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugAppDomain)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugAppDomain2.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugAppDomain2.cs index 771e7fc7a7..c628c0bf47 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugAppDomain2.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugAppDomain2.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugAppDomain2(Debugger.Interop.CorDebug.ICorDebugAppDomain2 wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugAppDomain2)); } public static ICorDebugAppDomain2 Wrap(Debugger.Interop.CorDebug.ICorDebugAppDomain2 objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugAppDomain2(objectToWrap); } + ~ICorDebugAppDomain2() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugAppDomain2)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugAppDomainEnum.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugAppDomainEnum.cs index 7498667e5e..c5807ad0d3 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugAppDomainEnum.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugAppDomainEnum.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugAppDomainEnum(Debugger.Interop.CorDebug.ICorDebugAppDomainEnum wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugAppDomainEnum)); } public static ICorDebugAppDomainEnum Wrap(Debugger.Interop.CorDebug.ICorDebugAppDomainEnum objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugAppDomainEnum(objectToWrap); } + ~ICorDebugAppDomainEnum() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugAppDomainEnum)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugArrayValue.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugArrayValue.cs index 3425fc56c5..b64d2444ad 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugArrayValue.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugArrayValue.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugArrayValue(Debugger.Interop.CorDebug.ICorDebugArrayValue wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugArrayValue)); } public static ICorDebugArrayValue Wrap(Debugger.Interop.CorDebug.ICorDebugArrayValue objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugArrayValue(objectToWrap); } + ~ICorDebugArrayValue() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugArrayValue)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugAssembly.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugAssembly.cs index 4e558c27e6..8e131a1656 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugAssembly.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugAssembly.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugAssembly(Debugger.Interop.CorDebug.ICorDebugAssembly wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugAssembly)); } public static ICorDebugAssembly Wrap(Debugger.Interop.CorDebug.ICorDebugAssembly objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugAssembly(objectToWrap); } + ~ICorDebugAssembly() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugAssembly)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugAssemblyEnum.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugAssemblyEnum.cs index fdcab959ef..1a9417487b 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugAssemblyEnum.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugAssemblyEnum.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugAssemblyEnum(Debugger.Interop.CorDebug.ICorDebugAssemblyEnum wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugAssemblyEnum)); } public static ICorDebugAssemblyEnum Wrap(Debugger.Interop.CorDebug.ICorDebugAssemblyEnum objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugAssemblyEnum(objectToWrap); } + ~ICorDebugAssemblyEnum() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugAssemblyEnum)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugBoxValue.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugBoxValue.cs index 6b011f1516..ddc1eada64 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugBoxValue.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugBoxValue.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugBoxValue(Debugger.Interop.CorDebug.ICorDebugBoxValue wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugBoxValue)); } public static ICorDebugBoxValue Wrap(Debugger.Interop.CorDebug.ICorDebugBoxValue objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugBoxValue(objectToWrap); } + ~ICorDebugBoxValue() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugBoxValue)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugBreakpoint.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugBreakpoint.cs index 4d2dd278dd..4f3d390e4c 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugBreakpoint.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugBreakpoint.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugBreakpoint(Debugger.Interop.CorDebug.ICorDebugBreakpoint wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugBreakpoint)); } public static ICorDebugBreakpoint Wrap(Debugger.Interop.CorDebug.ICorDebugBreakpoint objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugBreakpoint(objectToWrap); } + ~ICorDebugBreakpoint() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugBreakpoint)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugBreakpointEnum.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugBreakpointEnum.cs index 621c3a2456..e0d24d0bd8 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugBreakpointEnum.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugBreakpointEnum.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugBreakpointEnum(Debugger.Interop.CorDebug.ICorDebugBreakpointEnum wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugBreakpointEnum)); } public static ICorDebugBreakpointEnum Wrap(Debugger.Interop.CorDebug.ICorDebugBreakpointEnum objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugBreakpointEnum(objectToWrap); } + ~ICorDebugBreakpointEnum() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugBreakpointEnum)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugChain.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugChain.cs index c19860d033..77ce4fa1f9 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugChain.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugChain.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugChain(Debugger.Interop.CorDebug.ICorDebugChain wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugChain)); } public static ICorDebugChain Wrap(Debugger.Interop.CorDebug.ICorDebugChain objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugChain(objectToWrap); } + ~ICorDebugChain() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugChain)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugChainEnum.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugChainEnum.cs index c9b0ad36e9..9eac12f3ac 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugChainEnum.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugChainEnum.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugChainEnum(Debugger.Interop.CorDebug.ICorDebugChainEnum wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugChainEnum)); } public static ICorDebugChainEnum Wrap(Debugger.Interop.CorDebug.ICorDebugChainEnum objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugChainEnum(objectToWrap); } + ~ICorDebugChainEnum() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugChainEnum)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugClass.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugClass.cs index edcbb1356b..8307485497 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugClass.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugClass.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugClass(Debugger.Interop.CorDebug.ICorDebugClass wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugClass)); } public static ICorDebugClass Wrap(Debugger.Interop.CorDebug.ICorDebugClass objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugClass(objectToWrap); } + ~ICorDebugClass() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugClass)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugClass2.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugClass2.cs index 2cb4902a3f..39c26447cc 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugClass2.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugClass2.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugClass2(Debugger.Interop.CorDebug.ICorDebugClass2 wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugClass2)); } public static ICorDebugClass2 Wrap(Debugger.Interop.CorDebug.ICorDebugClass2 objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugClass2(objectToWrap); } + ~ICorDebugClass2() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugClass2)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugCode.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugCode.cs index 7315e7017b..d1fe80ed28 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugCode.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugCode.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugCode(Debugger.Interop.CorDebug.ICorDebugCode wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugCode)); } public static ICorDebugCode Wrap(Debugger.Interop.CorDebug.ICorDebugCode objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugCode(objectToWrap); } + ~ICorDebugCode() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugCode)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugCodeEnum.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugCodeEnum.cs index 381e79351b..9656292225 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugCodeEnum.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugCodeEnum.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugCodeEnum(Debugger.Interop.CorDebug.ICorDebugCodeEnum wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugCodeEnum)); } public static ICorDebugCodeEnum Wrap(Debugger.Interop.CorDebug.ICorDebugCodeEnum objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugCodeEnum(objectToWrap); } + ~ICorDebugCodeEnum() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugCodeEnum)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugContext.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugContext.cs index eda0880f9e..1bf75839b4 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugContext.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugContext.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugContext(Debugger.Interop.CorDebug.ICorDebugContext wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugContext)); } public static ICorDebugContext Wrap(Debugger.Interop.CorDebug.ICorDebugContext objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugContext(objectToWrap); } + ~ICorDebugContext() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugContext)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugController.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugController.cs index ba7abf83f7..51d3cdcb6e 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugController.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugController.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugController(Debugger.Interop.CorDebug.ICorDebugController wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugController)); } public static ICorDebugController Wrap(Debugger.Interop.CorDebug.ICorDebugController objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugController(objectToWrap); } + ~ICorDebugController() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugController)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugEditAndContinueSnapshot.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugEditAndContinueSnapshot.cs index 4aa35cfba8..ed29a9f394 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugEditAndContinueSnapshot.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugEditAndContinueSnapshot.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugEditAndContinueSnapshot(Debugger.Interop.CorDebug.ICorDebugEditAndContinueSnapshot wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugEditAndContinueSnapshot)); } public static ICorDebugEditAndContinueSnapshot Wrap(Debugger.Interop.CorDebug.ICorDebugEditAndContinueSnapshot objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugEditAndContinueSnapshot(objectToWrap); } + ~ICorDebugEditAndContinueSnapshot() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugEditAndContinueSnapshot)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugEnum.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugEnum.cs index 623ff8a71c..ea78c7e632 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugEnum.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugEnum.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugEnum(Debugger.Interop.CorDebug.ICorDebugEnum wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugEnum)); } public static ICorDebugEnum Wrap(Debugger.Interop.CorDebug.ICorDebugEnum objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugEnum(objectToWrap); } + ~ICorDebugEnum() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugEnum)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugErrorInfoEnum.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugErrorInfoEnum.cs index f6f9055a83..552ec46891 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugErrorInfoEnum.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugErrorInfoEnum.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugErrorInfoEnum(Debugger.Interop.CorDebug.ICorDebugErrorInfoEnum wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugErrorInfoEnum)); } public static ICorDebugErrorInfoEnum Wrap(Debugger.Interop.CorDebug.ICorDebugErrorInfoEnum objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugErrorInfoEnum(objectToWrap); } + ~ICorDebugErrorInfoEnum() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugErrorInfoEnum)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugEval.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugEval.cs index a5a3aea431..1c07a30a1e 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugEval.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugEval.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugEval(Debugger.Interop.CorDebug.ICorDebugEval wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugEval)); } public static ICorDebugEval Wrap(Debugger.Interop.CorDebug.ICorDebugEval objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugEval(objectToWrap); } + ~ICorDebugEval() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugEval)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugEval2.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugEval2.cs index 0265648653..12cce7b047 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugEval2.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugEval2.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugEval2(Debugger.Interop.CorDebug.ICorDebugEval2 wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugEval2)); } public static ICorDebugEval2 Wrap(Debugger.Interop.CorDebug.ICorDebugEval2 objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugEval2(objectToWrap); } + ~ICorDebugEval2() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugEval2)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugFrame.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugFrame.cs index 963f68efcf..82839a8e4a 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugFrame.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugFrame.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugFrame(Debugger.Interop.CorDebug.ICorDebugFrame wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugFrame)); } public static ICorDebugFrame Wrap(Debugger.Interop.CorDebug.ICorDebugFrame objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugFrame(objectToWrap); } + ~ICorDebugFrame() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugFrame)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugFrameEnum.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugFrameEnum.cs index b27b379fac..eeb7407b63 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugFrameEnum.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugFrameEnum.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugFrameEnum(Debugger.Interop.CorDebug.ICorDebugFrameEnum wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugFrameEnum)); } public static ICorDebugFrameEnum Wrap(Debugger.Interop.CorDebug.ICorDebugFrameEnum objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugFrameEnum(objectToWrap); } + ~ICorDebugFrameEnum() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugFrameEnum)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugFunction.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugFunction.cs index a3af5155dc..359d5df86a 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugFunction.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugFunction.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugFunction(Debugger.Interop.CorDebug.ICorDebugFunction wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugFunction)); } public static ICorDebugFunction Wrap(Debugger.Interop.CorDebug.ICorDebugFunction objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugFunction(objectToWrap); } + ~ICorDebugFunction() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugFunction)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugFunction2.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugFunction2.cs index d47cfe9bad..70b52fd5d8 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugFunction2.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugFunction2.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugFunction2(Debugger.Interop.CorDebug.ICorDebugFunction2 wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugFunction2)); } public static ICorDebugFunction2 Wrap(Debugger.Interop.CorDebug.ICorDebugFunction2 objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugFunction2(objectToWrap); } + ~ICorDebugFunction2() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugFunction2)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugFunctionBreakpoint.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugFunctionBreakpoint.cs index 3951681944..507820359c 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugFunctionBreakpoint.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugFunctionBreakpoint.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugFunctionBreakpoint(Debugger.Interop.CorDebug.ICorDebugFunctionBreakpoint wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugFunctionBreakpoint)); } public static ICorDebugFunctionBreakpoint Wrap(Debugger.Interop.CorDebug.ICorDebugFunctionBreakpoint objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugFunctionBreakpoint(objectToWrap); } + ~ICorDebugFunctionBreakpoint() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugFunctionBreakpoint)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugGenericValue.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugGenericValue.cs index 29774b747e..5e1cb607ed 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugGenericValue.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugGenericValue.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugGenericValue(Debugger.Interop.CorDebug.ICorDebugGenericValue wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugGenericValue)); } public static ICorDebugGenericValue Wrap(Debugger.Interop.CorDebug.ICorDebugGenericValue objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugGenericValue(objectToWrap); } + ~ICorDebugGenericValue() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugGenericValue)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugHandleValue.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugHandleValue.cs index d28170fe58..65be5a8119 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugHandleValue.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugHandleValue.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugHandleValue(Debugger.Interop.CorDebug.ICorDebugHandleValue wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugHandleValue)); } public static ICorDebugHandleValue Wrap(Debugger.Interop.CorDebug.ICorDebugHandleValue objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugHandleValue(objectToWrap); } + ~ICorDebugHandleValue() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugHandleValue)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugHeapValue.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugHeapValue.cs index 7d4ad3b3ec..d196e337d2 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugHeapValue.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugHeapValue.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugHeapValue(Debugger.Interop.CorDebug.ICorDebugHeapValue wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugHeapValue)); } public static ICorDebugHeapValue Wrap(Debugger.Interop.CorDebug.ICorDebugHeapValue objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugHeapValue(objectToWrap); } + ~ICorDebugHeapValue() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugHeapValue)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugHeapValue2.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugHeapValue2.cs index b59f13eb2e..f839e677d9 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugHeapValue2.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugHeapValue2.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugHeapValue2(Debugger.Interop.CorDebug.ICorDebugHeapValue2 wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugHeapValue2)); } public static ICorDebugHeapValue2 Wrap(Debugger.Interop.CorDebug.ICorDebugHeapValue2 objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugHeapValue2(objectToWrap); } + ~ICorDebugHeapValue2() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugHeapValue2)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugILFrame.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugILFrame.cs index 1103c25bb2..5052469317 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugILFrame.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugILFrame.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugILFrame(Debugger.Interop.CorDebug.ICorDebugILFrame wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugILFrame)); } public static ICorDebugILFrame Wrap(Debugger.Interop.CorDebug.ICorDebugILFrame objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugILFrame(objectToWrap); } + ~ICorDebugILFrame() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugILFrame)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugILFrame2.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugILFrame2.cs index bd591292cc..7ce23fed1e 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugILFrame2.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugILFrame2.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugILFrame2(Debugger.Interop.CorDebug.ICorDebugILFrame2 wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugILFrame2)); } public static ICorDebugILFrame2 Wrap(Debugger.Interop.CorDebug.ICorDebugILFrame2 objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugILFrame2(objectToWrap); } + ~ICorDebugILFrame2() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugILFrame2)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugInternalFrame.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugInternalFrame.cs index 454d644d1e..1e6e3a9c36 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugInternalFrame.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugInternalFrame.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugInternalFrame(Debugger.Interop.CorDebug.ICorDebugInternalFrame wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugInternalFrame)); } public static ICorDebugInternalFrame Wrap(Debugger.Interop.CorDebug.ICorDebugInternalFrame objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugInternalFrame(objectToWrap); } + ~ICorDebugInternalFrame() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugInternalFrame)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugMDA.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugMDA.cs index 247aea14de..3dbf0816a2 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugMDA.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugMDA.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugMDA(Debugger.Interop.CorDebug.ICorDebugMDA wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugMDA)); } public static ICorDebugMDA Wrap(Debugger.Interop.CorDebug.ICorDebugMDA objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugMDA(objectToWrap); } + ~ICorDebugMDA() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugMDA)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugManagedCallback.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugManagedCallback.cs index c6fac20bf7..63254b07a2 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugManagedCallback.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugManagedCallback.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugManagedCallback(Debugger.Interop.CorDebug.ICorDebugManagedCallback wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugManagedCallback)); } public static ICorDebugManagedCallback Wrap(Debugger.Interop.CorDebug.ICorDebugManagedCallback objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugManagedCallback(objectToWrap); } + ~ICorDebugManagedCallback() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugManagedCallback)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugManagedCallback2.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugManagedCallback2.cs index 7a20a65fc5..2b56de61cc 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugManagedCallback2.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugManagedCallback2.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugManagedCallback2(Debugger.Interop.CorDebug.ICorDebugManagedCallback2 wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugManagedCallback2)); } public static ICorDebugManagedCallback2 Wrap(Debugger.Interop.CorDebug.ICorDebugManagedCallback2 objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugManagedCallback2(objectToWrap); } + ~ICorDebugManagedCallback2() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugManagedCallback2)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugModule.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugModule.cs index e853e959d5..6f5db20d5a 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugModule.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugModule.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugModule(Debugger.Interop.CorDebug.ICorDebugModule wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugModule)); } public static ICorDebugModule Wrap(Debugger.Interop.CorDebug.ICorDebugModule objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugModule(objectToWrap); } + ~ICorDebugModule() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugModule)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugModule2.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugModule2.cs index a60520fd14..91a751b21f 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugModule2.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugModule2.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugModule2(Debugger.Interop.CorDebug.ICorDebugModule2 wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugModule2)); } public static ICorDebugModule2 Wrap(Debugger.Interop.CorDebug.ICorDebugModule2 objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugModule2(objectToWrap); } + ~ICorDebugModule2() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugModule2)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugModuleBreakpoint.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugModuleBreakpoint.cs index 4d10bcc064..d3a3ac0d22 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugModuleBreakpoint.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugModuleBreakpoint.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugModuleBreakpoint(Debugger.Interop.CorDebug.ICorDebugModuleBreakpoint wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugModuleBreakpoint)); } public static ICorDebugModuleBreakpoint Wrap(Debugger.Interop.CorDebug.ICorDebugModuleBreakpoint objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugModuleBreakpoint(objectToWrap); } + ~ICorDebugModuleBreakpoint() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugModuleBreakpoint)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugModuleEnum.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugModuleEnum.cs index 57f5adc5ad..977e6720bb 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugModuleEnum.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugModuleEnum.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugModuleEnum(Debugger.Interop.CorDebug.ICorDebugModuleEnum wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugModuleEnum)); } public static ICorDebugModuleEnum Wrap(Debugger.Interop.CorDebug.ICorDebugModuleEnum objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugModuleEnum(objectToWrap); } + ~ICorDebugModuleEnum() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugModuleEnum)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugNativeFrame.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugNativeFrame.cs index 5cfd641e8e..e506022504 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugNativeFrame.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugNativeFrame.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugNativeFrame(Debugger.Interop.CorDebug.ICorDebugNativeFrame wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugNativeFrame)); } public static ICorDebugNativeFrame Wrap(Debugger.Interop.CorDebug.ICorDebugNativeFrame objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugNativeFrame(objectToWrap); } + ~ICorDebugNativeFrame() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugNativeFrame)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugObjectEnum.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugObjectEnum.cs index 71b0b195ee..85d5edb0df 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugObjectEnum.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugObjectEnum.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugObjectEnum(Debugger.Interop.CorDebug.ICorDebugObjectEnum wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugObjectEnum)); } public static ICorDebugObjectEnum Wrap(Debugger.Interop.CorDebug.ICorDebugObjectEnum objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugObjectEnum(objectToWrap); } + ~ICorDebugObjectEnum() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugObjectEnum)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugObjectValue.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugObjectValue.cs index 7870995b17..793ebb4fc3 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugObjectValue.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugObjectValue.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugObjectValue(Debugger.Interop.CorDebug.ICorDebugObjectValue wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugObjectValue)); } public static ICorDebugObjectValue Wrap(Debugger.Interop.CorDebug.ICorDebugObjectValue objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugObjectValue(objectToWrap); } + ~ICorDebugObjectValue() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugObjectValue)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugObjectValue2.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugObjectValue2.cs index 02418fd912..2a07cfb88d 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugObjectValue2.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugObjectValue2.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugObjectValue2(Debugger.Interop.CorDebug.ICorDebugObjectValue2 wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugObjectValue2)); } public static ICorDebugObjectValue2 Wrap(Debugger.Interop.CorDebug.ICorDebugObjectValue2 objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugObjectValue2(objectToWrap); } + ~ICorDebugObjectValue2() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugObjectValue2)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugProcess.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugProcess.cs index 64766ef209..c86028c89a 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugProcess.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugProcess.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugProcess(Debugger.Interop.CorDebug.ICorDebugProcess wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugProcess)); } public static ICorDebugProcess Wrap(Debugger.Interop.CorDebug.ICorDebugProcess objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugProcess(objectToWrap); } + ~ICorDebugProcess() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugProcess)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugProcess2.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugProcess2.cs index f8e59c1955..03d98f965a 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugProcess2.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugProcess2.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugProcess2(Debugger.Interop.CorDebug.ICorDebugProcess2 wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugProcess2)); } public static ICorDebugProcess2 Wrap(Debugger.Interop.CorDebug.ICorDebugProcess2 objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugProcess2(objectToWrap); } + ~ICorDebugProcess2() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugProcess2)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugProcessEnum.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugProcessEnum.cs index 85e7806b0f..e11e970a30 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugProcessEnum.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugProcessEnum.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugProcessEnum(Debugger.Interop.CorDebug.ICorDebugProcessEnum wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugProcessEnum)); } public static ICorDebugProcessEnum Wrap(Debugger.Interop.CorDebug.ICorDebugProcessEnum objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugProcessEnum(objectToWrap); } + ~ICorDebugProcessEnum() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugProcessEnum)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugReferenceValue.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugReferenceValue.cs index e2fb25a131..4c60b2f278 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugReferenceValue.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugReferenceValue.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugReferenceValue(Debugger.Interop.CorDebug.ICorDebugReferenceValue wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugReferenceValue)); } public static ICorDebugReferenceValue Wrap(Debugger.Interop.CorDebug.ICorDebugReferenceValue objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugReferenceValue(objectToWrap); } + ~ICorDebugReferenceValue() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugReferenceValue)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugRegisterSet.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugRegisterSet.cs index 1502ee87d2..bd799355ee 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugRegisterSet.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugRegisterSet.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugRegisterSet(Debugger.Interop.CorDebug.ICorDebugRegisterSet wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugRegisterSet)); } public static ICorDebugRegisterSet Wrap(Debugger.Interop.CorDebug.ICorDebugRegisterSet objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugRegisterSet(objectToWrap); } + ~ICorDebugRegisterSet() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugRegisterSet)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugStepper.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugStepper.cs index 8ae00e1d36..58c7a20b30 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugStepper.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugStepper.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugStepper(Debugger.Interop.CorDebug.ICorDebugStepper wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugStepper)); } public static ICorDebugStepper Wrap(Debugger.Interop.CorDebug.ICorDebugStepper objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugStepper(objectToWrap); } + ~ICorDebugStepper() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugStepper)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugStepper2.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugStepper2.cs index ec897f89e0..63f3797e7f 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugStepper2.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugStepper2.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugStepper2(Debugger.Interop.CorDebug.ICorDebugStepper2 wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugStepper2)); } public static ICorDebugStepper2 Wrap(Debugger.Interop.CorDebug.ICorDebugStepper2 objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugStepper2(objectToWrap); } + ~ICorDebugStepper2() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugStepper2)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugStepperEnum.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugStepperEnum.cs index b65c8ef266..5b366f4230 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugStepperEnum.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugStepperEnum.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugStepperEnum(Debugger.Interop.CorDebug.ICorDebugStepperEnum wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugStepperEnum)); } public static ICorDebugStepperEnum Wrap(Debugger.Interop.CorDebug.ICorDebugStepperEnum objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugStepperEnum(objectToWrap); } + ~ICorDebugStepperEnum() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugStepperEnum)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugStringValue.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugStringValue.cs index 72874c4b92..4b0295a02f 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugStringValue.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugStringValue.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugStringValue(Debugger.Interop.CorDebug.ICorDebugStringValue wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugStringValue)); } public static ICorDebugStringValue Wrap(Debugger.Interop.CorDebug.ICorDebugStringValue objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugStringValue(objectToWrap); } + ~ICorDebugStringValue() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugStringValue)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugThread.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugThread.cs index 4526d32125..b1086fc6bb 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugThread.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugThread.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugThread(Debugger.Interop.CorDebug.ICorDebugThread wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugThread)); } public static ICorDebugThread Wrap(Debugger.Interop.CorDebug.ICorDebugThread objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugThread(objectToWrap); } + ~ICorDebugThread() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugThread)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugThread2.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugThread2.cs index ac4c997ecd..5082f9d2cf 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugThread2.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugThread2.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugThread2(Debugger.Interop.CorDebug.ICorDebugThread2 wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugThread2)); } public static ICorDebugThread2 Wrap(Debugger.Interop.CorDebug.ICorDebugThread2 objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugThread2(objectToWrap); } + ~ICorDebugThread2() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugThread2)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugThreadEnum.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugThreadEnum.cs index 5f3e312369..05c79146a6 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugThreadEnum.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugThreadEnum.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugThreadEnum(Debugger.Interop.CorDebug.ICorDebugThreadEnum wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugThreadEnum)); } public static ICorDebugThreadEnum Wrap(Debugger.Interop.CorDebug.ICorDebugThreadEnum objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugThreadEnum(objectToWrap); } + ~ICorDebugThreadEnum() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugThreadEnum)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugType.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugType.cs index 9b373074d0..c292a26697 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugType.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugType.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugType(Debugger.Interop.CorDebug.ICorDebugType wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugType)); } public static ICorDebugType Wrap(Debugger.Interop.CorDebug.ICorDebugType objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugType(objectToWrap); } + ~ICorDebugType() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugType)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugTypeEnum.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugTypeEnum.cs index cd29815149..bd37d4be59 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugTypeEnum.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugTypeEnum.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugTypeEnum(Debugger.Interop.CorDebug.ICorDebugTypeEnum wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugTypeEnum)); } public static ICorDebugTypeEnum Wrap(Debugger.Interop.CorDebug.ICorDebugTypeEnum objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugTypeEnum(objectToWrap); } + ~ICorDebugTypeEnum() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugTypeEnum)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugUnmanagedCallback.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugUnmanagedCallback.cs index 7e1db041cc..b39fad139a 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugUnmanagedCallback.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugUnmanagedCallback.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugUnmanagedCallback(Debugger.Interop.CorDebug.ICorDebugUnmanagedCallback wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugUnmanagedCallback)); } public static ICorDebugUnmanagedCallback Wrap(Debugger.Interop.CorDebug.ICorDebugUnmanagedCallback objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugUnmanagedCallback(objectToWrap); } + ~ICorDebugUnmanagedCallback() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugUnmanagedCallback)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugValue.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugValue.cs index 794492cc92..cf557c9973 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugValue.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugValue.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugValue(Debugger.Interop.CorDebug.ICorDebugValue wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugValue)); } public static ICorDebugValue Wrap(Debugger.Interop.CorDebug.ICorDebugValue objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugValue(objectToWrap); } + ~ICorDebugValue() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugValue)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugValue2.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugValue2.cs index 2c153abdb7..ae042ddc7f 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugValue2.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugValue2.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugValue2(Debugger.Interop.CorDebug.ICorDebugValue2 wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugValue2)); } public static ICorDebugValue2 Wrap(Debugger.Interop.CorDebug.ICorDebugValue2 objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugValue2(objectToWrap); } + ~ICorDebugValue2() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugValue2)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugValueBreakpoint.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugValueBreakpoint.cs index 07561322ee..2e1f327b8f 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugValueBreakpoint.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugValueBreakpoint.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugValueBreakpoint(Debugger.Interop.CorDebug.ICorDebugValueBreakpoint wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugValueBreakpoint)); } public static ICorDebugValueBreakpoint Wrap(Debugger.Interop.CorDebug.ICorDebugValueBreakpoint objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugValueBreakpoint(objectToWrap); } + ~ICorDebugValueBreakpoint() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugValueBreakpoint)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugValueEnum.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugValueEnum.cs index a1181b8a45..9de19baaa4 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugValueEnum.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugValueEnum.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ICorDebugValueEnum(Debugger.Interop.CorDebug.ICorDebugValueEnum wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugValueEnum)); } public static ICorDebugValueEnum Wrap(Debugger.Interop.CorDebug.ICorDebugValueEnum objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ICorDebugValueEnum(objectToWrap); } + ~ICorDebugValueEnum() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugValueEnum)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ISequentialStream.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ISequentialStream.cs index 518809858e..e6d59a2af8 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ISequentialStream.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ISequentialStream.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public ISequentialStream(Debugger.Interop.CorDebug.ISequentialStream wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(ISequentialStream)); } public static ISequentialStream Wrap(Debugger.Interop.CorDebug.ISequentialStream objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new ISequentialStream(objectToWrap); } + ~ISequentialStream() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(ISequentialStream)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/IStream.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/IStream.cs index 47a9aa7d8d..0f2fe79334 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/IStream.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/IStream.cs @@ -26,6 +26,7 @@ namespace Debugger.Wrappers.CorDebug public IStream(Debugger.Interop.CorDebug.IStream wrappedObject) { this.wrappedObject = wrappedObject; + ResourceManager.TrackCOMObject(wrappedObject, typeof(IStream)); } public static IStream Wrap(Debugger.Interop.CorDebug.IStream objectToWrap) @@ -33,6 +34,13 @@ namespace Debugger.Wrappers.CorDebug return new IStream(objectToWrap); } + ~IStream() + { + object o = wrappedObject; + wrappedObject = null; + ResourceManager.ReleaseCOMObject(o, typeof(IStream)); + } + public bool Is() where T: class { try { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/ResourceManager.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/ResourceManager.cs new file mode 100644 index 0000000000..0b9f1d33e0 --- /dev/null +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/ResourceManager.cs @@ -0,0 +1,95 @@ +// +// +// +// +// $Revision$ +// + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; + +namespace Debugger.Wrappers +{ + class MetaData + { + public Type ObjectType; + public int RefCount; + + public MetaData(Type objectType, int refCount) + { + this.ObjectType = objectType; + this.RefCount = refCount; + } + } + + public static class ResourceManager + { + static bool trace; + static Dictionary trackedCOMObjects = new Dictionary(); + + public static bool TraceMessagesEnabled { + get { + return trace; + } + set { + trace = value; + } + } + + public static void TrackCOMObject(object comObject, Type type) + { + if (!Marshal.IsComObject(comObject)) { + if (trace) Trace("Will not be tracked: {0}", type.Name); + } else { + MetaData metaData; + if (trackedCOMObjects.TryGetValue(comObject, out metaData)) { + metaData.RefCount += 1; + } else { + metaData = new MetaData(type,1); + trackedCOMObjects.Add(comObject, metaData); + } + if (trace) Trace("AddRef {0,2}: {1}", metaData.RefCount, type.Name); + } + } + + public static void ReleaseCOMObject(object comObject, Type type) + { + MetaData metaData; + if (trackedCOMObjects.TryGetValue(comObject, out metaData)) { + metaData.RefCount -= 1; + if (metaData.RefCount == 0) { + Marshal.FinalReleaseComObject(comObject); + trackedCOMObjects.Remove(comObject); + } + if (trace) Trace("Release {0,2}: {1}", metaData.RefCount, type.Name); + } else { + if (trace) Trace("Was not tracked: {0}", type.Name); + } + } + + public static void ReleaseAllTrackedCOMObjects() + { + if (trace) Trace("Releasing {0} tracked COM objects... ", trackedCOMObjects.Count); + while(trackedCOMObjects.Count > 0) { + foreach (KeyValuePair pair in trackedCOMObjects) { + Marshal.FinalReleaseComObject(pair.Key); + if (trace) Trace(" * Releasing {0} ({1} references)", pair.Value.ObjectType.Name, pair.Value.RefCount); + trackedCOMObjects.Remove(pair.Key); + break; + } + } + if (trace) Trace(" * Done"); + } + + public static event EventHandler TraceMessage; + + static void Trace(string msg, params object[] pars) + { + if (TraceMessage != null && trace) { + string message = String.Format("COM({0,-3}): {1}", trackedCOMObjects.Count, String.Format(msg, pars)); + TraceMessage(null, new MessageEventArgs(null, message)); + } + } + } +} diff --git a/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/DebuggerTests.cs b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/DebuggerTests.cs index ecb214042a..f94ccca08f 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/DebuggerTests.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/DebuggerTests.cs @@ -141,7 +141,7 @@ namespace Debugger.Tests Assert.AreEqual("Mark 1\r\nMark 2\r\n", log); } - [Test, Ignore("Works only if run alone")] + [Test] public void FileRelease() { Assert.IsTrue(File.Exists(assemblyFilename), "Assembly file not found"); diff --git a/src/Tools/WrapperGenerator/CodeGenerator.cs b/src/Tools/WrapperGenerator/CodeGenerator.cs index b574e14f21..9a239def19 100644 --- a/src/Tools/WrapperGenerator/CodeGenerator.cs +++ b/src/Tools/WrapperGenerator/CodeGenerator.cs @@ -21,7 +21,14 @@ namespace WrapperGenerator Assembly assembly; protected string wrapperNamespace; - string comparsionCode = + string comparsionCode = +@" ~TheType()" + "\r\n" + +@" {" + "\r\n" + +@" object o = wrappedObject;" + "\r\n" + +@" wrappedObject = null;" + "\r\n" + +@" ResourceManager.ReleaseCOMObject(o, typeof(TheType));" + "\r\n" + +@" }" + "\r\n" + +@" " + "\r\n" + @" public bool Is() where T: class" + "\r\n" + @" {" + "\r\n" + @" try {" + "\r\n" + @@ -220,6 +227,14 @@ namespace WrapperGenerator ExpressionForWrappedObjectField, new CodeArgumentReferenceExpression("wrappedObject"))); + codeConstructor.Statements.Add( + new CodeMethodInvokeExpression( + new CodeMethodReferenceExpression( + new CodeTypeReferenceExpression("ResourceManager"), + "TrackCOMObject"), + new CodeArgumentReferenceExpression("wrappedObject"), + new CodeTypeOfExpression(type.Name))); + return codeConstructor; }