VS 2015 SSIS脚本任务无法调试 [英] VS 2015 SSIS Script Tasks cannot be debugged
问题描述
仅仅花了几个小时就弄清楚为什么我的sis脚本组件在遇到断点时没有进入调试器的原因。
我搜索了网络并设置了64位设置(项目->属性->调试),但设置没有帮助。
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.
它原来,如果我在代码中使用字符串插值($ {someVar}),则调试器将无法启动。
一旦我用旧的string.Format( {0} ...,param1,...)方法替换了它,我的断点就被击中,我可以逐步执行代码。
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.
推荐答案
实际上,将C#脚本任务限制为C#4.0的语言功能可使调试器恢复活力。在我的情况下,添加单个null运算符会在SQL Server / SSIS 2016上使用Visual Studio 2015(VSTA)引起调试器问题。
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.
将脚本限制为 C#4.0 ,我们可以在任务的生成设置中强制执行特定的语言级别:
To restrict the Script to C# 4.0 we can enforce a specific Language Level in the Build settings of the Task:
- 打开有问题的脚本任务,单击 编辑脚本... 按钮以打开Visual Studio(VSTA)。
- 在解决方案资源管理器右侧-点击 Project 节点,然后选择 Properties
- 在 Project窗口中,进入 Build选项卡,向下滚动并单击高级。按钮。
- 在高级构建设置窗口中,更改语言版本从默认更改为 C#4.0 。
- 清除/ 重建脚本任务,修复编译错误。 li>
- 最后,退出VSTA,重建PR
- 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
然后应该可以再次调试C#脚本任务。
and then you should be able to debug the C# Script Task again.
这篇关于VS 2015 SSIS脚本任务无法调试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!