简体   繁体   中英

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.

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.

在此处输入图片说明

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.

Spent hours too and then finally found your post... thank you sir!

I'm using VS2015 with SSIS Script Task too. For me it was the function nameof() that was responsible for not firing up the debugger. Replacing the function with reflection worked for me: Get string name of property using reflection

I'd like to think the above has cured my issue, but there was another cause/work around that I needed to implement to get script task debugging working again.

In my instance, the issue was the debugger integration used by Resharper, as highlighted by user "Richard T. LaSalle" in the linked solution to the following issue: Could not set BreakPoint in SSIS ScriptTask

TL;DR, If using Resharper, turn off Debugger Integration

Microsoft released an update v3.2 of SQL Server Integration Services Projects where it resolves the issue with Roslyn and other C# language features introduced after .Net 4.5. C# features.
Bad news - this fix is for Visual Studio 2019 only, you have to upgrade your VS to use it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM