Token导航 LogoToken导航TokenDH.com
研究检索敏感数据github未标认证来源可访问许可证需确认审计提醒

clr-activation-debuggingclr 激活调试

Agent Skill

clr-activation-debugging 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

5,043

周安装

206

GitHub Stars

1,534

下载量

1,632
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:clr-activation-debugging(clr 激活调试)
来源仓库:https://github.com/dotnet/skills
仓库路径:skills/clr-activation-debugging
安装命令:
npx skills add https://github.com/dotnet/skills --skill clr-activation-debugging
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/dotnet/skills --skill clr-activation-debugging

简介

clr-activation-debugging 用于诊断 .NET Framework 运行时激活问题,分析 CLR 加载日志。

  • 适合在 Codex、Claude、Cursor、Gemini CLI 中排查 COM 组件加载失败或版本冲突。
  • 解析 shim 决策过程,识别错误 CLR 选择或 Feature-on-Demand 安装异常。
  • 需启用日志记录并确保有足够权限读取系统级调试输出。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

CLR Activation Debugging

Diagnose.NET Framework runtime activation issues by analyzing CLR activation logs (CLRLoad logs) produced by the shim (mscoree.dll). These logs record every decision the shim makes when selecting and loading a CLR version.

When to Use

  • A process fails to load the CLR at all ("Unable to find a version of the runtime to use")
  • The shim picks the wrong CLR version (e.g., v2.0 instead of v4.0)
  • Unexpected.NET 3.5 Feature-on-Demand (FOD) install dialogs appear
  • FOD dialogs are expected but do NOT appear
  • Both CLR v2 and CLR v4 load into the same process, causing failures
  • A COM object fails to activate because the shim can't resolve the runtime
  • Legacy hosting APIs (CorBindToRuntime) bind to an unexpected version

When Not to Use

  • Modern.NET (CoreCLR /.NET 5+) — this skill covers.NET Framework only (the mscoree.dll shim)
  • Assembly binding failures — use Fusion logs (fuslogvw.exe), not CLR activation logs
  • Runtime crashes after the CLR has loaded — activation succeeded; the problem is elsewhere

Background

The Shim Architecture

The.NET Framework shim has two layers:

  • mscoree.dll (the "shell shim") — the public-facing DLL that is the registered InprocServer32 for CLR-hosted COM objects and the entry point for _CorExeMain, legacy APIs, etc.
  • mscoreei.dll — the actual shim implementation where the runtime selection logic, logging, and activation decisions live. mscoree.dll forwards into mscoreei.dll.

When reading logs, the caller-name:mscoreei.dll in FOD command lines reflects this — it's mscoreei.dll doing the work.

.NET 3.5 / v2.0.50727 Version Mapping

.NET 2.0, 3.0, and 3.5 all share the same CLR runtime version: v2.0.50727. The "3.0" and "3.5" releases were library additions on top of CLR v2.0. For activation purposes, they are all "v2.0.50727." When the shim resolves to v2.0.50727 or FOD offers to install "NetFx3", it's installing the CLR v2.0 runtime (plus the 3.0/3.5 libraries). Similarly, CLR v4.0 (v4.0.30319) covers all.NET Framework versions from 4.0 through 4.8.x.

.NET 3.5 Availability on Recent Windows

On recent Windows versions (Windows 11 Insider Preview Build 27965 and future platform releases),.NET Framework 3.5 is no longer available as a Windows optional component (Feature-on-Demand). It must be installed from a standalone MSI. This means the FOD dialog (fondue.exe /enable-feature:NetFx3) will not succeed on these systems even if it fires. On Windows 10 and Windows 11 through 25H2, FOD remains available..NET Framework 3.5 reaches end of support on January 9, 2029.

Shim HRESULT Codes

When the shim fails, it returns specific HRESULTs in the 0x8013xxxx range. These are the errors you'll see from callers (not in the activation logs themselves, which log human-readable messages):

HRESULTSymbolMeaning
0x80131700CLR_E_SHIM_RUNTIMELOADCannot find or load a suitable runtime version. This is the most common shim error — it's what callers see when capped legacy activation fails on a v4-only machine.
0x80131701CLR_E_SHIM_RUNTIMEEXPORTFound a runtime but failed to get a required export or interface from it.
0x80131702CLR_E_SHIM_INSTALLROOTThe.NET Framework install root is missing or invalid in the registry.
0x80131703CLR_E_SHIM_INSTALLCOMPA required component of the installation is missing.
0x80131704CLR_E_SHIM_LEGACYRUNTIMEALREADYBOUNDA different runtime is already bound as the legacy runtime. A legacy API tried to bind to a version that conflicts with the one already chosen.
0x80131705CLR_E_SHIM_SHUTDOWNINPROGRESSThe shim is shutting down and cannot service the request.

