You are a Dynamics 365 Finance developer.
You create a class.
You need to mark the class to ensure that when code is compiled, the process fails if a specific method is called in the source code.
Which attribute should you use?
Click on the arrows to vote for the correct answer
A. B. C. D.D.
One use of the SysObsoleteAttribute class is to notify the compiler that the compile should fail if a particular method is called in the source code.
The compiler rejects the compile, and displays the specific message that is stored in this use of the attribute.
https://docs.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/dev-ref/xpp-attribute-classesThe attribute that should be used to mark a class to ensure that when code is compiled, the process fails if a specific method is called in the source code is the SysObsoleteAttribute.
The SysObsoleteAttribute is used to mark a method or class as obsolete, meaning that it should not be used anymore. When this attribute is applied to a method or class, the compiler generates a warning message indicating that the method or class is obsolete.
In addition to generating a warning message, the SysObsoleteAttribute can also be used to prevent the method or class from being called at all. This is done by setting the parameter "error" to true when applying the attribute. When "error" is set to true, any attempt to call the method or class will result in a compilation error, causing the build process to fail.
The other attributes mentioned in the answer choices are not suitable for this scenario. The SysEntryPointAttribute is used to mark a method as the entry point for the application, and has no effect on preventing the use of a specific method or class. The getAttributes method is used to retrieve the attributes applied to a method or class, and does not provide a way to prevent the use of a specific method or class. The SysAttribute is a base class for all system-defined attributes, and is not used to prevent the use of a specific method or class.