BizTalk自定义管道组件没有';不加载覆盖的属性

BizTalk自定义管道组件没有';不加载覆盖的属性,biztalk,custom-pipeline-component,Biztalk,Custom Pipeline Component,我有一个自定义BizTalk 2013 R2管道组件,该组件定义了多个设计时属性。出于某种原因,BizTalk将加载在VS管道设计器中设置的设计时属性值,但忽略在BizTalk管理控制台中设置的运行时值。我的组件实现了IPersistPropertyBag,并且我已经验证了它没有抛出任何异常 在调试管道(连接到独立主机实例)时,我注意到BizTalk仅在实例化管道时调用Load方法。这只加载VS designer值,BizTalk应该在调用Execute之前再次调用Load方法。不幸的是,这并没

我有一个自定义BizTalk 2013 R2管道组件,该组件定义了多个设计时属性。出于某种原因,BizTalk将加载在VS管道设计器中设置的设计时属性值,但忽略在BizTalk管理控制台中设置的运行时值。我的组件实现了IPersistPropertyBag,并且我已经验证了它没有抛出任何异常

在调试管道(连接到独立主机实例)时,我注意到BizTalk仅在实例化管道时调用Load方法。这只加载VS designer值,BizTalk应该在调用Execute之前再次调用Load方法。不幸的是,这并没有发生

[Edit]我又进行了一些调试,发现这似乎只发生在双向接收端口的发送管道上。接收管道按预期加载设计时和运行时属性

以下是我的代码示例:

[ComponentCategory(CategoryTypes.CATID_PipelineComponent)]
[ComponentCategory(CategoryTypes.CATID_Encoder)]
[System.Runtime.InteropServices.Guid(COMPONENT_GUID)]
public class RhapsodyMessageEncoder : BasePipelineComponent, IBaseComponent, IComponentUI, 
    IPersistPropertyBag, Microsoft.BizTalk.Component.Interop.IComponent
{
...
    public void Load(IPropertyBag propertyBag, int errorLog)
    {
        try
        {
            this.Enabled = Convert.ToBoolean(this.ReadPropertyBag(propertyBag, "Enabled"));
            this.UsernameSSOKey = this.ReadPropertyBag(propertyBag, "UsernameSSOKey") as string;
            this.PasswordSsoKey = this.ReadPropertyBag(propertyBag, "PasswordSsoKey") as string;
            this.AffiliateAppName = this.ReadPropertyBag(propertyBag, "AffiliateAppName") as string;
        }
        catch (Exception e) { this.WriteErrorLog(e); }
    }

    public void Save(IPropertyBag propertyBag, bool clearDirty, bool saveAllProperties)
    {
        try
        {
            this.WritePropertyBag(propertyBag, "Enabled", this.Enabled);
            this.WritePropertyBag(propertyBag, "UsernameSSOKey", this.UsernameSSOKey);
            this.WritePropertyBag(propertyBag, "PasswordSsoKey", this.PasswordSsoKey);
            this.WritePropertyBag(propertyBag, "AffiliateAppName", this.AffiliateAppName);
        }
        catch (Exception e) { this.WriteErrorLog(e); }
    }
...
}
读/写属性包帮助器方法:

    protected virtual object ReadPropertyBag(IPropertyBag pb, string propName)
    {
        PropertyInfo pInfo = this.GetType().GetProperty(propName);
        object currentValue = null;
        object val = null;

        if (pInfo != null)
            currentValue = pInfo.GetValue(this, null);

        try
        {
            pb.Read(propName, out val, 0);
        }
        catch (System.ArgumentException e)
        {
            System.Diagnostics.Trace.WriteLine(
                "Argument Exception encountered: " + e.Message,
                this.Name
            );
        }
        catch (System.Exception e)
        {
            throw new System.ApplicationException("Can't read design time Properties", e);
        }

        return val ?? currentValue;
    }

    protected virtual void WritePropertyBag(IPropertyBag pb, string propName, object val)
    {
        try
        {
            object obj = val;
            pb.Write(propName, ref obj);
        }
        catch (System.Exception e)
        {
            throw new System.ApplicationException("Can't write design time properties", e);
        }
    }

我将组件类别更改为Any,并将该组件安装在同一双向接收端口的接收管道中。显然,管道组件似乎没有问题,因为接收管道能够加载运行时属性,但同一组件的发送管道实例没有。您能否显示
WritePropertyBag
ReadPropertyBag
的代码?正如Dan提到的,这通常是propertybag代码中的错误。在Send和Receive中调试组件时要小心,因为可以从两个线程中命中断点。我添加了helper方法定义,但我认为这与实际的属性包代码无关。如果行为与这两种端口类型一致,我也会怀疑helper方法,但它似乎只影响双向端口。此外,我们多年来一直在使用这些辅助方法,没有发生意外。