0

I am trying to create a package containing several Data Flow tasks in them. The tasks are fairly similar in nature, but contain fairly important differences.

I have tried to copy the task, then change the things which need changing.

When I run the task by itself it runs fine, however when I run it with all the other tasks in the package I get the below error:

Object reference not set to an instance of an object. at ScriptMain.Input0_ProcessInputRow(Input0Buffer Row) at UserComponent.Input0_ProcessInput(Input0Buffer Buffer) at UserComponent.ProcessInput(Int32 InputID, String InputName, PipelineBuffer Buffer, OutputNameMap OutputMap) at Microsoft.SqlServer.Dts.Pipeline.ScriptComponent.ProcessInput(Int32 InputID, PipelineBuffer buffer) at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.ProcessInput(Int32 inputID, PipelineBuffer buffer)

Not the most friendly error message.

Can anyone tell me what this is and how to fix it? I assume that there is some variable or other attribute which is being repeated, but which one?

Note that many of the columns over the several data flow tasks will have the same column names.

Hadi
  • 36,233
  • 13
  • 65
  • 124
Mike de H
  • 599
  • 2
  • 6
  • 13
  • 1
    Object reference not set to an instance of an object means you're referencing an object that is null or nothing. Are your inputs missing a source or precedence or something? Maybe it is something that was deleted when you copied the task. https://stackoverflow.com/questions/4660142/what-is-a-nullreferenceexception-and-how-do-i-fix-it – Jacob H Feb 12 '18 at 15:19
  • Is there any way I can find out which object? – Mike de H Feb 12 '18 at 15:25
  • 2
    yes. put in a breakpoint in the beginning of the code and step through it. Also, .NET breaks without null handling – KeithL Feb 12 '18 at 21:01

3 Answers3

1

I figured it out in the end. The reason was that the second level objects need to be explicitly declared.

I had

public class Level2
{
    public string Somevalue { get; set; }
}
public class RootAttributes
{
    public Level2 lvl2 { get; set; }
    public string Somevalue2 { get; set; }
}

It should have been

public class Level2
{
    public string Somevalue { get; set; }
}
public class RootAttributes
{
    public Level2 lvl2 = new Level2;
    public string Somevalue2 { get; set; }
}

The weird thing was that the top method worked in several other places.

Mike de H
  • 599
  • 2
  • 6
  • 13
1

I had this issue with my send mail task.

As I was using a file connection for my body of the email, I had to create a new file connection and it worked fine.

Gamzosh
  • 93
  • 1
  • 11
  • This can happen if you copy code into the dtsx package and there is not a corresponding object reference for the GUID that is in the package code. Be sure you can create the references needed by the dtsx package. If nothing else, add them to the project, and reset your GUID's to point to the correct references. – Jamie Dec 23 '21 at 14:27
0

Use the package run report in vs 2012 to identify in which DFT task package got failed. Use the view code option of the package to see the whether all the DFT task having proper input.