RungerHeimdall

2026-11-24

We Turned Architecture Rules into Compiler Errors

How the analyzer reads layers, resolves symbols and avoids the false positives that get tools uninstalled.

RungerHeimdall is a Roslyn analyzer. It does not run a separate scan, does not need a test project, and does not wait for CI. The rules are evaluated while the compiler is already building the code.

This post is about the parts that were harder than expected.

Layers are inferred or declared

The simplest useful behavior is zero configuration. If a namespace contains a segment named Domain, Application, Infrastructure or Api, the analyzer assigns it a rank. Lower rank means closer to the core. A reference from a lower rank to a higher rank is reported.

That covers most projects. For everything else there is architecture.json, which supports exact namespace patterns, explicit ranks and per-rule severity. When the file exists, it wins.

Detection is not one callback

The analyzer checks two places:

Both feed the same rule engine, and both run through the same deduplication key so a target is reported once per containing type.

The edge cases that decide whether the tool is trusted

A rule that misses an alias is annoying. A rule that reports an alias twice is worse. The cases that needed explicit handling:

Each of these has a test. None of them are interesting in a demo, and all of them are the reason a real team keeps the tool installed.

False positives are the product risk

The first version of a rule is easy. The twentieth version is a decision about what not to report.

Two rules were downgraded after benchmarking on .NET 9:

Both rules still exist. Both are now Info. Reporting an allocation that the runtime removed would have been worse than not reporting it at all.

What the tool is not

It is not a security scanner, not a linter for style, and not a profiler. It does not claim to find every allocation. It finds the ones that can be proven from the compilation, and it stays quiet about the rest.