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



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

我基本上必须将我的泛型 T 转换为接口,并根据需要转换实际类型,这不太理想。 插件不会遭受这种命运,因为它只是在寻找 IPlugin 的实现(如果您使用通用基类,则必须显式声明在您的插件类上实现。 如果层次结构中有一个泛型类,则将基类定义为实现 IPlugin 将不起作用(。

最新更新