Really weird error. I have two independently working source C# scripts in SSIS. Basically they go and grab information from an external CRM source.
When they are both enabled in the same script, On the first script that executes I get:
Object reference not set to an instance of an object
This works
This does not - it freezes on the the first script.
I would think it might be a buffer issue, but it would still complete the first script before throwing the error. Both scripts have unique ids and guids.
Debugging is useless, it dosen't stop on any of the code that I've programmed. I'm stumped.
This is ScriptThree.CreateNewOutputRows() - Important to note that scriptthree is part of the second dataflow task.
public override void CreateNewOutputRows()
{
/*
Add rows by calling the AddRow method on the member variable named "<Output Name>Buffer".
For example, call MyOutputBuffer.AddRow() if your output was named "MyOutput".
*/
QueryExpression query = new QueryExpression("email")
{
ColumnSet = new ColumnSet(new string[] { "subject", "regardingobjectid", "createdon", "directioncode" }),
PageInfo = new PagingInfo()
{
Count = 250,
PageNumber = 1,
ReturnTotalRecordCount = false
}
};
EntityCollection results = null;
do
{
results = organizationservice.RetrieveMultiple(query);
foreach (Entity record in results.Entities)
{
emailBuffer.AddRow();
emailBuffer.emailid = record.Id;
if (record.Contains("subject"))
emailBuffer.subject = record.GetAttributeValue<string>("subject");
if (record.Contains("regardingobjectid"))
emailBuffer.regarding = record.GetAttributeValue<EntityReference>("regardingobjectid").Id;
if (record.Contains("createdon"))
emailBuffer.createdon = record.GetAttributeValue<DateTime>("createdon");
if (record.Contains("directioncode"))
emailBuffer.directioncode = record.GetAttributeValue<bool>("directioncode");
}
query.PageInfo.PageNumber++;
query.PageInfo.PagingCookie = results.PagingCookie;
}
while (results.MoreRecords);
}