Implement cDAC method definition enumeration by address#131338
Merged
Conversation
Co-authored-by: rcj1 <77995559+rcj1@users.noreply.github.com>
Co-authored-by: rcj1 <77995559+rcj1@users.noreply.github.com>
Co-authored-by: rcj1 <77995559+rcj1@users.noreply.github.com>
Co-authored-by: rcj1 <77995559+rcj1@users.noreply.github.com>
Co-authored-by: rcj1 <77995559+rcj1@users.noreply.github.com>
|
Azure Pipelines: Successfully started running 4 pipeline(s). 12 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag |
Co-authored-by: rcj1 <77995559+rcj1@users.noreply.github.com>
Co-authored-by: rcj1 <77995559+rcj1@users.noreply.github.com>
3 tasks
Contributor
There was a problem hiding this comment.
Copilot's findings
Comments suppressed due to low confidence (1)
src/native/managed/cdac/tests/UnitTests/IXCLRDataProcessTests.cs:326
- For tiny headers, the first address outside the IL stream is
codeStart + codeSize(i.e.,FirstHeaderAddress + 1 + TinyCodeSize). WithTinyCodeSize = 3,FirstHeaderAddress + 3is still inside the IL code range if you start from+1, so this boundary test should useFirstHeaderAddress + 4.
hr = process.StartEnumMethodDefinitionsByAddress(FirstHeaderAddress + 3, &handle);
Assert.Equal(HResults.S_OK, hr);
try
{
DacComNullableByRef<IXCLRDataMethodDefinition> methodOut = new(isNullRef: false);
Assert.Equal(HResults.S_FALSE, process.EnumMethodDefinitionByAddress(&handle, methodOut));
}
- Files reviewed: 2/2 changed files
- Comments generated: 2
Contributor
There was a problem hiding this comment.
Copilot's findings
Comments suppressed due to low confidence (1)
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/SOSDacImpl.IXCLRDataProcess.cs:1654
- The tiny-header case uses a 0-byte adjustment for the address filter (vs
headerSize). That matches the legacy DAC’s4 * COR_ILMETHOD_DECODER::GetSize()behavior (whereGetSize()is 0 for tiny), but it’s counterintuitive vs ECMA-335 and easy to “fix” incorrectly later. Add a short comment explaining the legacy parity requirement to preserve intent.
bool isTinyHeader = headerSize == sizeof(byte);
uint codeStartOffset = isTinyHeader ? 0 : (uint)headerSize;
ClrDataAddress codeStart = (ilHeader + codeStartOffset).ToClrDataAddress(_target);
- Files reviewed: 2/2 changed files
- Comments generated: 0 new
|
Azure Pipelines: Successfully started running 4 pipeline(s). 12 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
noahfalk
approved these changes
Jul 24, 2026
Contributor
There was a problem hiding this comment.
Copilot's findings
Comments suppressed due to low confidence (1)
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/SOSDacImpl.IXCLRDataProcess.cs:1612
- GCHandle.Target can throw InvalidOperationException when the handle value is not an allocated GCHandle (e.g., random/garbage non-zero handle), which would return COR_E_INVALIDOPERATION instead of E_INVALIDARG. Add an IsAllocated guard before accessing Target so invalid EndEnum handles consistently map to E_INVALIDARG.
GCHandle gcHandle = GCHandle.FromIntPtr((IntPtr)handle);
if (gcHandle.Target is not ProcessEnum<MethodDefinitionInfo> methodDefinitionsLocal)
throw new ArgumentException("Invalid enumeration handle", nameof(handle));
- Files reviewed: 3/3 changed files
- Comments generated: 1
rcj1
enabled auto-merge (squash)
July 25, 2026 04:07
hoyosjs
approved these changes
Jul 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements
StartEnumMethodDefinitionsByAddress,EnumMethodDefinitionByAddress, andEndEnumMethodDefinitionsByAddressforClrDataProcess.