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.
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
- Inspect the resolved graph (
dotnet list package --include-transitive) for the conflicting versions. - Add a direct reference or Central Package Management entry pinning one version.
- Clean output and re-publish so the unified version ships.
dotnet list package --include-transitiveHow to prevent it
- Use Central Package Management to pin transitive versions.
- Avoid caching
bin/output that can carry stale dependency copies.