Do you have a comment or suggestion to improve SQL Server? We’d love to hear it!

Script Tasks losing code in SSDT 17.1 for Visual Studio 2015

I have an SSIS 2016 package with a number of For Each ADO Loops, each with a single script task, which are usually working fine.

However, every so often, a script task will suddenly 'forget' all the code within it. I'm presented with an empty task editor which has reset to C# (if using VB), and lost the ReadOnlyVariable names.
If I click Edit Script, I get a brand new script created in the editor. This can occur intermittently on reopening the package, or after editing _a different_ script task.

The same thing also occurs with both VB and C# scripts, in 32 or 64 bit mode. I've even tried rebuilding a package from scratch and the same bug reappears.

Using latest Visual Studio 14.0.23107.0 D14REL, with .NET Version 4.6.01055. TargetServerVersion is SQL Server 2016. Same occurs whether I select Target .NET Framework 4.5, 4.5.1 or 4.5.2.

This is a critical bug as there is no workaround. I simply cannot proceed with development in SSIS 2016 and have had to downgrade to 2014.

77 votes
Sign in
(thinking…)
Sign in with: Microsoft
Signed in as (Sign out)

We’ll send you updates on this idea

AdminMicrosoft SQL Server (Product Manager, Microsoft Azure) shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

Upvotes: 47

<=-=Jun 26 2017 1:02AM=-=>

I have had the exact same issue, intermittently whenever I open script tasks all my code seems to have vanished and all the “ReadOnlyVaraiables” and “ReadWriteVariables” have also disappeared. It happens for c# and VB script tasks. This is is extremely frustrating and is impossible to develop a project when code randomly keeps disappearing. I’m wondering if this is a bug with Visual Studio 14.0.23107.0 D14REL. Can anyone at Microsoft shed some light on this please?

<=-=Jun 29 2017 10:45PM=-=>

Got the same problem. Seems like the Script Task is cleared when the project/Visual Studio i closed/shut down.

<=-=Jul 18 2017 5:38PM=-=>

Same problem for me, too. Once the original code in Script Task was still present after reloading the solution. But after that they are gone, along with ReadOnly/ReadWriteVariables and ConnectionManagers. I’m using SSDT 14.0.61705.170 (which just came out) with VS 14.0.25431.01 update 3.

<=-=Aug 14 2017 10:15PM=-=>

I have the same problem. Code and Variables disappear on the second execution of the script. Need a solution real fast!

<=-=Aug 17 2017 7:30AM=-=>

I tought I was going crazy. This is hapenning to me too. I did the following. Build -> Rebuild -> Run Code Analysis -> Save -> Build -> Save all and then closed, and click on OK on the editor, but when deploying the packages weren’t working. When I reimported the packages the VB script task had lost all code and variables, and was set to C#.

I am deploying to SQL 2016. Select @@Version:
Microsoft SQL Server 2016 (SP1-CU3) (KB4019916) – 13.0.4435.0 (X64) Apr 27 2017 17:36:12 Copyright © Microsoft Corporation Enterprise Edition: Core-based Licensing (64-bit) on Windows Server 2012 R2 Standard 6.3 <X64> (Build 9600: ) (Hypervisor)

Here is the dump from Help:
Microsoft Visual Studio Professional 2015
Version 14.0.25431.01 Update 3
Microsoft .NET Framework
Version 4.6.01055

Installed Version: Professional

LightSwitch for Visual Studio 2015 00325-60003-66538-AA356
Microsoft LightSwitch for Visual Studio 2015

Microsoft Visual Studio Tools for Applications 2015 00325-60003-66538-AA356
Microsoft Visual Studio Tools for Applications 2015

Visual Basic 2015 00325-60003-66538-AA356
Microsoft Visual Basic 2015

Visual C# 2015 00325-60003-66538-AA356
Microsoft Visual C# 2015

Visual C++ 2015 00325-60003-66538-AA356
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.

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/.

Office Developer Tools for Visual Studio 2015 ENU 14.0.23025
Microsoft Office Developer Tools for Visual Studio 2015 ENU

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

SQL Server Analysis Services 13.0.1701.8
Microsoft SQL Server Analysis Services Designer
Version 13.0.1701.8

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

Workflow Manager Tools 1.0 1.0
This package contains the necessary Visual Studio integration components for Workflow Manager.

<=-=Aug 23 2017 10:28AM=-=>

