> ## Content Index
> Fetch the complete content index at: https://devinside.cloud/llms.txt
> Use this file to discover other available public pages before exploring further.

# Native AOT Has No JIT: What Does Expression.Compile Run?
- URL: https://devinside.cloud/how-dotnet-runs-05-native-aot-code-built-after-publish/
- Published: 2026-11-21T15:00:05.000Z
- Description: Follow a customer rule from its expression tree into a native interpreter, check the managed bytes per call, and see when plain delegates can replace the tree.
- Author: Marcin Borecki
- Tags: Languages, Runtimes & Performance, .NET & C#, Performance & Data, How .NET Runs Your Code, #Technology .NET, #Technology C#, #Runtime JIT & AOT

**Series** [How .NET Runs Your Code](https://devinside.cloud/how-dotnet-runs/), part 5 of 11\. Previous: [Part 4, ReadyToRun and the code the JIT can replace](https://devinside.cloud/how-dotnet-runs-04-readytorun-precompiled-code/). Next: [Part 6, trimming, reflection and publish warnings](https://devinside.cloud/how-dotnet-runs-06-trimming-reflection-warnings/).

Today the Intake worker admits a job of exactly 1,024 bytes, its fixed limit. Lena wants customers to choose a limit and decide whether equality passes. The worker would read those settings once and reuse the rule for later jobs. In a code review Ravi spots `expression.Compile()`. His Native AOT publish, which compiles machine code ahead of time, ships without a just-in-time compiler (JIT). What will that line do when the next customer changes the rule?

Dana signs off releases for the fictional Intake team. If the worker alone consumes the rule, all it needs is a function that answers yes or no. If a query provider must translate the rule into a database filter, it needs to inspect the operator and its operands. Can Lena meet the actual worker requirement using only methods already in the executable?

- When the worker chooses between two known comparisons, bind the customer’s limit to a delegate, a function it can call for each job. The limit and the choice of operator can both arrive after publish.
- Keep an expression tree when another component needs its nodes. Calling `Compile()` gives the worker an executable delegate. For this rule the native build runs that delegate through an interpreter already in the binary.
- Count allocations when building the rule and again when invoking it. The measured native tree and the composed delegate agreed on every input. Reusing them charged different amounts of managed memory per job.

Working solution

### Intake 4.0, How .NET Runs Your Code, parts 1 to 11

Use the .NET 11 SDK and Python 3.10 or later. Part05.CodeAfterPublish runs the same rules on .NET 10 and .NET 11\. Publishing the native variants requires the native toolchain for your system. Debug and Release tests passed.

[Download the solution (zip)](https://devinside.cloud/content/files/2026/11/how-dotnet-runs-11-v9.zip)

how-dotnet-runs-11-v9.zip · 26.24 MiB (27,510,833 bytes) · tag articles/how-dotnet-runs-05-v9 · MIT license

For a local comparison, `Func<int, bool>` is enough. Call the delegate with a payload size to get a Boolean. An `Expression<Func<int, bool>>` also describes the operation. A translator can visit the comparison and both operands to build a query in another language. In the current worker, follow which of these two objects actually leaves `FromLimit`. [How query providers use expression trees](https://learn.microsoft.com/en-us/dotnet/csharp/advanced-topics/expression-trees/?ref=devinside.cloud).

```csharp
public static PayloadRule FromLimit(int limit)
{
    Expression<Func<int, bool>> expression = bytes => bytes <= limit;
    return new PayloadRule(expression.Compile());
}
```

[![Rider selects expression.Compile() in PayloadRule.FromLimit below the inclusive comparison.](https://devinside.cloud/content/images/2026/11/how-dotnet-runs-05-s1-detail-f464e6757b0b_o.webp)](https://devinside.cloud/content/images/2026/11/how-dotnet-runs-05-s1-2x.webp)

Rider Shot 1\. The call returns a delegate. Nothing on this source line tells Lena which engine will execute it.

The factory returns a `PayloadRule` that keeps the delegate. Its `Allows` method can call the rule for any job. If a second consumer needs to translate the rule, Lena must also give it access to the tree. Before deciding how to produce the delegate, predict what the published programs will do at exactly 1,024 bytes. Equality separates an inclusive rule from a strict one.

.NET Shot 2\. Compare each runtime banner with the four answers underneath it. The payload rule keeps its inclusive limit even when dynamic code is unavailable. [Full recording](https://devinside.cloud/content/media/2026/11/how-dotnet-runs-05-s2.mp4)

## The native file already contains a program that can evaluate a tree

The C# compiler produces intermediate language (IL). For a Native AOT publish, the build analyzes the application and its dependencies to find code and metadata it needs. The IL compiler produces native object code for the target. The platform linker joins it with the runtime services needed by the program, including the garbage collector. The receiver can start that executable without an installed shared .NET runtime. [Native AOT deployment](https://learn.microsoft.com/dotnet/core/deploying/native-aot/?ref=devinside.cloud).

The build logs for two small Mac Arm64 programs show the same stages, including `ComputeIlcCompileInputs`, `IlcCompile` and `LinkNative`. Both take the payload size as a command-line argument and print an answer. In the first, a C# method compares the integer with 1,024\. In the second, the program constructs that expression and asks for a delegate. What would you expect to find in the second executable that the first one can do without?

The compiler's map lists the objects it emitted. Select the rows marked `MethodCode` belonging to the expression interpreter, the code that walks the rule’s instructions to compute its answer. The table shows the size of the whole executable separately from the lengths of those selected nodes. This is a controlled pair of tiny programs on .NET 11, so an application that already uses expressions elsewhere can have a different size change.

| Implementation            | Executable bytes | Selected MethodCode nodes | Sum of their lengths |
| ------------------------- | ---------------- | ------------------------- | -------------------- |
| Source comparison         | 1,351,848        | 0                         | 0 B                  |
| Tree with default Compile | 2,962,424        | 840                       | 183,536 B            |

The tree build contains a 424-byte node for `LightLambda.Run` and a 240-byte node for the signed 32-bit less-than-or-equal instruction's `Run`. Look for those two names again when the sampler watches a live call. The difference between the files is 1,610,576 bytes. The 183,536-byte sum describes the selected compiler nodes before the final link. The completed files also contain other code, tables, metadata and platform-specific layout. Assigning the entire file difference to one class would greatly overstate what the filter established. [Native AOT compiler map and statistics switches](https://github.com/dotnet/runtime/blob/v11.0.0/src/coreclr/nativeaot/docs/troubleshooting.md?ref=devinside.cloud).

[![A Native AOT map excerpt shows 240 bytes for LessThanOrEqualInt32.Run and 424 for LightLambda.Run.](https://devinside.cloud/content/images/2026/11/how-dotnet-runs-05-s3-detail-9c5a7180aa5d_o.webp)](https://devinside.cloud/content/images/2026/11/how-dotnet-runs-05-s3-2x.webp)

Rider Shot 3\. The map assigns bytes to individual method bodies. The selected `LightLambda.Run` entry is one contribution to the image.

## The code is fixed at publish, while the customer's rule can still change

A new limit of 2,048 is data. A new choice between the existing `<` and `<=` operators is data too. The published program already has implementations of those comparisons. A customer supplying a new implementation in a managed assembly would ask something different of the runtime.

The closed-world restriction concerns the code available to carry out the calculation. The native process cannot later load an arbitrary new managed assembly and ask the JIT to generate its missing bodies. For generic types, the native compiler also has to make the machine code needed by supported instantiations available ahead of time. Substituting a value type can require a specialized body. That is a different demand from passing a new integer into an existing `Func<int, bool>`. Which demand does this expression actually make? [Documented Native AOT limits](https://learn.microsoft.com/dotnet/core/deploying/native-aot/?ref=devinside.cloud#limitations-of-native-aot-deployment).

## The expression library chooses how to produce a delegate

On the two runtime versions in the download, the typed `Compile()` overload checks `CanCompileToIL`. That property reads `RuntimeFeature.IsDynamicCodeSupported`. When true, the expression compiler can emit IL for a new dynamic method. On the ordinary runtime the JIT supplies machine code for that method. When false, the library builds interpreter instructions and wraps them in a delegate.

The overload accepting `preferInterpretation` adds a useful control. Ask for interpretation on the ordinary runtime, where generating code is possible, and the supported interpretation path can be selected there too. Predict which of the three routes will resemble the native process when you examine its stack.

Architecture

### The library can return a delegate over its existing interpreter

InputExpression treeLibrary choiceTyped Compile()ExecutionCapability check

1. The argument is a typed description of a comparison. Both runtimes already know how to create a delegate from this form.
2. On the ordinary runtime, the capability check permits IL emission. The diagnostic callback has a generated lambda method for its caller.
3. Without runtime emission, the expression library creates interpreter instructions. The native process executes a delegate over the interpreter included in its file.
4. The ordinary runtime also reaches its interpreter when the caller requests interpretation. This gives the stack observation an independent positive control.
5. Each executor produces the same four answers. The result of the policy and the identity of the executor answer different release questions.

The JIT and native stack records in `results/mac/part05` show the delegates returned by the two typed `Compile` overloads.

The call site always sees the same type of result. That is precisely why the behaviour can change without breaking a test that only asks for the Boolean. To identify the executor, you have to look from inside the invocation or sample the calling thread. [.NET 10 typed Compile overloads](https://github.com/dotnet/runtime/blob/v10.0.15/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/LambdaExpression.cs?ref=devinside.cloud#L195-L220) and [.NET 11 typed Compile overloads](https://github.com/dotnet/runtime/blob/v11.0.0/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/LambdaExpression.cs?ref=devinside.cloud#L195-L220).

## Read the caller that reached the rule

The expression in the worker has no reason to print a stack. The diagnostic program therefore makes a second version of the comparison. Before comparing `bytes` with the limit it calls `RulePaths.Capture(bytes)`. That tiny source method records `Environment.StackTrace` and returns the same integer. A no-inlining annotation keeps the callback visible. The business decision remains inclusive, but the expression now also contains a method call.

Run the default case on the ordinary build and stop in the callback. Walk one frame toward the caller. On the Mac, `lambda_method1(Closure, Int32)` sits immediately below `RulePaths.Capture`. The expression compiler created a method whose argument list includes the closure and the payload size. The generated name identifies this process's method. The numeric suffix can change when another tree compiles first.

[![Visual Studio breaks in the capture callback with [Lightweight Function] shown as its caller.](https://devinside.cloud/content/images/2026/11/how-dotnet-runs-05-s4-detail-87fdbe031046_o.webp)](https://devinside.cloud/content/images/2026/11/how-dotnet-runs-05-s4-2x.webp)

Visual Studio Insiders Shot 4\. The breakpoint sits inside `RulePaths.Capture`. The Call Stack labels its caller `[Lightweight Function]`, between the probe and `Program.Main`.

Now repeat with the native executable. The captured integer is the same. Its caller chain contains `MethodInfoCallInstruction.Run`, `Interpreter.Run` and `LightLambda.Run`. Reflection invocation frames appear around the call into the callback. The interpreter is executing an instruction that invokes the source method you inserted. Repeating `trace prefer --full` in an ordinary build also shows the expression interpreter. A frame containing “Interpreter” identifies how that rule ran. The process banner answers the separate question about dynamic code support.

.NET on Apple Silicon Shot 5\. Follow the filtered frame under the same call to Compile. The ordinary process enters `lambda_method1` and the native process enters `LightLambda.Run`. [Full recording](https://devinside.cloud/content/media/2026/11/how-dotnet-runs-05-s5.mp4)

The four boundary answers, the strict and inclusive variants and the diagnostic stacks were checked on .NET 10.0.15 and 11.0.0 on macOS Arm64, Windows x64 and Linux x64\. The methods immediately around the callback can differ. Look for an emitted method or a recognizable interpreter frame and keep the source-only and explicitly interpreted runs beside the default. A missing frame in an isolated snapshot would make a poor negative control. [Reading a stack for the work it actually contains](https://devinside.cloud/following-async-work-without-confusing-it-with-the-thread-stack/).

## The plain rule also reaches the interpreter

Lena points out that the production comparison never calls `RulePaths.Capture`. The callback adds a method-call instruction to the tree. Those reflection frames could belong entirely to the probe. What executes when the sampler watches the original comparison from outside?

For the second observation the driver builds the plain rule, evaluates it in short batches, and pauses between batches. An external sampler reads the process. These selected Mac .NET 11 native frames appear one inside the next during a default evaluation. The excerpt removes other branches, symbols outside this path, and the sampler's counts. Look at the last instruction's type.

```text
System_Linq_Expressions_System_Linq_Expressions_Interpreter_LightLambda__Run
System_Linq_Expressions_System_Linq_Expressions_Interpreter_Interpreter__Run
System_Linq_Expressions_System_Linq_Expressions_Interpreter_LessThanOrEqualInstruction_LessThanOrEqualInt32__Run
```

This time the interpreter executes the signed integer comparison directly. The operating system can see it because the interpreter itself consists of native code with symbols. On the ordinary build, the external managed snapshot showed `LightLambda.Run` when interpretation was requested. Its default-tree snapshot showed only `Program.Main` among the selected frames. That snapshot alone cannot disprove emission. The positive generated-caller frame came from the separate callback experiment.

[![LLDB stops inside the callback with the expression interpreter on the stack.](https://devinside.cloud/content/images/2026/11/how-dotnet-runs-05-s6-detail-b91d49663f29_o.webp)](https://devinside.cloud/content/images/2026/11/how-dotnet-runs-05-s6-2x.webp)

LLDB Shot 6\. Read down from the breakpoint in `RulePaths.Capture` to `MethodInfoCallInstruction`, `Interpreter.Run` and `LightLambda.Run`. These callers belong to the published native process.

Compare a third object, the source-written delegate, in the native file before launching it. Its Arm64 body loads the captured limit, compares two registers and sets the Boolean result. The disassembly in the download ends in `cmp w1, w0` and `cset x0, le` before restoring the frame and returning. The comparison is present before the process starts. When the worker reuses a callable, which choice creates new managed objects on each invocation?

## Construction and invocation spend different amounts of managed memory

Intake constructs the rule at startup and may evaluate it many times. Counting only one phase would miss the reason to pick an implementation. The allocation probe uses the configurable builder, which puts the numeric limit in an `Expression.Constant` node. The worker source shown at the start instead captures a limit field. Both produce the same decisions. The byte counts below belong to the constant-bound shape.

The probe warms each path and creates a destination array before constructing 32 new delegates into it. Retaining the delegates keeps this phase observable. In a separate interval it evaluates the last delegate 16,384 times, cycling through the four inputs and checking the expected accepted count.

Each interval measures the change in `GC.GetAllocatedBytesForCurrentThread()`. Native allocations for executable memory and work on other threads fall outside that count.

Each build ran in three fresh processes on macOS Arm64 (Apple M3 Max), Windows Server x64 (AMD EPYC 7502P), and Linux x64 in a container on the same EPYC host. For each runtime line, publish mode and rule form, mean bytes per construction and bytes per invocation matched across all three. The figure shows the .NET 11 invocation results.

Measured

### The native default tree allocates the same bytes per call as explicit interpretation

| Rule form             | Ordinary | Native |
| --------------------- | -------- | ------ |
| Source                | 0        | 0      |
| Default tree          | 0        | 184    |
| Prefer interpretation | 184      | 184    |
| Composed              | 0        | 0      |

1. In the ordinary executable only the explicitly interpreted path allocated managed bytes during this repeated evaluation loop.
2. In the native executable default compilation and explicit interpretation produced the same allocation per call on the measuring thread.
3. Selecting compiled comparisons from settings kept the same inclusive boundary and eliminated per-call managed allocation in this sample.

Managed bytes per invocation from the thread-allocation deltas in `results/mac/part05`. Three fresh processes per build, 16,384 calls per form per process, on the shared Mac.

The two runtime lines did differ during setup. On all three receivers, the explicitly interpreted tree on the ordinary runtime averaged 1,744 B per construction on .NET 10 and 1,728 B on .NET 11\. It still allocated 184 B per invocation on both. For a worker that builds this rule once, the mean saving is 16 B at setup.

The factory also allocates before it returns its first delegate. The upper Rider pane shows the benchmark configuration. The lower pane opens `allocation.tsv`, produced by the separate thread-counter experiment. Read across a row from bytes per build to bytes per call. Which charge will Dana pay again when the next job uses the same delegate?

[![Rider displays the benchmark configuration above eight allocation rows with bytes per build, bytes per call and process counts.](https://devinside.cloud/content/images/2026/11/how-dotnet-runs-05-s7-detail-85e63713dde3_o.webp)](https://devinside.cloud/content/images/2026/11/how-dotnet-runs-05-s7-2x.webp)

Rider Shot 7\. Compare the B/call column for default and prefer. The same input allocates differently when the callable runs through the interpreter.

Try the two lifetimes in the figure. Construct one rule and stop. Then let a worker reuse it. On the ordinary runtime, predict which tree has allocated less after sixteen calls and whether one more call changes the answer. On the native runtime, predict which operation caching can eliminate.

Explorable

### The native tree delegate still allocates after the worker caches it

0 evaluationsCallableTotal allocatedBuild onceEach call Native default tree1,712 B1,712 B184 B Native composed104 B104 B0 B JIT default tree4,678 B4,678 B0 B JIT interpreted tree1,728 B1,728 B184 B 

1. Construct one delegate and put it in the cache. Even a callable with zero measured bytes per invocation can allocate while it captures the customer’s settings.
2. Call the rule once. On the ordinary runtime the interpreted tree still has the lower total because its factory allocated less.
3. The two ordinary tree totals are now six bytes apart. Predict what the next call will do to each total before moving the slider.
4. The ordinary default tree now has the smaller total. Reuse has paid back its higher construction charge in managed bytes for this rule.
5. The native interpreter adds another charge on each job. The native composed delegate keeps its original construction charge across the entire batch.

Derived from `results/mac/part05/allocation.tsv`. Each total adds the mean bytes to construct one rule and the measured bytes per call multiplied by its number of uses.

If the native worker needs only the Boolean, Lena can bind a source-written comparison when settings load. In the native experiment this brought mean construction allocation from 1,712 B to 104 B and per-call allocation from 184 B to zero on both runtime lines. Caching the default tree delegate would save only repeated construction. These bytes count allocations even if the collector reclaims them during the batch. To choose by elapsed time, run the supplied timing harness on a quiet receiver.

## Three APIs can give three different answers about runtime code

Can you turn the result for `Expression.Compile()` into a rule for every library that produces a callable object? Try three small features first. The separate features program deliberately calls an API annotated for dynamic code. Its publish log has the diagnostic IL3050\. The payload-rule program compiled independently without that coded warning, which is how the team can check which source statement earned it.

The first probe explicitly requests a `DynamicMethod` and emits IL that returns seven. The second gives a fixed partner-name pattern to both `new Regex(..., RegexOptions.Compiled)` and a source-generated regular expression. The third caches a typed expression accessor for `Job.Bytes`, invokes it once and checks the identity of the cached delegate. Which operation actually requires a newly emitted method to exist?

| Feature on .NET 11         | Ordinary publish            | Native publish                      | Release decision                                                                                    |
| -------------------------- | --------------------------- | ----------------------------------- | --------------------------------------------------------------------------------------------------- |
| Explicit DynamicMethod     | Returned 7                  | Threw PlatformNotSupportedException | Choose an existing method or keep a runtime that supports emission.                                 |
| RegexOptions.Compiled      | Accepted night, rejected N7 | Accepted night, rejected N7         | A fixed pattern can use a source generator to bring its matching code to publish.                   |
| Cached expression accessor | Read 1024, reused delegate  | Read 1024, reused delegate          | Caching removes repeated construction. Inspect the cost of invoking the cached delegate separately. |

The Mac and Windows native emit probes reported the same message: `Dynamic code generation is not supported on this platform.` No alternate implementation can satisfy the explicit request to emit that method. The regex option behaves differently. The .NET runtime checks whether it can use its regex compiler before selecting it, and can use its interpreter for this pattern. The `GeneratedRegex` alternative runs a generator at build time. The two input strings verify matching behaviour. They cannot identify a regex engine solely from the answers. [Runtime regex selection](https://github.com/dotnet/runtime/blob/v11.0.0/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Regex.cs?ref=devinside.cloud) and [regular expression source generation](https://learn.microsoft.com/dotnet/standard/base-types/regular-expression-source-generators?ref=devinside.cloud).

The accessor makes a narrower point. Both builds cached a delegate and returned the same property value. We did not sample that accessor's stack. Its code calls the same typed expression API examined above. Caching can eliminate the second construction while leaving whatever invocation mechanism the first construction chose. [What a lazy cache puts on the hot path](https://devinside.cloud/lazy-t-on-a-hot-path-factories-contention-exceptions-and-allocations/).

## A late choice between known comparisons can stay in compiled code

Lena can make a stricter rule for one customer without generating any code. Follow `op` through the two branches below. One branch selects a compiled comparison and captures the limit. The other creates an object that names the comparison and can be inspected before execution. What would a query provider need from that second branch?

Code walkthrough

### A late setting can select between comparison methods already in the file

```csharp
if (form == "source")
    return trace ? bytes => Capture(bytes) <= limit : bytes => bytes <= limit;

if (form == "composed")
{
    Func<int, int, bool> compare = op == "inclusive"
        ? static (left, right) => left <= right : static (left, right) => left < right;
    return trace ? bytes => compare(Capture(bytes), limit) : bytes => compare(bytes, limit);
}

var bytes = Expression.Parameter(typeof(int), "bytes");
Expression operand = bytes;
var bound = Expression.Constant(limit);
var comparison = op == "inclusive"
    ? Expression.LessThanOrEqual(operand, bound) : Expression.LessThan(operand, bound);
var tree = Expression.Lambda<Func<int, bool>>(comparison, bytes);
return form == "prefer" ? tree.Compile(preferInterpretation: true) : tree.Compile();
```

1. The source control always implements the inclusive comparison. The trace flag can insert the diagnostic callback before comparing the payload with its captured limit.
2. The composed implementation chooses one of two compiled comparisons when reading the settings. The returned delegate holds that choice and the current limit.
3. The expression version instead creates nodes for the parameter, bound and selected operator. Those nodes can also be inspected before choosing how to execute.
4. Both overloads return the promised delegate. Only the tree-based path needs the expression library to decide how its nodes will run.

Excerpt from `src/Part05.CodeAfterPublish/RulePaths.cs`. Argument guards and tracing setup are omitted. The native results in `results/mac/part05` include rule shapes and stacks.

The configurable tree and the composition can both represent a strict limit. The fixed source control implements only the inclusive policy. Checking one value below and one above the limit lets a mistaken operator slip through either test. Which input would expose it?

#### Stop after checking answers

Comparing the four payload answers is essential. It lets the ordinary generated method and the native interpreter both pass, because they implement the same rule. In the executable check below, `Expected` holds the four independently specified decisions.

```csharp
var answers = Payloads.Select(rule.Invoke).ToArray();
valid &= answers.SequenceEqual(Expected);
```

The test still leaves the executor on the frequently called path open.

#### Verify the decisions and then the selected path

Run the published executable with both operators. In a separate diagnostic process, require an interpreter frame for the explicitly interpreted case and an emitted-method frame for ordinary default compilation. On the composed path, reject an observed interpreter or emitted method, and keep the positive controls in the same build. Here `interpreter` is a stack containing an expression-interpreter frame, and `generated` is a match for a generated lambda method.

```python
if interpreter != (form == "prefer" or (native and form == "default")):
    raise ValueError(f"Wrong path for {form}: {stack}")
if form == "composed" and generated:
    raise ValueError("The composed hot path entered a generated method")
```

A silent change in executor can now fail its own check while the rule continues to return the correct answer.

Suppose 1,000 customers use the same measured shape of comparison, and Lena builds a separate rule for each. Before the first job arrives, the startup path has already paid for 1,000 constructions. Does the next consumer need to call the rule or read its structure?

__Native AOT cache choices shared by macOS Arm64, Windows x64 and Linux x64__
| What must the cache return?             | What to store                                                                      | Estimated build allocation for 1,000 rules                                                 |
| --------------------------------------- | ---------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
| A local answer from known comparisons   | Bind the chosen comparison and limit in a delegate.                                | 104,000 B for composed delegates                                                           |
| The same local answer using Compile()   | Cache the delegate over the interpreter. Each job still executes its instructions. | 1,712,000 B for default tree delegates                                                     |
| A filter a query provider can translate | Keep the expression tree so the provider can visit the operator and operands.      | No estimate. The probe built callables and did not measure a cache that also stores trees. |

The two totals multiply the measured construction means by 1,000\. They exclude the cache container and give no estimate of how many bytes remain live. If one customer later submits most of the jobs, use that rule’s own call count in the [reuse slider](#fig-lifetime-bytes).

Try a change to the intake form. A customer selects *strict* and enters 2,048\. For a worker-only policy, bind the limit once. Of 2,047, 2,048 and 2,049 bytes, only 2,047 should pass. With an inclusive limit, 2,048 must pass too. Now suppose a report must translate the same rule into a database filter. Pass the expression nodes to the translator and check the returned rows at the same boundary. A correct local delegate test cannot tell you whether the report translated `<` as `<=`. The local comparisons run in the download. The report is the additional acceptance test a team would need if it introduced a translator.

## Run the same rule on your candidate artifacts

After unpacking the ZIP, open the `how-dotnet-runs-11-v9` directory containing `HowDotnetRuns.slnx`. Use a host with the native build tools for its operating system. The driver pins the target runtime packs and builds four separate directories. Its test phase executes the published file in each, checks independent boundary answers and classifies the diagnostic stack. Its collection phase repeats the checks and saves per-thread allocation deltas. Give it a fresh output directory so your samples remain easy to compare.

```bash
python3 tools/part05.py build --work my-rule-builds
python3 tools/part05.py test --work my-rule-builds
python3 tools/part05.py collect --work my-rule-builds --out my-rule-results
```

In `my-rule-results`, open `net11.0-native.json` beside `net11.0-jit.json`. Follow the same form from the `shapes` rows into `stacks` and `allocation`. The second video lesson shows one comparison through the two engines on a Mac. The downloadable study adds the other receivers, an allocation counter inside the native process and a file map you can search even when the worker is stopped.

- Separate the settings that arrive at run time from the code implementations known at publish.
- Run the equality boundary through every published implementation that promises the same policy.
- Keep the unmodified rule, the instrumented stack and the plain external sample identifiable.
- Measure construction separately from invocation. Record the receiver and the number of times each rule is reused.
- Keep the quiet-host throughput and latency entries open until the real worker supplies them.

## Further reading

- [Microsoft Learn on Native AOT compilation and deployment](https://learn.microsoft.com/dotnet/core/deploying/native-aot/?ref=devinside.cloud)
- [Runtime source for the typed lambda overloads](https://github.com/dotnet/runtime/blob/v11.0.0/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/LambdaExpression.cs?ref=devinside.cloud)
- [IL emission for a lambda](https://github.com/dotnet/runtime/blob/v11.0.0/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.cs?ref=devinside.cloud)
- [The expression interpreter's compiler](https://github.com/dotnet/runtime/blob/v11.0.0/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/LightCompiler.cs?ref=devinside.cloud)
- [Native AOT compiler diagnostic artifacts](https://github.com/dotnet/runtime/blob/v11.0.0/src/coreclr/nativeaot/docs/troubleshooting.md?ref=devinside.cloud)
- [What the per-thread allocation counter reports](https://learn.microsoft.com/dotnet/api/system.gc.getallocatedbytesforcurrentthread?ref=devinside.cloud)

Intake can express these customer settings with compiled comparisons on both publishing modes. The worker row now names its interpreter fallback, the equality cases that qualify a replacement and the managed allocation removed from the measured rule loop. A new operator that must be translated, or a failed throughput budget on a quiet receiver, would reopen the choice.

Intake's rule kept working because its fallback was already in the file. The partner export from part 1 stopped producing the required document, although both publishes reported the same warning codes. What do IL2026 and IL3050 actually tell Lena about that failure?

**Series** [How .NET Runs Your Code](https://devinside.cloud/how-dotnet-runs/), part 5 of 11\. Previous: [Part 4, ReadyToRun and the code the JIT can replace](https://devinside.cloud/how-dotnet-runs-04-readytorun-precompiled-code/). Next: [Part 6, trimming, reflection and publish warnings](https://devinside.cloud/how-dotnet-runs-06-trimming-reflection-warnings/).