CrmException:给定的键不存在于字典中.当打开一个现有的机会
本文关键字:一个 机会 字典 不存在 CrmException 于字典 | 更新日期: 2023-09-27 18:16:47
正如标题所说,当试图打开一个现有的机会时,我们现在得到一个"CrmException: the given key was not present in the dictionary."错误。
这似乎只影响一些记录,因为我们仍然可以打开其他记录。我的直觉反应是,其中一个picklist值不知何故从系统中删除了,但没有办法告诉当前。
我想我的问题是,我如何把这个通用的错误信息变成有用的东西来修复错误?
这是CRM跟踪日志中的堆栈跟踪
[2011-12-05 17:00:33.848] Process: w3wp |Organization:00000000-0000-0000-0000-000000000000 |Thread: 26 |Category: Platform |User: 00000000-0000-0000-0000-000000000000 |Level: Error | ExceptionConverter.ConvertMessageAndErrorCode
at ExceptionConverter.ConvertMessageAndErrorCode(Exception exception, Int32& errorCode)
at ExceptionConverter.ToSingleFaultOther(Exception exception)
at ExceptionConverter.ToSingleFaultUntyped(Exception exception)
at ExceptionConverter.ConvertToFault(Exception exception)
at ExceptionConverter.TryConvertToFaultExceptionInternal(Exception exception, Boolean createNewFaultException, FaultException`1& faultException)
at FaultHelper.ConvertToFault(Exception exception)
at ErrorInformation..ctor(Exception exception, Uri requestUrl, Boolean logError)
at MainApplication.Application_Error(Object sender, EventArgs eventArguments)
at EventHandler.Invoke(Object sender, EventArgs e)
at HttpApplication.RaiseOnError()
at ApplicationStepManager.ResumeSteps(Exception error)
at HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)
at HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)
at ISAPIRuntime.ProcessRequest(IntPtr ecb, Int32 iWRType)
>System.Web.HttpUnhandledException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #B89073F3: System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> Microsoft.Crm.CrmException: The given key was not present in the dictionary.
> at Microsoft.Crm.Application.Platform.ServiceCommands.PlatformCommand.XrmExecuteInternal()
在Microsoft.Crm.Application.Platform.ServiceCommands.RetrieveCommand.Execute ()在Microsoft.Crm.Application.Platform.EntityProxy。检索(String[] columns, Guid auditingTransactionId)在Microsoft.Crm.Application.Platform.EntityProxy。检索(String columnSet, Guid auditingTransactionId)在Microsoft.Crm.Application.Platform.EntityProxy。检索(字符串columnSet)在Microsoft.Crm.Application.Forms.AppForm.FormLoadEvent ()在Microsoft.Crm.Application.Forms.AppForm。RaiseDataEvent (FormEventId eventId)在Microsoft.Crm.Application.Forms.EndUserForm。初始化实体(实体)在Microsoft.Crm.Application.Forms.CustomizableForm。执行(实体实体,FormDescriptor fd)在Microsoft.Crm.Application.Components.PageHandlers.OpportunityRecordPageHandler.ConfigureFormHandler ()在Microsoft.Crm.Application.Components.Utility.GenericEventProcessor。eventName RaiseEvent(字符串)在Microsoft.Crm.Application.Controls.PageManager。OnPreRender (EventArgs e)在System.Web.UI.Control.PreRenderRecursiveInternal ()在System.Web.UI.Page。ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)在System.Web.UI.Page。HandleError(异常e)在System.Web.UI.Page。ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)在System.Web.UI.Page。ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)在System.Web.UI.Page.ProcessRequest ()在System.Web.UI.Page。ProcessRequest (HttpContext上下文)在System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute ()在System.Web.HttpApplication。ExecuteStep(IExecutionStep step, Boolean&completedSynchronously)
是的,如果你在插件启用时得到这个异常,而不是在插件被禁用时,那么你的插件正在抛出一个异常,这将被传递到你所看到的错误消息
这很可能发生,因为你在你的动态实体中使用的属性实际上不是在你运行插件的记录中(在这种情况下是机会)。检查拼写错误或未发布的自定义内容。
有关如何防止此类错误的更多信息,请参阅此链接:http://splatto.net/portfolio/blog/post/2010/07/30/0x80040265-The-given-key-was-not-present-in-the-dictionary.aspx
另一个测试导致此异常的原因的好方法是在插件上运行远程调试,看看是什么引发了异常:http://msdn.microsoft.com/en-us/library/cc151088.aspx