I have a method which performs and simple RetrieveMultiple, and the call back method loops through the attributes and performs some formatting.
The code works as a plugin, so I am quite sure that the logic is right.
When the request itself is executed, I get the following error
SCRIPT5022: Unhandled Error in Silverlight Application An AsyncCallback threw an exception. at System.ServiceModel.AsyncResult.Complete(Boolean completedSynchronously)
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.OnGetResponse(IAsyncResult result)
at System.Net.Browser.BrowserHttpWebRequest.<>c__DisplayClass19.<InvokeGetResponseCallback>b__17(Object state2)
at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
The code that performs the request is as below
QueryExpression query = new QueryExpression() { EntityName = "contact", ColumnSet = new ColumnSet() { //AllColumns = true }, }; OrganizationRequest request = new OrganizationRequest() { RequestName = "RetrieveMultiple" }; request.Parameters = new ParameterCollection(); request.Parameters.Add(new KeyValuePair<string, object>("Query", query)); //request["Query"] = query; IOrganizationService service = SilverlightUtility.GetSoapService(org_url); // service.BeginExecute(request, new AsyncCallback(performSearch), service); service.BeginRetrieveMultiple(query, (result) => { throw new Exception("before get response"); var response = ((IOrganizationService)result.AsyncState).EndRetrieveMultiple(result); Dispatcher.BeginInvoke(new Action( () => { performSearch2(response.Entities); })); }, service);
Am I missing something glaringly obvious?
Thanks!