InvalidCastException when disposing a peer provider after a sync session over WCF RRS feed

  • Question

  • I have a peer to peer sync scenario that syncs two sql server dbs over WCF.   It works flawlessly most of the time, but a couple of times during my testing though, I've received a InvalidCastException.  This only occurs when the sync session is ending and I can't duplicate it consistently.  I'm using WCF so the exception is actually coming from my web service, but the only thing I'm doing in the method is disposing of the peerprovider. 


    Here's the exception:

    Unable to cast COM object of type 'System.__ComObject' to interface type 'ISyncChangeBatchBase'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{52F6E694-6A71-4494-A184-A8311BF5D227}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).


    The sync is successful, however, and if I run the sync process again it works without failure.  Has anyone seen this before? 


    • Moved by Tina_Tian Friday, April 22, 2011 8:02 AM (From:SyncFx - Microsoft Sync Framework Database Providers [ReadOnly])
    Wednesday, October 15, 2008 7:23 PM

All replies

  • Can you post the complete stack trace thrown? Also can you post the signature of you EndSession WCF operation? My guess is you are passing some sync object which internally contains a COM object which is not serializable.
    Friday, October 17, 2008 4:24 AM