5

I'm making a small package in SSIS (Integration Services), and in my control flow I have a couple of script tasks and some data flows reading data from XML files into the database.

I made some edits to the C# code in a script task in the built-in Visual Studio editor, and hit save. The star by the file name disappeared, indicating the file was saved. I closed the Visual Studio editor, saved the package, right-clicked the script task and chose "Execute task". It ran without errors, but the XML files it was supposed to create never appeared, so I opened the script in the Visual Studio editor again, and to my horror only the default script was there (e.g. only the main method and it only contained the Dts.TaskResult = (int)ScriptResults.Success; statement)!

I have been unable to find the code I had in that script task, and when I open the .dtsx file in a text editor my code is gone! The code in the other script task is there though.

I was paying careful attention, so there's no way I mistakenly deleted everything before closing the editor and saving the package.

So my question is: Has anyone else encountered this totally insane bug, and is there a way to recover the code; or do I just have to bite the bullet and recreate it from memory?

We rarely use any significant amount of C# code in these SSIS jobs, so we don't have any integrated VCS. I have been copying the code to a new file and manually adding it to my own Git repo, just to be safe, but I hadn't done that yet with this particular code.

And I just have to restate my frustration with such an amazingly bad bug in Visual Studio...

5
  • Unlikely but look in you equivalent of C:\Users\AlexK\Documents\Visual Studio 2013\Backup Files Commented Feb 6, 2015 at 12:40
  • Thanks, but unfortunately that folder was empty. I've looked through lots of other likely and unlikely folders as well. I've kind of assumed from the start that I'm out of luck, but I just wanted to see if anyone happened to have a solution. Also, it was nice to vent a little, as a bug like that is mind blowing. Commented Feb 6, 2015 at 12:53
  • I have had this happen before, but only because I hit CANCEL instead of OK getting out of the script task editor. What is sometimes confusing is that you are working in both the component editor and Visual Studio to edit the code. I suggest putting any significant amount of code into it's own project and call the dll from the script task instead. Commented Feb 6, 2015 at 15:09
  • Thanks for the advice, I'll try that next time. The thing here is that yes, I might have hit cancel instead of OK when exiting, the script task, but the change I had done was small. The other code in that script task had been written over a couple of days and saved many times. That last time it deleted ALL of it and replaced it with the standard template. Commented Feb 6, 2015 at 15:49
  • 1
    This happened to me when I had accidentally listed a variable twice in the Script Task Editor window. I corrected the problem, but when I clicked OK it said there were compile errors and asked me if I would still like to save it. I said yes, and when I went back in, lo and behold, nothing but default code. I am able to reproduce the problem. Commented Feb 4, 2016 at 15:57

1 Answer 1

2

I am having a similar issue. It is reproducible. The code exists in a script task inside a foreach container. You can go in and view the code to confirm it exists as well as the variables set for read and readwrite. Next go to the foreach (parent container) and change a variable mapping. Go back to the script task and the code is gone. I have even made it as simple as no variables being used inside the script task and only putting in some comments. And it still happens and reverts back to the default code.

Sign up to request clarification or add additional context in comments.

2 Comments

Can confirm this behavior. If a variable is changed in a foreach loop container, the script task's code in that container, will have its code deleted when the project is loaded
I currently have a uservoice ticket open on the issue. Hopefully it gets more traction. It has a few up votes and is under review. feedback.azure.com/forums/908035-sql-server/suggestions/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.