Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SAP Sybase SQL Anywhere 16.0 » MobiLink - Server Administration » MobiLink server APIs » Synchronization scripts in .NET » .NET synchronization logic

 

Debugging .NET synchronization logic

The following procedure can be used to debug your .NET scripts using Visual Studio.

Prerequisites

There are no prerequisites for this task.

 Task
  1. Start Visual Studio.

  2. Select Tools » Attach to Process.

  3. In the Available Processes control, select mlsrv16.exe and then press Attach.

  4. Set your break points.

  5. Start a synchronization.

Results

The script can be debugged.

The following procedure can be used to debug your .NET scripts using Visual Studio.

Prerequisites

There are no prerequisites for this task.

 Debug .NET scripts
  1. Compile your code with debugging information turned on using one of the following methods:

    • On the csc command line, set the /debug+ option.

    • Use Microsoft Visual Studio settings to set debug output.

      • Click Build » Configuration Manager.

        In the Active Solution Configuration list, click Debug.

      • Build your assembly.

  2. Close running instances of Visual Studio that contain your source files.

  3. In this step, you start a new Visual Studio instance to debug the MobiLink server and your .NET synchronization scripts. Start Visual Studio using a command line option to debug the MobiLink server.

    • At a command prompt, navigate to the Common7\IDE subdirectory of your Visual Studio installation.

    • Start devenv (the Visual Studio IDE) using the /debugexe option.

      For example, run the following command to debug the MobiLink server. Remember to specify mlsrv16 options, including the connection string and the option to load .NET assemblies.

      For 32-bit Windows environments:

      devenv /debugexe %sqlany16%\bin32\mlsrv16.exe -c ...

      For 64-bit Windows environments:

      devenv /debugexe %sqlany16%\bin64\mlsrv16.exe -c ...

      Visual Studio starts and mlsrv16.exe appears in the Solution Explorer window.

  4. Set up Microsoft Visual Studio for debugging .NET code:

    • In the Visual Studio Solution Explorer window, right-click mlsrv16.exe and choose Properties.

    • Change Debugger Type from Auto to Mixed or Managed Only to ensure that Visual Studio only debugs your .NET synchronization scripts. In Visual Studio 2010, change Debugger Type to Managed(v2.0, v1.1, v1.0) or Managed v4.0, depending on the assembly version used by the MobiLink server.

    Note

    To use the v4.0 assemblies, you must explicitly include the -clrVersion option when you load the MobiLink server. For more information about the -clrVersion option, see -sl dnet mlsrv16 option.

  5. Open the associated .NET source files and set break points.

    Open the source files individually in the mlsrv16 solution. Do not open the original solution or project file.

  6. Start MobiLink from the Debug menu or by pressing F5.

    If prompted, save mlsrv16.sln.

    If the No Symbolic Information window appears, click OK to debug anyway. You are debugging the managed .NET synchronization scripts that MobiLink calls, not the MobiLink server itself.

  7. Perform a synchronization that causes the code with a breakpoint to be executed by MobiLink.

Results

The script can be debugged.