Debugging your project

This guide will help you learn how to debug your Shipping Integration Plugin's code when it is running in boxwise. If you haven't deployed your project and tested your project yet first follow the steps in these articles: Deploying your project to boxwise and Testing your project in boxwise.

Index

Before you begin
Local debugging
Remote debugging
Summary

Before you begin

Before you start with this guide make sure you have:

  1. installed an IDE like VS2019 or Jetbrains Rider
  2. built a Debug(❗) build of your code and you deployed both your .dll file and your .pdb file to the boxwise installation directory
  3. have not changed your code since you deployed your files to boxwise and started boxwise. (💥 If you change your code after deploying it your deployed pdb won't match correctly with your actual code's line numbers and it will give you very weird debugging results.)

Sample of the .dll and .pdb files deployed in the boxwise installation directory

mceclip0.png

 

Local debugging

Start boxwise

To debug your code in needs to be executed. Boxwise is responsible for executing your code so to debug in you first need to run boxwise. 

  1. Run boxwise either as a service (Wms.WarehouseServer.exe) or by running the console (Wms.WarehouseServerConsole.exe)
    1. As a service: Go to Services in Windows and start the service with name "Boxwise Pro Server"
    2. As a console app: Double click the icon on the desktop or start Wms.WarehouseServerConsole.exe directly from the installation folder of boxwise

Running boxwise a service

mceclip1.png

Running boxwise as a console app

mceclip2.png

 

Attach the debugger

  1. Open your IDE elevated as an administrator. This is needed because the boxwise runs elevated as well.
  2. Open your project in your IDE (with the code unchanged since the last time you have deployed it). 
  3. For Visual Studio:
    1. Click Debug>Attach to Process
    2. Select either Wms.WarehouseServer.exeor Wms.WarehouseServerConsole.exe
    3. Click Attach
  4. For Jetbrains Rider:
    1. Click Run>Attach to Process
    2. Select either Wms.WarehouseServer.exeor Wms.WarehouseServerConsole.exe
  5. If everything went ok your are now attached to the boxwise process. You can now set your breakpoints in your code and perform the steps in boxwise that will actually make a call to your code (like creating a new shipment or canceling a shipment).

Attaching to a process in Visual Studio 2019

mceclip4.png

Attaching to a process in Jetbrains Rider

mceclip3.png

 

Remote debugging 

There is also the option for VS2019 (or higher) and Jetbrains Rider to perform remote debugging. This means you have the source code and IDE running on your development machine and the application running on a remote server. Below the steps needed to perform remote debugging are described for Visual Studio users. For Jetbrains Rider you can use the manual created by Jetbrains here

Visual Studio 

  1. Install the correct remote tools for your visual studio version on the remote machine
  2. Start the Remote Debugger as an Administrator (Because boxwise always runs elevated as an Administrator you have to run the Remote Debugger as an Administrator also)
  3. Make sure you have the address of your remote machine and the port (default port for VS2019 is 4024)
  4. Make sure the port is open in the firewall(s) in front of your remote machine
  5. Make sure the deployed Shipping Integration .dll and .pdb belong to the version of your source code (⚠ don't change the source code after deploying!)
  6. Follow the steps described here in Visual Studio (❗ pls ignore step 9)
  7. And Happy ❤ Debugging!

Start Remote Debugger as Administrator

mceclip0.png

Summary

  1. ✅ You now know that boxwise can either as a console app or as a service
  2. ✅ You learned how to attach your debugger to boxwise to debug your code

The next step is to learn more about when certain functions are called by boxwise for example. You can read more about this under Reference & Context in the Overview article.

Was dit artikel nuttig?
Aantal gebruikers dat dit nuttig vond: 0 van 0