While developing some custom transforms for my talks at the BI Conference next week, I hit a problem where I was getting an a failed HRESULT (COM Exception) in my PreExecute() method on a call to BufferManager.FindColumnByLineageID().

HRESULT 0xC020402D

Which maps 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 SynchronousInputID 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 Buffer, use the input buffer instead(ComponentMetadata.InputCollection[0].Buffer).