With each update of Dynamics 365 Business Central, Microsoft enhances what is often referred to as the base application and enhances the development environment. Dynamics 365 Business Central 2022 Wave 2 has several exciting Development features for runtime 10.0. One of the exciting features is to Exclude Try functions when debugging errors.
Before Microsoft Dynamics 365 Business Central 2022 Wave 2, when debugging code, developers could determine if the debugger would break on errors by setting the key, BreakOnError, in the launch.json file value to true or false. When debugging code that uses Try functions, this often leads to many unnecessary breaks because, usually, Try functions are designed to cause errors. With the release of Microsoft Dynamics 365 Business Central, developers have new options for the value of the BreakOnError key.
Then options are:
None (false): do not break on errors
All (true): break on all errors
ExcludeTry: break on all errors if they occur outside of the context of a try function
When debugging the following code with the BreakOnError key value set to All, the debugger will break on the error generated within the Try function. If the BreakOnError key is set to ExcludeTry, the debugger will not break on the error within the Try function.
Note: the true and false options are used for backwards compatibility and may become obsolete in the future. It is recommended to use the All and None option values.
Read more about the feature Exclude Try functions when debugging errors here.
Note: The code and information discussed in this article is for informational and demonstration purposes only. This content was created referencing Microsoft Dynamics 365 Business Central 2022 Wave 2 online.