Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Recovering code deleted by SQL Server Data Tools (Visual Studio)

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

like image 749
Joe Dyndale Avatar asked Oct 31 '22 10:10

Joe Dyndale


1 Answers

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.

like image 109
DataNerd Avatar answered Nov 08 '22 07:11

DataNerd