为什么我无法注册我的CRM自定义工作流活动?

时间:2018-09-12 00:26:33

标签: dynamics-crm dynamics-crm-online

我能够成功注册我的工作流程程序集,但是在尝试注册我的自定义工作流程活动时收到以下错误。这导致我的工作流程序集位于CRM中,但其中不包含自定义代码活动。

  

未处理的异常:System.ServiceModel.FaultException插件   程序集不包含必需的类型或程序集内容   无法更新。

     

服务器堆栈跟踪:

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)
     

异常重新抛出为[0]:       在System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg,IMessage retMsg)       在System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&msgData,Int32类型)       在Microsoft.Xrm.Sdk.IOrganizationService.Create(实体实体)       在Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy.CreateCore(实体实体)       在Xrm.Sdk.PluginRegistration.Forms.PluginRegistrationForm.btnRegister_Click(Object sender,EventArgs e)

     

详细信息:

<OrganizationServiceFault xmlns="http://schemas.microsoft.com/xrm/2011/Contracts" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
  <ActivityId>5940962f-8dad-45bd-95f5-d9bdacab5c36</ActivityId>
  <ErrorCode>-2147204725</ErrorCode>
  <ErrorDetails xmlns:a="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
  <Message>Plug-in assembly does not contain the required types or assembly content cannot be updated.</Message>
  <Timestamp>2018-09-07T12:08:17.3337398Z</Timestamp>
  <ExceptionRetriable>false</ExceptionRetriable>
  <ExceptionSource i:nil="true" />
  <InnerFault>
    <ActivityId>5940962f-8dad-45bd-95f5-d9bdacab5c36</ActivityId>
    <ErrorCode>-2147204725</ErrorCode>
    <ErrorDetails xmlns:a="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
    <Message>Plug-in assembly does not contain the required types or assembly content cannot be updated.</Message>
    <Timestamp>2018-09-07T12:08:17.3357419Z</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" />
</OrganizationServiceFault>

1 个答案:

答案 0 :(得分:2)

我的自定义工作流程活动是从通用基类继承的。 CRM不支持此功能:

public class MyWorkflow: MyWorkflowBase<int>
{
    #region Overrides of CodeActivity

    protected override void Execute(CodeActivityContext context) { throw new NotImplementedException(); }

    #endregion
}

public abstract class MyWorkflowBase<T> : CodeActivity
{

}

我基本上必须将我的Generic T转换为接口,并根据需要强制转换实际类型,这不理想。插件不受此命运的影响,因为它只是在寻找IPlugin的实现(这是因为,如果您使用通用基类,则必须在插件类上显式声明已实现。将基类定义为实现如果您的层次结构中有通用类,则IPlugin无法正常工作。

相关问题