Skip to content
Latchkey

System.MissingMethodException "Method not found" at runtime in CI

MissingMethodException means the code was compiled against an assembly that declared a method, but the assembly actually loaded at runtime does not have it. It is the classic symptom of a transitive version conflict: compile-time and run-time saw different versions of a dependency.

What this error means

The app or test throws System.MissingMethodException: Method not found naming the method signature. It reproduces deterministically for the deployed binaries.

dotnet
System.MissingMethodException: Method not found:
'System.String Polly.Policy.get_PolicyKey()'.

Common causes

Compile-time and runtime versions differ

A diamond dependency resolved one version at build but a different (older) one ships at runtime, and the older one lacks the method.

A stale assembly in the output

An old copy of the dependency was cached or copied into the output, shadowing the expected version.

How to fix it

Unify the dependency version

  1. Inspect the resolved graph (dotnet list package --include-transitive) for the conflicting versions.
  2. Add a direct reference or Central Package Management entry pinning one version.
  3. Clean output and re-publish so the unified version ships.
shell
dotnet list package --include-transitive

How to prevent it

  • Use Central Package Management to pin transitive versions.
  • Avoid caching bin/output that can carry stale dependency copies.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →