Search code examples
c#pluginsdynamics-crmmicrosoft-dynamics

Error Registering Dynamics CRM Plugin


I have a plugin project built in C# that contains all of my plugins for Microsoft Dynamics CRM. The existing plugins are working correctly and appear to be updating correctly. However, when I attempt to register a new plugin, I am getting the below error.

The event I'm trying to register is on an entity that already has a Create & Update event attached. I've seen some other questions about the Unable to load plugin type error, but none of them seem to indicate a specific plugin that can't be loaded. What am I missing here for registering a new plugin?

Step Registration Settings

Plugin Registration Settings

Existing Registered Steps

enter image description here

Error

Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: Unable to load the plugin type: CCSEQ.Plugins.OpportunityPlugins
Detail: <OrganizationServiceFault xmlns="http://schemas.microsoft.com/xrm/2011/Contracts" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
  <ActivityId>f9958fce-2da6-44ce-855e-532e4e8deeac</ActivityId>
  <ErrorCode>-2147204720</ErrorCode>
  <ErrorDetails xmlns:a="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
  <Message>Unable to load the plugin type: CCSEQ.Plugins.OpportunityPlugins</Message>
  <Timestamp>2018-06-06T20:31:33.3462414Z</Timestamp>
  <ExceptionRetriable>false</ExceptionRetriable>
  <ExceptionSource i:nil="true" />
  <InnerFault>
    <ActivityId>f9958fce-2da6-44ce-855e-532e4e8deeac</ActivityId>
    <ErrorCode>-2147204720</ErrorCode>
    <ErrorDetails xmlns:a="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
    <Message>Unable to load the plugin type: CCSEQ.Plugins.OpportunityPlugins</Message>
    <Timestamp>2018-06-06T20:31:33.3462414Z</Timestamp>
    <ExceptionRetriable>false</ExceptionRetriable>
    <ExceptionSource i:nil="true" />
    <InnerFault>
      <ActivityId>f9958fce-2da6-44ce-855e-532e4e8deeac</ActivityId>
      <ErrorCode>-2147220970</ErrorCode>
      <ErrorDetails xmlns:a="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
      <Message>System.IO.FileLoadException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #0DE0CBC1</Message>
      <Timestamp>2018-06-06T20:31:33.3462414Z</Timestamp>
      <ExceptionRetriable>false</ExceptionRetriable>
      <ExceptionSource i:nil="true" />
      <InnerFault i:nil="true" />
      <OriginalException i:nil="true" />
      <TraceText i:nil="true" />
    </InnerFault>
    <OriginalException i:nil="true" />
    <TraceText i:nil="true" />
  </InnerFault>
  <OriginalException i:nil="true" />
  <TraceText i:nil="true" />
</OrganizationServiceFault>

Server stack trace: 
   at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]: 
   at Microsoft.Crm.Tools.Libraries.RegistrationHelper.RegisterStep(CrmOrganization org, CrmPluginStep step)
   at Microsoft.Crm.Tools.PluginRegistration.StepRegistrationViewModel.btnRegister_Click(Object sender, EventArgs e)

Update 1

Based on Arun's input, I changed the namespace & dll build name for my C# project and rebuilt the project. I did this so I wouldn't have to unregister my existing plugins and rebuild them from the ground up. I registered this new assembly using the plugin registration tool. When I tried to register a new step, I receive the same error as before. This occurs for all registered Plugins. The example below is one I tried with Activities (specifically appointments), although I also tried this for Opportunities

Step Registration Settings

Appointment Registration Settings

Error Message

Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: Unable to load the plugin type: COHEN.Plugins.ActivityPlugins
Detail: <OrganizationServiceFault xmlns="http://schemas.microsoft.com/xrm/2011/Contracts" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
  <ActivityId>1bf82d05-04d0-4bd0-a3db-87c480cc3c6e</ActivityId>
  <ErrorCode>-2147204720</ErrorCode>
  <ErrorDetails xmlns:a="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
  <Message>Unable to load the plugin type: COHEN.Plugins.ActivityPlugins</Message>
  <Timestamp>2018-06-07T13:57:24.8030045Z</Timestamp>
  <ExceptionRetriable>false</ExceptionRetriable>
  <ExceptionSource i:nil="true" />
  <InnerFault>
    <ActivityId>1bf82d05-04d0-4bd0-a3db-87c480cc3c6e</ActivityId>
    <ErrorCode>-2147204720</ErrorCode>
    <ErrorDetails xmlns:a="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
    <Message>Unable to load the plugin type: COHEN.Plugins.ActivityPlugins</Message>
    <Timestamp>2018-06-07T13:57:24.8030045Z</Timestamp>
    <ExceptionRetriable>false</ExceptionRetriable>
    <ExceptionSource i:nil="true" />
    <InnerFault>
      <ActivityId>1bf82d05-04d0-4bd0-a3db-87c480cc3c6e</ActivityId>
      <ErrorCode>-2147220970</ErrorCode>
      <ErrorDetails xmlns:a="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
      <Message>System.IO.FileLoadException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #FB840294</Message>
      <Timestamp>2018-06-07T13:57:24.8030045Z</Timestamp>
      <ExceptionRetriable>false</ExceptionRetriable>
      <ExceptionSource i:nil="true" />
      <InnerFault i:nil="true" />
      <OriginalException i:nil="true" />
      <TraceText i:nil="true" />
    </InnerFault>
    <OriginalException i:nil="true" />
    <TraceText i:nil="true" />
  </InnerFault>
  <OriginalException i:nil="true" />
  <TraceText i:nil="true" />
</OrganizationServiceFault>

Server stack trace: 
   at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]: 
   at Microsoft.Crm.Tools.Libraries.RegistrationHelper.RegisterStep(CrmOrganization org, CrmPluginStep step)
   at Microsoft.Crm.Tools.PluginRegistration.StepRegistrationViewModel.btnRegister_Click(Object sender, EventArgs e)

Update 2

I noticed that we have a post-build step that runs the command:

mkdir $(TargetDir)merged $(SolutionDir)packages\ILMerge.2.14.1208\tools\ilmerge.exe /out:$(TargetDir)merged\CCSEQ.Plugins.dll /keyfile:$(ProjectDir)customdevelopment.snk $(TargetDir)CCSEQ.Plugins.dll $(TargetDir)Microsoft.SharePoint.Client.dll $(TargetDir)Microsoft.SharePoint.Client.Runtime.dll

This appears to create a new directory in our output folder called merged which contains a version of the dll. I have tried updating the assembly with this version of the dll, but it errors the same way. I have tried doing this with both the debug & release versions of our build.

One other thing I tried is I imported the dll as a reference into my project to try to look at the classes/functions provided by the dll. It appears that there aren't any classes/functions in the dll, but I'm not sure if that means anything or not as I'm not that familiar with dlls.

Library Classes


Solution

  • We discovered that version 9.0.2.3 of the Microsoft.CrmSdk.CoreAssemblies was not compatible with our plugins. We aren't yet sure why this didn't work, but rolling back to version 8.2.0.2 resolved the issue.