SSIS Script Task Error

(click to enlarge)

Has this ever happened to you? You’re tooling along building an SSIS package. You configure a Script Task, press the F5 key, and BAM! Error!

DTS Script Task has encountered an exception in user code:
Project name: ST_…
Exception has been thrown by the target of an invocation. at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams) at Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTATaskScriptingEngine.ExecuteScript()

Not Helpful

Although accurate, this is not a very helpful error. What does it mean?

This error means an SSIS variable or parameter found in the ReadOnlyVariables property or the ReadWriteVariables property of the Script Task does not match the name of a variable or parameter referenced in the .Net code.

You can learn more by taking my short (and inexpensive) course titled SSIS Self-Help!

 

 

Need Help Getting Started or Updating SSIS or Azure Data Factory in Your Enterprise?

Enterprise Data & Analytics specializes in training and helping enterprises modernize their data engineering by lifting and shifting SSIS from on-premises to the Azure-SSIS integration runtime in Azure Data Factory. Our experienced engineers grok enterprises of all sizes. We’ve done the hard work for large and challenging data engineering enterprises. We’ve earned our blood-, sweat-, and tear-stained t-shirts. Reach out. We can help.

Enterprise Data & Analytics

Andy Leonard

andyleonard.blog

Christian, husband, dad, grandpa, Data Philosopher, Data Engineer, Azure Data Factory, SSIS guy, and farmer. I was cloud before cloud was cool. :{>

10 thoughts on “SSIS Script Task Error

  1. Andy, I’ve just upgraded my computer to WIn10 and installed VS 2015 Update 3 and SSDT 14.0.6 and I’m having an issue with a Script Task in one of my dataflows. I can bring edit the script but cannot add new ReadOnlyVariables. When I click the ellipsis button for a list of variables, Visual Studio locks up and I must end task to clear the issue.

    Have you seen this behavior before?

    Here is my installed products:
    Microsoft Visual Studio Enterprise 2015
    Version 14.0.25431.01 Update 3
    Microsoft .NET Framework
    Version 4.8.03752

    Installed Version: Enterprise

    Architecture and Modeling Tools 00322-80000-00000-AA187
    Microsoft Architecture and Modeling Tools

    UML® and Unified Modeling Language™ are trademarks or registered trademarks of the Object Management Group, Inc. in the United States and other countries.

    Microsoft Visual Studio Tools for Applications 2015 00322-80000-00000-AA187
    Microsoft Visual Studio Tools for Applications 2015

    Visual Basic 2015 00322-80000-00000-AA187
    Microsoft Visual Basic 2015

    Visual C# 2015 00322-80000-00000-AA187
    Microsoft Visual C# 2015

    Visual C++ 2015 00322-80000-00000-AA187
    Microsoft Visual C++ 2015

    Application Insights Tools for Visual Studio Package 7.0.20622.1
    Application Insights Tools for Visual Studio

    ASP.NET and Web Tools 2015.1 (Beta8) 14.1.11107.0
    ASP.NET and Web Tools 2015.1 (Beta8)

    ASP.NET Web Frameworks and Tools 2012.2 4.1.41102.0
    For additional information, visit http://go.microsoft.com/fwlink/?LinkID=309563

    ASP.NET Web Frameworks and Tools 2013 5.2.40314.0
    For additional information, visit http://www.asp.net/

    Common Azure Tools 1.8
    Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

    GitHub.VisualStudio 2.9.1.7781
    A Visual Studio Extension that brings the GitHub Flow into Visual Studio.

    JavaScript Language Service 2.0
    JavaScript Language Service

    JavaScript Project System 2.0
    JavaScript Project System

    Microsoft Azure Mobile Services Tools 1.4
    Microsoft Azure Mobile Services Tools

    NuGet Package Manager 3.4.4
    NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

    PreEmptive Analytics Visualizer 1.2
    Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

    SQL Server Data Tools 14.0.61021.0
    Microsoft SQL Server Data Tools

    SQL Server Integration Services
    Microsoft SQL Server Integration Services Designer
    Version 13.0.1601.5

    SQL Server Reporting Services 13.0.1701.8
    Microsoft SQL Server Reporting Services Designers
    Version 13.0.1701.8

    TypeScript 1.8.36.0
    TypeScript tools for Visual Studio

      1. Hi Andy,

        am having the same issue, have you given the repair option in the setup application of VS 2015 or SSDT 2015 for VS 2015.

  2. I have gone through several times and my variables are named the same in the script task, and then execute SQL Task. I am trying to use a SQL query (Select…..FOR JSON) to then take the full result set and load as a JSON Payload in SSIS. I know the JSON format is proper since I can export and upload in my SAS process, but we are trying to automate in SSIS. I am stuck and have been googling for days. Any thought?

    1. Hi Kevin,

      When troubleshooting, I like to break the process into smaller chunks of functionality. It sounds as if you’ve done that already – or may have. My suggestion (if you’ve not already done this) is to start at the end and work your way back:

      1. Compare the JSON file that you can upload to SAS to the output from SSIS. I use a text comparator called Beyond Compare (www.scootersoftware.com), but there are other text comparators available. Make sure the files are identical. If the SSIS version fails to upload and another version uploads successfully, check file formats (ANSI? Unicode?).

      2. When you locate differences in step 1, follow the different text *backwards* in your SSIS process until you locate where the difference is being generated. Fix that place so the desired JSON is generated.

      3. Repeat.

      Hope this helps,
      Andy

  3. Thank you!! After visiting this article I just filled the fields “ReadOnlyVariables” and “ReadWriteVarialbes” using the necessary values and then the problem was solved 🙂

    1. i already filled “ReadOnlyVariables” and “ReadWriteVarialbes”, and the variable naming was same. But i still got the error. Any others solution that you have?

  4. Hey Andy
    Am facing same issue the name of my variable are same but i keep getting the error message, Pls any other way to troubleshoot this problem?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.