We have an SSIS package at work that has a Transformation component in it which has a script that takes an Input Column called "Transaction" and depending on it's value puts an "Amount" Value from another Input Column in one of several other Output Columns.
In the script we have a case statement that determines which of the several rows to put the Amount in based on the Transaction, it looks something like this:
Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)
...
Select Case GetTransactionType(Row.Transaction)
Case TranType.LOSS_PAYMENT
Row.LossPaymentAmount = Row.Value
Case TranType.LOSS_RECOVERY
Row.LossRecoveryAmount = Row.Value
Case TranType.LOSS_RESERVE
Row.LossReserveAmount = Row.Value
Case TranType.LOSS_RECOVERY_RESERVE
Row.LossRecoveryReserveAmount = Row.Value
Case TranType.TRUST_PAYMENT
Row.TrustPaymentAmount = Row.Value
Case TranType.TRUST_RECOVERY
Row.TrustRecoveryAmount = Row.Value
Case TranType.TRUST_REIMBURSEMENT
Row.TrustReimbursementAmount = Row.Value
Case TranType.AGGREGATE_PAYMENT
Row.AggregatePaymentAmount = Row.Value
Case TranType.AGGREGATE_RECOVERY
Row.AggregateRecoveryAmount = Row.Value
Case TranType.EXPENSE_PAYMENT
Row.ExpensePaymentAmount = Row.Value
Case TranType.EXPENSE_RECOVERY
Row.ExpenseRecoveryAmount = Row.Value
Case TranType.EXPENSE_RESERVE
Row.ExpenseReserveAmount = Row.Value
Case TranType.SUBRO_RECOVERY
Row.SubroRecoveryAmount = Row.Value
Case TranType.SUBRO_RESERVE
Row.SubroReserveAmount = Row.Value
Case TranType.SALVAGE_RECOVERY
Row.SalvageRecoveryAmount = Row.Value
Case TranType.SALVAGE_RESERVE
Row.SalvageReserveAmount = Row.Value
End Select
...
End Sub
This has worked fine in production for several months now. We needed to make a "slight" change to the package. When doing unit testing in development we suddenly started getting odd values in several amount rows. For one thing, it should be IMPOSSIBLE for more then one of these rows in the case statement to get a value. Well we had several in one row getting odd values.
After looking into this for some time, Eugene Koblov of Microsoft told me on a MSDN forum that:
"SSIS doesn't guarantee initial values of output columns. When you ran it in runtime you were lucky to get a part of memory initialized with zeros. When you used debugger the probability of it is getting lower. So actually, a good practice is to initialize every added output column explicitly."
These seems ridiculous to me. I know that in a language like C or C++ we can't expect default values, but in SSIS that scripts in .NET? Come on. If anything let us set a default value in the Data Type Properties in the Script Transformation Editor:
I find it really strange that I can't find anything on the web about others having similar issues. Has anyone else ran across a problem not setting default values on output columns?