RangeOutOfOrderException thrown from ReplicaMetadata.GetChangeBatch(uint batchSize, SyncKnowledge destinationKnowledge) RRS feed

  • Question

  • Hi,


    I'm playing with new tutorials for Sync Framework from New Sync Framework Tutorial which works fine when I run them as they are provided. But in 4th sample I'm creating more items in _providerA (about 50). Then I got RangeOutOfOrderException from ReplicaMetadata.GetChangeBatch() (in MyGenericSyncProvider.GetChangeBatch()):


    Range was provided out-of expected order. Ranges should be provided in increasing order.

    Error Code: -2147217398

    HRESULT: 0x8004100A


    I must change batchSize in MyGenericSyncProvider.GetSyncBatchParameters() to 1 otherwise the code occasionally throws that exception.


    I have also my own KnowledgeSyncProvider which uses strings for SyncIds and the exception is thrown on the same place in my code (when batchSize is greather then 1).


    Do you have any suggestions why is this happening and how can I fix this?



    Best regards,




    PS: This is changed code in 4th sample:


    Line 99:

    _providerA.CreateItem(CreateItem(item1Name, "(206) 555-0001"));

    _providerA.CreateItem(CreateItem(item2Name, "(206) 555-0002"));

    for (int i = 7; i < 50; i++)


    _providerA.CreateItem(CreateItem("Name" + i, "123"));


    _providerB.CreateItem(CreateItem(item3Name, "(206) 555-0003"));

    _providerB.CreateItem(CreateItem(item4Name, "(206) 555-0004"));

    _providerC.CreateItem(CreateItem(item5Name, "(206) 555-0005"));

    _providerC.CreateItem(CreateItem(item6Name, "(206) 555-0006"));

    Wednesday, April 30, 2008 9:18 AM


  • Hi Jozef,


    Yes, we found this issue earlier in the week.  There are two workarounds for CTP2:

    1) Using batch size = 1

    2) Pad the names so that they all have the same lengths.

    For example, in the sample:
            Instead of using
                    For real names, you could pad all the names with spaces so that they are, for example, 50 characters long.


    Wednesday, April 30, 2008 5:19 PM