Draft
Deprecate ForceEnc: remove implicit debugger-attach EnC enablement, migrate to DOTNET_MODIFIABLE_ASSEMBLIES#130495
Conversation
Contributor
|
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag |
…ror messages Co-authored-by: steveisok <471438+steveisok@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Deprecate ForceEnc and migrate tests to DOTNET_MODIFIABLE_ASSEMBLIES
Deprecate ForceEnc: remove implicit debugger-attach EnC enablement, migrate to DOTNET_MODIFIABLE_ASSEMBLIES
Jul 10, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR tightens metadata update / Hot Reload enablement to require explicit opt-in via DOTNET_MODIFIABLE_ASSEMBLIES=debug, and aligns Mono’s user-facing error text with the canonical value.
Changes:
- CoreCLR:
AssemblyNative_IsApplyUpdateSupported()now returnstrueonly wheng_pConfig->ModifiableAssemblies() == MODIFIABLE_ASSM_DEBUG(removing the implicit “debugger attached” enablement). - Mono: error messages now refer to
'debug'instead of'Debug'when explaining the requiredDOTNET_MODIFIABLE_ASSEMBLIESvalue.
Show a summary per file
| File | Description |
|---|---|
| src/coreclr/vm/assemblynative.cpp | Removes debugger-attach-based enablement for IsApplyUpdateSupported, requiring explicit MODIFIABLE_ASSM_DEBUG. |
| src/mono/mono/component/hot_reload.c | Adjusts Hot Reload error messages to use lowercase 'debug' to match the documented/canonical env var value. |
Copilot's findings
- Files reviewed: 2/2 changed files
- Comments generated: 1
Comment on lines
1445
to
1447
| #ifdef FEATURE_METADATA_UPDATER | ||
| result = (g_pConfig->ModifiableAssemblies() != MODIFIABLE_ASSM_NONE) && | ||
| (CORDebuggerAttached() || g_pConfig->ModifiableAssemblies() == MODIFIABLE_ASSM_DEBUG); | ||
| result = g_pConfig->ModifiableAssemblies() == MODIFIABLE_ASSM_DEBUG; | ||
| #endif |
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.
ForceEncwas an undocumented, broken mechanism where attaching a debugger would implicitly setMetadataUpdater.IsSupported = true— even thoughMetadataUpdater.ApplyUpdatethrowsNotSupportedExceptionwhen a debugger is attached. The correct path isDOTNET_MODIFIABLE_ASSEMBLIES=debug.Changes
src/coreclr/vm/assemblynative.cpp— SimplifiedAssemblyNative_IsApplyUpdateSupported()to require explicit opt-in:The
CORDebuggerAttached()path was doubly broken:ApplyUpdatethrows when a debugger is attached, and sinceIsSupportedis a cached static property, the check was also unreliable depending on when theMetadataUpdatertype was first loaded relative to debugger attachment.src/mono/mono/component/hot_reload.c— Fixed error messages to use lowercase'debug'(matching the actual accepted env var value) instead of'Debug'.