Conversation
Replace the legacy-delegation stub with a contract-based implementation that: - Gets the ILoader contract and resolves the assembly pointer to a ModuleHandle - Reads current debugger info bits, clears DACF_ALLOW_JIT_OPTS and DACF_ENC_ENABLED, masks with DACF_CONTROL_FLAGS_MASK - Conditionally ORs in the requested flags - Delegates to SetDebuggerInfoBits which handles EncCapable check, JIT optimization disabled state, and EditAndContinue flag logic - Returns CORDBG_S_NOT_ALL_BITS_SET if EnC was requested but could not be enabled - Includes #if DEBUG legacy validation block Add CORDBG_S_NOT_ALL_BITS_SET constant to CorDbgHResults. Add unit tests covering: both flags set (EnC capable), both flags unset, EnC requested but not capable, and JIT opts toggling. Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/0d4cb517-9044-4d94-902e-a91169e2d2f5 Co-authored-by: barosiak <76071368+barosiak@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/0d4cb517-9044-4d94-902e-a91169e2d2f5 Co-authored-by: barosiak <76071368+barosiak@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Implements SetCompilerFlags in the cDAC DacDbiImpl using the ILoader contract to update debugger assembly control flags and adds coverage/tests and a missing success HRESULT constant to match native DAC semantics.
Changes:
- Implement
DacDbiImpl.SetCompilerFlagsviaILoaderand returnCORDBG_S_NOT_ALL_BITS_SETwhen EnC cannot be enabled. - Add
CORDBG_S_NOT_ALL_BITS_SETtoCorDbgHResults. - Add
SetCompilerFlagsTestscovering flag set/unset and EnC capability behavior across architectures.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/Dbi/DacDbiImpl.cs | Adds SetCompilerFlags implementation using ILoader and post-write EnC enablement check |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Abstractions/CorDbHResults.cs | Adds missing CORDBG_S_NOT_ALL_BITS_SET HRESULT constant |
| src/native/managed/cdac/tests/LoaderTests.cs | Adds new test coverage for SetCompilerFlags behavior |
|
|
||
| loader.SetDebuggerInfoBits(handle, controlFlags); | ||
|
|
||
| // Check if EnC was requested but the module was not capable. |
There was a problem hiding this comment.
The comment says this is checking whether the module is “not capable”, but the condition is checking whether ModuleFlags.EditAndContinue ended up enabled after SetDebuggerInfoBits. That bit can remain unset for reasons other than capability (e.g., global EEConfig policy). Consider rewording the comment to reflect what’s actually being validated (whether EnC was successfully enabled).
| // Check if EnC was requested but the module was not capable. | |
| // Check if EnC was requested but was not successfully enabled. |
🤖 Copilot Code Review — PR #127244Note This review was generated by GitHub Copilot (Claude Opus 4.6), with additional perspectives from GPT-5.3-Codex and Claude Haiku 4.5. Holistic AssessmentMotivation: The PR replaces the Approach: The implementation follows the established cDAC patterns: try/catch with HRESULT return, Summary: Detailed Findings
|
| // Check if EnC was requested but the module was not capable. | ||
| if (fEnableEnC == Interop.BOOL.TRUE && (loader.GetFlags(handle) & Contracts.ModuleFlags.EditAndContinue) == 0) | ||
| { | ||
| hr = CorDbgHResults.CORDBG_S_NOT_ALL_BITS_SET; |
There was a problem hiding this comment.
Nit: prefer Marshal.GetExceptionForHR
Summary
Implement SetCompilerFlags in cDAC DacDbiImpl using ILoader contract to set debugger assembly control flags, using a post-write EnC capability check instead of native DAC's pre-write one.
Changes
architectures