locked
AddListMembersListRequest problem: "An unexpected error occurred." RRS feed

  • Question

  • Hello,

    I need help to solve a problem using AddListMembersListRequest. When I use the AddMemberListRequest all works properly and the contact are added to the Marketing List but with AddListMembersListRequest I run into some trouble, the code generate an "An unexpected error occurred." exception and the contact are not added.

    -AddMemberListRequest  Code that works fine

                        AddMemberListRequest req = new AddMemberListRequest();
                        req.ListId = new Guid("B32A4E30-08C2-E111-BECD-0800274B5A1F");
                        req.EntityId = new Guid("12EE48A2-47B5-E111-9444-0800274B5A1F");
                        AddMemberListResponse resp = (AddMemberListResponse)service.Execute(req);


    -AddListMembersListRequest Code that generates the exception

    List<Guid> MemberListIds = new List<Guid>(); MemberListIds.Add(new Guid("12EE48A2-47B5-E111-9444-0800274B5A1F")); AddListMembersListRequest req = new AddListMembersListRequest(); req.ListId = new Guid("B32A4E30-08C2-E111-BECD-0800274B5A1F"); req.MemberIds = MemberListIds.ToArray() ; AddListMembersListResponse resp = (AddListMembersListResponse)service.Execute(req);

    at VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context) at Pipeline.Execute(PipelineExecutionContext context) at MessageProcessor.Execute(PipelineExecutionContext context) at InternalMessageDispatcher.Execute(PipelineExecutionContext context) at ExternalMessageDispatcher.ExecuteInternal(IInProcessOrganizationServiceFactory serviceFactory, IPlatformMessageDispatcherFactory dispatcherFactory, String messageName, String requestName, Int32 primaryObjectTypeCode, Int32 secondaryObjectTypeCode, ParameterCollection fields, CorrelationToken correlationToken, CallerOriginToken originToken, UserAuth userAuth, Guid callerId, Guid transactionContextId, Int32 invocationSource, Nullable`1 requestId, Version endpointVersion) at OrganizationSdkServiceInternal.ExecuteRequest(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType) at OrganizationSdkServiceInternal.Execute(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType) at at SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs) at DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc) at ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc) at ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc) at MessageRpc.Process(Boolean isOperationContextSet) at ChannelHandler.DispatchAndReleasePump(RequestContext request, Boolean cleanThread, OperationContext currentOperationContext) at ChannelHandler.HandleRequest(RequestContext request, OperationContext currentOperationContext) at ChannelHandler.AsyncMessagePump(IAsyncResult result) at AsyncThunk.UnhandledExceptionFrame(IAsyncResult result) at AsyncResult.Complete(Boolean completedSynchronously) at ReceiveItemAndVerifySecurityAsyncResult`2.InnerTryReceiveCompletedCallback(IAsyncResult result) at AsyncThunk.UnhandledExceptionFrame(IAsyncResult result) at AsyncResult.Complete(Boolean completedSynchronously) at AsyncQueueReader.Set(Item item) at InputQueue`1.Dispatch() at ScheduledOverlapped.IOCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped) at IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped) at _IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP) >Web Service Plug-in failed in SdkMessageProcessingStepId: {01224BD7-BE9F-4FF5-86C8-A692EB5D11D8}; EntityName: list; Stage: 30; MessageName: AddListMembers; AssemblyName: Microsoft.Crm.Extensibility.InternalOperationPlugin, Microsoft.Crm.ObjectModel, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35; ClassName: Microsoft.Crm.Extensibility.InternalOperationPlugin; Exception: Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& 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 System.Web.Services.Protocols.LogicalMethodInfo.Invoke(Object target, Object[] values) at Microsoft.Crm.Extensibility.InternalOperationPlugin.Execute(IServiceProvider serviceProvider) at Microsoft.Crm.Extensibility.V5PluginProxyStep.ExecuteInternal(PipelineExecutionContext context) at Microsoft.Crm.Extensibility.VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context) Inner Exception: System.InvalidCastException: Specified cast is not valid. at Microsoft.Crm.BusinessEntities.SecurityLibrary.AccessCheckInternal(ExecutionContext context, SecurityPrincipal principal, String values, Int32 objectTypeCode, AccessRights rights) at Microsoft.Crm.BusinessEntities.SecurityLibrary.MultipleEntityAccessCheck(ExecutionContext context, Int32 objectTypeCode, AccessRights rights, String values) at Microsoft.Crm.ObjectModel.ListMemberSecurityExtension.VerifyListMemberAppendAccess(Int32 memberType, ExecutionContext context, Guid user, String values) at Microsoft.Crm.ObjectModel.ListService.CreateXmlAndAddUsingSproc(Guid listId, Int32 memberType, String resultXml, ExecutionContext context) at Microsoft.Crm.ObjectModel.ListService.AddListMembers(Guid listId, Guid[] memberIds, ExecutionContext context).

    at CrmException..ctor(String message, Exception innerException, Int32 errorCode, Boolean isFlowControlException)
    at CrmException..ctor(Exception innerException, Int32 errorCode, Object[] arguments)
    at VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)
    at Pipeline.Execute(PipelineExecutionContext context)
    at MessageProcessor.Execute(PipelineExecutionContext context)
    at InternalMessageDispatcher.Execute(PipelineExecutionContext context)
    at ExternalMessageDispatcher.ExecuteInternal(IInProcessOrganizationServiceFactory serviceFactory, IPlatformMessageDispatcherFactory dispatcherFactory, String messageName, String requestName, Int32 primaryObjectTypeCode, Int32 secondaryObjectTypeCode, ParameterCollection fields, CorrelationToken correlationToken, CallerOriginToken originToken, UserAuth userAuth, Guid callerId, Guid transactionContextId, Int32 invocationSource, Nullable`1 requestId, Version endpointVersion)
    at OrganizationSdkServiceInternal.ExecuteRequest(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType)
    at OrganizationSdkServiceInternal.Execute(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType)
    at
    at SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
    at DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
    at ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)
    at ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc)
    at MessageRpc.Process(Boolean isOperationContextSet)
    at ChannelHandler.DispatchAndReleasePump(RequestContext request, Boolean cleanThread, OperationContext currentOperationContext)
    at ChannelHandler.HandleRequest(RequestContext request, OperationContext currentOperationContext)
    at ChannelHandler.AsyncMessagePump(IAsyncResult result)
    at AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)
    at AsyncResult.Complete(Boolean completedSynchronously)
    at ReceiveItemAndVerifySecurityAsyncResult`2.InnerTryReceiveCompletedCallback(IAsyncResult result)
    at AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)
    at AsyncResult.Complete(Boolean completedSynchronously)
    at AsyncQueueReader.Set(Item item)
    at InputQueue`1.Dispatch()
    at ScheduledOverlapped.IOCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
    at IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped)
    at _IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
    >Crm Exception: Message: An unexpected error occurred., ErrorCode: -2147220970, InnerException: System.InvalidCastException: Specified cast is not valid.
    at Microsoft.Crm.BusinessEntities.SecurityLibrary.AccessCheckInternal(ExecutionContext context, SecurityPrincipal principal, String values, Int32 objectTypeCode, AccessRights rights)
    at Microsoft.Crm.BusinessEntities.SecurityLibrary.MultipleEntityAccessCheck(ExecutionContext context, Int32 objectTypeCode, AccessRights rights, String values)
    at Microsoft.Crm.ObjectModel.ListMemberSecurityExtension.VerifyListMemberAppendAccess(Int32 memberType, ExecutionContext context, Guid user, String values)
    at Microsoft.Crm.ObjectModel.ListService.CreateXmlAndAddUsingSproc(Guid listId, Int32 memberType, String resultXml, ExecutionContext context)
    at Microsoft.Crm.ObjectModel.ListService.AddListMembers(Guid listId, Guid[] memberIds, ExecutionContext context)

    Thanks for your help.




    • Edited by STagliaro Saturday, June 30, 2012 4:23 PM
    Friday, June 29, 2012 5:22 PM

Answers

  • I figured out by myself what the problem was, on my machine I had the TurnOffFetchThrottling enabled, when I removed from the registry all worked fine as expected.

    Saturday, June 30, 2012 4:30 PM