none
TargetInvocationException was handled in windows mobile RRS feed

  • Question

  • I am building a windows mobile application using Visual Studio 2008 also installed SP1 for synchronization,  i have done the synchronization code using C# now i am getting the following exception:

    System.Reflection.TargetInvocationException was unhandled
      Message="TargetInvocationException"
      StackTrace:
           at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean verifyAccess, StackCrawlMark& stackMark)
           at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
           at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
           at Microsoft.Synchronization.Data.ServerSyncProviderProxy.GetChanges(SyncGroupMetadata groupMetadata, SyncSession syncSession)
           at Microsoft.Synchronization.SyncAgent.DownloadChanges(SyncGroupMetadata groupMetadata)
           at Microsoft.Synchronization.SyncAgent.Synchronize()
           at Synchronize.BussinessLogic.Synchronization.Synchronize()
           at Synchronize.mainForm.mainForm_Load(Object sender, EventArgs e)
           at System.Windows.Forms.Form.OnLoad(EventArgs e)
           at System.Windows.Forms.Form._SetVisibleNotify(Boolean fVis)
           at System.Windows.Forms.Control.set_Visible(Boolean value)
           at System.Windows.Forms.Application.Run(Form fm)
           at Synchronize.Program.Main()
      InnerException: System.Net.WebException
           Message="Could not establish connection to network."
           StackTrace:
                at System.Net.HttpWebRequest.finishGetResponse()
                at System.Net.HttpWebRequest.GetResponse()
                at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest request)
                at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebRequest request)
                at System.Web.Services.Protocols.SoapHttpClientProtocol.doInvoke(String methodName, Object[] parameters, WebClientAsyncResult asyncResult)
                at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
                at Synchronize.ExampleProxy.ExampleCacheSyncService.GetChanges(SyncGroupMetadata groupMetadata, SyncSession syncSession)
                at System.Reflection.RuntimeMethodInfo.InternalInvoke(RuntimeMethodInfo rtmi, Object obj, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture, Boolean isBinderDefault, Assembly caller, Boolean verifyAccess, StackCrawlMark& stackMark)
                at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean verifyAccess, StackCrawlMark& stackMark)
                at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
                at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
                at Microsoft.Synchronization.Data.ServerSyncProviderProxy.GetChanges(SyncGroupMetadata groupMetadata, SyncSession syncSession)
                at Microsoft.Synchronization.SyncAgent.DownloadChanges(SyncGroupMetadata groupMetadata)
                at Microsoft.Synchronization.SyncAgent.Synchronize()
                at Synchronize.BussinessLogic.Synchronization.Synchronize()
                at Synchronize.mainForm.mainForm_Load(Object sender, EventArgs e)
                at System.Windows.Forms.Form.OnLoad(EventArgs e)
                at System.Windows.Forms.Form._SetVisibleNotify(Boolean fVis)
                at System.Windows.Forms.Control.set_Visible(Boolean value)
                at System.Windows.Forms.Application.Run(Form fm)
                at Synchronize.Program.Main()

    Friday, July 8, 2011 7:10 AM

