title: The given key was not present in the dictionary
body: <p>I am trying to make a simple plugin for MS Dynamics CRM 4.0 where send data of a salesorder in a SOAP message on the update of the order.
  The strange thing is that I get this error every other time i try to save /(execute the plugin).
  So when I update (any field) of a salesorder and then save I get the error:</p>
  
  <blockquote>
  <pre><code>The given key was not present in the dictionary.
  </code></pre>
  </blockquote>
  
  <p>When I save again right away after that(without even changing anything in between the two saves) it executes correctly and gives me all data I want. It is really every time the same thing: first save: error, second save: execute correctly.</p>
  
  <p>Any ideas what this could be?</p>
  
  <p>This is the first part of my code; where it actually gets the dataset of the salesorder in this case:</p>
  
  <pre><code>   public class CompleteOrderPlugin : IPlugin
  
  
      {      
  
  
          public void Execute(IPluginExecutionContext context)
          {
  
  
  
  
                  DynamicEntity entity = null;
                  if (context.InputParameters.Properties.Contains(ParameterName.Target) &amp;&amp;
                          context.InputParameters.Properties[ParameterName.Target] is DynamicEntity)
                  {
  
                      entity = (DynamicEntity)context.InputParameters[ParameterName.Target];
                      if (entity.Name != EntityName.salesorder.ToString()) { return; }
  
                  }
                  else
                  {
  
                      return;
                  }
  </code></pre>
  
  <p>The rest is where I use values from attributes to fill my own variables.</p>