繁体   English   中英

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

[英]Why Am I Not Able to Register My CRM Custom Workflow Activity?

我能够成功注册我的工作流程程序集,但是在尝试注册我的自定义工作流程活动时收到以下错误。 这导致我的工作流程序集位于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]:Microsoft.Xrm处的System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&msgData,Int32类型)的System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg,IMessage retMsg)。 Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy.CreateCore(实体实体)处的Sdk.IOrganizationService.Create(实体实体)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>

我的自定义工作流活动是从通用基类继承的。 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无法正常工作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM