locked
FileSyncProvider throwing AccessViolationException RRS feed

  • Question

  • Working on a sample remote file sync provider, so I started by inheriting from KnowledgeSyncProvider and implementing the methods to point to another class, which will eventually become a web service.  I wanted to make a general purpose RemoteKnowledgeSyncService that wrapped all of the methods of a KnowledgeSyncProvider, then instanciated the provider on demand and call the wrapped method.  It's very much not an optimal solution, but I'm just working for proof-of-concept right now.

    Code Snippet

    SyncKnowledge knowledge = new SyncKnowledge();
    FileSyncProvider t = new FileSyncProvider(REPLICA_ID,PATH_DEST);

    uint batchSize = 1;


    t.GetSyncBatchParameters(out batchSize, out knowledge);
    return knowledge;



    The GetSyncBatchParameters call is causing this exception to be thrown:
    Call Stack

    at Microsoft.Synchronization.Files.Interop.FileSyncProviderClass.GetSyncBatchParameters(ISyncKnowledge& ppSyncKnowledge, UInt32& pdwRequestedBatchSize)
    at Microsoft.Synchronization.UnmanagedSyncProviderWrapper.GetSyncBatchParameters(UInt32& batchSize, SyncKnowledge& knowledge)
    at Sync.Framework.Remote.RemoteKnowledgeSyncService.GetSyncKnowledge(String configName) in C:\Projects\Sync\Sync.Framework\Remote\RemoteKnowledgeSyncService.cs:line 33
    at DummyConsole.Program.Main(String[] args) in C:\Projects\Sync\DummyConsole\Program.cs:line 20
    at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
    at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
    at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
    at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
    at System.Threading.ThreadHelper.ThreadStart()


    So, what am I doing wrong here?
    Tuesday, December 2, 2008 11:08 PM

Answers

  • Hi -

     

    What you are missing here is a call to BeginSession before your call to GetSyncBatchParameters. The AccessViolationException is a bug that we will fix but calling BeginSession will cause the exception to go away.

     

    But we are interested in understanding what you are trying to do here. Why did you need to call these methods directly - normally the framework itself calls these methods directly and would have called these methods in the right order.

     

    Thanks

    Deepa

     

     

    Tuesday, December 9, 2008 4:45 PM
    Answerer

All replies

  • Hi -

     

    What you are missing here is a call to BeginSession before your call to GetSyncBatchParameters. The AccessViolationException is a bug that we will fix but calling BeginSession will cause the exception to go away.

     

    But we are interested in understanding what you are trying to do here. Why did you need to call these methods directly - normally the framework itself calls these methods directly and would have called these methods in the right order.

     

    Thanks

    Deepa

     

     

    Tuesday, December 9, 2008 4:45 PM
    Answerer
  • Hi Deepa,

    I read your answer and i am wondering how can i call the Begin session method?
    It requires a parameter of type SyncSessionContext which has no constructor...i have failed to find any documentation on the matter.

    I am trying to synchronize two folder over a network using WCF and i thought that i can trasfer knowledge between the providers using WCF.
    What do u think?

    Thanks,
    Morious

    1 Picture = 1000 Words;
    Wednesday, March 25, 2009 9:29 PM