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
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.
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
SQL Server Data Tools 14.0.61021.0
Microsoft SQL Server Data Tools
SQL Server Integration Services
Microsoft SQL Server Integration Services Designer
SQL Server Reporting Services 13.0.1701.8
Microsoft SQL Server Reporting Services Designers
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.
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:
- 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.
Matt Fraser commented
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
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
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.
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.
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
OK - I don't know how to solve it, but I found a workaround, if somebody maybe interested:
1. instead of having script task, use Execute Package Task.
2. Put your script task into new package (just one task in the package), create parameters that your parent package is going to supply when calling it.
3. In your script, add lines to assign values to your Parent package (child package has access to your parent package variables at runtime). Btw, you don't need to specify any read-only, read-write variables in the GUI of the script task. use the following template in the script:
public void Main()
Variables vars = null;
VariableDispenser variableDispenser = Dts.VariableDispenser;
vars["User::ParentPackageVariable"].Value = "new value"; //whatever your code does
Dts.TaskResult = (int)ScriptResults.Success;
Microsoft, please wake up!
Similar bug as,
This is slowing, if not halting production. Please review.
It is March of 2018 now and there seem to be to solution to it. I have the same issues with strange VS behavior when SSIS package contains script task (regardless of the language: VB or C#). In debugging mode the task starts ignoring the execution of the code while reporting Success. Closing and opening of the solution causes then the script to disappear. It only happens when script tasks contains read-only and/or read-write variables. Microsoft - please do something about it.