The preview environment for Dynamics 365 Business Central 2022 release wave 2 (BC21) is available. Learn more: Link.
I will continue to test and share some new features that I hope will be helpful.
When debugging, it has been possible to control whether to break on errors. However, until now, failing Try functions would also lead to breaking execution. These Try functions are usually used to handle errors and might not be of interest. To allow ignoring these to more efficiently debug errors, a new option has been added to omit errors in Try functions.https://docs.microsoft.com/en-us/dynamics365-release-plan/2022wave2/smb/dynamics365-business-central/exclude-try-functions-when-debugging-errors
This new feature is similar to Exclude temporary records when debugging record writes (“breakOnRecordWrite”:”ExcludeTemporary”) feature.
Microsoft have added new options to control when the debugger should break on errors in Try functions. Instead of the old Boolean BreakOnError setting in a launch.json file connection setup, this now takes one of the following values: true, false, None, All, ExcludeTry
The behavior for each option is:
- false/None: Does not break on any errors.
- true/All: Breaks on all errors.
- ExcludeTry: Breaks on errors only if they occur outside of the context of a Try function.
The values true and false are retained for now for backward compatibility. They map to All and None. We recommend using the latter going forward. True and false might become obsolete in a future version.
PS: As of now (2022/09/06), Microsoft has not updated MS Docs. More details: Launch.json file
|breakOnError||No||Specifies whether to break on errors when debugging. The default value is |
You can find more about Try functions in How to use Try methods/functions (TryFunction Attribute).
Let’s look at a simple example.
I added a new action to Customer List to excute a try function. More details about: Promoted action groups, action references, and ShowAs Property (New Modern Action Bar)
If I set “breakOnError”: “All” in launch.json file.
The debugger breaks on the error in the try function.
If I set “breakOnError”: “ExcludeTry” in launch.json file. The debugger ignores errors in the try function.
Give it a try!!!😁
Hope this will help.
Thanks for reading.