diff --git a/src/coreclr/debug/di/rsthread.cpp b/src/coreclr/debug/di/rsthread.cpp index f32c499371a44f..15285136229e05 100644 --- a/src/coreclr/debug/di/rsthread.cpp +++ b/src/coreclr/debug/di/rsthread.cpp @@ -11525,8 +11525,14 @@ void CordbAsyncFrame::LoadGenericArgs() { if (m_asyncVars[i].ilVarNum == genericArgIndex) { - - HRESULT hr = GetProcess()->SafeReadStruct(m_continuationAddress + m_asyncVars[i].offset, &genericTypeParam); + // Read a target-pointer-sized value. CORDB_ADDRESS is always 8 bytes (ULONG64), + // but on x86 targets the generic arg field is only a 4-byte pointer. Using + // SIZE_T (which is pointer-sized for the DBI build, matching the target here) + // avoids reading adjacent memory. This mirrors how CordbJITILFrame::Init() + // reads the raw token via GetRegisterOrStackValue (which returns SIZE_T). + SIZE_T rawToken = 0; + HRESULT hr = GetProcess()->SafeReadStruct(m_continuationAddress + m_asyncVars[i].offset, &rawToken); + genericTypeParam = (CORDB_ADDRESS)rawToken; IfFailThrow(hr); break; }