开发者

help debugging "target of an invocation" error in Microsoft Sync Framework application

I am writing an application that uses MS Sync Framework to sync a local database (SQLCe) in a desktop WPF application to a remote server via a WCF web service. This is the first time I have worked with Sync Framework and with a SQLCe database included as part of a Visual Studio project (not a server-hosted DB) so, there is a LOT that I don't know about the proper setup of the application.

My sync client library has a SQLCe database included in the project. I have created the DB but, I have not created any tables, etc...it is my understanding that the tables will be created on the first sync.

I have written a simple test application that has a form with a button on it. It references the library that includes the sync client dll. So, when the button is clicked I instantiate the MyAppSyncAgent object that inherits from SyncAgent. The constructor of MyAppSyncAgent instantiates a SyncGroup object and then, for each table of the source db, it creates a SyncTable object (CreationOption = DropExistingOrCreateNewTable), sets the Syn开发者_如何学编程cDirection, sets the SyncTable's SyncGroup and addes the SyncTable to this.Configuration.SyncTables. Once the SyngAgent object is instantiated, I call its Synchronize() method.

I am currently receiving the "Exception thrown by the target of an invocation" error after the constructor has run. Here is the top of the call stack:

System.Reflection.TargetInvocationException was unhandled Message=Exception has been thrown by the target of an invocation. Source=mscorlib StackTrace: at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner) at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at Microsoft.Synchronization.Data.ServerSyncProviderProxy.GetSchema(Collection`1 tableNames, SyncSession syncSession) at Microsoft.Synchronization.SyncAgent.InitClientSchema() at Microsoft.Synchronization.SyncAgent.DataSynchronize()

It appears that GetSchema is the culprit but, what is causing it to fail? How can I get more information? Can anyone suggest some techniques for debugging this?. Is there more information I can provide to this thread that might help you have a more precise picture of what is happening?

I would appreciate any advice you can give.


try enabling Sync Fx Tracing. checked that you have configured the WCF service correctly as well.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