Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
409 views
in Technique[技术] by (71.8m points)

c# - Method not found SetDataTypeProperties in custom SSIS component

I'm trying to build a simple custom SSIS component which looks at a single input column and validates it, creating an output column of type bool depending on the value of each row.

I've successfully built an even simpler component that takes a value and transforms it: that doesn't require fiddling with the output columns. In this instance I need to take in a string and output a boolean and the component needs to know that it outputs a boolean so I can feed the value into a conditional split.

I'm struggling to add the output columns. Based on code samples from Microsoft, I have done this:

public override DTSValidationStatus Validate()
{
    IDTSOutput100 output = ComponentMetaData.OutputCollection[0];

    IDTSOutputColumn100 outputcol = output.OutputColumnCollection.New();
    outputcol.Name = "IsValid";
    outputcol.SetDataTypeProperties(DataType.DT_BOOL, 0, 0, 0, 0);

    return DTSValidationStatus.VS_ISVALID;
}

And then I attempt to populate it during the ProcessInput step:

public override void ProcessInput(int inputID, PipelineBuffer buffer)
{
    while (buffer.NextRow())
    {
        string str = buffer.GetString(0);
        buffer.SetBoolean(0, IsValid(str)); // validation code not relevant
    }
}

When I try to use this component in the package, I get this error:

The component has detected potential metadata corruption during validation.
Error at Data Flow Task [Uppercase [24]]: System.MissingMethodException: Method not found: 'Void Microsoft.SqlServer.Dts.Pipeline.Wrapper.IDTSOutputColumn100.SetDataTypeProperties(Microsoft.SqlServer.Dts.Runtime.Wrapper.DataType, Int32, Int32, Int32, Int32)'.
   at EmailValidation.Uppercase.Validate()
   at Microsoft.SqlServer.Dts.Pipeline.ManagedComponentHost.HostValidate(IDTSManagedComponentWrapper100 wrapper)

Searching on this error message has yielded nothing of value.

In the original sample - and some other tutorials online - adding output columns is done by looping through the input column and adding an additional output for each. I have tried this and get the same error.

I have also tried moving the output column code from Validate to OnInputPathAttached which still yields the same error.

What am I doing wrong?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

On investigation this appears to be a bug in SQL Server Data Tools for Visual Studio 2015. I have built, deployed and used a custom component with customised output columns in an Integration Services package in Visual Studio 2013. However, the same tool deployed in a package in 2015 causes the error described.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...