If a user reports one of these HRESULTs (especially 0x80131700), CLR activation logs are the right diagnostic tool.

Prerequisites

CLR activation logging must be enabled to produce log files. If the user doesn't have logs yet, instruct them to enable logging:

Via environment variable (recommended — scoped to current session):

set COMPLUS_CLRLoadLogDir=C:\CLRLoadLogs

Via registry (machine-wide — affects all.NET Framework processes):

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework
  CLRLoadLogDir = "C:\CLRLoadLogs" (REG_SZ)

On 64-bit systems, also set under Wow6432Node if 32-bit processes are involved.

⚠️ The log directory must already exist. The shim will not create it. If it doesn't exist, no logs will be written and there will be no error or indication of failure.

Logs are written as {ProcessName}.CLRLoad{NN}.log (NN = 00–99, one per process instance). Logs cannot be read until the process exits — the file is held open.

After capturing, remove the env var or registry key to stop logging.

Inputs

InputRequiredDescription
CLR activation log filesYesOne or more .CLRLoad*.log files
Symptom descriptionRecommendedWhat the user observed (FOD dialog, wrong runtime, failure, etc.)
Expected behaviorRecommendedWhat the user expected to happen

Workflow

Step 1: Load Reference Material

Try to load the reference files in this order — they contain the detailed log format, decision flow, and CLSID registry documentation:

  1. references/log-format.md — Log line format, fields, and all known log message types
  2. references/activation-flow.md — The shim's decision tree for runtime selection
  3. references/com-activation.md — COM (DllGetClassObject) activation specifics, CLSID registry layout

If reference files are not available, proceed using the inline knowledge below.

Step 2: Survey the Log Files

Get the big picture before diving into any single log:

  1. List all log files and group by process name — this shows which executables triggered CLR activation
  2. For each process, scan for outcome lines:

- Decided on runtime: vX.Y.Z — successful resolution - ERROR: — failed resolution - Launching feature-on-demand — FOD dialog was shown - Could have launched feature-on-demand — FOD would have fired but was suppressed - V2.0 Capping is preventing consideration — v4+ was skipped due to capping

grep -l "ERROR:\|Launching feature-on-demand\|Could have launched" *.log
grep -c "Launching feature-on-demand" *.log
  1. Build a summary table:
ProcessLog FilesOutcomeRuntime SelectedFOD?
...............

Step 3: Analyze Problematic Logs

For each log file with an unexpected outcome, trace the full activation flow. Read the log top-to-bottom and identify:

⚠️ Nested log entries: The shim's own internal calls can trigger additional log entries within an activation sequence that is already being logged. For example, a DllGetClassObject call may internally call ComputeVersionString, which calls FindLatestVersion, each generating log lines. When the FOD check runs ("Checking if feature-on-demand installation would help"), it re-runs the entire version computation — producing a second ComputeVersionString block within the same activation. Don't mistake these nested/re-entrant entries for separate activation attempts.

3a. Entry Point

The first FunctionCall: or MethodCall: line tells you how activation was triggered:

Entry PointMeaning
_CorExeMainManaged EXE launch — the binary IS a.NET assembly
DllGetClassObject. Clsid: {guid}COM activation — something CoCreated a COM class routed through mscoree.dll
ClrCreateInstanceModern (v4+) hosting API
CorBindToRuntimeExLegacy (v1/v2) hosting API — binds the process to one runtime
ICLRMetaHostPolicy::GetRequestedRuntimePolicy-based hosting API (often called internally after other entry points)
LoadLibraryShimLegacy API to load a framework DLL by name

3b. Input Parameters

Immediately after the entry point, the log dumps the version computation inputs:

  • IsLegacyBind: Is this a legacy (pre-v4) activation path? If 1, the shim uses the single-runtime "legacy" view of the world. Legacy APIs (CorBindToRuntimeEx, DllGetClassObject for legacy COM, LoadLibraryShim, etc.) set this.
  • IsCapped: If 1, the shim's roll-forward semantics are capped at Whidbey (v2.0.50727) — it will NOT consider v4.0+ when enumerating installed runtimes. This is the mechanism that makes v4 installation non-impactful: legacy codepaths continue to behave as if v4 doesn't exist. On a v4-only machine with no.NET 3.5, a capped enumeration sees no runtimes at all. Capping does NOT prevent loading v4+ if a specific v4 version string is explicitly provided (e.g., via CorBindToRuntimeEx("v4.0.30319",...) or via config with useLegacyV2RuntimeActivationPolicy).
  • SkuCheckFlags: Controls SKU (edition) compatibility checking.
  • ShouldEmulateExeLaunch: Whether to pretend this is an EXE launch for policy purposes.
  • LegacyBindRequired: Whether a legacy bind is strictly required.

3c. Config File Processing

