Build and dependencies defect patterns¶
This page lists defects in the parts of a repository around the code: pipeline files, settings files, package references and MSBuild files. These defects often pass every unit test, because the tests run in a layout or configuration that differs from the one that fails. Each pattern names the symptom, the cause, what to look for in a review, and how to prove the change is sound. The rules these patterns break are on the CI/CD, configuration and options, central package management and dependency licensing pages.
Pipelines and CI¶
CS-DP-DEP-001: Pipeline path filter misses the src/ prefix¶
Severity: major · Applies to: library, api-client, template, pipelines · Enforced by: manual · Status: active
Symptom¶
A change pushed to a package project never starts its pipeline, so the package is never built or published.
Cause¶
trigger.paths.include paths are relative to the repository root, but the filter lists bare project names that live under src/.
Check¶
Each path in trigger.paths.include and trigger.paths.exclude exists in the repository layout.
Test¶
A script that resolves every include path against the repository and fails when one does not exist.
Related rules¶
CS-DP-DEP-002: Publish step gated on one default-branch name¶
Severity: major · Applies to: library, api-client, template, pipelines · Enforced by: manual · Status: active
Symptom¶
A repository whose default branch is main builds green on every merge and publishes nothing.
Cause¶
The trigger includes both master and main, but the pack and push conditions compare with refs/heads/master only. Pipelines copied between repositories keep the source repository's branch name.
Check¶
The branch named in the pack and push conditions is the repository's actual default branch.
Test¶
A pipeline check that compares the publish condition with the default branch reported by the repository.
Related rules¶
CS-PRC-006, CS-PRC-011, CS-GIT-001
CS-DP-DEP-003: One results file is overwritten by every test assembly¶
Severity: major · Applies to: service, library, api-client, blazor, template, pipelines · Enforced by: manual · Status: active
Symptom¶
The published test results of a failed run show only passing tests.
Cause¶
--logger "trx;LogFileName=<fixed name>" on a solution-level dotnet test makes every test assembly write the same file, so the last assembly to finish wins and the failures of the others are lost.
Check¶
A fixed LogFileName on a dotnet test that runs more than one test assembly.
Test¶
A pipeline check that the number of results files equals the number of test assemblies.
Related rules¶
CS-DP-DEP-004: Fixed service-container name and host port on a shared agent¶
Severity: major · Applies to: service, template, pipelines · Enforced by: manual · Status: active
Symptom¶
Every database-backed test fails with the same "no listener" network error, while the commit under test is innocent.
Cause¶
Several pipelines declare the same container name and the same host port. On one agent, the job that loses the race, or a job that runs after a crashed one, gets no database.
Check¶
Fixed --name options and fixed host ports in the container resources of a pipeline.
Test¶
Read the "Initialize containers" step of the failed run before looking at the code. Use generated names and dynamic host ports, which removes the race.
Related rules¶
Configuration and deployment¶
CS-DP-DEP-005: Deployment substitution skips a key the settings file does not declare¶
Severity: major · Applies to: service, template, pipelines · Enforced by: manual · Status: active
Symptom¶
A value set in the deployment pipeline never takes effect in one environment or test variant, although the pipeline variable is set. Examples are an event route or a time zone.
Cause¶
JSON variable substitution overwrites only keys that already exist in the deployed settings file. A key that is missing from one settings variant keeps its code default, and nothing reports it.
Check¶
A new configuration key added to some, but not all, settings variants of its section, acceptance-test variants included.
Test¶
A settings-shape test that compares the set of leaf keys across every settings variant of a service.
Related rules¶
CS-CFG-010, CS-CFG-005, CS-CFG-007, CS-MSG-004
CS-DP-DEP-006: Start-up test passes whether a setting is read or ignored¶
Severity: major · Applies to: service, library, template · Enforced by: manual · Status: active
Symptom¶
A licence key or an optional setting "works" because the service starts, but the code that reads it never ran.
Cause¶
The library does not check the value at start-up, so a valid value, an invalid value and no value all behave the same until the feature is used.
Check¶
New configuration wiring that is verified only by start-up or by health checks.
Test¶
A registration unit test with fake configuration that asserts the value reaches the library's options.
Related rules¶
CS-DEP-003, CS-MAP-002, CS-CFG-001
CS-DP-DEP-007: New required options section fails at start-up, not at build¶
Severity: major · Applies to: service, template · Enforced by: manual · Status: active
Symptom¶
The build and the unit tests are green, but every acceptance scenario fails at host start with a configuration binding exception.
Cause¶
A shared registration binds and validates a new section unconditionally, and hosts that were composed or copied earlier do not have the section in their settings.
Check¶
New validated options bindings in shared registration code. The section must be added to every host's settings and to every test settings file.
Test¶
A start-up test for each host and settings variant, or a settings-shape check against the top-level keys of a reference host.
Related rules¶
CS-DP-DEP-008: Raw configuration read beside a bound options class¶
Severity: minor · Applies to: service, library, template · Enforced by: manual · Status: active
Symptom¶
A documented default, or a guard said to fail loudly, has no effect, and the value falls back to a host-specific default.
Cause¶
Code reads configuration.GetSection(...)["Key"] instead of the bound and validated options, so the options class default and its validation decorate a value that nothing uses.
Check¶
Raw configuration indexers or GetValue calls on a section that already has an options type.
Test¶
Start with the key missing and with an invalid value, and assert the product default in the first case and a start-up failure in the second.
Related rules¶
CS-CFG-011, CS-CFG-001, CS-CFG-002
Packages and upgrades¶
CS-DP-DEP-009: Security pin strands an assembly another package still binds¶
Severity: major · Applies to: service, library, api-client, blazor, template · Enforced by: manual · Status: active
Symptom¶
After a dependency bump, services log hundreds of FileNotFoundException errors for one assembly from a background component, while health checks and API suites stay green.
Cause¶
Pinning a package to a newer major for a security advisory removes a transitive dependency that another compiled package still loads at run time.
Check¶
Security pins that cross a major version. Compare project.assets.json before and after the pin for assemblies that disappear.
Test¶
A start-up smoke test that runs the hosted services once and fails on any assembly load exception in the logs.
Related rules¶
CS-DP-DEP-010: Removed package is still named by configuration or project files¶
Severity: major · Applies to: service, library, api-client, blazor, template · Enforced by: manual · Status: active
Symptom¶
After a library is removed, a host crashes at start in its logging configuration, or restore fails with NU1010.
Cause¶
The package is removed from the central versions file, but a host project, a logging enricher entry, a log-level filter or a settings section in some variants still names it.
Check¶
A package removal whose diff does not touch every project and settings variant that names the package. Search case-insensitively for the package name and its namespaces.
Test¶
Build the whole solution and start each host with each settings variant after the removal.
Related rules¶
CS-DEP-017, CS-DEP-007, CS-DEP-009
CS-DP-DEP-011: Analyzer upgrade breaks only the Release build¶
Severity: major · Applies to: service, library, api-client, blazor, template · Enforced by: manual · Status: active
Symptom¶
A dependency wave builds clean locally and fails in CI with dozens of analyzer errors in code the wave did not touch. Tests that contain version strings of the moved packages fail too.
Cause¶
Warnings are errors only in the Release configuration, which CI builds and the local check did not. Tests pin literal version strings of the packages that moved.
Check¶
- Analyzer packages that move in a bump.
- Tests that contain
Version="…"literals for bumped packages.
Test¶
Build and test every repository of the wave in Release before review.
Related rules¶
CS-DEP-016, CS-DOD-001, CS-DEP-012
CS-DP-DEP-012: Package adds a component name the application already owns¶
Severity: major · Applies to: blazor, template · Enforced by: manual · Status: active
Symptom¶
A UI package bump produces about a thousand meaningless compile errors inside generated *_razor.g.cs files.
Cause¶
The new package version adds a component whose tag name equals an application component imported through _Imports.razor. With two candidates for one tag, the Razor compiler fails across every file that uses it.
Check¶
UI package upgrades that add components whose names match application components in scope.
Test¶
Build in Release after each UI package bump. When the errors appear, revert one package at a time to find the one that adds the name.
Related rules¶
CS-DP-DEP-013: Package ships its static web assets twice¶
Severity: major · Applies to: library, blazor, template · Enforced by: manual · Status: active
Symptom¶
Every consumer of a Razor class library fails to build with a duplicate static web asset identity in the development manifest.
Cause¶
A custom pack target adds wwwroot as content files on top of the static web assets that the SDK already packs.
Check¶
Custom pack targets in a Razor class library that include wwwroot/** as content.
Test¶
A package-content check that the static web assets are present and that no contentFiles/**/wwwroot entries exist.
Related rules¶
Build layout and verification¶
CS-DP-DEP-014: MSBuild Exists() used as a property value is always empty¶
Severity: major · Applies to: service, library, api-client, blazor, template · Enforced by: manual · Status: active
Symptom¶
An import guarded by a "has the optional folder" property never runs. Local builds pass, and container builds fail with missing package versions.
Cause¶
Exists() is a condition function. Written inside a property value, such as <HasFolder>$(Exists('…'))</HasFolder>, it evaluates to an empty string.
Check¶
$(Exists( anywhere in a property value.
Test¶
Build in both layouts, with and without the optional folder, and in the container build.
Related rules¶
CS-DP-DEP-015: Fallback project reference keeps "dead" vendored code live¶
Severity: major · Applies to: service, template · Enforced by: manual · Status: active
Symptom¶
Deleting an apparently unused vendored copy of template projects breaks the build.
Cause¶
Project references come in a conditional pair that prefers the submodule path when it exists and falls back to the vendored copy, which is then compiled into the product.
Check¶
Before deleting vendored code, resolve every Condition="Exists(...)" reference on disk and compute the reference closure.
Test¶
Build in a clean checkout without the submodule after the removal.
Related rules¶
CS-DP-DEP-016: Verification run executes a stale binary¶
Severity: major · Applies to: service, library, api-client, blazor, template · Enforced by: manual · Status: active
Symptom¶
A red-then-green proof shows the wrong half. A "green" run fails with the reverted value, or a run passes against code that lacks the change.
Cause¶
- A file restored by a move or a copy keeps its old modification time, so the incremental build or the code generation is skipped.
- A custom output path combined with
--artifacts-pathbuilds into one folder while the runner starts another. - A file that the build copies, such as a settings file or an ORM mapping file, is edited in the source, and the run uses
--no-build.
Check¶
- Verification evidence that does not show that the running binary contains the change.
- Output-path overrides in
Directory.Build.propsthat conflict with artifacts output.
Test¶
Touch restored files before rebuilding. Before trusting the result, confirm the running process's module path and a marker of the change.
Related rules¶
CS-DOD-009, CS-TPL-002, CS-DP-TST-010