none
Specified argument was out of the range of valid values. Parameter name: managedData RRS feed

  • Question

  • I know that there are already a number of questions about this, but none of them seem to have real answers. I'm getting this error when I call Synchronize() on the SyncOrchestrator. Here's my setup:

    localFolderProv = new FileSyncProvider(conGuid, pathToLocalFolder, filter, opts);
    remoteProv = new CustomSyncProvider("test");
    SyncOrchestrator agent = new SyncOrchestrator();
    agent.LocalProvider = localFolderProv;
    agent.RemoteProvider = remoteProv;
    agent.Direction = SyncDirectionOrder.DownloadAndUpload;
    agent.Synchronize();

    The last method to be called in the CustomSyncProvider class is LoadChangeData. After reading the MSDN page and looking at the sample Sync101 program, I'm still unclear about what the method is supposed to do, but I tried to mimic what the Sync101 program does.

    public override object LoadChangeData(ItemFieldDictionary keyAndExpectedVersion, IEnumerable<SyncId> changeUnitsToLoad, RecoverableErrorReportingContext recoverableErrorReportingContext)
    {
          IDictionary<uint, ItemField> expectedFields = (IDictionary<uint, ItemField>)keyAndExpectedVersion;
          //Psuedo-path specified as integers. It seemed from MetadataSchema that I can't store a int[] but I can store a byte[]
          int[] directions = DeserializeBytePath((byte[])expectedFields[CUSTOM_INDICES_ID].Value);
          //GetFile reads the file from the remote source and returns a byte[]
          var toReturn = new ItemTransfer((string)expectedFields[CUSTOM_PATH_ID].Value, directions, GetFile(directions));
          return toReturn;
    
    }

    I have double checked, and toReturn is not null. Nor does this seem to be a conflict issue because it even happens when the remote side has files and the local side is an empty folder. I thought that the issue may be that ItemTransfer stores the whole file, but that's what they do in the sample, and it happens even when I replace the GetFile(directions) with new int[] {1}.

    I downloaded the .Net Reflector trial and tried debugging. It shows a more detailed call stack:

    > Microsoft.Synchronization.dll!Microsoft.Synchronization.KnowledgeSyncOrchestrator.DoOneWaySyncHelper(Microsoft.Synchronization.SyncIdFormatGroup sourceIdFormats, Microsoft.Synchronization.SyncIdFormatGroup destinationIdFormats, Microsoft.Synchronization.KnowledgeSyncProviderConfiguration destinationConfiguration, Microsoft.Synchronization.SyncCallbacks DestinationCallbacks, Microsoft.Synchronization.CoreInterop.ISyncProvider sourceProxy, Microsoft.Synchronization.CoreInterop.ISyncProvider destinationProxy, Microsoft.Synchronization.ChangeDataAdapter callbackChangeDataAdapter, Microsoft.Synchronization.SyncDataConverter conflictDataConverter, out int changesApplied, out int changesFailed) Line 167 C#
    >  Microsoft.Synchronization.dll!Microsoft.Synchronization.KnowledgeSyncOrchestrator.DoOneWayKnowledgeSync(Microsoft.Synchronization.SyncDataConverter sourceConverter, Microsoft.Synchronization.SyncDataConverter destinationConverter, Microsoft.Synchronization.SyncProvider sourceProvider, Microsoft.Synchronization.SyncProvider destinationProvider, out int changesApplied, out int changesFailed) Line 146 + 0x9d bytes C#
    >  Microsoft.Synchronization.dll!Microsoft.Synchronization.KnowledgeSyncOrchestrator.Synchronize() Line 316 C#
    > Microsoft.Synchronization.dll!Microsoft.Synchronization.SyncOrchestrator.Synchronize() Line 71 + 0x10 bytes C#

    and the line

     this.nativeSession.Start((CoreInterop.CONFLICT_RESOLUTION_POLICY) destinationConfiguration.ConflictResolutionPolicy, ref pSyncSessionStatistics);

    If I continue running, I get a SyncInvalidOperation "Operation is not valid due to the current state of the object." coming from a COMException with HRESULT 0x80041001.

    Sunday, December 9, 2012 4:17 AM