I have wasted over 14 hours with this critical bug. The losing code in the Script Task within Visual Studio 2015 is one of the issues but I first had a similar issue when deploying the SSIS packages with script tasks. After deploying the packages the SSIS will run and succeed but the script task won’t do anything since the code is gone! During deployment it will strip the code from the Script Task but you’ll still have it locally. I have reproduce losing the code locally in the script task twice. You will know when you are about to lose all the script task code once Visual Studio will not hit break points within the code. Soon as you close Visual Studio the code is gone!

It took me hours to figure that out and I can’t believe Microsoft is working on SQL Server 2017 and this is not even solved in 2016! This is a major bug and no response from Microsoft since the issue was posted 2 months ago. I first thought I was doing something wrong but it is definitely a major software bug.

<=-=Aug 24 2017 4:11PM=-=>

We also are seeing this issue on multiple systems.

We have seen this issue in 17.1, 17.2, and now 17.3…

We just upgraded to 17.3 hoping it would solve the issue – it seems to be worse now.

<=-=Sep 5 2017 8:36AM=-=>

At least three SSIS developers at our company are having the same issue, code within Script tasks is just randomly disappearing and we have to pull code from a previous version or rewrite. We are uninstalling v17.0 and going back to v16.5 of SSDT

<=-=Sep 6 2017 11:40PM=-=>

We are also facing the exact same issue. This is becoming a serious problem as we are always at risk editing an SSIS package running in production. To mitigate this risk we are forced to take a backup of the code file every-time we edit an ETL. Request you to fix this issue asap.

<=-=Sep 20 2017 1:14PM=-=>

Same issue here. It seems to be random on how it occurs, but once a script task has this happen, it seems to happen to that same task over and over again. We have one package in particular that has multiple script tasks in it and this one task keeps getting lost. We keep the code for that task in notepad files on all of our dev machines so that when it gets lost we can put it back quickly. It’s unfortunate because that task doesn’t get any changes to it. We just expect it to work but when we deploy and the code is gone, we end up not sending any files to our partners / clients. It doesn’t make us look very good when that fails…

<=-=Oct 17 2017 2:14AM=-=>

Same issue, C# tasks migrated OK .VB is blank.
It is almost 4 months since issue opened .
Should I wait for a fix or start rewriting code or better, find stable ETL tool?

<=-=Oct 24 2017 9:37AM=-=>

Same issue. VB code disappearing.
Come on Microsoft. Fix this!!!!

<=-=Nov 17 2017 3:41AM=-=>

I’m also experiencing this bug. Since installing the latest version of SSDT for VS 2015, it hasn’t been as prolific, but it’s still happening inconsistently.

I’ve had to start duplicating my code changes to a text file every time I make a change, so I’ve got a quick backup for when the inevitable happens!

<=-=Nov 27 2017 11:48PM=-=>

I had this issue as well. seems to appear after installing new SSMS 17.3
The thing is that even when I tried to open previous versions that surly has the code inside, the task code becomes the initial page without my code.
To get the code back I edited (by notepad++) one of my previous versions of dtsx file and copy/paste it from there.
I must say it is very annoying and hope to have a fix as soon as possible.
I think it started right after installing SSMS 17.3 which also installed MS System CLR Types for SQL server 2017 and SSDT Application Framework (14.0.1000.169)

<=-=Nov 30 2017 11:00AM=-=>

Thank you for deleting my morning’s work, Microsoft.
Your silence on this issue is deafening.

With help like this, who needs malware?

<=-=Dec 17 2017 7:27AM=-=>

This is a serious problem. I am unable to save any script code. The work arounds suggested are laughable. I’ve tried saving the C# code in a text file, deleting the script task, dropping in a new script task and pasting the C# code back in. I save it and try to immediately execute it with a breakpoint set in the C#. It never hits the breakpoint because the code is gone. It looks like the code is there and it says it ran successfully but never hits the breakpoint on the first executable line of code. If I close the .dtsx file and reopen it, the code is gone. I tried dropping in Cozyroc’s Script Task Plus but the same thing happens.

This same behavior occurs in SSDT for VS 2015 and SSDT for VS 2017. This is my company’s first attempt to use SQL Server 2016 and if this isn’t resolved, it is unusable and I will have to recommend using another product. We’re about to go to the cloud (AWS) and management would really prefer that we convert to MySQL or Postgres anyway since it’s much cheaper. Your move Microsoft and I suggest you respond in some way within the next week as we need to support a new customer on January 1.

24 comments

