Blog Post

SQL Server Integration Services (SSIS) Blog
1 MIN READ

Handling HRESULT 0xC020402D from BufferManager.FindColumnByLineageID

SSIS-Team's avatar
SSIS-Team
Copper Contributor
Mar 25, 2019
First published on MSDN on Jun 04, 2010

While developing some custom transforms for my talks at http://blogs.msdn.com/b/mattm/archive/2010/04/14/ssis-sessions-at-tech-ed-2010-in-new-orleans.aspx , I hit a problem where I was getting an a failed HRESULT (COM Exception) in my http://msdn.microsoft.com/en-us/library/microsoft.sqlserver.dts.pipeline.pipelinecomponent.preexecute.aspx () method on a call to http://msdn.microsoft.com/en-us/library/microsoft.sqlserver.dts.pipeline.wrapper.idtsbuffermanager100.findcolumnbylineageid.aspx ().

HRESULT 0xC020402D

Which http://msdn.microsoft.com/en-us/library/ms345164(SQL.100).aspx to DTS_E_NOBUFFERTYPEONSYNCOUTPUT.

The error message for that exception is

The %1 is a synchronous output and the buffer type cannot be retrieved for a synchronous output.

Which really wasn’t much help in this case.

The problematic line of code was #3:

Code Snippet
  1. var output = ComponentMetaData.OutputCollection[0];
  2. var outputColumns = output.OutputColumnCollection;
  3. columnBufferIndex = BufferManager.FindColumnByLineageID(output.Buffer, outputColumns[0].LineageID);

I was looking for the LineageID of the only column my transform was adding, so (naturally) I thought that I should pass in the Buffer value for my output.

This is not the case.

Since in my case the Output was synchronous (i.e. its http://msdn.microsoft.com/en-us/library/microsoft.sqlserver.dts.pipeline.wrapper.idtsoutput100.synchronousinputid(v=SQL.105).aspx was mapped to the transform’s input), you can’t access it’s Buffer output type (since it’s not outputting its own buffers – it’s reusing the one from the input).

The fix was really simple – instead of the output http://msdn.microsoft.com/en-us/library/microsoft.sqlserver.dts.pipeline.wrapper.idtsoutput100.buffer(v=SQL.105).aspx , use the input buffer instead(ComponentMetadata.InputCollection[0].Buffer).

Updated Mar 25, 2019
Version 2.0
No CommentsBe the first to comment