Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS 2015 SSIS Script Tasks cannot be debugged

Just spent hours pulling my hair trying to work out why my ssis Script Component was not breaking into debugger on hitting a breakpoint. I searched the web and fund 64 bit setting (Project -> Properies -> Debugging) to be turned off but it didn't help me.

It turns out that if I use string interpolation ( $"{someVar}" ) in my code then debugger does not start. Once I replaced it with the old string.Format("{0}...", param1, ...) method my breakpoints got hit and I could step through the code.

The code works either way and it is just the debugger that is affected by the newer syntax.

I hope this helps someone.

like image 756
Zvirk Avatar asked Nov 18 '16 12:11

Zvirk


People also ask

How do you set a breakpoint in SSIS Script task?

Click Script and then click Edit Script. In Microsoft Visual Studio Tools for Applications (VSTA), locate the line of script on which you want to set a breakpoint, right-click that line, point to Breakpoint, and then click Insert Breakpoint. The breakpoint icon appears on the line of code. On the File menu, click Exit.

How do I debug the script component in SSIS?

To debug the code in your Script component, set at least one breakpoint in the code, and then close the VSTA IDE to run the package in SQL Server Data Tools (SSDT). When package execution enters the Script component, the VSTA IDE reopens and displays your code in read-only mode.

How do I debug SSIS package in Visual Studio 2015?

Steps: Go to the Control Flow and right click on the Data Flow Task (or any task where you want create a breakpoint) and select Edit Breakpoints. Now in the new Set Breakpoints window Select Break when the container receives the OnPostExecute event. Click OK.

How do I enable debug progress reporting in SSIS?

To enable or disable the display of messages on the Progress tab, toggle the Debug Progress Reporting option on the SSIS menu. Disabling progress reporting can help improve performance while running a complex package in SQL Server Data Tools.


2 Answers

Indeed, limiting C# Script Tasks to language features of C# 4.0 brings the Debugger back to life. In my case, adding a single null-coalescing operator caused the debugger issue using Visual Studio 2015 (VSTA) on SQL Server/SSIS 2016.

To restrict the Script to C# 4.0 we can enforce a specific Language Level in the Build settings of the Task:

  • Open the Script Task in question, click the "Edit Script..." button to open Visual Studio (VSTA).
  • In the Solution Explorer right-click the Project node and select Properties
  • In the Project window, go the Build tab, scroll down and click the Advanced.. button.
  • In the Advanced Build Settings window change the Langauge Version from "default" to "C# 4.0".
  • Clean/Rebuild the Script Task, fix compilation errors.
  • Finally, exit VSTA, rebuild the project

and then you should be able to debug the C# Script Task again.

enter image description here

like image 187
wp78de Avatar answered Nov 16 '22 02:11

wp78de


Also spent hours pulling my hair out and found out it is indeed due to new Roslyn compiler features not being recognised in older versions of Visual Studio. (I am using VS2015 with an SSIS Script Task)

To get the breakpoints to hit, I opened project in earlier version of VS (2012) and made changes to source code to get it to compile successfully. Once i got it to build i ran in 2012 and voilà! - it hits all the breakpoints. Re-opened project and ran in VS2015 and confirmed it works as intended.

like image 40
Lamb Chop Avatar answered Nov 16 '22 00:11

Lamb Chop