public void RegisterForRelease(IModuleData module) { if (module != null) { COMHelper.Release(module.LegacyMetaDataImport); } }
internal override IModuleData GetModuleData(ulong addr) { if (addr == 0) { return(null); } IModuleData result; if (CLRVersion == DesktopVersion.v2) { V2ModuleData data = new V2ModuleData(); if (!RequestStruct(DacRequests.MODULE_DATA, addr, ref data)) { return(null); } COMHelper.Release(data.MetaDataImport); result = data; } else { V4ModuleData data = new V4ModuleData(); if (!RequestStruct(DacRequests.MODULE_DATA, addr, ref data)) { return(null); } COMHelper.Release(data.MetaDataImport); result = data; } return(result); }
void IDisposable.Dispose() { Trace.TraceInformation($"SOSHost.Dispose {_disposed}"); if (!_disposed) { _disposed = true; TargetWrapper.Release(); COMHelper.Release(_interface); } }
public async Task OpenVirtualProcess(TestConfiguration config) { // The current Linux test assets are not alpine/musl if (OS.IsAlpine) { throw new SkipTestException("Not supported on Alpine Linux (musl)"); } if (!config.AllSettings.ContainsKey("DumpFile")) { throw new SkipTestException("OpenVirtualProcessTest: No dump file"); } await RemoteInvoke(config, nameof(OpenVirtualProcess), static (string configXml) => { AfterInvoke(configXml, out TestConfiguration cfg, out ITestOutputHelper output); DbgShimAPI.Initialize(cfg.DbgShimPath()); AssertResult(DbgShimAPI.CLRCreateInstance(out ICLRDebugging clrDebugging)); Assert.NotNull(clrDebugging); TestDump testDump = new(cfg); ITarget target = testDump.Target; IRuntimeService runtimeService = target.Services.GetService <IRuntimeService>(); IRuntime runtime = runtimeService.EnumerateRuntimes().Single(); CorDebugDataTargetWrapper dataTarget = new(target.Services); LibraryProviderWrapper libraryProvider = new(target.OperatingSystem, runtime.RuntimeModule.BuildId, runtime.GetDbiFilePath(), runtime.GetDacFilePath()); ClrDebuggingVersion maxDebuggerSupportedVersion = new() { StructVersion = 0, Major = 4, Minor = 0, Build = 0, Revision = 0, }; HResult hr = clrDebugging.OpenVirtualProcess( runtime.RuntimeModule.ImageBase, dataTarget.ICorDebugDataTarget, libraryProvider.ILibraryProvider, maxDebuggerSupportedVersion, in RuntimeWrapper.IID_ICorDebugProcess, out IntPtr corDebugProcess, out ClrDebuggingVersion version, out ClrDebuggingProcessFlags flags); AssertResult(hr); Assert.NotEqual(IntPtr.Zero, corDebugProcess); Assert.Equal(1, COMHelper.Release(corDebugProcess)); Assert.Equal(0, COMHelper.Release(corDebugProcess)); Assert.Equal(0, clrDebugging.Release()); return(Task.FromResult(0)); });