Use attributes to surface method intent during build

MB-500 By islever Editorial Last updated

Short answer

B Apply attributes to the methods so the compiler emits their intent as messages in the Output window during the build process.

Question

A company is developing a new solution in Dynamics 365 Supply Chain Management. Customers will be able to use the solution in their own implementations.
Several of the classes in the solution are designed to be extended by customers in other implementations to accommodate unique requirements.
Certain methods must show up in the output window during the build process to advise other developers about the intent of the methods.
You need to implement the statements for the methods.
What should you implement?
  1. comments
  2. attributes Correct Answer
  3. global variables
  4. properties
  5. info() function

Key Takeaways

The test is whether you can separate build-time compiler diagnostics from runtime output; only attributes are processed by the compiler during build.

This MB-500 scenario asks how to make method-level guidance appear in Visual Studio's Output window during a Dynamics 365 build. The answer is attributes (B): compiler-processed metadata such as SysObsolete emits build diagnostics, while comments and info() never reach build output.

Common mistake: Comments (A) look like the natural way to describe intent but the compiler ignores them, so they never appear in the build Output window.

Expert Analysis

Trace the request. The requirement is not runtime behaviour but build-time behaviour: statements attached to methods must surface in Visual Studio's Output window while the solution compiles, so that downstream developers extending those methods learn the intended use. That immediately eliminates anything evaluated only when code runs: E info writes to the Infolog at runtime, and C global variables carry data, not developer-facing guidance. D properties are element-level settings (a few of which, like IsDeprecated, can suppress members) but they are not statements you write on a method body to describe intent, and A comments are invisible to the compiler — they never appear in build output.

Where the message is produced. The mechanism that reaches the build log is compiler-processed metadata. An attribute such as [SysObsolete(...)] is applied directly to the method, and when the compiler resolves the method during build it emits a warning/diagnostic into the Output window telling the extending developer the method is deprecated or reserved. The same pattern generalises: a custom attribute consumed by a generator or analyser can emit diagnostics about a method's intent. So the statements you implement are attributes — B.

Why not the tempting distractors. The comments split between those who reach for A (ChatGPT-style answer) and those who argue 'only something the compiler reacts to can put a message in the build output' — which is the decisive reasoning and points to B. One commenter concedes they would 'like to see comments come up in the output window' but agrees it is not A, while another guesses a TODO-style comment; neither survives the requirement that the text appears during the build. E info is the classic wrong pick because it does produce visible output — but only at runtime in the Infolog, not during compilation.

Extension angle. Because customers subclass these classes, attributes travel with the metadata and remain visible to anyone consuming the assembly/source during build, which is exactly the 'advise other developers' intent described.

Exam Strategy

On MB-500, treat the phrase 'during the build process' as a filter: only compiler-processed constructs (attributes, analyzers, generators) can emit into build output, so eliminate runtime calls like info() and ignored constructs like comments before choosing. Then check which option is actually written on a method — that rules out element-level properties and variables.

Frequently Asked Questions

Why don't X++ comments appear in the build Output window?

Comments are stripped by the lexer and never processed by the compiler, so they produce no diagnostics. To reach the Output window you need compiler-processed metadata such as an attribute.

What is the difference between info() output and an attribute warning?

info() writes to the Infolog at runtime when code executes; an attribute such as SysObsolete makes the compiler emit a warning during the build, before the app runs.

Can attributes guide customers extending my classes?

Yes. Attributes travel with the method metadata, so any developer building or decompiling the extension sees the emitted diagnostics about the method's intent.

Community Votes

B
80%
A
20%

80% of anonymous learners picked answer B. Votes are pick records left by other test-takers — they are not the verified answer.

Discussion 7 contributions

Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.

From public community threads 7

  1. globeearth 👍 2 Answered B
    Attributesare metadata that can be applied to classes, methods, or other elements to provide additional information or behavior. Specific attributes, such as [SysObsolete] or custom attributes, can be used to display messages in the output window during the build process, informing developers about the purpose or status of methods (e.g., whether they are intended for extension or deprecated).
  2. smithlaod 👍 2
    B. attributes Explanation: Attributes in .NET can be used to annotate methods with additional metadata, which can be processed at compile time or run time. You can create a custom attribute that outputs messages during the build process. However, for general purposes, you might also see that certain build systems can utilize attributes to display information in the output window.
  3. Ali20 👍 2 Answered A
    ChatGPT: The correct choice to implement statements for methods that should show up in the output window during the build process to advise other developers about the intent of the methods is: A. comments
  4. cbef765 👍 1 Answered B
    The key phrase is “show up in the output window during the build process”. Only something the compiler reacts to can put a message in the build output, and in X++ that means an attribute.
  5. techsupport 👍 1 Answered B
    The SysObsolete attribute is used to mark methods as obsolete. During the build process, this attribute will trigger a warning in the output window.
Show 2 more comments
  1. cbef765 👍 1
    Id like to see comments come up in the output window.... it's not A
  2. 8933e4c 👍 1
    I agree. I suppose it is simply the well known todo comment.

Reader comments & corrections

No reader corrections yet — spotted an error or have a note? Share it below.

Log in to comment, report an error, or add a note about this question.

Practice All MB-500 Questions

Access 115 questions with complete answers and detailed explanations.

View Full MB-500 Practice Test →

← Back to MB-500 Study Guide