From 9099acbd13eab0bf596eca4bc6fb689add06ba89 Mon Sep 17 00:00:00 2001
From: Max Charlamb <44248479+max-charlamb@users.noreply.github.com>
Date: Thu, 5 Mar 2026 15:51:36 -0500
Subject: [PATCH] fix
---
.../ClrDataFrame.cs | 6 +-
.../ClrDataMethodInstance.cs | 11 +-
.../ClrDataStackWalk.cs | 6 +-
.../DebugExtensions.cs | 46 +++++
.../SOSDacImpl.IXCLRDataProcess.cs | 12 +-
.../SOSDacImpl.cs | 192 +++++++++---------
6 files changed, 159 insertions(+), 114 deletions(-)
create mode 100644 src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/DebugExtensions.cs
diff --git a/src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/ClrDataFrame.cs b/src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/ClrDataFrame.cs
index a47ab74739da47..9d12cf85a89f5b 100644
--- a/src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/ClrDataFrame.cs
+++ b/src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/ClrDataFrame.cs
@@ -91,7 +91,7 @@ int IXCLRDataFrame.GetNumArguments(uint* numArgs)
{
uint numArgsLocal;
int hrLocal = _legacyImpl.GetNumArguments(&numArgsLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
Debug.Assert(*numArgs == numArgsLocal, $"cDAC: {*numArgs}, DAC: {numArgsLocal}");
}
@@ -162,7 +162,7 @@ int IXCLRDataFrame.GetNumLocalVariables(uint* numLocals)
{
uint numLocalsLocal;
int hrLocal = _legacyImpl.GetNumLocalVariables(&numLocalsLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
Debug.Assert(*numLocals == numLocalsLocal, $"cDAC: {*numLocals}, DAC: {numLocalsLocal}");
}
@@ -221,7 +221,7 @@ int IXCLRDataFrame.GetMethodInstance(out IXCLRDataMethodInstance? method)
#if DEBUG
if (_legacyImpl is not null)
{
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
}
#endif
diff --git a/src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/ClrDataMethodInstance.cs b/src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/ClrDataMethodInstance.cs
index 51d0952e5782cc..76554e67618880 100644
--- a/src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/ClrDataMethodInstance.cs
+++ b/src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/ClrDataMethodInstance.cs
@@ -93,7 +93,7 @@ int IXCLRDataMethodInstance.GetTokenAndScope(uint* token, void** /*IXCLRDataModu
void* legacyModPtr = null;
int hrLocal = _legacyImpl.GetTokenAndScope(validateToken ? &tokenLocal : null, validateMod ? &legacyModPtr : null);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (validateToken)
{
@@ -172,7 +172,7 @@ int IXCLRDataMethodInstance.GetName(uint flags, uint bufLen, uint* nameLen, char
hrLocal = _legacyImpl.GetName(flags, bufLen, &nameLenLocal, nameBuf is null ? null : pNameBufLocal);
}
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (nameLen is not null)
Debug.Assert(nameLenLocal == *nameLen, $"cDAC: {*nameLen:x}, DAC: {nameLenLocal:x}");
@@ -270,8 +270,7 @@ int IXCLRDataMethodInstance.GetILOffsetsByAddress(ClrDataAddress address, uint o
validateIlOffsets ? localIlOffsetsPtr : null);
}
- // DAC function returns odd failure codes it doesn't make sense to match directly
- Debug.Assert(hrLocal == hr || (hrLocal < 0 && hr < 0), $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
@@ -362,7 +361,7 @@ int IXCLRDataMethodInstance.GetILAddressMap(uint mapLen, uint* mapNeeded, [In, O
uint mapNeededLocal;
ClrDataILAddressMap[]? mapsLocal = mapLen > 0 ? new ClrDataILAddressMap[mapLen] : null;
int hrLocal = _legacyImpl.GetILAddressMap(mapLen, &mapNeededLocal, mapsLocal);
- Debug.Assert(hrLocal == hr, $"HResult - cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
@@ -428,7 +427,7 @@ int IXCLRDataMethodInstance.GetRepresentativeEntryAddress(ClrDataAddress* addr)
ClrDataAddress addrLocal;
int hrLocal = _legacyImpl.GetRepresentativeEntryAddress(&addrLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
Debug.Assert(addrLocal == *addr, $"cDAC: {*addr:x}, DAC: {addrLocal:x}");
}
#endif
diff --git a/src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/ClrDataStackWalk.cs b/src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/ClrDataStackWalk.cs
index 7f25c92e4cc154..bdfe1cc02a96a2 100644
--- a/src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/ClrDataStackWalk.cs
+++ b/src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/ClrDataStackWalk.cs
@@ -67,7 +67,7 @@ int IXCLRDataStackWalk.GetContext(uint contextFlags, uint contextBufSize, uint*
{
byte[] localContextBuf = new byte[contextBufSize];
int hrLocal = _legacyImpl.GetContext(contextFlags, contextBufSize, null, localContextBuf);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
@@ -136,7 +136,7 @@ int IXCLRDataStackWalk.Next()
{
int hrLocal = _legacyImpl.Next();
#if DEBUG
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
#endif
}
@@ -174,7 +174,7 @@ int IXCLRDataStackWalk.Request(uint reqCode, uint inBufferSize, byte* inBuffer,
{
hrLocal = _legacyImpl.Request(reqCode, inBufferSize, inBuffer, outBufferSize, localOutBufferPtr);
}
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
for (int i = 0; i < outBufferSize; i++)
{
diff --git a/src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/DebugExtensions.cs b/src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/DebugExtensions.cs
new file mode 100644
index 00000000000000..a816cc4fcf33cf
--- /dev/null
+++ b/src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/DebugExtensions.cs
@@ -0,0 +1,46 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System.Diagnostics;
+using System.IO;
+using System.Runtime.CompilerServices;
+
+namespace Microsoft.Diagnostics.DataContractReader.Legacy;
+
+internal enum HResultValidationMode
+{
+ ///
+ /// HRESULTs must match exactly.
+ ///
+ Exact,
+
+ ///
+ /// Success HRESULTs must match exactly, but any two failing HRESULTs (negative values) are considered equivalent.
+ /// This is the recommended default because the cDAC and native DAC may use different exception types for the
+ /// same invalid input (e.g., InvalidOperationException vs E_INVALIDARG), producing different failing HRESULTs.
+ ///
+ AllowDivergentFailures,
+}
+
+internal static class DebugExtensions
+{
+ extension(Debug)
+ {
+ [Conditional("DEBUG")]
+ internal static void ValidateHResult(
+ int cdacHr,
+ int dacHr,
+ HResultValidationMode mode = HResultValidationMode.AllowDivergentFailures,
+ [CallerFilePath] string? filePath = null,
+ [CallerLineNumber] int lineNumber = 0)
+ {
+ bool match = mode switch
+ {
+ HResultValidationMode.Exact => cdacHr == dacHr,
+ HResultValidationMode.AllowDivergentFailures => cdacHr == dacHr || (cdacHr < 0 && dacHr < 0),
+ _ => cdacHr == dacHr,
+ };
+ Debug.Assert(match, $"HResult mismatch - cDAC: 0x{unchecked((uint)cdacHr):X8}, DAC: 0x{unchecked((uint)dacHr):X8} ({Path.GetFileName(filePath)}:{lineNumber})");
+ }
+ }
+}
diff --git a/src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/SOSDacImpl.IXCLRDataProcess.cs b/src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/SOSDacImpl.IXCLRDataProcess.cs
index 3747f76e5d9be6..96f325e884c3db 100644
--- a/src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/SOSDacImpl.IXCLRDataProcess.cs
+++ b/src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/SOSDacImpl.IXCLRDataProcess.cs
@@ -374,7 +374,7 @@ int IXCLRDataProcess.StartEnumMethodInstancesByAddress(ClrDataAddress address, /
#if DEBUG
if (_legacyProcess is not null)
{
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
}
#endif
return hr;
@@ -440,7 +440,7 @@ int IXCLRDataProcess.EnumMethodInstanceByAddress(ulong* handle, out IXCLRDataMet
#if DEBUG
if (_legacyProcess is not null)
{
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
}
#endif
@@ -550,7 +550,7 @@ int IXCLRDataProcess.GetOtherNotificationFlags(uint* flags)
{
uint flagsLocal;
int hrLocal = _legacyProcess.GetOtherNotificationFlags(&flagsLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
Debug.Assert(*flags == flagsLocal);
}
#endif
@@ -595,7 +595,7 @@ int IXCLRDataProcess.SetOtherNotificationFlags(uint flags)
{
hrLocal = ex.HResult;
}
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
Debug.Assert(flags == flagsLocal);
@@ -650,7 +650,7 @@ int IXCLRDataProcess2.GetGcNotification(GcEvtArgs* gcEvtArgs)
if (_legacyProcess2 is not null)
{
int hrLocal = _legacyProcess2.GetGcNotification(gcEvtArgs);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
}
#endif
return hr;
@@ -674,7 +674,7 @@ int IXCLRDataProcess2.SetGcNotification(GcEvtArgs gcEvtArgs)
{
// update the DAC cache
int hrLocal = _legacyProcess2.SetGcNotification(gcEvtArgs);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
}
#endif
return hr;
diff --git a/src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/SOSDacImpl.cs b/src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/SOSDacImpl.cs
index 81b420fe7d6bb2..abf53494d1e687 100644
--- a/src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/SOSDacImpl.cs
+++ b/src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/SOSDacImpl.cs
@@ -118,7 +118,7 @@ int ISOSDacInterface.GetAppDomainConfigFile(ClrDataAddress appDomain, int count,
if (_legacyImpl is not null)
{
int hrLocal = _legacyImpl.GetAppDomainConfigFile(appDomain, count, configFile, pNeeded);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
}
#endif
@@ -176,7 +176,7 @@ int ISOSDacInterface.GetAppDomainData(ClrDataAddress addr, DacpAppDomainData* da
{
DacpAppDomainData dataLocal = default;
int hrLocal = _legacyImpl.GetAppDomainData(addr, &dataLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
Debug.Assert(data->AppDomainPtr == dataLocal.AppDomainPtr);
@@ -225,7 +225,7 @@ int ISOSDacInterface.GetAppDomainList(uint count, [In, MarshalUsing(CountElement
ClrDataAddress[] valuesLocal = new ClrDataAddress[count];
uint neededLocal;
int hrLocal = _legacyImpl.GetAppDomainList(count, valuesLocal, &neededLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
Debug.Assert(pNeeded == null || *pNeeded == neededLocal);
if (values is not null && values.Length > 0 && valuesLocal.Length > 0)
{
@@ -299,7 +299,7 @@ int ISOSDacInterface.GetAppDomainName(ClrDataAddress addr, uint count, char* nam
{
hrLocal = _legacyImpl.GetAppDomainName(addr, count, ptr, &neededLocal);
}
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
Debug.Assert(pNeeded == null || *pNeeded == neededLocal);
@@ -331,7 +331,7 @@ int ISOSDacInterface.GetAppDomainStoreData(void* data)
{
DacpAppDomainStoreData dataLocal = default;
int hrLocal = _legacyImpl.GetAppDomainStoreData(&dataLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
Debug.Assert(appDomainStoreData->sharedDomain == dataLocal.sharedDomain, $"cDAC: {appDomainStoreData->sharedDomain:x}, DAC: {dataLocal.sharedDomain:x}");
Debug.Assert(appDomainStoreData->systemDomain == dataLocal.systemDomain, $"cDAC: {appDomainStoreData->systemDomain:x}, DAC: {dataLocal.systemDomain:x}");
Debug.Assert(appDomainStoreData->DomainCount == dataLocal.DomainCount, $"cDAC: {appDomainStoreData->DomainCount}, DAC: {dataLocal.DomainCount}");
@@ -349,7 +349,7 @@ int ISOSDacInterface.GetApplicationBase(ClrDataAddress appDomain, int count, cha
if (_legacyImpl is not null)
{
int hrLocal = _legacyImpl.GetApplicationBase(appDomain, count, appBase, pNeeded);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
}
#endif
@@ -394,7 +394,7 @@ int ISOSDacInterface.GetAssemblyData(ClrDataAddress domain, ClrDataAddress assem
{
DacpAssemblyData dataLocal = default;
int hrLocal = _legacyImpl.GetAssemblyData(domain, assembly, &dataLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
Debug.Assert(data->AssemblyPtr == dataLocal.AssemblyPtr, $"cDAC: {data->AssemblyPtr:x}, DAC: {dataLocal.AssemblyPtr:x}");
@@ -476,7 +476,7 @@ int ISOSDacInterface.GetAssemblyList(ClrDataAddress addr, int count, [In, Marsha
ClrDataAddress[]? valuesLocal = values != null ? new ClrDataAddress[count] : null;
int neededLocal;
int hrLocal = _legacyImpl.GetAssemblyList(addr, count, valuesLocal, &neededLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
Debug.Assert(pNeeded == null || *pNeeded == neededLocal);
@@ -529,7 +529,7 @@ int ISOSDacInterface.GetAssemblyModuleList(ClrDataAddress assembly, uint count,
ClrDataAddress[] modulesLocal = new ClrDataAddress[count];
uint neededLocal;
int hrLocal = _legacyImpl.GetAssemblyModuleList(assembly, count, modulesLocal, &neededLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
Debug.Assert(pNeeded == null || *pNeeded == neededLocal);
@@ -581,7 +581,7 @@ int ISOSDacInterface.GetAssemblyName(ClrDataAddress assembly, uint count, char*
{
hrLocal = _legacyImpl.GetAssemblyName(assembly, count, ptr, &neededLocal);
}
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
Debug.Assert(pNeeded == null || *pNeeded == neededLocal);
@@ -634,7 +634,7 @@ int ISOSDacInterface.GetClrWatsonBuckets(ClrDataAddress thread, void* pGenericMo
hrLocal = _legacyImpl.GetClrWatsonBuckets(thread, ptr);
}
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
Debug.Assert(new ReadOnlySpan(genericModeBlockLocal, 0, sizeOfGenericModeBlock).SequenceEqual(new Span(pGenericModeBlock, sizeOfGenericModeBlock)));
@@ -698,7 +698,7 @@ int ISOSDacInterface.GetCodeHeaderData(ClrDataAddress ip, DacpCodeHeaderData* da
{
DacpCodeHeaderData dataLocal = default;
int hrLocal = _legacyImpl.GetCodeHeaderData(ip, &dataLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
Debug.Assert(data->MethodDescPtr == dataLocal.MethodDescPtr, $"cDAC: {data->MethodDescPtr:x}, DAC: {dataLocal.MethodDescPtr:x}");
@@ -736,7 +736,7 @@ int ISOSDacInterface.GetDomainFromContext(ClrDataAddress context, ClrDataAddress
{
ClrDataAddress domainLocal;
int hrLocal = _legacyImpl.GetDomainFromContext(context, &domainLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
Debug.Assert(domainLocal == context, $"cDAC: {context:x}, DAC: {domainLocal:x}");
@@ -754,7 +754,7 @@ int ISOSDacInterface.GetDomainLocalModuleData(ClrDataAddress addr, void* data)
if (_legacyImpl is not null)
{
int hrLocal = _legacyImpl.GetDomainLocalModuleData(addr, data);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
}
#endif
@@ -770,7 +770,7 @@ int ISOSDacInterface.GetDomainLocalModuleDataFromAppDomain(ClrDataAddress appDom
if (_legacyImpl is not null)
{
int hrLocal = _legacyImpl.GetDomainLocalModuleDataFromAppDomain(appDomainAddr, moduleID, data);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
}
#endif
@@ -785,7 +785,7 @@ int ISOSDacInterface.GetDomainLocalModuleDataFromModule(ClrDataAddress moduleAdd
if (_legacyImpl is not null)
{
int hrLocal = _legacyImpl.GetDomainLocalModuleDataFromModule(moduleAddr, data);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
}
#endif
@@ -825,7 +825,7 @@ int ISOSDacInterface.GetFailedAssemblyLocation(ClrDataAddress assembly, uint cou
{
hrLocal = _legacyImpl.GetFailedAssemblyLocation(assembly, count, ptr, &neededLocal);
}
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
Debug.Assert(pNeeded == null || *pNeeded == neededLocal);
@@ -944,7 +944,7 @@ int ISOSDacInterface.GetFieldDescData(ClrDataAddress fieldDesc, DacpFieldDescDat
{
DacpFieldDescData dataLocal = default;
int hrLocal = _legacyImpl.GetFieldDescData(fieldDesc, &dataLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
Debug.Assert(data->Type == dataLocal.Type, $"cDAC: {data->Type}, DAC: {dataLocal.Type}");
@@ -1002,7 +1002,7 @@ int ISOSDacInterface.GetFrameName(ClrDataAddress vtable, uint count, char* frame
{
hrLocal = _legacyImpl.GetFrameName(vtable, count, ptr, &neededLocal);
}
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
Debug.Assert(pNeeded == null || *pNeeded == neededLocal);
@@ -1047,7 +1047,7 @@ int ISOSDacInterface.GetGCHeapData(DacpGcHeapData* data)
{
DacpGcHeapData dataLocal = default;
int hrLocal = _legacyImpl.GetGCHeapData(&dataLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
Debug.Assert(data->bServerMode == dataLocal.bServerMode, $"cDAC: {data->bServerMode}, DAC: {dataLocal.bServerMode}");
@@ -1107,7 +1107,7 @@ int ISOSDacInterface.GetGCHeapList(uint count, [In, MarshalUsing(CountElementNam
ClrDataAddress[] heapsLocal = new ClrDataAddress[count];
uint neededLocal;
int hrLocal = _legacyImpl.GetGCHeapList(count, heapsLocal, &neededLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
Debug.Assert(pNeeded == null || *pNeeded == neededLocal);
@@ -1215,7 +1215,7 @@ int ISOSDacInterface.GetGCHeapDetails(ClrDataAddress heap, DacpGcHeapDetails* de
{
DacpGcHeapDetails detailsLocal = default;
int hrLocal = _legacyImpl.GetGCHeapDetails(heap, &detailsLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
Debug.Assert(details->heapAddr == detailsLocal.heapAddr, $"cDAC: {details->heapAddr:x}, DAC: {detailsLocal.heapAddr:x}");
@@ -1348,7 +1348,7 @@ int ISOSDacInterface.GetGCHeapStaticData(DacpGcHeapDetails* details)
{
DacpGcHeapDetails detailsLocal = default;
int hrLocal = _legacyImpl.GetGCHeapStaticData(&detailsLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
Debug.Assert(details->heapAddr == detailsLocal.heapAddr, $"cDAC: {details->heapAddr:x}, DAC: {detailsLocal.heapAddr:x}");
@@ -1457,7 +1457,7 @@ int ISOSHandleEnum.Next(uint count, SOSHandleData[] handles, uint* pNeeded)
SOSHandleData[] handlesLocal = new SOSHandleData[count];
uint neededLocal;
int hrLocal = _legacyHandleEnum.Next(count, handlesLocal, &neededLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK || hr == HResults.S_FALSE)
{
Debug.Assert(*pNeeded == neededLocal, $"cDAC: {*pNeeded}, DAC: {neededLocal}");
@@ -1523,7 +1523,7 @@ int ISOSDacInterface.GetHandleEnum(out ISOSHandleEnum? ppHandleEnum)
if (_legacyImpl is not null)
{
int hrLocal = _legacyImpl.GetHandleEnum(out legacyHandleEnum);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
}
#endif
ppHandleEnum = new SOSHandleEnum(_target, supportedHandleTypes, legacyHandleEnum);
@@ -1550,7 +1550,7 @@ int ISOSDacInterface.GetHandleEnumForTypes([In, MarshalUsing(CountElementName =
if (_legacyImpl is not null)
{
int hrLocal = _legacyImpl.GetHandleEnumForTypes(types, count, out legacyHandleEnum);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
}
#endif
IGC gc = _target.Contracts.GC;
@@ -1600,7 +1600,7 @@ int ISOSDacInterface.GetHeapAnalyzeData(ClrDataAddress addr, DacpGcHeapAnalyzeDa
{
DacpGcHeapAnalyzeData dataLocal = default;
int hrLocal = _legacyImpl.GetHeapAnalyzeData(addr, &dataLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
Debug.Assert(data->heapAddr == dataLocal.heapAddr, $"cDAC: {data->heapAddr:x}, DAC: {dataLocal.heapAddr:x}");
@@ -1646,7 +1646,7 @@ int ISOSDacInterface.GetHeapAnalyzeStaticData(DacpGcHeapAnalyzeData* data)
{
DacpGcHeapAnalyzeData dataLocal = default;
int hrLocal = _legacyImpl.GetHeapAnalyzeStaticData(&dataLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
Debug.Assert(data->heapAddr == dataLocal.heapAddr, $"cDAC: {data->heapAddr:x}, DAC: {dataLocal.heapAddr:x}");
@@ -1707,7 +1707,7 @@ int ISOSDacInterface.GetHeapSegmentData(ClrDataAddress seg, DacpHeapSegmentData*
{
DacpHeapSegmentData dataLocal = default;
int hrLocal = _legacyImpl.GetHeapSegmentData(seg, &dataLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
Debug.Assert(data->segmentAddr == dataLocal.segmentAddr, $"segmentAddr - cDAC: {data->segmentAddr:x}, DAC: {dataLocal.segmentAddr:x}");
@@ -1737,7 +1737,7 @@ int ISOSDacInterface.GetHillClimbingLogEntry(ClrDataAddress addr, void* data)
if (_legacyImpl is not null)
{
int hrLocal = _legacyImpl.GetHillClimbingLogEntry(addr, data);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
}
#endif
@@ -1766,7 +1766,7 @@ int ISOSDacInterface.GetILForModule(ClrDataAddress moduleAddr, int rva, ClrDataA
{
ClrDataAddress ilLocal;
int hrLocal = _legacyImpl.GetILForModule(moduleAddr, rva, &ilLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
Debug.Assert(*il == ilLocal, $"cDAC: {*il:x}, DAC: {ilLocal:x}");
@@ -1809,7 +1809,7 @@ int ISOSDacInterface.GetJitManagerList(uint count, DacpJitManagerInfo* managers,
{
DacpJitManagerInfo managerLocal = default;
int hrLocal = _legacyImpl.GetJitManagerList(count, &managerLocal, null);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK && count >= 1)
{
Debug.Assert(managers->managerAddr == managerLocal.managerAddr);
@@ -1821,7 +1821,7 @@ int ISOSDacInterface.GetJitManagerList(uint count, DacpJitManagerInfo* managers,
{
uint neededLocal;
int hrLocal = _legacyImpl.GetJitManagerList(0, null, &neededLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK && pNeeded is not null)
{
Debug.Assert(*pNeeded == neededLocal);
@@ -1883,7 +1883,7 @@ int ISOSDacInterface.GetJumpThunkTarget(void* ctx, ClrDataAddress* targetIP, Clr
ClrDataAddress targetIPLocal;
ClrDataAddress targetMDLocal;
int hrLocal = _legacyImpl.GetJumpThunkTarget(ctx, &targetIPLocal, &targetMDLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
Debug.Assert(*targetIP == targetIPLocal, $"cDAC: {*targetIP:x}, DAC: {targetIPLocal:x}");
@@ -2101,7 +2101,7 @@ int ISOSDacInterface.GetMethodDescData(ClrDataAddress addr, ClrDataAddress ip, D
{
hrLocal = _legacyImpl.GetMethodDescData(addr, ip, &dataLocal, cRevertedRejitVersions, rgRevertedRejitDataLocalPtr, pcNeededRevertedRejitDataLocal);
}
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
Debug.Assert(data->bHasNativeCode == dataLocal.bHasNativeCode, $"cDAC: {data->bHasNativeCode}, DAC: {dataLocal.bHasNativeCode}");
@@ -2225,7 +2225,7 @@ int ISOSDacInterface.GetMethodDescFromToken(ClrDataAddress moduleAddr, uint toke
{
ClrDataAddress methodDescLocal;
int hrLocal = _legacyImpl.GetMethodDescFromToken(moduleAddr, token, &methodDescLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
Debug.Assert(*methodDesc == methodDescLocal, $"cDAC: {*methodDesc:x}, DAC: {methodDescLocal:x}");
@@ -2312,7 +2312,7 @@ int ISOSDacInterface.GetMethodDescName(ClrDataAddress addr, uint count, char* na
{
hrLocal = _legacyImpl.GetMethodDescName(addr, count, ptr, &neededLocal);
}
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
Debug.Assert(pNeeded == null || *pNeeded == neededLocal);
@@ -2349,7 +2349,7 @@ int ISOSDacInterface.GetMethodDescPtrFromFrame(ClrDataAddress frameAddr, ClrData
ClrDataAddress ppMDLocal;
int hrLocal = _legacyImpl.GetMethodDescPtrFromFrame(frameAddr, &ppMDLocal);
- Debug.Assert(hrLocal == hr);
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
Debug.Assert(*ppMD == ppMDLocal);
@@ -2400,7 +2400,7 @@ int ISOSDacInterface.GetMethodDescPtrFromIP(ClrDataAddress ip, ClrDataAddress* p
ClrDataAddress ppMDLocal;
int hrLocal = _legacyImpl.GetMethodDescPtrFromIP(ip, &ppMDLocal);
- Debug.Assert(hrLocal == hr);
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
Debug.Assert(*ppMD == ppMDLocal);
@@ -2483,7 +2483,7 @@ int ISOSDacInterface.GetMethodTableData(ClrDataAddress mt, DacpMethodTableData*
{
DacpMethodTableData dataLocal;
int hrLocal = _legacyImpl.GetMethodTableData(mt, &dataLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
Debug.Assert(data->module == dataLocal.module);
@@ -2531,7 +2531,7 @@ int ISOSDacInterface.GetMethodTableFieldData(ClrDataAddress mt, DacpMethodTableF
{
DacpMethodTableFieldData mtFieldDataLocal = default;
int hrLocal = _legacyImpl.GetMethodTableFieldData(mt, &mtFieldDataLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
Debug.Assert(data->wNumInstanceFields == mtFieldDataLocal.wNumInstanceFields);
@@ -2566,7 +2566,7 @@ int ISOSDacInterface.GetMethodTableForEEClass(ClrDataAddress eeClassReallyCanonM
{
ClrDataAddress valueLocal;
int hrLocal = _legacyImpl.GetMethodTableForEEClass(eeClassReallyCanonMT, &valueLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
Debug.Assert(*value == valueLocal);
}
@@ -2632,7 +2632,7 @@ int ISOSDacInterface.GetMethodTableName(ClrDataAddress mt, uint count, char* mtN
{
hrLocal = _legacyImpl.GetMethodTableName(mt, count, ptr, &neededLocal);
}
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
Debug.Assert(pNeeded == null || *pNeeded == neededLocal);
@@ -2702,7 +2702,7 @@ int ISOSDacInterface.GetMethodTableSlot(ClrDataAddress mt, uint slot, ClrDataAdd
hrLocal = _legacyImpl.GetMethodTableSlot(mt, slot, &valueLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK || hr == HResults.S_FALSE)
{
Debug.Assert(*value == valueLocal, $"cDAC: {*value:x}, DAC: {valueLocal:x}");
@@ -2816,7 +2816,7 @@ int ISOSDacInterface.GetModuleData(ClrDataAddress moduleAddr, DacpModuleData* da
{
DacpModuleData dataLocal;
int hrLocal = _legacyImpl.GetModuleData(moduleAddr, &dataLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
Debug.Assert(data->Address == dataLocal.Address);
@@ -2870,7 +2870,7 @@ int ISOSDacInterface.GetNestedExceptionData(ClrDataAddress exception, ClrDataAdd
ClrDataAddress exceptionObjectLocal;
ClrDataAddress nextNestedExceptionLocal;
int hrLocal = _legacyImpl.GetNestedExceptionData(exception, &exceptionObjectLocal, &nextNestedExceptionLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
Debug.Assert(*exceptionObject == exceptionObjectLocal);
@@ -2943,7 +2943,7 @@ int ISOSDacInterface.GetObjectClassName(ClrDataAddress obj, uint count, char* cl
{
hrLocal = _legacyImpl.GetObjectClassName(obj, count, ptr, &neededLocal);
}
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
Debug.Assert(pNeeded == null || *pNeeded == neededLocal);
@@ -3042,7 +3042,7 @@ int ISOSDacInterface.GetObjectData(ClrDataAddress objAddr, DacpObjectData* data)
{
DacpObjectData dataLocal;
int hrLocal = _legacyImpl.GetObjectData(objAddr, &dataLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
Debug.Assert(data->MethodTable == dataLocal.MethodTable);
@@ -3090,7 +3090,7 @@ int ISOSDacInterface.GetObjectStringData(ClrDataAddress obj, uint count, char* s
{
hrLocal = _legacyImpl.GetObjectStringData(obj, count, ptr, &neededLocal);
}
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
Debug.Assert(pNeeded == null || *pNeeded == neededLocal);
@@ -3137,7 +3137,7 @@ int ISOSDacInterface.GetOOMData(ClrDataAddress oomAddr, DacpOomData* data)
{
DacpOomData dataLocal;
int hrLocal = _legacyImpl.GetOOMData(oomAddr, &dataLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
Debug.Assert(data->reason == dataLocal.reason, $"cDAC: {data->reason}, DAC: {dataLocal.reason}");
@@ -3187,7 +3187,7 @@ int ISOSDacInterface.GetOOMStaticData(DacpOomData* data)
{
DacpOomData dataLocal;
int hrLocal = _legacyImpl.GetOOMStaticData(&dataLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
Debug.Assert(data->reason == dataLocal.reason, $"cDAC: {data->reason}, DAC: {dataLocal.reason}");
@@ -3233,7 +3233,7 @@ int ISOSDacInterface.GetPEFileBase(ClrDataAddress addr, ClrDataAddress* peBase)
{
ClrDataAddress peBaseLocal;
int hrLocal = _legacyImpl.GetPEFileBase(addr, &peBaseLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
Debug.Assert(*peBase == peBaseLocal);
}
@@ -3278,7 +3278,7 @@ int ISOSDacInterface.GetPEFileName(ClrDataAddress addr, uint count, char* fileNa
{
hrLocal = _legacyImpl.GetPEFileName(addr, count, ptr, &neededLocal);
}
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
Debug.Assert(pNeeded == null || *pNeeded == neededLocal);
@@ -3298,7 +3298,7 @@ int ISOSDacInterface.GetPrivateBinPaths(ClrDataAddress appDomain, int count, cha
if (_legacyImpl is not null)
{
int hrLocal = _legacyImpl.GetPrivateBinPaths(appDomain, count, paths, pNeeded);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
}
#endif
@@ -3363,7 +3363,7 @@ int ISOSDacInterface.GetRegisterName(int regName, uint count, char* buffer, uint
{
hrLocal = _legacyImpl.GetRegisterName(regName, count, ptr, &neededLocal);
}
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK || hr == HResults.S_FALSE)
{
Debug.Assert(pNeeded is null || *pNeeded == neededLocal);
@@ -3455,7 +3455,7 @@ int ISOSDacInterface.GetStackLimits(ClrDataAddress threadPtr, ClrDataAddress* lo
{
ClrDataAddress lowerLocal, upperLocal, fpLocal;
int hrLocal = _legacyImpl.GetStackLimits(threadPtr, &lowerLocal, &upperLocal, &fpLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
Debug.Assert(lower == null || *lower == lowerLocal, $"cDAC: {*lower:x}, DAC: {lowerLocal:x}");
@@ -3532,7 +3532,7 @@ int ISOSDacInterface.GetSyncBlockCleanupData(ClrDataAddress addr, DacpSyncBlockC
{
DacpSyncBlockCleanupData dataLocal;
int hrLocal = _legacyImpl.GetSyncBlockCleanupData(addr, &dataLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
Debug.Assert(data->SyncBlockPointer == dataLocal.SyncBlockPointer, $"cDAC: {data->SyncBlockPointer:x}, DAC: {dataLocal.SyncBlockPointer:x}");
@@ -3604,7 +3604,7 @@ int ISOSDacInterface.GetSyncBlockData(uint number, DacpSyncBlockData* data)
{
DacpSyncBlockData dataLocal;
int hrLocal = _legacyImpl.GetSyncBlockData(number, &dataLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
Debug.Assert(data->Object == dataLocal.Object, $"cDAC: {data->Object:x}, DAC: {dataLocal.Object:x}");
@@ -3651,7 +3651,7 @@ int ISOSDacInterface.GetThreadAllocData(ClrDataAddress thread, DacpAllocData* da
{
DacpAllocData dataLocal = default;
int hrLocal = _legacyImpl.GetThreadAllocData(thread, &dataLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
Debug.Assert(data->allocBytes == dataLocal.allocBytes, $"cDAC: {data->allocBytes:x}, DAC: {dataLocal.allocBytes:x}");
@@ -3701,7 +3701,7 @@ int ISOSDacInterface.GetThreadData(ClrDataAddress thread, DacpThreadData* data)
{
DacpThreadData dataLocal;
int hrLocal = _legacyImpl.GetThreadData(thread, &dataLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
Debug.Assert(data->corThreadId == dataLocal.corThreadId, $"cDAC: {data->corThreadId}, DAC: {dataLocal.corThreadId}");
@@ -3743,7 +3743,7 @@ int ISOSDacInterface.GetThreadFromThinlockID(uint thinLockId, ClrDataAddress* pT
{
ClrDataAddress pThreadLocal;
int hrLocal = _legacyImpl.GetThreadFromThinlockID(thinLockId, &pThreadLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
Debug.Assert(*pThread == pThreadLocal);
@@ -3761,7 +3761,7 @@ int ISOSDacInterface.GetThreadLocalModuleData(ClrDataAddress thread, uint index,
if (_legacyImpl is not null)
{
int hrLocal = _legacyImpl.GetThreadLocalModuleData(thread, index, data);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
}
#endif
@@ -3777,7 +3777,7 @@ int ISOSDacInterface.GetThreadpoolData(void* data)
if (_legacyImpl is not null)
{
int hrLocal = _legacyImpl.GetThreadpoolData(data);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
}
#endif
@@ -3816,7 +3816,7 @@ int ISOSDacInterface.GetThreadStoreData(DacpThreadStoreData* data)
{
DacpThreadStoreData dataLocal;
int hrLocal = _legacyImpl.GetThreadStoreData(&dataLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
Debug.Assert(data->threadCount == dataLocal.threadCount);
@@ -3855,7 +3855,7 @@ int ISOSDacInterface.GetTLSIndex(uint* pIndex)
{
uint indexLocal;
int hrLocal = _legacyImpl.GetTLSIndex(&indexLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK || hr == HResults.S_FALSE)
{
Debug.Assert(*pIndex == indexLocal);
@@ -3934,7 +3934,7 @@ int ISOSDacInterface.GetWorkRequestData(ClrDataAddress addrWorkRequest, void* da
if (_legacyImpl is not null)
{
int hrLocal = _legacyImpl.GetWorkRequestData(addrWorkRequest, data);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
}
#endif
@@ -4003,7 +4003,7 @@ int ISOSDacInterface.TraverseModuleMap(ModuleMapType mmt, ClrDataAddress moduleA
delegate* unmanaged[Stdcall] callbackDebugPtr = &TraverseModuleMapCallback;
int hrLocal = _legacyImpl.TraverseModuleMap(mmt, moduleAddr, callbackDebugPtr, tokenDebug);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
Debug.Assert(expectedElements[default] == elements.Count(), $"cDAC: {elements.Count()} elements, DAC: {expectedElements[default]} elements");
GCHandle.FromIntPtr((nint)tokenDebug).Free();
}
@@ -4063,7 +4063,7 @@ int ISOSDacInterface.TraverseRCWCleanupList(ClrDataAddress cleanupListPtr, deleg
delegate* unmanaged[Stdcall] callbackDebugPtr = &TraverseRCWCleanupListCallback;
int hrLocal = _legacyImpl.TraverseRCWCleanupList(cleanupListPtr, callbackDebugPtr, tokenDebug);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
Debug.Assert(expectedElements[default] == (ulong)cleanupInfos.Count(), $"cDAC: {cleanupInfos.Count()} elements, DAC: {expectedElements[default]} elements");
expectedElementsHandle.Free();
}
@@ -4123,7 +4123,7 @@ int ISOSDacInterface2.IsRCWDCOMProxy(ClrDataAddress rcwAddress, int* inDCOMProxy
{
int inDCOMProxyLocal;
int hrLocal = _legacyImpl2.IsRCWDCOMProxy(rcwAddress, &inDCOMProxyLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
Debug.Assert(*inDCOMProxy == inDCOMProxyLocal);
@@ -4166,7 +4166,7 @@ int ISOSDacInterface3.GetGCInterestingInfoData(ClrDataAddress interestingInfoAdd
{
DacpGCInterestingInfoData dataLocal = default;
int hrLocal = _legacyImpl3.GetGCInterestingInfoData(interestingInfoAddr, &dataLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
VerifyGCInterestingInfoData(data, &dataLocal);
@@ -4208,7 +4208,7 @@ int ISOSDacInterface3.GetGCInterestingInfoStaticData(DacpGCInterestingInfoData*
{
DacpGCInterestingInfoData dataLocal = default;
int hrLocal = _legacyImpl3.GetGCInterestingInfoStaticData(&dataLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
VerifyGCInterestingInfoData(data, &dataLocal);
@@ -4320,7 +4320,7 @@ int ISOSDacInterface3.GetGCGlobalMechanisms(nuint* globalMechanisms)
fixed (nuint* pLocal = globalMechanismsLocal)
{
int hrLocal = _legacyImpl3.GetGCGlobalMechanisms(pLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
for (int i = 0; i < GCConstants.DAC_MAX_GLOBAL_GC_MECHANISMS_COUNT; i++)
@@ -4364,7 +4364,7 @@ int ISOSDacInterface4.GetClrNotification(ClrDataAddress[] arguments, int count,
ClrDataAddress[] argumentsLocal = new ClrDataAddress[count];
int neededLocal;
int hrLocal = _legacyImpl4.GetClrNotification(argumentsLocal, count, &neededLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
Debug.Assert(*pNeeded == neededLocal);
@@ -4417,7 +4417,7 @@ int ISOSDacInterface6.GetMethodTableCollectibleData(ClrDataAddress mt, DacpMetho
{
DacpMethodTableCollectibleData dataLocal;
int hrLocal = _legacyImpl6.GetMethodTableCollectibleData(mt, &dataLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
Debug.Assert((data->bCollectible == 0) == (dataLocal.bCollectible == 0), $"cDAC: {data->bCollectible}, DAC: {dataLocal.bCollectible}");
@@ -4460,7 +4460,7 @@ int ISOSDacInterface7.GetPendingReJITID(ClrDataAddress methodDesc, int* pRejitId
{
int rejitIdLocal;
int hrLocal = _legacyImpl7.GetPendingReJITID(methodDesc, &rejitIdLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
Debug.Assert(*pRejitId == rejitIdLocal);
@@ -4518,7 +4518,7 @@ int ISOSDacInterface7.GetReJITInformation(ClrDataAddress methodDesc, int rejitId
{
DacpReJitData2 rejitDataLocal;
int hrLocal = _legacyImpl7.GetReJITInformation(methodDesc, rejitId, &rejitDataLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
Debug.Assert(pRejitData->rejitID == rejitDataLocal.rejitID);
@@ -4579,7 +4579,7 @@ int ISOSDacInterface7.GetProfilerModifiedILInformation(ClrDataAddress methodDesc
{
DacpProfilerILData ilDataLocal;
int hrLocal = _legacyImpl7.GetProfilerModifiedILInformation(methodDesc, &ilDataLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
Debug.Assert(pILData->type == ilDataLocal.type, $"cDAC: {pILData->type}, DAC: {ilDataLocal.type}");
@@ -4645,7 +4645,7 @@ int ISOSDacInterface7.GetMethodsWithProfilerModifiedIL(ClrDataAddress mod, ClrDa
{
hrLocal = _legacyImpl7.GetMethodsWithProfilerModifiedIL(mod, ptr, cMethodDescs, &pcMethodDescsLocal);
}
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
Debug.Assert(*pcMethodDescs == pcMethodDescsLocal, $"cDAC: {*pcMethodDescs}, DAC: {pcMethodDescsLocal}");
@@ -4686,7 +4686,7 @@ int ISOSDacInterface8.GetNumberGenerations(uint* pGenerations)
{
uint pGenerationsLocal;
int hrLocal = _legacyImpl8.GetNumberGenerations(&pGenerationsLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
Debug.Assert(*pGenerations == pGenerationsLocal);
@@ -4744,7 +4744,7 @@ int ISOSDacInterface8.GetGenerationTable(uint cGenerations, DacpGenerationData*
fixed (DacpGenerationData* pGenDataLocal = genDataLocal)
{
int hrLocal = _legacyImpl8.GetGenerationTable(cGenerations, pGenDataLocal, &pNeededLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (pNeeded is not null)
{
Debug.Assert(*pNeeded == pNeededLocal);
@@ -4809,7 +4809,7 @@ int ISOSDacInterface8.GetFinalizationFillPointers(uint cFillPointers, ClrDataAdd
fixed (ClrDataAddress* pFillPointersLocal = fillPointersLocal)
{
int hrLocal = _legacyImpl8.GetFinalizationFillPointers(cFillPointers, pFillPointersLocal, &pNeededLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (pNeeded is not null)
{
Debug.Assert(*pNeeded == pNeededLocal);
@@ -4875,7 +4875,7 @@ int ISOSDacInterface8.GetGenerationTableSvr(ClrDataAddress heapAddr, uint cGener
fixed (DacpGenerationData* pGenDataLocal = genDataLocal)
{
int hrLocal = _legacyImpl8.GetGenerationTableSvr(heapAddr, cGenerations, pGenDataLocal, &pNeededLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (pNeeded is not null)
{
Debug.Assert(*pNeeded == pNeededLocal);
@@ -4940,7 +4940,7 @@ int ISOSDacInterface8.GetFinalizationFillPointersSvr(ClrDataAddress heapAddr, ui
fixed (ClrDataAddress* pFillPointersLocal = fillPointersLocal)
{
int hrLocal = _legacyImpl8.GetFinalizationFillPointersSvr(heapAddr, cFillPointers, pFillPointersLocal, &pNeededLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (pNeeded is not null)
{
Debug.Assert(*pNeeded == pNeededLocal);
@@ -4983,7 +4983,7 @@ int ISOSDacInterface8.GetAssemblyLoadContext(ClrDataAddress methodTable, ClrData
{
ClrDataAddress assemblyLoadContextLocal;
int hrLocal = _legacyImpl8.GetAssemblyLoadContext(methodTable, &assemblyLoadContextLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
Debug.Assert(*assemblyLoadContext == assemblyLoadContextLocal);
@@ -5037,7 +5037,7 @@ int ISOSDacInterface10.IsComWrappersCCW(ClrDataAddress ccw, Interop.BOOL* isComW
{
Interop.BOOL isComWrappersCCWLocal;
int hrLocal = _legacyImpl10.IsComWrappersCCW(ccw, &isComWrappersCCWLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK || hr == HResults.S_FALSE)
{
Debug.Assert(*isComWrappersCCW == isComWrappersCCWLocal);
@@ -5078,7 +5078,7 @@ int ISOSDacInterface10.GetComWrappersCCWData(ClrDataAddress ccw, ClrDataAddress*
ClrDataAddress managedObjectLocal;
int refCountLocal;
int hrLocal = _legacyImpl10.GetComWrappersCCWData(ccw, &managedObjectLocal, &refCountLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
if (managedObject != null)
@@ -5119,7 +5119,7 @@ int ISOSDacInterface10.IsComWrappersRCW(ClrDataAddress rcw, Interop.BOOL* isComW
{
Interop.BOOL isComWrappersRCWLocal;
int hrLocal = _legacyImpl10.IsComWrappersRCW(rcw, &isComWrappersRCWLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK || hr == HResults.S_FALSE)
{
Debug.Assert(*isComWrappersRCW == isComWrappersRCWLocal);
@@ -5153,7 +5153,7 @@ int ISOSDacInterface10.GetComWrappersRCWData(ClrDataAddress rcw, ClrDataAddress*
{
ClrDataAddress identityLocal;
int hrLocal = _legacyImpl10.GetComWrappersRCWData(rcw, &identityLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
Debug.Assert(*identity == identityLocal);
@@ -5196,7 +5196,7 @@ int ISOSDacInterface12.GetGlobalAllocationContext(ClrDataAddress* allocPtr, ClrD
ClrDataAddress allocPtrLocal = default;
ClrDataAddress allocLimitLocal = default;
int hrLocal = _legacyImpl12.GetGlobalAllocationContext(&allocPtrLocal, &allocLimitLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
Debug.Assert(*allocPtr == allocPtrLocal);
@@ -5242,7 +5242,7 @@ int ISOSDacInterface13.GetDomainLoaderAllocator(ClrDataAddress domainAddress, Cl
{
ClrDataAddress pLoaderAllocatorLocal;
int hrLocal = _legacyImpl13.GetDomainLoaderAllocator(domainAddress, &pLoaderAllocatorLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK || hr == HResults.S_FALSE)
{
Debug.Assert(*pLoaderAllocator == pLoaderAllocatorLocal);
@@ -5293,7 +5293,7 @@ int ISOSDacInterface14.GetStaticBaseAddress(ClrDataAddress methodTable, ClrDataA
ClrDataAddress nonGCStaticsAddressLocal;
ClrDataAddress GCStaticsAddressLocal;
int hrLocal = _legacyImpl14.GetStaticBaseAddress(methodTable, &nonGCStaticsAddressLocal, &GCStaticsAddressLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
if (GCStaticsAddress != null)
@@ -5347,7 +5347,7 @@ int ISOSDacInterface14.GetThreadStaticBaseAddress(ClrDataAddress methodTable, Cl
ClrDataAddress* nonGCStaticsAddressOrNull = nonGCStaticsAddress != null ? &nonGCStaticsAddressLocal : null;
ClrDataAddress* gcStaticsAddressOrNull = GCStaticsAddress != null ? &GCStaticsAddressLocal : null;
int hrLocal = _legacyImpl14.GetThreadStaticBaseAddress(methodTable, thread, nonGCStaticsAddressOrNull, gcStaticsAddressOrNull);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
if (nonGCStaticsAddress != null)
@@ -5387,7 +5387,7 @@ int ISOSDacInterface14.GetMethodTableInitializationFlags(ClrDataAddress methodTa
{
MethodTableInitializationFlags initializationStatusLocal;
int hrLocal = _legacyImpl14.GetMethodTableInitializationFlags(methodTable, &initializationStatusLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK)
{
Debug.Assert(*initializationStatus == initializationStatusLocal);
@@ -5518,7 +5518,7 @@ int ISOSMethodEnum.Next(uint count, [In, Out, MarshalUsing(CountElementName = na
uint neededLocal;
int hrLocal = _legacyMethodEnum.Next(count, valuesLocal, &neededLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK || hr == HResults.S_FALSE)
{
Debug.Assert(*pNeeded == neededLocal, $"cDAC: {*pNeeded}, DAC: {neededLocal}");
@@ -5599,7 +5599,7 @@ int ISOSDacInterface15.GetMethodTableSlotEnumerator(ClrDataAddress mt, out ISOSM
if (_legacyImpl15 is not null)
{
int hrLocal = _legacyImpl15.GetMethodTableSlotEnumerator(mt, out legacyMethodEnum);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
}
#endif
@@ -5645,7 +5645,7 @@ int ISOSDacInterface16.GetGCDynamicAdaptationMode(int* pDynamicAdaptationMode)
{
int dynamicAdaptationModeLocal;
int hrLocal = _legacyImpl16.GetGCDynamicAdaptationMode(&dynamicAdaptationModeLocal);
- Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
+ Debug.ValidateHResult(hr, hrLocal);
if (hr == HResults.S_OK || hr == HResults.S_FALSE)
{
Debug.Assert(pDynamicAdaptationMode == null || *pDynamicAdaptationMode == dynamicAdaptationModeLocal);