Look for config file parsing results:

  • Parsing config file: {path} — the shim is looking for a .config file
  • Config File (Open). Result:00000000 — config file found and opened successfully
  • Config File (Open). Result:80070002config file not found (HRESULT for ERROR_FILE_NOT_FOUND)
  • Found config file: {path} — config was successfully read
  • UseLegacyV2RuntimeActivationPolicy is set to {0|1} — whether <startup useLegacyV2RuntimeActivationPolicy="true"> is present. When 1, all runtimes are treated as candidates for legacy codepaths — meaning legacy shim APIs can enumerate and choose v4+. This can be used with multiple <supportedRuntime> entries, with other config options, or even with no <supportedRuntime> entries at all (in which case legacy APIs can simply enumerate v4). Side effect: turns off in-proc SxS with pre-v4 runtimes — locks them out of the process.
  • Config file includes SupportedRuntime entry. Version: vX.Y.Z, SKU: {sku} — each <supportedRuntime> found in config

Key insight: If a process has no config file AND is doing a capped legacy bind, the shim has nothing to direct it to v4.0. It will enumerate installed runtimes (capped to ≤v2.0), find nothing if 3.5 isn't installed, and fail. This is by design — v4 is intentionally invisible to these codepaths to keep v4 installation non-impactful.

3d. Version Resolution

  • Installed Runtime: vX.Y.Z. VERSION_ARCHITECTURE: N — what's installed on the machine
  • {exe} was built with version: vX.Y.Z — version from the binary's PE header (managed assemblies only; native EXEs won't have this)
  • Using supportedRuntime: vX.Y.Z — the shim picked a version from the config's <supportedRuntime> list
  • FindLatestVersion is returning the following version: vX.Y.Z... V2.0 Capped: {0|1} — result of policy-based latest-version search
  • Default version of the runtime on the machine: vX.Y.Z or (null) — what the shim settled on; (null) means nothing was found
  • Decided on runtime: vX.Y.Zfinal decision — this is the version that will be loaded

3e. Failure and FOD Path

If version resolution fails:

  1. ERROR: Unable to find a version of the runtime to use — the shim found no suitable runtime
  2. SEM_FAILCRITICALERRORS is set to {value} — checks the process error mode:

- Value 0: Error dialogs and FOD are ALLOWED - Nonzero (any bit set, commonly 0x8001): Error dialogs and FOD are SUPPRESSED. The SEM_FAILCRITICALERRORS flag (0x0001) is inherited from the parent process.

  1. Checking if feature-on-demand installation would help — the shim re-runs version computation to see if installing.NET 3.5 would resolve the request
  2. Then either:

- Launching feature-on-demand installation. CmdLine: "...\fondue.exe" /enable-feature:NetFx3FOD dialog shown - Could have launched feature-on-demand installation if was not opted out.FOD suppressed because SEM_FAILCRITICALERRORS was set

3f. Multiple Activations in One Process

A single log can contain multiple activation sequences. Each begins with a new FunctionCall: or MethodCall: entry. A common pattern:

  1. First activation via ClrCreateInstance / GetRequestedRuntime → succeeds (loads v4.0 via config)
  2. Second activation via DllGetClassObject (COM) → legacy bind, capped → fails

This happens when a native EXE (like link.exe or mt.exe) loads the CLR successfully for its primary work, then a secondary COM activation request (e.g., for diasymreader) triggers a separate legacy resolution that can't find v2.0.

Step 4: Check System State (if needed)

When log analysis points to a registration or configuration issue, check:

CLSID Registration (for COM activation issues):

# Check the CLSID entry
Get-ItemProperty 'Registry::HKCR\CLSID\{guid}'
Get-ItemProperty 'Registry::HKCR\CLSID\{guid}\InprocServer32'
Get-ChildItem 'Registry::HKCR\CLSID\{guid}\InprocServer32' | ForEach-Object {
    Write-Output "--- $($_.PSChildName) ---"
    Get-ItemProperty "Registry::$($_.Name)"
}

Key values under InprocServer32:

  • (Default) should be mscoree.dll for CLR-hosted COM objects
  • Version subkeys (e.g., 2.0.50727, 4.0.30319) indicate which runtime versions registered this CLSID
  • ImplementedInThisVersion under a version subkey means that runtime version natively implements the COM class (not via managed interop)
  • Assembly and Class under a version subkey indicate a managed COM interop registration
  • RuntimeVersion under a version subkey specifies which CLR version should host this object

Installed runtimes:

Get-ChildItem 'Registry::HKLM\SOFTWARE\Microsoft\.NETFramework\policy'

