I have had an issue for a while with one of our CRM 4.0 Orgs (that was originally upgraded from CRM 3.0) and now recently had the same problem on a CRM 2011 Org (that was upgraded from CRM 4.0) where I received an InternalOperation error on a native CRM Plugin assembly when trying to add a new user.
I have seen various forum posts around this problem, unfortunately with no solutions.
My team and I spent quite a bit of time investigating this and finally found the solution to the problem (although unfortunately still don’t have the root cause bedded down, that will be the subject of a future post).
The major credit though, needs to go to my Development Manager, Sean Vowles (@seanvowles) who came up with the simple solution.
The Error message goes a little something like this :
The Web Service plug-in failed in OrganizationId: ed3212c2-fbb4-df11-8578-a6a06cd1068d; SdkMessageProcessingStepId: 5acabb1b-ea3e-db11-86a7-000a3a5473e8; EntityName: systemuser; Stage: 30; MessageName: Create; AssemblyName: Microsoft.Crm.Extensibility.InternalOperationPlugin, Microsoft.Crm.ObjectModel, Version=184.108.40.206, 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._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture, Boolean skipVisibilityChecks)
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.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
at Microsoft.Crm.ObjectModel.UserSettingsServiceInternal`1.PopulateOrgDefaults(IBusinessEntity entity, ExecutionContext context)
at Microsoft.Crm.ObjectModel.UserSettingsServiceInternal`1.Create(IBusinessEntity usersettings, ExecutionContext context)
at Microsoft.Crm.ObjectModel.SystemUserServiceInternal`1.CreateDefaultUserSettings(Guid userId, Guid businessId, ExecutionContext context)
at Microsoft.Crm.ObjectModel.SystemUserServiceInternal`1.CreateInternal(Guid organizationId, IBusinessEntity systemuser, ExecutionContext context)
at Microsoft.Crm.ObjectModel.SystemUserServiceInternal`1.Create(IBusinessEntity systemuser, ExecutionContext context)
It turns out that there are some default values that the platform tries to populate when creating a new user and some of these values are missing.
To fix the problem you need to change the Region Formatting settings in CRM to something different and then change them back. This process fixes the missing default values and resolves the problem.
To change the settings, navigate to Settings –> Administration –> System Settings and then to the Formats tab.
Then change the Region Settings to Something different, click Ok, then Rinse and Repeat.
Presto… You should now be able to add a new user.