Using SQL Server 2014. I have a script task, that downloads files via WinSCPnet.dll assembly, where I am attempting to log errors to the SSIS log via a FireError() within the catch block. Unfortunately, when the program reaches the FireError(), it just hangs without failing or without any message. I have followed the example provided on the MSDN (see code below) without success. Can anyone please help?
Note: I have a FireInformation() event that works upon successful download.
public void Main()
{
// Set variable declaration(s).
string strTaskName = (string)Dts.Variables["System::TaskName"].Value; // Has been selected as read-only.
SessionOptions sessionOptions = new SessionOptions
{
// Set SessionOptions here
};
try
{
using (Session session = new Session())
{
// Create error here by downloading a file from a folder path that does not exist.
foreach (TransferEventArgs transfer in transferOperationResult.Transfers)
{
// Print results to SSIS log. The FireInformation() works here.
Dts.Events.FireInformation(0, string.Format("Script Task {0}", strTaskName), string.Format("Download of file {0} succeeded.", transfer.FileName), null, 0, ref fireAgain);
}
}
Dts.TaskResult = (int)ScriptResults.Success;
}
catch (Exception ex)
{
// Print results to SSIS log. The program hangs here without message.
Dts.Events.FireError(0, string.Format("Script Task {0}", strTaskName), ex.Message, null, 0);
Dts.TaskResult = (int)ScriptResults.Failure;
}
}