Script Component uncaught System.NullReferenceException

James Clark 231 Reputation points
2021-09-23T17:45:28.78+00:00

I have a SSIS Script Component that's serving a single output that's crashing, and it's not being caught by my Try/Catch block, nor in the debugger:

    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".  
        */  
        try  
        {  
            // Set the ModelDiagram table columns.  
            ModelDiagramOutputBuffer.AddRow();  
            ModelDiagramOutputBuffer.ModelDiagramID = Variables.ClassId;  // set this to the NDO "container" class primary key, NOT the ID of the diagram itself  
            ModelDiagramOutputBuffer.Name = Variables.NDODiagramName;  
            ModelDiagramOutputBuffer.Description = Variables.NDODiagramDescription.Length > 0 ? Variables.NDODiagramDescription : null;  
            ModelDiagramOutputBuffer.KeyClasses = Variables.NDOKeyClass.Length > 0 ? Variables.NDOKeyClass : null;  
            ModelDiagramOutputBuffer.Comments = Variables.NDOComment.Length > 0 ? Variables.NDOComment : null;  
            if (Variables.NDONumber > 0)  // it's nullable in the database  
                ModelDiagramOutputBuffer.Number = Variables.NDONumber;  
            ModelDiagramOutputBuffer.ModelDiagramTypeListID = 1;  // NDO  
            ModelDiagramOutputBuffer.DevelopmentStateListID = Variables.DevelopmentStateListId;  // set to either 2 (Elaborated) or 5 (NDO Container Class Only, No Diagram)  
            ModelDiagramOutputBuffer.RecordStateListID = 2;  // Draft  
        }  
        catch (Exception ex)  
        {  
            ComponentMetaData.FireError(ex.HResult, string.Empty, "Exception thrown: " + ex.Message + " - " + ex.InnerException.Message + ", Curl response code: " + Variables.CurlResponseCode, string.Empty, 0, out bool cancel);  
        }  
    }  
  

Here is the error as shown when run on the database/SSIS server:

134677-2021-09-23-11-24-25.png

134640-image.png

SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,452 questions
0 comments No comments
{count} votes

1 additional answer

Sort by: Most helpful
  1. ZoeHui-MSFT 32,736 Reputation points
    2021-09-24T01:15:32.877+00:00

    Hi @James Clark ,

    Please try below methods to see if it could be helpful.

    Open the script editor in VS to see if it complains any error in your code.

    After that, re-build it and save your script. Remember to click ok in the script editor.

    Redeploy the project to SSMS and run again.

    You may also copy the script to a new SSIS project, re-build and re-deploy for a try.

    Regards,

    Zoe


    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
    Hot issues October

    0 comments No comments