All replies

  • thinks looks like a WCF/Web service error rather than Sync Fx. are you running this from an emulator? check that the device can actually connect to the service (easy test will be to browse the service url from the device)
    Monday, July 11, 2011 2:52 AM
    Moderator
  • I have tried connecting the device (windows CE 5.0 & windows Mobile Datalogic memor scanner) I get the Following Exception:

    System.MissingMethodException was unhandled
    Message: This application requires a newer version of the Microsoft® .NET Compact Framework than the version installed on this device.


    Monday, July 11, 2011 10:00 AM
  • i suggest you follow what the message says and make sure you have the same CF version on your dev machine and the device itself.
    Monday, July 11, 2011 10:06 AM
    Moderator
  • I have added the OpenNETCF.dll and the problem have been solved thanx again june

     

    C:\Program Files\OpenNETCF\Smart Device Framework\2.2\Bin\OpenNETCF.dll

     

    • Marked as answer by mrmavit Tuesday, July 12, 2011 12:06 PM
    • Unmarked as answer by mrmavit Wednesday, July 13, 2011 9:51 AM
    Tuesday, July 12, 2011 12:03 PM
  • The problem resurfaced again eish cant seem to get rid of this Exception
    Wednesday, July 13, 2011 9:53 AM
  • which exception has reoccured?
    Thursday, July 14, 2011 8:01 AM
    Moderator
  • the TargetInvocationException was handled in windows mobile, and i'm debuging the the system on a device
    Thursday, July 21, 2011 11:20 AM
  • Did you ever find a resolution?  I have had a similar problem and have not been able to track down the cause of the targetinvocationexception.  Seems to happen randomly, but once it happens I cannot recover.
    Wednesday, August 24, 2011 8:11 PM
  • Hi Guys, I'm trying to develop a solution to Sync between a Database.mdf in a Handheld with Windows Mobile 6.0 and local PC Database.mdf. I try to follow this 'Walkthrough: Creating an Occasionally Connected Smart Device Application'(http://msdn.microsoft.com/en-us/library/cc488004%28v=vs.90%29.aspx) but it seems to be something wrong.

    I add a new rule to Firewall, but it doesn't work, or I didn't add the rule correctly, can someone help me with this issues, I really appreciate it?

    System.Reflection.TargetInvocationException was unhandled
      Message="TargetInvocationException"
      StackTrace:
           at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean verifyAccess, StackCrawlMark& stackMark)
           at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
           at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
           at Microsoft.Synchronization.Data.ServerSyncProviderProxy.GetSchema(Collection`1 tableNames, SyncSession syncSession)
           at Microsoft.Synchronization.SyncAgent.InitClientSchema()
           at Microsoft.Synchronization.SyncAgent.Synchronize()
           at HHCarTracking.Form1.mnuSynchronizeNow_Click(Object sender, EventArgs e)
           at System.Windows.Forms.MenuItem.OnClick(EventArgs e)
           at System.Windows.Forms.Menu.ProcessMnuProc(Control ctlThis, WM wm, Int32 wParam, Int32 lParam)
           at System.Windows.Forms.Form.WnProc(WM wm, Int32 wParam, Int32 lParam)
           at System.Windows.Forms.Control._InternalWnProc(WM wm, Int32 wParam, Int32 lParam)
           at Microsoft.AGL.Forms.EVL.EnterMainLoop(IntPtr hwnMain)
           at System.Windows.Forms.Application.Run(Form fm)
           at HHCarTracking.Program.Main()
      InnerException: System.Net.WebException
           Message="Unable to connect to the remote server"
           StackTrace:
                at System.Net.HttpWebRequest.finishGetResponse()
                at System.Net.HttpWebRequest.GetResponse()
                at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest request)
                at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebRequest request)
                at System.Web.Services.Protocols.SoapHttpClientProtocol.doInvoke(String methodName, Object[] parameters, WebClientAsyncResult asyncResult)
                at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
                at HHCarTracking.TrackingDBCacheWebRef.TrackingDBCacheSyncService.GetSchema(String[] tableNames, SyncSession syncSession)
                at System.Reflection.RuntimeMethodInfo.InternalInvoke(RuntimeMethodInfo rtmi, Object obj, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture, Boolean isBinderDefault, Assembly caller, Boolean verifyAccess, StackCrawlMark& stackMark)
                at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean verifyAccess, StackCrawlMark& stackMark)
                at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
                at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
                at Microsoft.Synchronization.Data.ServerSyncProviderProxy.GetSchema(Collection`1 tableNames, SyncSession syncSession)
                at Microsoft.Synchronization.SyncAgent.InitClientSchema()
                at Microsoft.Synchronization.SyncAgent.Synchronize()
                at HHCarTracking.Form1.mnuSynchronizeNow_Click(Object sender, EventArgs e)
                at System.Windows.Forms.MenuItem.OnClick(EventArgs e)
                at System.Windows.Forms.Menu.ProcessMnuProc(Control ctlThis, WM wm, Int32 wParam, Int32 lParam)
                at System.Windows.Forms.Form.WnProc(WM wm, Int32 wParam, Int32 lParam)
                at System.Windows.Forms.Control._InternalWnProc(WM wm, Int32 wParam, Int32 lParam)
                at Microsoft.AGL.Forms.EVL.EnterMainLoop(IntPtr hwnMain)
                at System.Windows.Forms.Application.Run(Form fm)
                at HHCarTracking.Program.Main()
           InnerException: System.Net.Sockets.SocketException
                Message="No connection could be made because the target machine actively refused it"
                ErrorCode=10061
                NativeErrorCode=10061
                StackTrace:
                     at System.Net.Sockets.Socket.ConnectNoCheck(EndPoint remoteEP)
                     at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)
                     at System.Net.Connection.doConnect(IPEndPoint ep)
                     at System.Net.Connection.connect(Object ignored)
                     at System.Threading.ThreadPool.WorkItem.doWork(Object o)
                     at System.Threading.Timer.ring()

     

    Monday, September 5, 2011 3:54 PM