← Richard Murillo

BLOG

Move the deployment failure to the keystroke

A rollout stops halfway. The validator rejects a configuration value for that region. The engineer wrote the line days ago and has moved on. Now they have to find the rule, fix one value, and wait for another pipeline run. The source held enough information to flag the mistake in the editor.

The rule

Catch errors in the editor and the build when the source exposes the cause. Keep deploy-time validation as a safety net.

Sort last quarter’s deployment failures by what you knew when you wrote the change. Put causes the source exposed in one pile. Put runtime causes, such as capacity limits, outages, and races, in the other. Pick a class from the first pile and add an analyzer, a type, or a build gate. If that class keeps reaching deployment, find what the check misses.

A small, shipped example

I maintain Moq.Analyzers, a set of Roslyn analyzers for the Moq mocking library.

Moq generates a subclass to build a mock. It can intercept members that a subclass can override. This example compiles:

class SampleClass
{
    int Property { get; set; }
}

var mock = new Mock<SampleClass>()
    .Setup(x => x.Property);

Without an analyzer, the test exposes the problem at runtime. Moq 4 throws a NotSupportedException: "Non-overridable members (here: ...) may not be used in setup / verification expressions" (Moq source). The compiler had the relevant code before the test ran.

With Moq.Analyzers installed, Moq1200 flags the line at Error severity. The rule reads "Setup should be used only for overridable members". The fix: mock an interface or make the member virtual. Moq1200 first shipped in release 0.0.7. It appears in v0.4.2, released March 11, 2026. NuGet listed 3,834,656 downloads on October 17, 2026.

A Roslyn analyzer runs in the IDE and the compiler. Teams that reference the package get the same rule as they type and when they build.

Why this is a capability gain

The diagnostic gives the author the rule, the reason, and the fix while the code is in front of them.

Coding agents can read compiler diagnostics and act on them. In my last post, I argued for tools that expand what an agent can do. An error diagnostic puts the rule in the agent’s path and blocks the build until the agent deals with it.

What a good authoring-time check needs

Give engineers enough information to fix a failure or make a deliberate exception.

Better than earlier: impossible

An analyzer catches a mistake at build time. A typed API can prevent it. If a deployment option accepts a fixed set of regions, the compiler rejects values outside that set.

Rico Mariani called this the Pit of Success in a 2003 talk. As Brad Abrams recorded it, "we want our customers to simply fall into winning practices by using our platform and frameworks. To the extent that we make it easy to get into trouble we fail."

Dan North argues that shifting testing left "means doing different things" (We Need to Talk About Testing). Use analyzers to catch mistakes and types to prevent them. Keep deploy-time validation for failures that depend on runtime conditions.

The same problem at platform scale

My team, Policy and Configuration in Microsoft Security, works on deployment policy. The public job description describes our tools. They help teams deploy across Azure regions and sovereign clouds. We use typed APIs, analyzers, and build gates to catch data residency, rollout, and configuration errors before deployment.

The goal is for service teams to handle secure deployments on their own. That takes clear diagnostics and safe upgrades. Support requests and adoption data guide the work. The team is moving from proprietary tools toward .NET Aspire and Azure platform features.

We're hiring

I’m hiring a Principal Software Engineer in Redmond, WA, to set technical direction for this work. Apply through the Principal Software Engineer, Policy and Configuration listing.

Written by Richard Murillo. Find me on GitHub rjmurillo, LinkedIn richardmurillo, X @OODARichard.