Post Updating of ServiceAppointment entity giving strange error RRS feed

  • Question

  • Hello there,

    We're trying to update CRM 2011 from RU 11 to RU 14 to be able to install RU 15 when RU 14 is all ready to go. Been fixing various issues concerning this update since Microsoft did quite some changes due to the Cross Platform and obviously since were moving from the 11 to the 14. 

    Now, my main issue is that I have a plugin that's running synchronously on the create of a service appointment. It's in charge of doing several things, like comparing values or using values from other entities to populate data in the Service Activity record. Regarding what the strange error is, since changes are being done on a Post Operations, a _service.Update(entity) has to be done in order for changes to be seen in the form and database. If I debug the code step by step everything passes smoothly except when the code reaches the .Update. When the update is called CRM throws an Unexpected Error Occured. When I go to the TraceLogs this is what I find:


    [2013-12-10 14:49:56.323] Process: w3wp |Organization:3e484d20-6245-e311-8a60-00155d6f6b34 |Thread:   20 |Category: Platform.Sdk |User: 0a51b463-df74-e011-81b3-00155d7a7a17 |Level: Error |ReqId: dca72532-8bed-491c-9295-62211d39a6f6 | VersionedPluginProxyStepBase.Execute  ilOffset = 0x65
    at VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)  ilOffset = 0x65
    at Pipeline.Execute(PipelineExecutionContext context)  ilOffset = 0x65
    at MessageProcessor.Execute(PipelineExecutionContext context)  ilOffset = 0x1C5
    at InternalMessageDispatcher.Execute(PipelineExecutionContext context)  ilOffset = 0xE4
    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)  ilOffset = 0x156
    at OrganizationSdkServiceInternal.ExecuteRequest(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType, UserAuth userAuth, Guid targetUserId, Boolean traceRequest, OrganizationContext context, Boolean returnResponse)  ilOffset = 0x145
    at OrganizationSdkServiceInternal.ExecuteRequest(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType)  ilOffset = 0x34
    at OrganizationSdkServiceInternal.Execute(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType)  ilOffset = 0x24
    at InprocessServiceProxy.ExecuteCore(OrganizationRequest request)  ilOffset = 0x34
    at SandboxSdkListener.Execute(SandboxCallInfo callInfo, SandboxSdkContext requestContext, String operation, Byte[] serializedRequest)  ilOffset = 0xAC
    at   ilOffset = 0xFFFFFFFF
    at SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)  ilOffset = 0x241
    at DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)  ilOffset = 0x100
    at ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)  ilOffset = 0x48
    at ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc)  ilOffset = 0xC6
    at MessageRpc.Process(Boolean isOperationContextSet)  ilOffset = 0x62
    at ChannelHandler.DispatchAndReleasePump(RequestContext request, Boolean cleanThread, OperationContext currentOperationContext)  ilOffset = 0x256
    at ChannelHandler.HandleRequest(RequestContext request, OperationContext currentOperationContext)  ilOffset = 0xF1
    at ChannelHandler.AsyncMessagePump(IAsyncResult result)  ilOffset = 0x39
    at AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)  ilOffset = 0x0
    at AsyncResult.Complete(Boolean completedSynchronously)  ilOffset = 0xC2
    at TryReceiveAsyncResult.OnReceive(IAsyncResult result)  ilOffset = 0x4B
    at AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)  ilOffset = 0x0
    at AsyncResult.Complete(Boolean completedSynchronously)  ilOffset = 0xC2
    at ReceiveAsyncResult.OnReceiveComplete(Object state)  ilOffset = 0x2B
    at SessionConnectionReader.OnAsyncReadComplete(Object state)  ilOffset = 0xBC
    at AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)  ilOffset = 0x0
    at LazyAsyncResult.Complete(IntPtr userToken)  ilOffset = 0x3E
    at NegotiateStream.ProcessFrameBody(Int32 readBytes, Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)  ilOffset = 0x70
    at NegotiateStream.ReadCallback(AsyncProtocolRequest asyncRequest)  ilOffset = 0x68
    at FixedSizeReader.CheckCompletionBeforeNextRead(Int32 bytes)  ilOffset = 0x5D
    at FixedSizeReader.ReadCallback(IAsyncResult transportResult)  ilOffset = 0x29
    at AsyncResult.Complete(Boolean completedSynchronously)  ilOffset = 0xC2
    at IOAsyncResult.OnAsyncIOComplete(Object state)  ilOffset = 0x26
    at SocketConnection.OnReceiveAsync(Object sender, SocketAsyncEventArgs eventArgs)  ilOffset = 0x57
    at SocketAsyncEventArgs.FinishOperationSuccess(SocketError socketError, Int32 bytesTransferred, SocketFlags flags)  ilOffset = 0x5CB
    at SocketAsyncEventArgs.CompletionPortCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)  ilOffset = 0x10
    at _IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)  ilOffset = 0x3C
    >Web Service Plug-in failed in SdkMessageProcessingStepId: {B9CDBB1B-EA3E-DB11-86A7-000A3A5473E8}; EntityName: serviceappointment; Stage: 30; MessageName: Update; AssemblyName: Microsoft.Crm.Extensibility.InternalOperationPlugin, Microsoft.Crm.ObjectModel, Version=, 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.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
    at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
    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.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
    Parameter name: index
    at System.Collections.CollectionBase.System.Collections.IList.get_Item(Int32 index)
    at Microsoft.Crm.BusinessEntities.BusinessEntityCollection.get_Item(Int32 index)
    at Microsoft.Crm.ObjectModel.CommunicationActivityServiceBase.UpdateCommunicationPartiesInternal(BusinessEntityMoniker moniker, CommunicationActivity activity, ExecutionContext context, ExtensionEventArgs e)
    at Microsoft.Crm.ObjectModel.CommunicationActivityServiceBase.UpdateCommunicationParties(Object sender, ExtensionEventArgs e)
    at Microsoft.Crm.BusinessEntities.BusinessProcessObject.PostUpdateEventHandler.Invoke(Object sender, ExtensionEventArgs e)
    at Microsoft.Crm.ObjectModel.GenericActivityServiceBase.UpdateInternal(IBusinessEntity entityInterface, ExecutionContext context)
    at Microsoft.Crm.ObjectModel.CommunicationActivityServiceBase.Update(IBusinessEntity entityInterface, ExecutionContext context)


    I've done different changes trying to figure out what the problem would be, among them, turning off all registered plugins other than Microsoft ones and this one. Turned off all JavaScript in the form in case any values are being changed that are making it throw the error, hard coded State Code and Status Code because of some related issues found online, commented ALL the code in the plugin and only left the _service.Update(entity) in case an invalid value was being passed but update would still throw error, and other things I found online that seemed like a solution. I've been going on this error for some time now and would like to have some more minds thinking this out with me. The plugin has to be run Synchronously and in the Post Operation because of logic tied to the plugin.

    Any help is appreciated and if you need any more information to understand what could be going on please let me know. 

    Tuesday, December 10, 2013 9:54 PM

All replies

  • Hope after executing the CRM Rollups, you have applied the update to the Organization as shown below

    On CRM Server, open Deployment Manager and update the CRM Organization with any available updates

    Give a try again after applying updates to the Organization.

    Hope it helps.

    Ajay Chawla

    Wednesday, December 11, 2013 5:40 AM
  • Yeah, that wouldn't be the problem though. I had already done that for my organization. In any case the Update option doesn't appear when I do a right click on the organization. Thanks for the idea. Any other? :D
    • Edited by Tito710 Wednesday, December 11, 2013 9:36 PM
    Wednesday, December 11, 2013 6:01 PM
  • would you not be creating a loop situation if you updated in a postupdate message?
    Wednesday, December 11, 2013 10:15 PM
  • I'm running a Update on Create message done post operation. Sorry if Title is a bit confusing but I'm not using the update message for anything right now. When the a new Service Actvity record is created I run a plugin that will run post operation on the Create message and then call an update on the ContextEntity because if not changes won't be saved. 

    Sorry If I'm repeating myself, i just want to be as clear as possible. 

    Thursday, December 12, 2013 12:54 AM