Skip to content

Linker Problems

Question

Possible problems with linker and how to resolve it?

Short interview answer

A linker can remove code that is not statically visible as used, breaking reflection, dependency injection, serialization, or platform callbacks at runtime. Preserve the required members through supported configuration or annotations, and test the actual release build.

Detailed answer

Code elimination is based on what the build can determine. If an app loads a type by name or invokes a member through reflection, the linker may not see the dependency. The symptom is often a release-only failure such as a missing type, missing member, or a feature that silently stops working. Diagnose the exact dynamically reached code path, preserve only the required types or members, and add a release-build test for it. Turning linking off can be a temporary diagnostic step, but it gives up size benefits and does not explain the dependency to future maintainers.

Sources