Recovering code deleted by SQL Server data tools (Visual Studio)

I am making a small package in SSIS (Integration Services), and in my control flow I have several script tasks and some data streams that read data from XML files into a database.

I made some changes to the C # code in the script job in the built-in Visual Studio editor and clicked save. The star by the file name disappeared, indicating that the file was saved. I closed the Visual Studio editor, saved the package, right-click the script task, and selected Run Task. It worked without errors, but the XML files that it was supposed to create never appeared, so I opened the script again in the Visual Studio editor, and, to my horror, there was only a standard script (for example, only the main method and it contained only the statement Dts.TaskResult = (int)ScriptResults.Success; )!

I was unable to find the code that I had in this script task, and when I open the .dtsx file in a text editor, my code is gone! However, the code is in another script task.

I paid close attention, so I could not mistakenly delete everything before closing the editor and saving the package.

So my question is: has anyone else encountered this absolutely crazy mistake and there is a way to recover the code; or do I just need to bite a bullet and recreate it from memory?

We rarely use any significant amount of C # code in these SSIS jobs, so we don’t have a built-in VCS. I copied the code to a new file and manually added it to my own Git repository to be safe, but I have not done this with this specific code yet.

And I just need to repeat my disappointment with such an amazingly bad mistake in Visual Studio ...

+5
source share
1 answer

I have the same problem. It is reproducible. The code exists in the script task inside the foreach container. You can enter and view the code to confirm its existence, as well as the variables set for reading and reading. Then go to foreach (parent container) and change the display of variables. Go back to the script task and the code has not disappeared. I even made it as simple as no variables were used inside the script task and only inserted some comments. And this is still happening and is returning to the standard code.

+2
source

Source: https://habr.com/ru/post/1212801/


All Articles