dotnet / dotnet/runtime

[R2R] Apply --resilient consistently to recoverable compilation failures

Open
#132,338 0 comments 0 reactions 0 assignees View on GitHub
area-ReadyToRun untriaged
Dominant language
C#
Stars
18.3k
Forks
5.6k
PR merge metrics
PR metrics pending

Description

## Problem

Crossgen2 has several places where `TypeSystemException` or code-generation failures are caught so ReadyToRun compilation can omit affected methods or dependencies and fall back to runtime JIT. These catches are currently inconsistent:

- some are unconditional
- some are gated by `--resilient`
- most dependency-discovery catches silently skip work
- the SDK does not currently enable `--resilient` by default

This makes the direct Crossgen2 CLI and SDK-driven ReadyToRun publishing difficult to reason about, and recoverable missing-reference failures may either terminate compilation or be silently ignored depending on where they occur.

## Proposed follow-up

- plumb the `--resilient` setting through R2R root providers and dependency-analysis nodes
- gate catches that intentionally omit R2R methods or dependencies on that setting
- produce actionable warnings when resilient compilation skips code or dependency discovery
- decide whether SDK/MSBuild ReadyToRun publishing should pass `--resilient` by default while preserving explicit fail-fast behavior for direct Crossgen2 invocation
- keep profile parsing and best-effort metadata lookup behavior separate from compilation/de-optimization policy

The immediate missing-interface-signature crash is addressed separately by #132337.

> [!NOTE]
> This issue was generated with GitHub Copilot.

Contributor guide

Open the contributing guide

Research direction

Start by tracing Crossgen2's R2R root providers and dependency-analysis nodes, focusing on catches for TypeSystemException and code-generation failures. Compare direct Crossgen2 behavior with SDK/MSBuild ReadyToRun publishing and keep profile parsing separate. Done means --resilient consistently controls recoverable omissions, skipped work produces actionable warnings, and the default behavior is decided without removing explicit fail-fast invocation.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
build-system, compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.