To Debug the Customization Code
The Code Editor does not provide facilities you can use to debug a code item of a customization project. We recommend that you use Microsoft Visual Studio to develop and debug any source code in customization projects. To start debugging using in Visual Studio, you need to perform the following steps, which are described in greater detail below:
- Install Acumatica Debugger Tools.
- Configure the web.config file for your Acumatica ERP instance.
- Perform the debugging.
Install Acumatica Debugger Tools
The MYOB debugger tools are PDB files located in the Bin folder of the MYOB Acumatica site folder.
The PDB files are copied to the Acumatica ERP/Files/Bin folder during the installation process if the Install Debugger Tools option is selected. If you haven't selected this option during installation, you should remove MYOB Acumatica and install it again with the Install Debugger Tools option selected. For details, see To Install the MYOB Acumatica Tools.
Every time you install or upgrade any MYOB instance, the MYOB Acumatica ERP Configuration Wizard copies data from the Acumatica ERP/Files/Bin folder to replace instance files. These files are not copied to any instance automatically. To be able to debug MYOB, you must have them in every instance that you need to debug.
To distribute PDB files, you can do one of the following:
- Install a new instance
- Upgrade an existing instance
- Copy files manually from Acumatica ERP/Files/Bin
If you want to copy files manually, note that the most important files are the following:
- PX.Data.pdb (PDB for PX.Data.dll), which contains the platform core code
- PX.Objects.pdb (PDB for PX.Objects.dll), which contains the MYOB Acumatica business logic
Prepare the web.config File for your Acumatica ERP instance
When the installation is finished and the instance is ready, you have to specify the debug option by doing the following:
- In the MYOB Acumatica folder, open in a text editor the web.config file located in the root folder of the your instance.
- In the<system.web> tag of the file, locate the <compilation> element.
- Set the debug attribute of the element to true as
follows.
<compilation debug="true" ...>
Note:See Debug mode in ASP.NET applications for details.
Perform the Debugging
To configure VS to debug source code of MYOB Acumatica code, select , and clear the Enable Just My Code check box.
To specify the path for PDB files, select C:\\Program files\Acumatica ERP\Files\Bin).
, and add a path to your files (which is typically- Publish the customization project, as described in Publishing Customization Projects.
- Make sure your instance of MYOB Acumatica is running by opening any page of the instance in a browser.
- Launch Visual Studio as an administrator.
- To open the website of your instance of MYOB Acumatica in Visual Studio, on the main menu, click , and select the website folder in the Open Web Site dialog box, which opens.
- In the Solution Explorer of Visual Studio, expand the App_RuntimeCode website folder, and double-click the file of the Code item to open it.
To debug customization code that has been added from the user interface, see To Move a Code Item to the Extension Library.
To start debugging an existing Code item in Visual Studio, do the following:
- In the item source code, set a breakpoint on the line of the code where you need to stop the process for debugging.
- On the main menu, click Attach to Process dialog
box, which opens, select the w3wp.exe process in the
list of Available Processes.Note:In the dialog box, ensure that the Show processes from all users check box is selected. If the check box is cleared, the list will not display the w3wp.exe process record.
, and in the
- In the browser, open the form of MYOB Acumatica whose business logic code you want to debug.
- In the browser, run an operation that invokes the fragment of the code that contains the breakpoint.
The process will be stopped at the breakpoint, and you can debug the code in Visual Studio.