I registered one plugin assembly with two plugins written targeted to contact entity and registered in one of Dynamics CRM 2015 Online instances. It worked properly after adding steps into it. Here I am discussing the issue raised, an observation was done and the solution to the issue. But this only on a scenario for this issue to be raised and there can be many other scenarios to see this same issue.
Issue: After some time I wanted to add few more plug-ins to the same assembly, targeting some custom entity events and I updated the same registered plugin assembly with the newly build assembly. However, after adding steps to the relevant plugins and after triggering relevant events I got some errors from all the plugins I newly added. I checked the very first plugin events I registered in the same assembly and those functioned perfectly.
Error Message: All the errors showed the same error message “The plug-in type could not be found in the plug-in assembly:” in them.
Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: System.ArgumentNullException: Value cannot be null. Parameter name: TrackingId: 87e5f936-7499-4bc1-b649-f78fd4739016, Depth: 1, Message: SandboxAppDomainHelper.Execute: The plug-in type could not be found in the plug-in assembly: CrmFortress.Extensions.Plu gins.LicencePluginDetail: <OrganizationServiceFault xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts"> <ErrorCode>-2147220970</ErrorCode> <ErrorDetails xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" /> <Message>System.ArgumentNullException: Value cannot be null. Parameter name: TrackingId: 87e5f936-7499-4bc1-b649-f78fd4739016, Depth: 1, Message: SandboxAppDomainHelper.Execute: The plug-in type could not be found in the plug-in assembly: CrmFortress.Extensions.Plugins.LicencePlugin</Message> <Timestamp>2016-06-21T00:23:18.5217957Z</Timestamp> <InnerFault i:nil="true" /> <TraceText i:nil="true" /> </OrganizationServiceFault>
Observation: Although the new plugins didn’t function, previous plugins in the same assembly worked properly even after updating the assembly. It seems although we registered\update the new assembly, still Dynamics CRM refers to the old assembly.
Mistake: When I was building the plugin project I didn’t update the version of the assembly and I registered\updated the assembly with the same version before.
Solution: I had to change the version of the plugin assembly and registere\update it back in Dynamics CRM to solve the issue and it functioned as expected after that. It’s always a good practice to change the version of Plugin and Workflow assemblies and register whenever we change them.
A workaround in On-Premise: If I faced the problem in on-premise version, I could restart the MSCRM Asynchronous service and Dynamics CRM will pick the correct assembly registered.