Reputation: 21
I wrote a plugin to update some data on a salesorder, right after the user has updated the record itself. Based on whether certain dates were changed, I want to update another field with a formatted date.
I ran across the error "The given key was not present in the dictionary" so I added a few traces to see where it exactly returned the error. I then discovered that the trace never wrote out, so I assumed the code I wrote never gets executed. This is indeed the case because if I just do
public class SalesOrderPlugin : IPlugin
{
public void Execute(IServiceProvider serviceProvider)
{
}
}
I get the same error:
Unhandled Exception: System.ServiceModel.FaultException`1
[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]:
Unexpected exception from plug-in (Execute): Iu.PreConsultants.Crm.SalesOrderPlugin:
System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.Detail:
<OrganizationServiceFault xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts">
<ErrorCode>-2147220956</ErrorCode>
<ErrorDetails xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
<Message>Unexpected exception from plug-in (Execute): Iu.PreConsultants.Crm.SalesOrderPlugin: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.</Message>
<Timestamp>2012-02-21T07:09:48.471378Z</Timestamp>
<InnerFault i:nil="true" />
<TraceText>
[Iu.PreConsultants.Crm: Iu.PreConsultants.Crm.SalesOrderPlugin]
[1486b5df-595c-e111-b7b0-46c950e6c8cd: Iu.PreConsultants.Crm.SalesOrderPlugin: Update of salesorder]
</TraceText>
</OrganizationServiceFault>
The settings for the plugin:
On a hosted setup (sandboxed)
SalesOrder has been altered and has some custom attributes.
Any help on this would be greatly appreciated!
Kind regards,
Vincent
Upvotes: 1
Views: 4110
Reputation: 21
Ok it works now. It seems like glosrob was right and there was a cached version kept by CRM. I tried to use "Update" on the IPlugin implementations on the registrationtool from the SDK but that wasn't sufficient. I had to Update the Assembly first, and after that, the IPlugin implementations also got updated.
Upvotes: 1