After attributes are applied in a .NET application, which of the following cannot inspect or read those attributes?

Difficulty: Easy

Correct Answer: Linker

Explanation:


Introduction / Context:
Attributes are stored as metadata in the compiled assembly. Various parts of the .NET toolchain and runtime can read this metadata for diagnostics, code generation, runtime behavior changes, and framework integration.



Given Data / Assumptions:

  • Attributes are compiled into assembly metadata.
  • We consider which components typically read or react to attributes.


Concept / Approach:
The CLR and frameworks (e.g., ASP.NET) commonly use reflection to read attributes at runtime. Compilers and tooling (e.g., Visual Studio analyzers) can interpret attributes at compile-time or design-time to produce warnings, errors, or scaffolding. A traditional “linker” in .NET does not generally inspect attributes to drive behavior in the way the CLR, compilers, or runtimes do.



Step-by-Step Solution:

CLR → can inspect attributes via reflection at runtime.ASP.NET Runtime → commonly uses attributes (e.g., WebMethod, Route attributes) to wire behaviors.Visual Studio .NET → tooling and designers can read attributes to influence design-time experience.Language compilers → read attributes (e.g., Obsolete) to emit warnings/errors.Linker → not the component that inspects attributes in typical .NET build/run flows; its role does not include interpreting application-specific attribute metadata.


Verification / Alternative check:
Use reflection (GetCustomAttributes) at runtime to confirm CLR accessibility. Mark members with [Obsolete] and watch the compiler react at compile-time.



Why Other Options Are Wrong:
They all are known to read attributes in their respective phases.



Common Pitfalls:
Assuming attribute processing is only runtime; in .NET it spans compile-time, design-time, and runtime.



Final Answer:
Linker

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion