How To Debug Acumatica With Dnspy
Hello everybody,
today I want to share with you few words about debugging of Acumatica. There are plenty of wonderful posts for doing this with help of already provided PDB files of existing graphs and first of all I definetely recommend to use them.
But there are scenarios when default pdb provided is not enough. One of recent examples when I faced it was debugging of web api rest calls.
Below I'll provide you with steps, which you can accomplish in order to debug error stack trace like this ( screenshot from postman ):
how many times in your life you looked on it and said: I'd like to debug that code, but I don't have source code! What will be next steps? Open case in Acumatica, provide them with reproducable customization,
and slowly but gradually solve the problem.
Let me introduce to you tool dnSpy. With it's help, you can debug source code of Acumatica, which is not available for you by default. Below goes steps, necessary for debugging class
PX.Api.ContractBased.EntityService and it's method GetOperationResult.
1. Download source code of dnSpy and build it.
2. Execute dnSpy.exe
3. Send Post request to your Acumatica instance for example in Postman similar to this: https://localhost/PaymentSystem/entity/auth/login
4. In menu of dnSpy choose Debug -> Attach to Process like on screenshot:
5. Find your instance of w3wp of Acumatica. It can look similar to next screenshot:
6. Go to tab modules, and find there module PX.API.ContractBased
7. Enjoy debugging