Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
319 views
in Technique[技术] by (71.8m points)

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...