Process error mode (why FOD did/didn't fire): The SEM_FAILCRITICALERRORS flag is inherited from the parent process. If a build system or script sets it (or calls SetErrorMode), all child processes inherit it.

Step 5: Diagnose and Report

Produce a clear diagnosis covering:

  1. What happened — which process(es) had activation issues and what the symptom was
  2. Why it happened — trace through the specific decision path in the shim that led to the outcome
  3. What controls the behavior — identify the specific inputs (config file presence, error mode, CLSID registration, capping state) that determined the outcome
  4. What changed (if applicable) — if the user says behavior changed, identify which input could have changed (error mode from parent process, config file, CLSID registration, installed runtimes)

Common Scenarios

Unexpected FOD Dialogs

Pattern: DllGetClassObjectIsCapped: 1 → no config file → (null)SEM_FAILCRITICALERRORS: 0 → FOD launched

Root cause: A native EXE is doing COM activation of a CLSID registered under mscoree.dll. This takes the legacy codepath, which is capped at v2.0. With no config file (and no useLegacyV2RuntimeActivationPolicy), v4 is invisible to this codepath. On a machine without.NET 3.5, there are no runtimes visible, and with SEM_FAILCRITICALERRORS not set, the FOD dialog fires.

Key question: Why did SEM_FAILCRITICALERRORS change? It's inherited from the parent. Different launch methods (script vs. direct invocation, different build systems) produce different error modes. The underlying capped-legacy-bind-on-v4-only-machine failure is always there — it's just that SEM_FAILCRITICALERRORS controls whether it manifests as a visible dialog or a silent failure.

Wrong Runtime Selected

Pattern: supportedRuntime entries in config list multiple versions; the shim picks the first one that's installed. If v2.0 is listed first and.NET 3.5 is installed, v2.0 wins even though v4.0 is also available.

Key insight: Config <supportedRuntime> entries are evaluated in order. First installed match wins.

Both v2 and v4 Loaded

Pattern: Multiple activation sequences in the same process log — one binds v4, another binds v2 (or vice versa). Side-by-side loading of CLR v2 and v4 in the same process IS supported but can cause issues with shared state.

Key insight: Look for separate Decided on runtime lines with different versions in the same log file.

Legacy Runtime Already Bound

Pattern: A legacy codepath succeeds early in the process (e.g., CorBindToRuntimeEx with an explicit v4 version, or config with useLegacyV2RuntimeActivationPolicy). This sets the legacy runtime to v4.0. All subsequent legacy activations — including capped COM activations that would otherwise fail — silently succeed by reusing the already-bound legacy runtime.

Key insight: The ORDER of activations within a process matters. If v4.0 is bound as the legacy runtime first, capped COM activations work. If the capped COM activation happens first (before any legacy runtime is bound), it fails. This means behavior can depend on which component activates first — a race condition in concurrent code can change the outcome.

Common Pitfalls

PitfallCorrect Approach
Assuming IsCapped: 1 means v4.0 can never loadCapping only restricts roll-forward enumeration. v4.0 can still be loaded if: a specific version string is passed explicitly, config has useLegacyV2RuntimeActivationPolicy="true" with <supportedRuntime version="v4.0"/>, or the legacy runtime is already bound to v4+.
Thinking capping is broken or a bugCapping is intentional — it makes v4 installation non-impactful. On a v4-only machine, legacy codepaths correctly see no runtimes. This is working as designed.
Assuming FOD is controlled per-processSEM_FAILCRITICALERRORS is inherited from the parent process. A change in the parent (build system, script, shell) changes behavior for all children.
Looking only at the first activation in a logA single log can contain multiple independent activation sequences. The problematic one is often a secondary COM activation, not the initial CLR load.
Assuming a missing config file is benignFor native EXEs doing COM activation with legacy/capped bind, the config file (with useLegacyV2RuntimeActivationPolicy) is the primary way to make legacy codepaths see v4.0. No config = capped = v4 invisible.
Adding <supportedRuntime> without useLegacyV2RuntimeActivationPolicyWithout useLegacyV2RuntimeActivationPolicy="true", rolling forward to v4 via config works for the primary EXE load, but legacy codepaths (COM activation, P/Invoke to mscoree.h APIs) remain capped at v2.0. Both are needed for legacy codepaths.
Setting useLegacyV2RuntimeActivationPolicy without understanding the trade-offThis attribute turns off in-proc SxS — it locks pre-v4 runtimes out of the process. This is usually fine for build tools but should be considered for apps that need to host both v2 and v4.

Validation

Before delivering a diagnosis, verify:

  • All log files with errors or FOD triggers were analyzed (not just the first one)
  • The entry point for each problematic activation was identified
  • The capping and legacy bind state was noted for each activation sequence
  • Config file presence/absence was checked
  • SEM_FAILCRITICALERRORS state was noted for FOD-related issues
  • Multiple activations within a single log were individually traced
  • The diagnosis explains the specific decision path, not just the outcome

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

36.6%
按下载量换算597

Claude

32.16%
按下载量换算525

Cursor

18.85%
按下载量换算308

Gemini CLI

9.35%
按下载量换算153

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills