【发布时间】:2013-12-31 05:42:00
【问题描述】:
我们正在尝试将 CRM 2011 从 RU 11 更新到 RU 14,以便能够在 RU 14 准备就绪时安装 RU 15。一直在修复与此更新有关的各种问题,因为 Microsoft 由于跨平台而进行了相当多的更改,并且显然是从 11 迁移到 14。
现在,我的主要问题是我有一个在创建服务预约时同步运行的插件。它负责做几件事,比如比较值或使用来自其他实体的值来填充服务活动记录中的数据。关于奇怪的错误是什么,由于正在对 Post Operations 进行更改,因此必须执行 _service.Update(entity) 才能在表单和数据库中看到更改。如果我一步一步调试代码,一切都会顺利进行,除非代码到达.Update。当调用更新时,CRM 会引发意外错误。当我转到 TraceLogs 时,我发现:
[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=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.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)
_______________
我做了不同的更改,试图找出问题所在,其中包括关闭除 Microsoft 和这个之外的所有已注册插件。关闭表单中的所有 JavaScript,以防任何值被更改而导致错误,硬编码状态代码和状态代码,因为在网上发现了一些相关问题,评论了插件中的所有代码,只留下了 _service。更新(实体)以防传递了无效值但更新仍会引发错误,以及我在网上找到的其他似乎是解决方案的东西。我已经犯了这个错误一段时间了,希望有更多的人跟我一起思考这个问题。由于与插件相关的逻辑,该插件必须在 Post Operation 中同步运行。
感谢您提供任何帮助,如果您需要更多信息以了解可能发生的情况,请告诉我。
【问题讨论】:
-
如果您有插件解决方案的备份,我建议您将其全部删除,然后重新导入(最好通过插件注册工具)。
-
我去注销了给出错误的插件,并在 Post Operation 的 Create 步骤中再次注册了它。但是,仍然是同样的错误,当调用 .update 时,它会因发生意外错误而爆炸。你认为在我禁用所有其他插件之后取消注册所有这些都是值得的吗?它可以作为修复工作吗?
-
您可能被锁定在阻止您更新记录的事务中。作为测试,如果您将插件注册为 Async,它可以工作吗?
-
当我做插件异步它运行。最初的问题是,当我在 Async 中逐步执行插件时,.Update 仍然会引发错误,但更新仍然会发生。异步中的 .Update 会抛出一个错误,指出 1 不是 Service Activity.Scheduled 的有效状态原因。这有点难以理解,因为我没有改变任何插件或 JS 中的状态或状态。我删除此错误的方法是删除状态代码和状态原因的属性,然后不会出现问题。
-
问题是,某些插件逻辑要求它运行同步,因为在 RU 11 中插件运行没有任何问题。这就是为什么我不能在异步中运行它,即使它“有效”。
标签: dynamics-crm-2011 dynamics-crm crm dynamics-crm-4 dynamics-crm-online