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.

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.
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?
Same issue. VB code disappearing.
Come on Microsoft. Fix this!!!!
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)
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.
29 comments
-
Vijay commented
I am also facing the same problem, installed VS 2015 ,while running manually from local iScript task code is working file some times. and once i closed and re-opened the solution C# code is not appearing in the script task. And while deployed the solution in SSISDB catalog and tried to run , but it is not entering into Script task , due to C# code is missing and don't have any thing to execute as per the logic. Here trying to load XML files to SQL server DB.
Please help me out on this issue, if anyone have solution.
please provide the solution to fix this issue Microsoft team .
-
Nelson commented
I figure out the issue on my side, Is the script task, you need to create a new one on VS2015 and make sure it set the framework to 4.5, copy and past your code to the new task and DELETE the old one, it will work
-
Raphael commented
Oh joy...! Microsoft simply ignoring an absolutely MAJOR issue... I'll add to the "me too" movement on this thread. It's now September 3rd, 2019... Mine is a bit different though, and I did not waste my time pinpointing exactly what workflow causes the problem. I do know that in my case, sometimes when I open the solution in VS 2019, I cannot access the package parameter(s). I mean, I click on parameters for the package, and there is NOTHING there. Expected behavior: I should see the parameter(s) for the package. My solution: I open VS2010, which is still installed on the machine, and I CAN see the parameter(s) again. Then, if I open VS2019, now I CAN see the parameter(s). Absolutely ridiculous that MS is not fixing this over, how many versions now???
Be well everyone. R. -
Daniel commented
Same issue with VS 2019 . im trying to edit a SSIS script written in VB , but anytime i save and reopen the script is convert to c# . think im going back to 2012 vs
-
Rene Wißmann commented
Having the problem now in VS2019 - had this problem not in VS2015 or 2017.
I think the installation could be corrupted with no reason - i tried to reinstall ssdt from the extensions menu but it did't help.This cost me some hours of work until now and i can't find any sollution because there is no error-message and i am loosing code i wrote with no warning.
-
Marek commented
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.
-
Marek commented
I have same problem with last version Visual Studio 2017 (SSDT) 15.8.9.
-
Anonymous commented
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
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.02558Installed Version: IDE Standard
Microsoft Visual Studio Tools for Applications 2017 00371-40000-00001-AA167
Microsoft Visual Studio Tools for Applications 2017C# 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 packageProjectServicesPackage Extension 1.0
ProjectServicesPackage Visual Studio Extension Detailed InfoResourcePackage Extension 1.0
ResourcePackage Visual Studio Extension Detailed InfoResourcePackage Extension 1.0
ResourcePackage Visual Studio Extension Detailed InfoSQL Server Analysis Services 14.0.1016.285
Microsoft SQL Server Analysis Services Designer
Version 14.0.1016.285SQL Server Data Tools 15.1.61808.07020
Microsoft SQL Server Data ToolsSQL Server Integration Services
Microsoft SQL Server Integration Services Designer
Version 14.0.3002.107SQL Server Reporting Services 14.0.1016.285
Microsoft SQL Server Reporting Services Designers
Version 14.0.1016.285SsmsVsIntegration 1.0
Information about my packageVisual 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 StudioData 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
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
-
Kevnotec commented
Looks like it's now been fixed in VS 2017:
Only took a year since I first reported it - and no word yet on VS 2015
-
Anonymous commented
Has this been fixed yet? This is seriously harshing my mellow.
-
Art Cohen commented
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
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
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
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
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.
-
Matt Fraser commented
It looks like this will be fixed in an upcoming release!
https://developercommunity.visualstudio.com/content/problem/199587/ssis-script-task-losing-code.html -
Lawrence JM commented
Tom Phillips is reporting over on the MSDN SSDT sub-forum that that version 15.6.0 may contain a fix for this issue:
"Fix an issue that sometimes variable list of ScriptTask will disappear in task UI".
-
Lawrence JM commented
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: