2
votes

I am trying to deploy a plugin to an on-premise Dynamics CRM 2011. The plugin does not do anything, it is simply an empty Execute method attached on the Post-Process event of the Account entity.

My plugin looks like this:

namespace CrmDemo.Plugins
{
    public class PostAccountCreateDetail: IPlugin
    {
        public void Execute(IServiceProvider serviceProvider)
        {
        }
    }
}

The plugin registers fine; here is what the registration screen looks like: plugin registration

When I create a new account, I receive the following error:

Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: System.ArgumentNullException: Value cannot be null.
Parameter name: The plug-in type could not be found in the plug-in assembly: CrmDemo.Plugins.PostAccountCreateDetailDetail: 
<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: The plug-in type could not be found in the plug-in assembly: CrmDemo.Plugins.PostAccountCreateDetail</Message>
    <Timestamp>2014-08-14T15:29:09.9661308Z</Timestamp>
    <InnerFault i:nil="true" />
    <TraceText>

    [CrmDemo.Plugins: CrmDemo.Plugins.PostAccountCreateDetail]
    [3e3c27ae-c723-e411-bdf4-00155d1e0a3f: CrmDemo.Plugins.PostAccountCreateDetail: Create of account]


    </TraceText>
</OrganizationServiceFault>

Here is the error log:

[2014-08-14 14:11:31.100] Process: w3wp |Organization:d39e4ccc-fc01-4c27-824d-9106d1ec082e |Thread:   22 |Category: Exception |User: 6abf3aac-971d-e411-aded-00155d1e0a3f |Level: Error |ReqId: 5c0dd2c9-f20d-4ebb-b9ff-3b8698a15c4d | CrmException..ctor  ilOffset = 0x7
    at CrmException..ctor(String message, Exception innerException, Int32 errorCode, Boolean isFlowControlException)  ilOffset = 0x7
    at CrmException..ctor(String message, Exception innerException, Int32 errorCode)  ilOffset = 0x5
    at ExceptionConverter.TryConvertToCrmExceptionInternal(Exception exception, CrmException& crmException)  ilOffset = 0x81
    at ExceptionConverter.TryConvertToCrmException(Exception exception, CrmException& crmException)  ilOffset = 0xAE
    at SandboxCodeUnit.Execute(IExecutionContext context)  ilOffset = 0x116
    at V5PluginProxyStep.ExecuteInternal(PipelineExecutionContext context)  ilOffset = 0xE5
    at VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)  ilOffset = 0x65
    at Pipeline.Execute(PipelineExecutionContext context)  ilOffset = 0x65
    at MessageProcessor.Execute(PipelineExecutionContext context)  ilOffset = 0x1FB
    at InternalMessageDispatcher.Execute(PipelineExecutionContext context)  ilOffset = 0xE4
    at ExtensiblePlatformMessageDispatcher.Execute(PipelineExecutionContext pluginContext)  ilOffset = 0x0
    at ExtensiblePlatformMessageDispatcher.CreateWithInvocationSource(BusinessEntity entity, Int32 invocationSource, ExecutionContext context)  ilOffset = 0xB4
    at BusinessProcessObject.Create(IBusinessEntity entity, ExecutionContext context)  ilOffset = 0x4E
    at AccountService.Create(IBusinessEntity entity, ExecutionContext context)  ilOffset = 0xB
    at RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)  ilOffset = 0xFFFFFFFF
    at RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)  ilOffset = 0x25
    at RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)  ilOffset = 0x89
    at LogicalMethodInfo.Invoke(Object target, Object[] values)  ilOffset = 0x4F
    at InternalOperationPlugin.Execute(IServiceProvider serviceProvider)  ilOffset = 0x57
    at V5PluginProxyStep.ExecuteInternal(PipelineExecutionContext context)  ilOffset = 0x50
    at VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)  ilOffset = 0x65
    at Pipeline.Execute(PipelineExecutionContext context)  ilOffset = 0x65
    at MessageProcessor.Execute(PipelineExecutionContext context)  ilOffset = 0x1C5
    at InternalMessageDispatcher.Execute(PipelineExecutionContext context)  ilOffset = 0xE4
    at ExternalMessageDispatcher.ExecuteInternal(IInProcessOrganizationServiceFactory serviceFactory, IPlatformMessageDispatcherFactory dispatcherFactory, String messageName, String requestName, Int32 primaryObjectTypeCode, Int32 secondaryObjectTypeCode, ParameterCollection fields, CorrelationToken correlationToken, CallerOriginToken originToken, UserAuth userAuth, Guid callerId, Guid transactionContextId, Int32 invocationSource, Nullable`1 requestId, Version endpointVersion)  ilOffset = 0x156
    at OrganizationSdkServiceInternal.ExecuteRequest(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType, UserAuth userAuth, Guid targetUserId, Boolean traceRequest, OrganizationContext context, Boolean returnResponse)  ilOffset = 0x145
    at OrganizationSdkServiceInternal.ExecuteRequest(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType)  ilOffset = 0x3D
    at OrganizationSdkServiceInternal.Execute(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType)  ilOffset = 0x24
    at InprocessServiceProxy.ExecuteCore(OrganizationRequest request)  ilOffset = 0x34
    at PlatformCommand.XrmExecuteInternal()  ilOffset = 0xF6
    at CreateCommand.Execute()  ilOffset = 0xC
    at EntityProxy.Create(Boolean performDuplicateCheck, Guid auditingTransactionId)  ilOffset = 0x0
    at EntityProxy.Create(Boolean performDuplicateCheck)  ilOffset = 0x7
    at AppForm.SaveEntity(EntityProxy entity, FormEventId eventType, String redirectPath, Boolean performDuplicateCheck)  ilOffset = 0x28
    at AppForm.FormSaveAndCloseEvent()  ilOffset = 0x18
    at AppForm.RaiseDataEvent(FormEventId eventId)  ilOffset = 0xD7
    at EndUserForm.Initialize(Entity entity)  ilOffset = 0x1F
    at CustomizableForm.Execute(Entity entity, FormDescriptor fd)  ilOffset = 0x62
    at AccountRecordPageHandler.ConfigureFormHandler()  ilOffset = 0x56
    at RecordPageHandler.ConfigureFormWrapper()  ilOffset = 0xC
    at GenericEventProcessor.RaiseEvent(String eventName)  ilOffset = 0x2D
    at PageManager.OnPreRender(EventArgs e)  ilOffset = 0x47
    at Control.PreRenderRecursiveInternal()  ilOffset = 0x54
    at Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)  ilOffset = 0x6D3
    at Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)  ilOffset = 0x3C
    at Page.ProcessRequest()  ilOffset = 0x14
    at Page.ProcessRequest(HttpContext context)  ilOffset = 0x33
    at CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()  ilOffset = 0x18D
    at HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)  ilOffset = 0x15
    at ApplicationStepManager.ResumeSteps(Exception error)  ilOffset = 0x10A
    at HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)  ilOffset = 0x5C
    at HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)  ilOffset = 0x16A
    at ISAPIRuntime.ProcessRequest(IntPtr ecb, Int32 iWRType)  ilOffset = 0x4B
>Crm Exception: Message: Assembly should be provided, ErrorCode: -2147204719
[2014-08-14 14:11:35.029] Process: w3wp |Organization:00000000-0000-0000-0000-000000000000 |Thread:   22 |Category: Exception |User: 00000000-0000-0000-0000-000000000000 |Level: Error |ReqId: 5c0dd2c9-f20d-4ebb-b9ff-3b8698a15c4d | CrmException..ctor  ilOffset = 0x7
    at CrmException..ctor(String message, Exception innerException, Int32 errorCode, Boolean isFlowControlException)  ilOffset = 0x7
    at CrmException..ctor(String message, Exception innerException, Int32 errorCode)  ilOffset = 0x5
    at ExceptionConverter.TryConvertToCrmExceptionInternal(Exception exception, CrmException& crmException)  ilOffset = 0x81
    at ExceptionConverter.TryConvertToCrmException(Exception exception, CrmException& crmException)  ilOffset = 0xAE
    at SandboxCodeUnit.Execute(IExecutionContext context)  ilOffset = 0x116
    at V5PluginProxyStep.ExecuteInternal(PipelineExecutionContext context)  ilOffset = 0xE5
    at VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)  ilOffset = 0x65
    at Pipeline.Execute(PipelineExecutionContext context)  ilOffset = 0x65
    at MessageProcessor.Execute(PipelineExecutionContext context)  ilOffset = 0x1FB
    at InternalMessageDispatcher.Execute(PipelineExecutionContext context)  ilOffset = 0xE4
    at ExtensiblePlatformMessageDispatcher.Execute(PipelineExecutionContext pluginContext)  ilOffset = 0x0
    at ExtensiblePlatformMessageDispatcher.CreateWithInvocationSource(BusinessEntity entity, Int32 invocationSource, ExecutionContext context)  ilOffset = 0xB4
    at BusinessProcessObject.Create(IBusinessEntity entity, ExecutionContext context)  ilOffset = 0x4E
    at AccountService.Create(IBusinessEntity entity, ExecutionContext context)  ilOffset = 0xB
    at RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)  ilOffset = 0xFFFFFFFF
    at RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)  ilOffset = 0x25
    at RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)  ilOffset = 0x89
    at LogicalMethodInfo.Invoke(Object target, Object[] values)  ilOffset = 0x4F
    at InternalOperationPlugin.Execute(IServiceProvider serviceProvider)  ilOffset = 0x57
    at V5PluginProxyStep.ExecuteInternal(PipelineExecutionContext context)  ilOffset = 0x50
    at VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)  ilOffset = 0x65
    at Pipeline.Execute(PipelineExecutionContext context)  ilOffset = 0x65
    at MessageProcessor.Execute(PipelineExecutionContext context)  ilOffset = 0x1C5
    at InternalMessageDispatcher.Execute(PipelineExecutionContext context)  ilOffset = 0xE4
    at ExternalMessageDispatcher.ExecuteInternal(IInProcessOrganizationServiceFactory serviceFactory, IPlatformMessageDispatcherFactory dispatcherFactory, String messageName, String requestName, Int32 primaryObjectTypeCode, Int32 secondaryObjectTypeCode, ParameterCollection fields, CorrelationToken correlationToken, CallerOriginToken originToken, UserAuth userAuth, Guid callerId, Guid transactionContextId, Int32 invocationSource, Nullable`1 requestId, Version endpointVersion)  ilOffset = 0x156
    at OrganizationSdkServiceInternal.ExecuteRequest(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType, UserAuth userAuth, Guid targetUserId, Boolean traceRequest, OrganizationContext context, Boolean returnResponse)  ilOffset = 0x145
    at OrganizationSdkServiceInternal.ExecuteRequest(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType)  ilOffset = 0x3D
    at OrganizationSdkServiceInternal.Execute(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType)  ilOffset = 0x24
    at InprocessServiceProxy.ExecuteCore(OrganizationRequest request)  ilOffset = 0x34
    at PlatformCommand.XrmExecuteInternal()  ilOffset = 0xF6
    at CreateCommand.Execute()  ilOffset = 0xC
    at EntityProxy.Create(Boolean performDuplicateCheck, Guid auditingTransactionId)  ilOffset = 0x0
    at EntityProxy.Create(Boolean performDuplicateCheck)  ilOffset = 0x7
    at AppForm.SaveEntity(EntityProxy entity, FormEventId eventType, String redirectPath, Boolean performDuplicateCheck)  ilOffset = 0x28
    at AppForm.FormSaveAndCloseEvent()  ilOffset = 0x18
    at AppForm.RaiseDataEvent(FormEventId eventId)  ilOffset = 0xD7
    at EndUserForm.Initialize(Entity entity)  ilOffset = 0x1F
    at CustomizableForm.Execute(Entity entity, FormDescriptor fd)  ilOffset = 0x62
    at AccountRecordPageHandler.ConfigureFormHandler()  ilOffset = 0x56
    at RecordPageHandler.ConfigureFormWrapper()  ilOffset = 0xC
    at GenericEventProcessor.RaiseEvent(String eventName)  ilOffset = 0x2D
    at PageManager.OnPreRender(EventArgs e)  ilOffset = 0x47
    at Control.PreRenderRecursiveInternal()  ilOffset = 0x54
    at Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)  ilOffset = 0x6D3
    at Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)  ilOffset = 0x3C
    at Page.ProcessRequest()  ilOffset = 0x14
    at Page.ProcessRequest(HttpContext context)  ilOffset = 0x33
    at CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()  ilOffset = 0x18D
    at HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)  ilOffset = 0x15
    at ApplicationStepManager.ResumeSteps(Exception error)  ilOffset = 0x10A
    at HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)  ilOffset = 0x5C
    at HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)  ilOffset = 0x16A
    at ISAPIRuntime.ProcessRequest(IntPtr ecb, Int32 iWRType)  ilOffset = 0x4B
