Step 2: Preparing a Project for Debugging
To find the event that you can use in the custom workflow, it is helpful to debug the
MYOB Acumatica source code with breakpoints and see which breakpoint is hit in which scenario.
In this step, you will prepare the PhoneRepairShop_Code
for debugging in Visual Studio.
To prepare the PhoneRepairShop_Code
project for the debugging of the MYOB Acumatica code, you should do the following:
- Make sure the MYOB program database (PDB) files are located in the Bin
folder of the MYOB Acumatica instance folder that you are using for this activity (for example, in
SmartFix_T270\Bin).
The PDB files were copied to the Files\Bin folder of the MYOB Acumatica installation folder (such as C:\Program Files\Acumatica ERP\Files\Bin) during the installation process if the Install Debugger Tools check box was selected in the MYOB Acumatica Installation wizard. With the check box selected when you create a new instance or update an existing one, the PDB files are copied to the Bin folder of the instance. If you did not select the Install Debugger Tools check box during installation, you should remove MYOB Acumatica and install it again with the Install Debugger Tools check box selected. For details, see To Install the MYOB Acumatica Tools.
Tip:A PDB file holds debugging and project state information that allows incremental linking of a debug configuration of your program. In general, a PDB file contains the link between compiler instructions and some lines in source code. - Configure the Web.config file of the instance by doing the
following:
- In the file system, open in the text editor the Web.config file, which is located in the root folder of the PhoneRepairShop instance.
- In the
<system.web>
tag of the file, locate the<compilation>
element. - Set the debug attribute of the element to
True, as shown in the following code.
<system.web> <compilation debug="True" ...>
- Save your changes.
- Configure the
PhoneRepairShop_Code
project for debugging by doing the following:- In Visual Studio, open the
PhoneRepairShop_Code
solution, which includes both thePhoneRepairShop_Code
project and the PhoneRepairShop website. - On the main menu, select .
- In the Enable Just My Code check box, as shown in the following screenshot. section, clear the
- In the Symbols file (.pdb) locations list, add the path to the location of the PDB files that you discovered in Instruction 1 of this step, such as C:\Training\SmartFix_T270\Bin. section, in the
- Click OK.
- In Visual Studio, open the
- Open the MYOB Acumatica source code files. For the SmartFix_T270 instance, all files are located in the SmartFix_T270/App_Data/CodeRepository folder.
- To view the source code of the
Release
action of the Payments and Applications (AR302000) form, open thePX.Objects.AR.ARPaymentEntry
graph: In the Solution Explorer, select , and go to the definition of the Release action—that is, theIEnumerable Release(PXAdapter adapter)
method. The code should look as shown in the following screenshot. - Add a breakpoint inside the
Release
method, as shown in the screenshot above. - Attach the Visual Studio debugger to a running process.
- Start debugging by doing the following:
- In MYOB Acumatica, open the Payments and Applications form.
- Create a payment.
- On the form toolbar, click the Release
button.
Wait until the breakpoint is hit.
- In Visual Studio, view the debug information for the
Release
method.