You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The cdac legacy data-target adapters in mscordaccore_universal/Entrypoints.cs return generic HRESULTs where the CoreCLR debugger stack uses more specific ones. The same patterns exist across the ICorDebugDataTarget path (added in #130856) and the ICLRDataTarget/CLRDataCreateInstance path (added in #114812), and were re-flagged in review of #131008. Consolidating the fixes here so they land in one change.
Items to address across both data-target adapter paths (CreateTargetFromCorDebugDataTarget and CLRDataCreateInstanceCore):
Partial ReadVirtual. When ReadVirtual returns success but reads fewer bytes than requested, return CORDBG_E_READVIRTUAL_FAILURE instead of E_FAIL. The CLRDataCreateInstance path currently does not check bytesRead at all - a partial read there can leave a fixed-size header buffer partly uninitialized and cause nondeterministic descriptor parsing. Apply the check consistently.
Write to a read-only target. When the target does not implement ICorDebugMutableDataTarget, the WriteVirtual and SetThreadContext callbacks return E_NOTIMPL, which is ambiguous (method-missing vs. intentionally read-only). Return CORDBG_E_TARGET_READONLY, matching ReadOnlyDataTargetFacade.
ContractDescriptorTarget.TryCreate failure. When TryCreate returns false, the entrypoint surfaces COR_E_INVALIDOPERATION via InvalidOperationException. Return a conventional HRESULT (E_FAIL) instead.
Out of scope: the shimdatatarget.cppE_INVALIDARG -> E_UNEXPECTED suggestions from #131008 review are moot; those methods were removed.
Note
This issue was authored by GitHub Copilot on behalf of @hoyosjs.
The cdac legacy data-target adapters in
mscordaccore_universal/Entrypoints.csreturn generic HRESULTs where the CoreCLR debugger stack uses more specific ones. The same patterns exist across theICorDebugDataTargetpath (added in #130856) and theICLRDataTarget/CLRDataCreateInstancepath (added in #114812), and were re-flagged in review of #131008. Consolidating the fixes here so they land in one change.Items to address across both data-target adapter paths (
CreateTargetFromCorDebugDataTargetandCLRDataCreateInstanceCore):ReadVirtual. WhenReadVirtualreturns success but reads fewer bytes than requested, returnCORDBG_E_READVIRTUAL_FAILUREinstead ofE_FAIL. TheCLRDataCreateInstancepath currently does not checkbytesReadat all - a partial read there can leave a fixed-size header buffer partly uninitialized and cause nondeterministic descriptor parsing. Apply the check consistently.ICorDebugMutableDataTarget, theWriteVirtualandSetThreadContextcallbacks returnE_NOTIMPL, which is ambiguous (method-missing vs. intentionally read-only). ReturnCORDBG_E_TARGET_READONLY, matchingReadOnlyDataTargetFacade.ContractDescriptorTarget.TryCreatefailure. WhenTryCreatereturnsfalse, the entrypoint surfacesCOR_E_INVALIDOPERATIONviaInvalidOperationException. Return a conventional HRESULT (E_FAIL) instead.Out of scope: the
shimdatatarget.cppE_INVALIDARG->E_UNEXPECTEDsuggestions from #131008 review are moot; those methods were removed.Note
This issue was authored by GitHub Copilot on behalf of @hoyosjs.