I found out what's wrong. The EzExecuteSqlTask's Connection property's setter is actually incorrectly coded. Current implementation is as follows.
public EzConnectionManager Connection
{
get { return m_connection; }
set
{
if (value == null)
{
throw new ArgumentNullException("Connection value");
}
if (value.CM.CreationName != "OLEDB")
{
throw new IncorrectAssignException(string.Format("Cannot assign {0} connection to EzExecSqlTask", value.CM.CreationName));
}
(host.InnerObject as ExecuteSQLTask).Connection = value.Name;
m_connection = value;
}
}
The problem is with the line (host.InnerObject as ExecuteSQLTask).Connection = value.Name;
First of all the cast can't be done that way (and shouldn't since NullReferenceException will be thrown and it isn't dealt with). Secondly the line should be (or similar)host.Properties["Connection"].SetValue(host, value.Name);