Поделиться через


Walkthrough: Setting Up Remote Debugging on the Macintosh

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Silverlight remote debugging on the Macintosh consists of the following pieces:

  • An add-on to Visual Studio 2008 that provides Silverlight remote debugging as a transport option. This is installed as part of the Silverlight Tools for Visual Studio 2010.

  • A proxy service that runs on the Macintosh and helps the remote debugger identify the local processes running Silverlight applications. This is installed as part of the Silverlight developer runtime for the Macintosh.

Remote debugging occurs over an SSL-encrypted TCP channel between the debugger and the target computer. Initial configuration must be performed on both the Macintosh computer and the computer running Windows in order to set up the TCP port and private/public key pair.

The following walkthrough describes how to configure your computers for debugging and to start a debugging session in Visual Studio.

Prerequisites

You need the following components to complete this walkthrough:

  • A computer running Windows with Visual Studio 2008 SP1 and the Silverlight Tools for Visual Studio 2010 installed.

  • A Macintosh computer that has the Silverlight developer runtime installed.

  • A network connection on both computers.

  • A way to transfer files between the Windows and Macintosh computers.

For information about the Macintosh support for Silverlight, see Silverlight Requirements. For information about the Silverlight Tools, see Silverlight Tools.

Setting Up Remote Debugging

First, you must configure the remote debugging proxy on the Macintosh computer.

To configure the Macintosh computer

  1. From the /Applications directory, run the Silverlight Debugging Configuration application.

  2. Click the Generate New Configuration button.

    This has the following effects:

    • The Network Port (TCP IPv4) field is populated with a randomly generated port number between 49152 and 65535.

    • A per-user configuration directory ~/Library/Application Support/SilverlightDebuggingConfig1.0/ is created that contains the following files: Certificate.dat, PrivateKey.dat, and Settings.dat.

    • A per-user launch agent, ~/Library/LaunchAgents/com.microsoft.silverlight.debugproxy.plist, is created.

  3. In the Encryption Password text box, specify an 8-to-25-character password and then duplicate it in the Verify Password text box.

  4. In the Replicator Path text box, specify a path and .exe file name for the PC configuration, or accept the default value.

  5. Click the Generate PC Configuration button.

    A dialog box will confirm the creation of the PC configuration .exe file at the location you specified in step 4. You can use this file with any computer running Windows that you want to use to debug Silverlight on the Macintosh computer. You can also re-generate this file as needed by running the Silverlight Debugging Configuration application again and following this procedure starting with step 4.

The Macintosh computer is now configured for remote debugging. Next, you will use the generated .exe file to configure the computer running Windows.

To configure the computer running Windows

  1. Close any open instances of Visual Studio.

  2. Copy the .exe file created in the previous procedure to your computer running Windows.

  3. Run the .exe file.

  4. Enter the password you specified in the previous procedure.

  5. Click OK in the dialog box that indicates that the Windows configuration has completed successfully.

The computer running Windows is now configured for remote debugging. Next, you will establish a connection between the two computers in order to begin debugging.

To connect the Visual Studio debugger to a Silverlight-based application running on your Macintosh

  1. On your Macintosh computer, start the Silverlight-based application that you want to debug.

  2. On your computer running Windows, use Visual Studio to open the Silverlight project that corresponds to the application that is running on your Macintosh computer.

  3. On the Debug menu, select Attach to Process.

  4. In the Transport drop-down list, select Silverlight Remote Cross-Platform Debugging.

  5. In the Qualifier combo box, specify the fully-qualified domain name or IP address of your Macintosh computer.

    The Available Processes window displays a list of processes running on your Macintosh.

  6. Select your Silverlight-based application process. You can use the Type column to identify the Silverlight processes.

  7. Click Attach.

The Visual Studio debugger is now attached to the target process on the Macintosh. At this point, you can use Visual Studio to perform normal debugger tasks, such as setting breakpoints, stepping through code, and examining the call stack.

At some point, you might want to undo the configuration that you have just performed. For example, you might need to upgrade the configuration for the next release of Silverlight. The following procedure describes how to undo the previous procedures.

To remove the Macintosh debugging configuration

  1. On the computer running Windows, open a command prompt and then run the following command:

    On Windows Vista:

    rmdir /s /q %LOCALAPPDATA%\Microsoft\SilverlightDebuggingConfig1.0

    On Windows XP:

    rmdir /s /q "%USERPROFILE%\Local Settings\Application Data\Microsoft\SilverlightDebuggingConfig1.0"

  2. On the Macintosh computer, open a terminal window and then run the following commands:

    rm –rf  ~/Library/Application\ Support/SilverlightdebuggingConfig1.0
    cd ~/Library/LaunchAgents
    launchctl unload ~/Library/LaunchAgents/com.microsoft.silverlight.debugproxy.plist
    rm ~/Library/LaunchAgents/com.microsoft.silverlight.debugproxy.plist
    

See Also

Concepts

Other Resources