Unable to create ActiveSync object. Make sure ActiveSync is installed Error 104397372 (0x638FA3C)

Nov 28, 2012 at 8:40 PM

I'm just curious as to why the following exception occurs with the code below.

Unable to create ActiveSync object.  Make sure ActiveSync is installed Error 105708516 (0x64CFBE4)

// works
using ( RAPI device = new RAPI( ) )
{
    if ( device.DevicePresent )
    {
        device.Connect( );
        // copy files
    }
}

Thread.Sleep( 500 );

ThreadPool.QueueUserWorkItem( delegate( object state )
{
    try
    {
        using ( RAPI device = new RAPI( ) ) // exception here
        {
            if ( device.DevicePresent )
            {
                device.Connect( );
                // copy files
            }
        }
    }
    catch ( RAPIException ex )
    {
        MessageBox.Show( ex.Message );
    }
}  );

Correct me if I'm wrong, but I think it has to do with the thread the RAPI object was created on? I say this because if I pass in the RAPI object to the thread then there is no exception.

Thanks!