>Crm Exception: Message: System.ArgumentNullException: Value cannot be null.
Parameter name: The plug-in type could not be found in the plug-in assembly: CrmDemo.Plugins.PostAccountCreateDetail, ErrorCode: -2147220970
[2014-08-14 14:11:35.031] Process: w3wp |Organization:d39e4ccc-fc01-4c27-824d-9106d1ec082e |Thread:   22 |Category: Sandbox |User: 00000000-0000-0000-0000-000000000000 |Level: Error |ReqId: 5c0dd2c9-f20d-4ebb-b9ff-3b8698a15c4d | SandboxCodeUnit.Execute  ilOffset = 0x116
>Execute: CrmException: CrmDemo.Plugins, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a1e5ef8c26cb80d2; 80040216; System.ArgumentNullException: Value cannot be null.
>Parameter name: The plug-in type could not be found in the plug-in assembly: CrmDemo.Plugins.PostAccountCreateDetail
[2014-08-14 14:11:35.032] Process: w3wp |Organization:d39e4ccc-fc01-4c27-824d-9106d1ec082e |Thread:   22 |Category: Platform |User: 00000000-0000-0000-0000-000000000000 |Level: Error |ReqId: 5c0dd2c9-f20d-4ebb-b9ff-3b8698a15c4d | MessageProcessor.Execute  ilOffset = 0x1FB
>MessageProcessor fail to process message 'Create' for 'account'.
[2014-08-14 14:11:35.034] Process: w3wp |Organization:d39e4ccc-fc01-4c27-824d-9106d1ec082e |Thread:   22 |Category: Platform |User: 00000000-0000-0000-0000-000000000000 |Level: Error |ReqId: 5c0dd2c9-f20d-4ebb-b9ff-3b8698a15c4d | MessageProcessor.Execute  ilOffset = 0x1C5
>MessageProcessor fail to process message 'Create' for 'account'.
[2014-08-14 14:11:35.035] Process: w3wp |Organization:00000000-0000-0000-0000-000000000000 |Thread:   22 |Category: Exception |User: 00000000-0000-0000-0000-000000000000 |Level: Error |ReqId: 5c0dd2c9-f20d-4ebb-b9ff-3b8698a15c4d | CrmException..ctor  ilOffset = 0x7
    at CrmException..ctor(String message, Exception innerException, Int32 errorCode, Boolean isFlowControlException)  ilOffset = 0x7
    at CrmException..ctor(String message, Int32 errorCode)  ilOffset = 0x5
    at PlatformCommand.CreateCrmExceptionFromServiceFault(FaultException`1 fe)  ilOffset = 0x1B
    at PlatformCommand.XrmExecuteInternal()  ilOffset = 0xF6
    at CreateCommand.Execute()  ilOffset = 0xC
    at EntityProxy.Create(Boolean performDuplicateCheck, Guid auditingTransactionId)  ilOffset = 0x0
    at EntityProxy.Create(Boolean performDuplicateCheck)  ilOffset = 0x7
    at AppForm.SaveEntity(EntityProxy entity, FormEventId eventType, String redirectPath, Boolean performDuplicateCheck)  ilOffset = 0x28
    at AppForm.FormSaveAndCloseEvent()  ilOffset = 0x18
    at AppForm.RaiseDataEvent(FormEventId eventId)  ilOffset = 0xD7
    at EndUserForm.Initialize(Entity entity)  ilOffset = 0x1F
    at CustomizableForm.Execute(Entity entity, FormDescriptor fd)  ilOffset = 0x62
    at AccountRecordPageHandler.ConfigureFormHandler()  ilOffset = 0x56
    at RecordPageHandler.ConfigureFormWrapper()  ilOffset = 0xC
    at GenericEventProcessor.RaiseEvent(String eventName)  ilOffset = 0x2D
    at PageManager.OnPreRender(EventArgs e)  ilOffset = 0x47
    at Control.PreRenderRecursiveInternal()  ilOffset = 0x54
    at Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)  ilOffset = 0x6D3
    at Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)  ilOffset = 0x3C
    at Page.ProcessRequest()  ilOffset = 0x14
    at Page.ProcessRequest(HttpContext context)  ilOffset = 0x33
    at CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()  ilOffset = 0x18D
    at HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)  ilOffset = 0x15
    at ApplicationStepManager.ResumeSteps(Exception error)  ilOffset = 0x10A
    at HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)  ilOffset = 0x5C
    at HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)  ilOffset = 0x16A
    at ISAPIRuntime.ProcessRequest(IntPtr ecb, Int32 iWRType)  ilOffset = 0x4B
>Crm Exception: Message: System.ArgumentNullException: Value cannot be null.
Parameter name: The plug-in type could not be found in the plug-in assembly: CrmDemo.Plugins.PostAccountCreateDetail, ErrorCode: -2147220970
[2014-08-14 14:11:35.037] Process: w3wp |Organization:d39e4ccc-fc01-4c27-824d-9106d1ec082e |Thread:   22 |Category: Application |User: 00000000-0000-0000-0000-000000000000 |Level: Error |ReqId: 5c0dd2c9-f20d-4ebb-b9ff-3b8698a15c4d | ErrorInformation.LogError  ilOffset = 0x17
>MSCRM Error Report:
--------------------------------------------------------------------------------------------------------
Error: System.ArgumentNullException: Value cannot be null.
Parameter name: The plug-in type could not be found in the plug-in assembly: CrmDemo.Plugins.PostAccountCreateDetail

Error Number: 0x80040216

Error Message: System.ArgumentNullException: Value cannot be null.
Parameter name: The plug-in type could not be found in the plug-in assembly: CrmDemo.Plugins.PostAccountCreateDetail

Error Details: System.ArgumentNullException: Value cannot be null.
Parameter name: The plug-in type could not be found in the plug-in assembly: CrmDemo.Plugins.PostAccountCreateDetail

Source File: Not available

Line Number: Not available

Request URL: http://localhost/MartinandAssociates/userdefined/edit.aspx?etc=1&pagemode=iframe

Stack Trace Info: [CrmException: System.ArgumentNullException: Value cannot be null.
Parameter name: The plug-in type could not be found in the plug-in assembly: CrmDemo.Plugins.PostAccountCreateDetail]
   at Microsoft.Crm.Application.Platform.ServiceCommands.PlatformCommand.XrmExecuteInternal()
   at Microsoft.Crm.Application.Platform.ServiceCommands.CreateCommand.Execute()
   at Microsoft.Crm.Application.Platform.EntityProxy.Create(Boolean performDuplicateCheck, Guid auditingTransactionId)
   at Microsoft.Crm.Application.Platform.EntityProxy.Create(Boolean performDuplicateCheck)
   at Microsoft.Crm.Application.Forms.AppForm.SaveEntity(EntityProxy entity, FormEventId eventType, String redirectPath, Boolean performDuplicateCheck)

Looking at the CrmDemo.Plugins.dll file in DotPeek, I can clearly see the PostAccountCreateDetail class, so I'm not sure why CRM says it can't find it.

1
I think that is just unfortunate editing It's saying The plug-in type could not be found in the plug-in assembly: CrmDemo.Plugins.PostAccountCreateDetail Detail:<detail of the exception> See how the second error just says: CrmDemo.Plugins.PostAccountCreateDetail As to why you are getting that error is hard to tell, is there anything in the trace logs?ManyRootsofAllEvil
I added the crm error trace file to the original post.Dan Taylor
is this registered in sandbox mode? have you tried registering in normal mode? The error log doesn't give much of a clueManyRootsofAllEvil
This is registered in sandbox mode and stored in database mode. When trying to register in 'none' mode, I get the following exception: Unable to load the plugin type: CrmDemo.Plugins.PostAccountCreateDetailDan Taylor
The screen shot of the plugin registration tool looks like the CRM 2013 version. Are you sure you have developed your plugin with the right version of the sdk?Ollie

1 Answers

2
votes

This could be the problem of dll versions you included...
Check for (Microsoft.Xrm.Sdk and Microsoft.Crm.Sdk) version are they 5.0.0.0 or 6.0.0.0 ?
it looks like CRM doesn’t have them in the GAC yet