Sign in
(thinking…)
Sign in with: Microsoft
Signed in as (Sign out)
Submitting...
  • Marek commented  ·   ·  Flag as inappropriate

    I solved my problem uninstall Visual studio and install new version. So don't use update!!! Or problem maybe was in previous version Business intelligence. I also uninstall SQL Server 2008 with Business Intelligence.

  • Anonymous commented  ·   ·  Flag as inappropriate

    This issue continues with VS 2017 15.8.2
    I'm amazed how impossible it is to have SSIS packages that support more than one version of SQL Server.

  • Anonymous commented  ·   ·  Flag as inappropriate

    same issue here, vs 2017 Enterprise
    Microsoft SQL Server Data Tools for Visual Studio 2017 (SSDT)
    Version 15.8.1
    VisualStudio.15.Release/15.8.1+28010.2003
    Microsoft .NET Framework
    Version 4.7.02558

    Installed Version: IDE Standard

    Microsoft Visual Studio Tools for Applications 2017 00371-40000-00001-AA167
    Microsoft Visual Studio Tools for Applications 2017

    C# Tools 2.9.0-beta8-63208-01
    C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

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

    GitLab Extension for Visual Studio 1.0.0.129
    A Visual Studio Extension that brings the GitLab Flow into Visual Studio.

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

    Project 1.0
    Information about my package

    ProjectServicesPackage Extension 1.0
    ProjectServicesPackage Visual Studio Extension Detailed Info

    ResourcePackage Extension 1.0
    ResourcePackage Visual Studio Extension Detailed Info

    ResourcePackage Extension 1.0
    ResourcePackage Visual Studio Extension Detailed Info

    SQL Server Analysis Services 14.0.1016.285
    Microsoft SQL Server Analysis Services Designer
    Version 14.0.1016.285

    SQL Server Data Tools 15.1.61808.07020
    Microsoft SQL Server Data Tools

    SQL Server Integration Services
    Microsoft SQL Server Integration Services Designer
    Version 14.0.3002.107

    SQL Server Reporting Services 14.0.1016.285
    Microsoft SQL Server Reporting Services Designers
    Version 14.0.1016.285

    SsmsVsIntegration 1.0
    Information about my package

    Visual Basic Tools 2.9.0-beta8-63208-01
    Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

    Visual Studio Code Debug Adapter Host Package 1.0
    Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

    Data Flow Task containing
    XML Source going to Script Component (code does not save, lost a full days work) Any code written was auto deleted from the temp directories.

  • Joseph-Seaman commented  ·   ·  Flag as inappropriate

    This started happening to me again last Friday. I've wasted 3 days trying to get SSDT back. It is not intermittent. It happens 100% of the time when I try to create a script task

  • Art Cohen commented  ·   ·  Flag as inappropriate

    I took a look at the roadmap this morning and I see no mention of this bug being fixed. As others have mentioned this bug is very frustrating and slows down development and testing. I see comments where MSFT thinks it is fixed and then comments from users that it is not fixed in the version that MFST seems to think it is fixed. So this issue remains a real character builder for the developer. That being said MFST please fix this problem. I would love to see a post on the VS splash panel that says this issue has been fixed!

  • QA Collective commented  ·   ·  Flag as inappropriate

    SAME HERE! I've been continually having to copy/paste my code into another text editor, simply to have the peace of mind that my code won't be DELETED! >:(

    This *may* be because sometimes I accidentally interact with the SSDT window when the VSDT window is still open?

  • [Deleted User] commented  ·   ·  Flag as inappropriate

    May 2018 and this problem still isn't fixed. Lost my scripts six times today. I do keep a manual backup but this is insane.

  • Anonymous commented  ·   ·  Flag as inappropriate

    I am using SSDT with SQL Server 2016 and Visual Studio 2015. I thought I was the only one going crazy. I have several Script Tasks in C# inside a few sequence containers. After completing and testing the package I saved and closed the solution and Visual Studio. After a few hours when reopened the solution I found all the variable references and the code was all gone. I redid the whole work and saved again and after testing I closed the solution. When I reopened the script code and variable references are again gone. But strangely a few of the scripts tasks did retain the code and variable references. Now I see this problem existed for more than a year and wonder why apparently there is no response from MSFT. Can we get a detailed response from Microsoft with any work around or a fix.

  • Anonymous commented  ·   ·  Flag as inappropriate

    this is happening even now after more than 4 months. I had 35 c# tasks. When I reopened the project all the variable references were gone and the code in the script is all gone.

  • Lawrence JM commented  ·   ·  Flag as inappropriate

    We have been dealing with this problem intermittently for several years, and recently conducted a thorough investigation of the issue. Here's what we found:

    The problem occurs when:

    - There is a Foreach Loop or For Loop Container,
    - Which contains child Script Tasks,
    - And the user opens the Foreach Loop or For Loop Editor.

    The problem is now triggered; when the user next saves, Visual Studio will fail to write the following properties of each child Script Task to file:

    - ReadOnlyVariables,
    - ReadWriteVariables,
    - Any and all Script Task code.

    The insidious part of the problem is that even though the file on disk no longer contains these properties, *the Visual Studio UI keeps them in memory and will act as if this data still exists*. It is only after the project is closed and reopened will it become apparent that this data has been lost.

    We do not have a solution at this time. However, we have successfully instituted the following workarounds:

    1. Avoid using the Foreach Loop and and For Loop Editors (i.e. where possible, change properties in the Properties panel instead).

    2. If the Editors must be used, then: move all child objects outside of the relevant container; make your changes; save; and then return the child objects back to the container.

    Final note: this problem does not appear to occur with Sequence Containers (which have no Editor interface). It may affect child objects other than Script Tasks - we did not test extensively in this area.

    Additional Resources:

    - https://feedback.azure.com/forums/908035-sql-server/suggestions/33215863-ssis-script-tasks-losing-code

    - https://social.msdn.microsoft.com/Forums/sqlserver/en-US/059012f7-180c-43a0-a0b7-3a40b8569a6f/script-task-drops-code-in-ssis-package?forum=ssdt

  • Matt Fraser commented  ·   ·  Flag as inappropriate

    I am also having the same issue with SSDT 2017 (15.6.2). Target server version for the project is SQL Server 2016. The only extension beyond SSDT that we have installed is BI Developer Extensions 2017 2.1.1.

    I'm hesitant to upgrade to the latest SSDT release because my installation has proven fragile before and broke the last time we tried to upgrade.

    Note that all of the scripts that disappeared were in a For Each Loop container. There are two other scripts that we had in this package, one in a parent Sequence container and the other in the OnError Event Handler, and neither were affected.

    Some of the scripts affected were very basic, only setting the value of a read/write variable.

  • Jongman Postma commented  ·   ·  Flag as inappropriate

    We are staying on VisualStudio 2015 with SSDT 16.5 and don't upgrade SSDT anymore until it is fixed. In this version every thing is still fine.

    Same behavior with the Analysis Services Processing Task. That stopped working also for OLAP cubes (still working for Tabular cubus). In SSDT 16.5 everything is just fine.

  • Jonatan Cisneros commented  ·   ·  Flag as inappropriate

    We got a lot of people excited about the SQL 2016 Migration, and now we are stuck with this problem. please provide a solution ASAP.

  • sbdragoo commented  ·   ·  Flag as inappropriate

    We have seen this issue also across multiple developers in the team. One thing that seems to reduce the occurrence of this is to always close the first properties / dialog box with either the "OK" or the "Cancel" button - never with the "X" button in the upper right corner. This workaround was noted in VS 2015 / SSDT 2012 and still seems to help.

    I agree with other commenters on this issue that it is a shock that it has not been addressed yet. This has been a known issue for several releases now and we are still experiencing it. Fortunately for our team, we use TFS and can download previous versions to recover our C# and VB code that vanishes, but that is a PIA when we have to go that route.

  • Lenin commented  ·   ·  Flag as inappropriate

    I have the same issue, I keep multiple backups of the same package and constantly monitor that the size doesn't decrease while coding.

    For me issue has been with the EACH LOOP CONTAINER , after script tasks are added even opening the properties , moving through the tab and just saving the package causes the scripts to disappear.

    sometimes I would get The Script Task "ST_..." has been migrated. The package must be saved to retain migration changes

    sometimes I will get this

    There was an exception while loading Script Task from XML: System.Exception: The Script Task "ST_" uses version 15.0 script that is not supported in this release of Integration Services. To run the package, use the Script Task to create a new VSTA script. In most cases, scripts are converted automatically to use a supported version, when you open a SQL Server Integration Services package in %SQL_PRODUCT_SHORT_NAME% Integration Services.
    at Microsoft.SqlServer.Dts.Tasks.ScriptTask.ScriptTask.LoadFromXML(XmlElement elemProj, IDTSInfoEvents events)

    Sometimes nothing .... the task are just gone

← Previous 1

Feedback and Knowledge Base