This topic demonstrates how to use log data to debug a Microsoft Windows Presentation Foundation (WPF) application that contains Microsoft Lync Controls. This walkthrough builds on the topic Walkthrough: Add Logging to a Lync Controls Application which describes how to enable logging.

Prerequisites

For a list of prerequisites, see Walkthrough: Presence Hello World .

Creating the Application

Create a Lync WPF Application with logging enabled, and then add XAML code that contains an error.

To create the application

  1. Create a Lync WPF Application with logging enabled. For more information, see Walkthrough: Add Logging to a Lync Controls Application .

  2. In Page.xaml, in the XAML pane add the following XAML, which sets the Source property to an invalid URI.

      Copy imageCopy Code
    <controls:StartInstantMessagingButton
    Source="sip:typo@contoso"/>
    
  3. Close Microsoft Lync 2010.

Debugging the 'Lync is not running' Error

To experience how easy it is to use log data, find the message created when Lync 2010 is closed.

To set up and run the 'Lync is not running' Scenario

  1. Close Microsoft Lync 2010.

  2. Build and run the application created in the previous procedure. In the log file, expect to see a message like the following.

      Copy imageCopy Code
    2010-07-21T13:16:05.4663269-07:00 : Error : MThreadId=10 :
    Categories=LyncServiceProvider :
    Message=UCClientInitializationFailed:Microsoft Lync 4.0.7400.542 or
    later is not running and it is required for this application.
    Please start Lync to resolve this issue.
    

Debugging a Malformed URI

Next, see the message created by a malformed URI.

To Run the 'Lync is not running' Scenario

  1. Lync 2010 was closed in the previous procedure. Restart it.

  2. Build and run the application created in the first procedure. In the log file, expect to see a message like the following.

      Copy imageCopy Code
    Unable to create IContactModel from ContactUri. 
    Uri='typo@contoso.'
    Unable to create a contact for 'sip:typo@contoso.'.
    System.ArgumentException: Value does not fall within the expected
    range.
    
  3. Fix the malformed URI. It should be something like "sip:typo@contoso.com".

  4. Build and run the application. The error should be missing this time.

See Also