Click or drag to resize

Debugging Server Business Rules

Visual Studio allows the connection to other processes through the debugger. This is very helpful in stepping through business rule code that is developed against ShipExec. The directions below are on how to connect using Visual Studio 2010 Professional Debugger.

Debugging SBR with Visual Studio

  1. With the business rules project open in Visual Studio. Select Debug -> Attach to Process… from the file menu. This will bring up the Attach to Process dialog window.

    DebugSBRVisual Studio
  2. Find SoxOnWcfWinService.exe process. Highlight and click Attach. This will put Visual Studio in debug mode. When attaching to a process, it is easiest to find the correct WCF instance by stopping all other instances of ShipExec. The ToolTip also provides the location of the executable when you place the cursor over the process name.

  3. To debug the Load business rule, place a breakpoint in the load method of the SBR.

    load
    public ShipmentRequest load(string value, ShipmentRequest shipmentRequest, ref SoxDictionary Params)
    {
        //Creating New Sox Shipment Request
        ShipmentRequest ship_req = new ShipmentRequest();
    
        //Creating Default Attributes
        ship_req.def_attr = new Package();
    
        //Creating Consignee
        ship_req.def_attr.consignee = new NameAddress();
        ship_req.def_attr.consignee.company = "Consignee Company";
        ship_req.def_attr.consignee.address1 = "123 East Ave";
        ship_req.def_attr.consignee.city = "Orlando";
        ship_req.def_attr.consignee.state_province = "FL";
        ship_req.def_attr.consignee.postal_code = "32809";
        ship_req.def_attr.consignee.country_symbol = "UNITED_STATES";
    }
  4. Now execute the ShipExec load method. The business rules will stop at your breakpoint enabling you to debug your business rules.

    VSDebug Break Point
  5. Debugging at this point can be done against any custom assemblies as you can enter them using the PSI.Sox.SBR.dll as an entry point.